7 #include "art/Framework/Core/EDAnalyzer.h"
8 #include "art/Framework/Core/ModuleMacros.h"
9 #include "art/Framework/Principal/Event.h"
11 #include "fhiclcpp/ParameterSet.h"
65 PandoraData(
const art::Event &evt,
const std::string &pandoraLabel,
const std::string &trackLabel =
"",
const std::string &showerLabel =
"");
119 template <
class T,
class U>
170 void PrintHit(
const art::Ptr<recob::Hit> &
hit,
const unsigned int depth)
const;
179 void PrintSlice(
const art::Ptr<recob::Slice> &slice,
const PandoraData &data,
const unsigned int depth)
const;
196 void PrintVertex(
const art::Ptr<recob::Vertex> &
vertex,
const unsigned int depth)
const;
230 void PrintRule(
const unsigned int depth)
const;
238 void PrintTitle(
const std::string &
name,
const unsigned int depth)
const;
263 namespace lar_pandora
268 m_pandoraLabel(pset.
get<
std::string>(
"PandoraLabel")),
269 m_trackLabel(pset.
get<
std::string>(
"TrackLabel" ,
"")),
270 m_showerLabel(pset.
get<
std::string>(
"ShowerLabel",
""))
280 throw cet::exception(
"LArPandoraEventDump") <<
"Unknown verbosity level: " <<
m_verbosityLevel << std::endl;
302 std::cout << std::string(80,
'=') << std::endl;
303 std::cout <<
"run : " << evt.run() << std::endl;
304 std::cout <<
"subRun : " << evt.subRun() << std::endl;
305 std::cout <<
"event : " << evt.event() << std::endl;
313 std::cout << std::string(80,
'-') << std::endl;
314 std::cout <<
"Collection sizes" << std::endl;
315 std::cout << std::string(80,
'-') << std::endl;
328 std::cout << std::string(80,
'-') << std::endl;
329 std::cout <<
"Association sizes" << std::endl;
330 std::cout << std::string(80,
'-') << std::endl;
387 if (!particle->IsPrimary())
401 pfParticleMap[particle->Self()] = particle;
408 const PandoraData &data,
const unsigned int depth)
const
418 this->
PrintProperty(
"IsPrimary", particle->IsPrimary(), depth);
420 if (!particle->IsPrimary())
429 for (
const auto &metadatum : metadata)
431 const auto &propertiesMap(metadatum->GetPropertiesMap());
432 this->
PrintProperty(
"# Properties", propertiesMap.size(), depth + 2);
434 for (
const auto &propertiesMapEntry : propertiesMap)
435 this->
PrintProperty(propertiesMapEntry.first, propertiesMapEntry.second, depth + 4);
447 for (
const auto &slice :
slices)
461 for (
const auto &
cluster : clusters)
470 this->
PrintProperty(
"# SpacePoints", spacePoints.size(), depth);
474 for (
const auto &spacePoint : spacePoints)
487 for (
const auto &
vertex : vertices)
513 for (
const auto &
shower : showers)
519 this->
PrintProperty(
"# Daughters", particle->NumDaughters(), depth);
522 for (
auto &daughterId : particle->Daughters())
524 const auto daughterIter(pfParticleMap.find(daughterId));
526 if (daughterIter == pfParticleMap.end())
527 throw cet::exception(
"LArPandoraEventDump") <<
"Couldn't find daughter of PFParticle in the PFParticle map";
529 const auto &daughter(daughterIter->second);
530 this->
PrintParticle(daughter, pfParticleMap, data, depth + 4);
542 this->
PrintProperty(
"Peak time", hit->PeakTime(), depth + 2);
564 for (
const auto &
hit : hits)
587 for (
const auto &
hit : hits)
598 const auto &position(spacePoint->XYZ());
613 for (
const auto &
hit : hits)
624 const auto &position(vertex->position());
636 this->
PrintProperty(
"# Trajectory points", track->NumberTrajectoryPoints(), depth + 2);
649 for (
const auto &
hit : hits)
660 this->
PrintProperty(
"StartX", shower->ShowerStart().X(), depth + 2);
661 this->
PrintProperty(
"StartY", shower->ShowerStart().Y(), depth + 2);
662 this->
PrintProperty(
"StartZ", shower->ShowerStart().Z(), depth + 2);
664 this->
PrintProperty(
"OpenAngle", shower->OpenAngle(), depth + 2);
671 for (
const auto &pcAxis : pcAxes)
676 this->
PrintProperty(
"# Hits used", pcAxis->getNumHitsUsed(), depth + 6);
690 for (
const auto &
hit : hits)
698 const unsigned int nDashes(std::max(0, 120 - static_cast<int>(depth)));
700 std::cout << std::string(depth,
' ') << std::string(nDashes,
'-') << std::endl;
707 std::cout << std::string(depth,
' ') << name << std::endl;
717 const unsigned int separation(std::max(0, 32 - static_cast<int>(depth)));
719 std::cout << std::string(depth,
' ') << std::setw(separation) <<
std::left << (
"- " +
name) << value << std::endl;
726 const std::string &showerLabel) :
727 m_pPFParticleToMetadataAssociation(nullptr),
728 m_pPFParticleToClusterAssociation(nullptr),
729 m_pPFParticleToSpacePointAssociation(nullptr),
730 m_pPFParticleToVertexAssociation(nullptr),
731 m_pPFParticleToTrackAssociation(nullptr),
732 m_pPFParticleToShowerAssociation(nullptr),
733 m_pPFParticleToSliceAssociation(nullptr),
734 m_pClusterToHitAssociation(nullptr),
735 m_pSpacePointToHitAssociation(nullptr),
736 m_pTrackToHitAssociation(nullptr),
737 m_pShowerToHitAssociation(nullptr),
738 m_pSliceToHitAssociation(nullptr),
739 m_pShowerToPCAxisAssociation(nullptr)
776 delete m_pPFParticleToMetadataAssociation;
777 delete m_pPFParticleToClusterAssociation;
778 delete m_pPFParticleToSpacePointAssociation;
779 delete m_pPFParticleToVertexAssociation;
780 delete m_pPFParticleToTrackAssociation;
781 delete m_pPFParticleToShowerAssociation;
782 delete m_pPFParticleToSliceAssociation;
783 delete m_pClusterToHitAssociation;
784 delete m_pSpacePointToHitAssociation;
785 delete m_pTrackToHitAssociation;
786 delete m_pShowerToHitAssociation;
787 delete m_pShowerToPCAxisAssociation;
788 delete m_pSliceToHitAssociation;
799 evt.getByLabel(label, collection);
804 template <
class T,
class U>
811 throw cet::exception(
"LArPandoraEventDump") <<
"Association supplied type has already been loaded!";
void BuildPFParticleMap(const PandoraData &data, PFParticleMap &pfParticleMap) const
Build the map from PFParticle ID to PFParticle from the input data.
Association< recob::Slice > * m_pPFParticleToSliceAssociation
The PFParticle to slice association.
void PrintRule(const unsigned int depth) const
Print a horizontal line.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
std::string m_trackLabel
The track producer label.
Association< recob::Hit > * m_pClusterToHitAssociation
The Cluster to hit association.
Collection< recob::Cluster > m_clusterCollection
The Cluster handle.
ClusterModuleLabel join with tracks
void PrintEventMetadata(const art::Event &evt) const
Print the metadata about the event.
LArPandoraEventDump(fhicl::ParameterSet const &pset)
Association< recob::PCAxis > * m_pShowerToPCAxisAssociation
The Shower to PCAxis association.
Declaration of signal hit object.
Collection< recob::SpacePoint > m_spacePointCollection
The SpacePoint handle.
Association< recob::Hit > * m_pSliceToHitAssociation
The Slice to hit association.
void PrintShower(const art::Ptr< recob::Shower > &shower, const PandoraData &data, const unsigned int depth) const
Print a given Shower.
void PrintVertex(const art::Ptr< recob::Vertex > &vertex, const unsigned int depth) const
Print a given Vertex.
art::Handle< std::vector< T > > Collection
LArPandoraEventDump & operator=(LArPandoraEventDump const &)=delete
void PrintParticle(const art::Ptr< recob::PFParticle > &particle, const PFParticleMap &pfParticleMap, const PandoraData &data, const unsigned int depth) const
Print a given PFParticle.
process_name use argoneut_mc_hitfinder track
void PrintHit(const art::Ptr< recob::Hit > &hit, const unsigned int depth) const
Print a given Hit.
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
void PrintEventSummary(const PandoraData &data) const
Print a summary of the event similar to the standard event dump.
Association< recob::Shower > * m_pPFParticleToShowerAssociation
The PFParticle to shower association.
void LoadAssociation(const art::Event &evt, const std::string &label, const Collection< T > &collection, Association< U > *&pAssociation)
Load an association from the event.
art::FindManyP< T > Association
Association< recob::Cluster > * m_pPFParticleToClusterAssociation
The PFParticle to cluster association.
Collection< recob::PCAxis > m_pcAxisCollection
The PCAxis handle.
std::string m_showerLabel
The shower producer label.
void PrintTrack(const art::Ptr< recob::Track > &track, const PandoraData &data, const unsigned int depth) const
Print a given Track.
~PandoraData()
Default destructor.
Collection< recob::Slice > m_sliceCollection
The Slice handle.
void PrintSpacePoint(const art::Ptr< recob::SpacePoint > &spacePoint, const PandoraData &data, const unsigned int depth) const
Print a given SpacePoint.
Association< recob::Track > * m_pPFParticleToTrackAssociation
The PFParticle to track association.
Collection< recob::Vertex > m_vertexCollection
The Vertex handle.
Declaration of cluster object.
std::string m_pandoraLabel
The label of the Pandora pattern recognition producer.
Association< larpandoraobj::PFParticleMetadata > * m_pPFParticleToMetadataAssociation
The PFParticle to metadata association.
Provides recob::Track data product.
Collection< recob::Shower > m_showerCollection
The Shower handle.
std::vector< TCSlice > slices
void PrintTitle(const std::string &name, const unsigned int depth) const
Print a title line.
void analyze(art::Event const &evt) override
Association< recob::SpacePoint > * m_pPFParticleToSpacePointAssociation
The PFParticle to space point association.
void PrintSlice(const art::Ptr< recob::Slice > &slice, const PandoraData &data, const unsigned int depth) const
Print a given Slice.
Association< recob::Hit > * m_pSpacePointToHitAssociation
The SpacePoint to hit association.
Association< recob::Hit > * m_pShowerToHitAssociation
The Shower to hit association.
std::string m_verbosityLevel
The level of verbosity to use.
void LoadCollection(const art::Event &evt, const std::string &label, Collection< T > &collection)
Load a collection from the event.
void PrintCluster(const art::Ptr< recob::Cluster > &cluster, const PandoraData &data, const unsigned int depth) const
Print a given Cluster.
Collection< recob::PFParticle > m_pfParticleCollection
The PFParticle handle.
PandoraData(const art::Event &evt, const std::string &pandoraLabel, const std::string &trackLabel="", const std::string &showerLabel="")
Default constructor.
Collection< larpandoraobj::PFParticleMetadata > m_pfParticleMetadataCollection
The PFParticleMetadata handle.
void PrintPFParticleHierarchy(const PandoraData &data) const
Print the full PFParticle Hierarchy.
Association< recob::Vertex > * m_pPFParticleToVertexAssociation
The PFParticle to vertex association.
void PrintProperty(const std::string &name, const T &value, const unsigned int depth) const
Print a given property with the correct amount of whitespace.
Class holding the handle for all of the data types from Pandora.
helper function for LArPandoraInterface producer module
BEGIN_PROLOG could also be cout
Association< recob::Hit > * m_pTrackToHitAssociation
The Track to hit association.
Collection< recob::Track > m_trackCollection
The Track handle.