155 #include "art_root_io/TFileDirectory.h" 156 #include "art_root_io/TFileService.h" 201 mf::LogDebug(
"LArPandora") <<
" *** PFParticleCosmicAna::beginJob() *** " << std::endl;
206 m_pRecoTree = tfs->make<TTree>(
"recoTree",
"LAr Cosmic Reco Tree");
238 m_pTrueTree = tfs->make<TTree>(
"trueTree",
"LAr Cosmic True Tree");
249 m_pTrueTree->Branch(
"nNeutrinoHitsNotReconstructed",
251 "nNeutrinoHitsNotReconstructed/I");
262 "nCosmicHitsNotReconstructed/I");
275 std::cout <<
" *** PFParticleCosmicAna::analyze(...) *** " << std::endl;
284 std::cout <<
" Run: " <<
m_run << std::endl;
285 std::cout <<
" Event: " <<
m_event << std::endl;
321 LArPandoraHelper::kIgnoreDaughters));
323 std::cout <<
" PFParticles: " << recoParticleVector.size() << std::endl;
336 evt,
m_cosmicLabel, recoCosmicTagVector, recoTracksToCosmicTags);
340 this->
FillRecoTree(recoParticlesToHits, recoParticlesToTracks, recoTracksToCosmicTags);
348 recoParticlesToTracks,
349 recoTracksToCosmicTags);
362 const double xmin(0.0);
366 const double zmin(0.0);
367 const double zmax(theGeometry->
DetLength());
406 iterEnd1 = recoParticlesToHits.end();
411 const HitVector& hitVector = iter1->second;
412 if (hitVector.empty())
continue;
415 if (recoParticlesToTracks.end() == iter2)
continue;
418 if (trackVector.empty())
continue;
428 this->
GetCosmicScore(recoParticle, recoParticlesToTracks, recoTracksToCosmicTags);
456 const float trackLength(track->
Length());
462 const auto& trackVtxPosition = track->
Vertex();
464 const auto& trackEndPosition = track->
End();
536 if (trueHitsToParticles.end() == iter3)
continue;
541 if (particlesToTruth.end() == iter4)
542 throw cet::exception(
"LArPandora") <<
" PFParticleCosmicAna::analyze --- Found a true " 543 "particle without any ancestry information ";
547 float cosmicScore(-0.2);
550 if (recoHitsToParticles.end() != iter5) {
552 cosmicScore = this->
GetCosmicScore(particle, particlesToTracks, tracksToCosmicTags);
560 if (cosmicScore >= 0)
565 if (cosmicScore > 0.51)
567 else if (cosmicScore > 0.39)
575 if (cosmicScore >= 0)
580 if (cosmicScore > 0.51)
582 else if (cosmicScore > 0.39)
598 float cosmicScore(0.
f);
602 if (recoParticlesToTracks.end() != iter2) {
604 iterEnd3 = iter2->second.end();
610 if (recoTracksToCosmicTags.end() != iter4) {
612 iterEnd5 = iter4->second.end();
static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode=kUseDaughters)
Build mapping between PFParticles and Hits using PFParticle/SpacePoint/Hit maps.
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > HitsToMCParticles
PFParticleCosmicAna class.
size_t Self() const
Returns the index of this particle.
int m_nNeutrinoHitsSemiTagged
int m_nNeutrinoHitsReconstructed
void FillTrueTree(const HitVector &hitVector, const HitsToMCParticles &trueHitsToParticles, const HitsToPFParticles &recoHitsToParticles, const MCParticlesToMCTruth &particlesToTruth, const PFParticlesToTracks &particlesToTracks, const TracksToCosmicTags &tracksToCosmicTags)
Fill track-level variables using input maps between reconstructed objects.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
Vector_t VertexDirection() const
Access to track direction at different points.
int PdgCode() const
Return the type of particle as a PDG ID.
std::vector< art::Ptr< anab::CosmicTag > > CosmicTagVector
int m_nNeutrinoHitsNotTagged
EDAnalyzer(fhicl::ParameterSet const &pset)
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
int m_nCosmicHitsNotTagged
int m_nCosmicHitsSemiTagged
std::map< art::Ptr< recob::Track >, CosmicTagVector > TracksToCosmicTags
std::string m_hitfinderLabel
void reconfigure(fhicl::ParameterSet const &pset)
double Length(size_t p=0) const
Access to various track properties.
#define DEFINE_ART_MODULE(klass)
std::map< art::Ptr< simb::MCParticle >, HitVector > MCParticlesToHits
int m_nCosmicHitsReconstructed
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
double m_cosmicContainmentCut
T get(std::string const &key) const
std::string m_cosmicLabel
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
Point_t const & Vertex() const
Access to track position at different points.
Provides recob::Track data product.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
std::string m_particleLabel
int m_nNeutrinoHitsNotReconstructed
std::vector< art::Ptr< recob::Track > > TrackVector
static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector, PFParticlesToTracks &particlesToTracks)
Collect the reconstructed PFParticles and associated Tracks from the ART event record.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
void FillRecoTree(const PFParticlesToHits &recoParticlesToHits, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags)
Fill event-level variables using input maps between reconstructed objects.
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
Detector simulation of raw signals on wires.
bool m_useDaughterMCParticles
std::string m_geantModuleLabel
std::vector< art::Ptr< recob::Hit > > HitVector
virtual ~PFParticleCosmicAna()
Destructor.
float GetCosmicScore(const art::Ptr< recob::PFParticle > particle, const PFParticlesToTracks &recoParticlesToTracks, const TracksToCosmicTags &recoTracksToCosmicTags) const
Get cosmic score for a PFParticle using track-level information.
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Vector_t EndDirection() const
Access to track direction at different points.
static bool IsTrack(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as track-like.
std::string m_trackfitLabel
EventNumber_t event() const
Point_t const & End() const
Access to track position at different points.
int m_nNeutrinoHitsFullyTagged
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
int m_nCosmicHitsNotReconstructed
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
bool m_useDaughterPFParticles
helper function for LArPandoraInterface producer module
PFParticleCosmicAna(fhicl::ParameterSet const &pset)
Constructor.
int m_nCosmicHitsFullyTagged
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
void analyze(const art::Event &evt)
static void CollectCosmicTags(const art::Event &evt, const std::string &label, CosmicTagVector &cosmicTagVector, TracksToCosmicTags &tracksToCosmicTags)
Collect a vector of cosmic tags from the ART event record.