150 #include "art_root_io/TFileDirectory.h" 151 #include "art_root_io/TFileService.h" 185 mf::LogDebug(
"LArPandora") <<
" *** PFParticleCosmicAna::beginJob() *** " << std::endl;
190 m_pRecoTree = tfs->make<TTree>(
"recoTree",
"LAr Cosmic Reco Tree");
222 m_pTrueTree = tfs->make<TTree>(
"trueTree",
"LAr Cosmic True Tree");
233 m_pTrueTree->Branch(
"nNeutrinoHitsNotReconstructed",
235 "nNeutrinoHitsNotReconstructed/I");
246 "nCosmicHitsNotReconstructed/I");
259 std::cout <<
" *** PFParticleCosmicAna::analyze(...) *** " << std::endl;
268 std::cout <<
" Run: " <<
m_run << std::endl;
269 std::cout <<
" Event: " <<
m_event << std::endl;
305 LArPandoraHelper::kIgnoreDaughters));
307 std::cout <<
" PFParticles: " << recoParticleVector.size() << std::endl;
320 evt,
m_cosmicLabel, recoCosmicTagVector, recoTracksToCosmicTags);
324 this->
FillRecoTree(recoParticlesToHits, recoParticlesToTracks, recoTracksToCosmicTags);
332 recoParticlesToTracks,
333 recoTracksToCosmicTags);
346 const double xmin(0.0);
347 const double xmax(2.0 * tpc.HalfWidth());
348 const double ymin(-tpc.HalfHeight());
349 const double ymax(+tpc.HalfHeight());
350 const double zmin(0.0);
351 const double zmax(tpc.Length());
390 iterEnd1 = recoParticlesToHits.end();
395 const HitVector& hitVector = iter1->second;
396 if (hitVector.empty())
continue;
399 if (recoParticlesToTracks.end() == iter2)
continue;
402 if (trackVector.empty())
continue;
412 this->
GetCosmicScore(recoParticle, recoParticlesToTracks, recoTracksToCosmicTags);
440 const float trackLength(track->
Length());
446 const auto& trackVtxPosition = track->
Vertex();
448 const auto& trackEndPosition = track->
End();
520 if (trueHitsToParticles.end() == iter3)
continue;
525 if (particlesToTruth.end() == iter4)
526 throw cet::exception(
"LArPandora") <<
" PFParticleCosmicAna::analyze --- Found a true " 527 "particle without any ancestry information ";
531 float cosmicScore(-0.2);
534 if (recoHitsToParticles.end() != iter5) {
536 cosmicScore = this->
GetCosmicScore(particle, particlesToTracks, tracksToCosmicTags);
544 if (cosmicScore >= 0)
549 if (cosmicScore > 0.51)
551 else if (cosmicScore > 0.39)
559 if (cosmicScore >= 0)
564 if (cosmicScore > 0.51)
566 else if (cosmicScore > 0.39)
582 float cosmicScore(0.
f);
586 if (recoParticlesToTracks.end() != iter2) {
588 iterEnd3 = iter2->second.end();
594 if (recoTracksToCosmicTags.end() != iter4) {
596 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
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)
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.
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
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.
Provides recob::Track data product.
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
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.