153 #include "art_root_io/TFileService.h" 154 #include "art_root_io/TFileDirectory.h" 156 #include "canvas/Persistency/Common/FindManyP.h" 157 #include "canvas/Persistency/Common/FindOneP.h" 206 m_pRecoTree = tfs->make<TTree>(
"recoTree",
"LAr Cosmic Reco Tree");
238 m_pTrueTree = tfs->make<TTree>(
"trueTree",
"LAr Cosmic True Tree");
266 std::cout <<
" *** PFParticleCosmicAna::analyze(...) *** " <<
std::endl;
303 std::cout <<
" PFParticles: " << recoParticleVector.size() <<
std::endl;
322 this->
FillRecoTree(recoParticlesToHits, recoParticlesToTracks, recoTracksToCosmicTags);
327 this->
FillTrueTree(hitVector, trueHitsToParticles, recoHitsToParticles, particlesToTruth, recoParticlesToTracks, recoTracksToCosmicTags);
339 const double xmin(0.0);
343 const double zmin(0.0);
344 const double zmax(theGeometry->
DetLength());
383 iter1 != iterEnd1; ++iter1)
387 const HitVector &hitVector = iter1->second;
388 if (hitVector.empty())
392 if (recoParticlesToTracks.end() == iter2)
396 if (trackVector.empty())
433 const float trackLength(track->
Length());
440 const auto &trackVtxPosition = track->
Vertex();
442 const auto &trackEndPosition = track->
End();
508 if (trueHitsToParticles.end() == iter3)
514 if (particlesToTruth.end() == iter4)
515 throw cet::exception(
"LArPandora") <<
" PFParticleCosmicAna::analyze --- Found a true particle without any ancestry information ";
519 float cosmicScore(-0.2);
522 if (recoHitsToParticles.end() != iter5)
525 cosmicScore = this->
GetCosmicScore(particle, particlesToTracks, tracksToCosmicTags);
562 float cosmicScore(0.
f);
566 if (recoParticlesToTracks.end() != iter2)
573 if (recoTracksToCosmicTags.end() != iter4)
576 iter5 != iterEnd5; ++iter5)
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.
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
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
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
art framework interface to geometry description
std::map< art::Ptr< recob::Track >, CosmicTagVector > TracksToCosmicTags
std::string m_hitfinderLabel
void reconfigure(fhicl::ParameterSet const &pset)
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
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
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
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.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Vector_t EndDirection() const
static bool IsTrack(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as track-like.
Provides recob::Track data product.
std::string m_trackfitLabel
EventNumber_t event() const
Point_t const & End() const
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
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
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.