118 #include "art_root_io/TFileDirectory.h" 119 #include "art_root_io/TFileService.h" 158 mf::LogDebug(
"LArPandora") <<
" *** PFParticleAnalysis::beginJob() *** " << std::endl;
163 m_pRecoTree = tfs->make<TTree>(
"pandora",
"LAr PFParticles");
223 if (
m_printDebug) std::cout <<
" *** PFParticleAnalysis::analyze(...) *** " << std::endl;
282 std::cout <<
" Run: " <<
m_run << std::endl;
283 std::cout <<
" Event: " <<
m_event << std::endl;
301 if (
m_printDebug) std::cout <<
" PFParticles: " << particleVector.size() << std::endl;
303 if (particleVector.empty()) {
343 for (
unsigned int n = 0;
n < particleVector.size(); ++
n) {
401 if (particlesToClusters.end() != cIter)
m_clusters = cIter->second.size();
405 if (particlesToSpacePoints.end() != pIter)
m_spacepoints = pIter->second.size();
409 if (particlesToHits.end() != hIter)
m_hits = hIter->second.size();
413 if (particlesToVertices.end() != vIter) {
415 if (!vertexVector.empty()) {
417 std::cout <<
" Warning: Found particle with more than one associated vertex " 421 double xyz[3] = {0.0, 0.0, 0.0};
433 if (particlesToT0s.end() != t0Iter) {
434 const T0Vector& t0Vector = t0Iter->second;
435 if (!t0Vector.empty()) {
437 std::cout <<
" Warning: Found particle with more than one associated T0 " << std::endl;
446 if (particlesToTracks.end() != trkIter) {
448 if (!trackVector.empty()) {
450 std::cout <<
" Warning: Found particle with more than one associated track " 454 const auto& trackVtxPosition = track->
Vertex();
456 const auto& trackEndPosition = track->
End();
478 if (tracksToHits.end() != trkIter2)
m_trackhits = trkIter2->second.size();
484 if (particlesToShowers.end() != shwIter) {
486 if (!showerVector.empty()) {
488 std::cout <<
" Warning: Found particle with more than one associated shower " 492 const TVector3& showerVtxPosition = shower->
ShowerStart();
493 const TVector3& showerVtxDirection = shower->
Direction();
510 if (showersToHits.end() != shwIter2)
m_showerhits = shwIter2->second.size();
515 std::cout <<
" PFParticle [" <<
n <<
"] Primary=" <<
m_primary 521 <<
", Hits=" <<
m_hits <<
") " << std::endl;
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
Access to track direction at different points.
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
Access to track position at different points.
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.
Provides recob::Track data product.
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
Access to track direction at different points.
std::vector< art::Ptr< recob::Vertex > > VertexVector
EventNumber_t event() const
Point_t const & End() const
Access to track position at different points.
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.
std::string m_particleLabel