122 #include "art_root_io/TFileService.h" 123 #include "art_root_io/TFileDirectory.h" 169 m_pRecoTree = tfs->make<TTree>(
"pandora",
"LAr PFParticles");
232 std::cout <<
" *** PFParticleAnalysis::analyze(...) *** " <<
std::endl;
311 std::cout <<
" PFParticles: " << particleVector.size() <<
std::endl;
313 if (particleVector.empty())
354 for (
unsigned int n = 0;
n < particleVector.size(); ++
n)
413 if (particlesToClusters.end() != cIter)
418 if (particlesToSpacePoints.end() != pIter)
423 if (particlesToHits.end() != hIter)
424 m_hits = hIter->second.size();
428 if (particlesToVertices.end() != vIter)
431 if (!vertexVector.empty())
434 std::cout <<
" Warning: Found particle with more than one associated vertex " << std::endl;
437 double xyz[3] = {0.0, 0.0, 0.0} ;
449 if (particlesToT0s.end() != t0Iter)
451 const T0Vector &t0Vector = t0Iter->second;
452 if (!t0Vector.empty())
455 std::cout <<
" Warning: Found particle with more than one associated T0 " << std::endl;
464 if (particlesToTracks.end() != trkIter)
467 if (!trackVector.empty())
470 std::cout <<
" Warning: Found particle with more than one associated track " << std::endl;
473 const auto &trackVtxPosition = track->
Vertex();
475 const auto &trackEndPosition = track->
End();
497 if (tracksToHits.end() != trkIter2)
504 if (particlesToShowers.end() != shwIter)
507 if (!showerVector.empty())
510 std::cout <<
" Warning: Found particle with more than one associated shower " << std::endl;
513 const TVector3 &showerVtxPosition = shower->
ShowerStart();
514 const TVector3 &showerVtxDirection = shower->
Direction();
531 if (showersToHits.end() != shwIter2)
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.
code to link reconstructed objects back to the MC truth information
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
const TVector3 & ShowerStart() const
bool m_printDebug
switch for print statements (TODO: use message service!)
static void BuildPFParticleMap(const PFParticleVector &particleVector, PFParticleMap &particleMap)
Build particle maps for reconstructed particles.
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
static int GetParentNeutrino(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the parent neutrino PDG code (or zero for cosmics) for a given reconstructed particle...
size_t Self() const
Returns the index of this particle.
std::map< art::Ptr< recob::PFParticle >, ClusterVector > PFParticlesToClusters
const double & Time() const
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Vector_t VertexDirection() const
int PdgCode() const
Return the type of particle as a PDG ID.
std::vector< art::Ptr< recob::Shower > > ShowerVector
EDAnalyzer(fhicl::ParameterSet const &pset)
PFParticleAnalysis(fhicl::ParameterSet const &pset)
Constructor.
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
PFParticleAnalysis class.
std::map< art::Ptr< recob::PFParticle >, T0Vector > PFParticlesToT0s
double Length(size_t p=0) const
Access to various track properties.
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
#define DEFINE_ART_MODULE(klass)
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector, PFParticlesToShowers &particlesToShowers)
Collect the reconstructed PFParticles and associated Showers from the ART event record.
T get(std::string const &key) const
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
Point_t const & Vertex() const
static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector, PFParticlesToVertices &particlesToVertices)
Collect the reconstructed PFParticles and associated Vertices from the ART event record.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
const TVector3 & Direction() const
void reconfigure(fhicl::ParameterSet const &pset)
std::vector< art::Ptr< recob::Track > > TrackVector
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
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.
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Vector_t EndDirection() const
Provides recob::Track data product.
std::vector< art::Ptr< recob::Vertex > > VertexVector
EventNumber_t event() const
Point_t const & End() const
void analyze(const art::Event &evt)
static int GetGeneration(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the generation of this particle (first generation if primary)
std::vector< art::Ptr< anab::T0 > > T0Vector
std::string m_showerLabel
static void CollectT0s(const art::Event &evt, const std::string &label, T0Vector &t0Vector, PFParticlesToT0s &particlesToT0s)
Collect a vector of T0s from the ART event record.
virtual ~PFParticleAnalysis()
Destructor.
helper function for LArPandoraInterface producer module
double m_trkstraightlength
static bool IsFinalState(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Determine whether a particle has been reconstructed as a final-state particle.
QTextStream & endl(QTextStream &s)
std::string m_particleLabel