107 if(
evt.isRealData())
return;
124 auto mcTruths =
evt.getValidHandle<std::vector<simb::MCTruth>>(
fGeneratorTag);
128 if(geantGoodParticle != 0x0){
129 std::cout <<
"Found GEANT particle corresponding to the good particle with pdg = " << geantGoodParticle->PdgCode() <<
std::endl;
140 unsigned int nTracksWithTruth = 0;
141 unsigned int nTracksWithT0 = 0;
142 unsigned int nTracksWithTag = 0;
143 unsigned int nTracksWithCalo = 0;
145 auto recoTracks =
evt.getValidHandle<std::vector<recob::Track> >(
fTrackerTag);
149 for(
unsigned int t = 0;
t < recoTracks->size(); ++
t){
155 bool hasTruth = (trueMatch != 0x0);
160 bool hasT0 = (trackT0.size() != 0);
164 bool hasTag = (trackCosmic.size() != 0);
168 bool hasCalo = (trackCalo.size() != 0);
173 if(hasTruth) ++nTracksWithTruth;
174 if(hasT0) ++nTracksWithT0;
175 if(hasTag) ++nTracksWithTag;
176 if(hasCalo) ++nTracksWithCalo;
180 std::cout <<
"Found " << recoTracks->size() <<
" reconstructed tracks:" <<
std::endl;
181 std::cout <<
" - " << nTracksWithTruth <<
" successfully associated to the truth information " <<
std::endl;
182 std::cout <<
" - " << nTracksWithT0 <<
" have a reconstructed T0" <<
std::endl;
183 std::cout <<
" - " << nTracksWithTag <<
" have a cosmic tag" <<
std::endl;
184 std::cout <<
" - " << nTracksWithCalo <<
" have calorimetry info" <<
std::endl;
194 auto recoShowers =
evt.getValidHandle<std::vector<recob::Shower> >(
fShowerTag);
196 float totalHits = 0.0;
198 for(
unsigned int s = 0;
s < recoShowers->
size(); ++
s){
205 std::cout <<
"Found " << recoShowers->size() <<
" showers with an average of " << totalHits/(
float)recoShowers->size() <<
" hits" <<
std::endl;
218 auto recoParticles =
evt.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleTag);
221 unsigned int nParticlesPrimary = 0;
222 unsigned int nParticlesWithT0 = 0;
223 unsigned int nParticlesWithTag = 0;
224 for(
unsigned int p = 0;
p < recoParticles->size(); ++
p){
241 std::cout <<
"Found " << nParticlesPrimary <<
" reconstructed primary particles:" <<
std::endl;
242 std::cout <<
" - Total number of particles = " << recoParticles->size() <<
std::endl;
243 std::cout <<
" - " << nParticlesWithT0 <<
" have a reconstructed T0" <<
std::endl;
244 std::cout <<
" - " << nParticlesWithTag <<
" have a cosmic tag" <<
std::endl;
250 std::map<unsigned int, std::vector<const recob::PFParticle*>> sliceMap;
253 unsigned int nMultiSlice = 0;
255 std::cout <<
"Found " << sliceMap.size() <<
" slices with PFParticles" <<
std::endl;
256 for(
auto slice : sliceMap){
257 if(slice.second.size() > 1) ++nMultiSlice;
259 std::cout <<
" - " << nMultiSlice <<
" have at least one primary PFParticle" <<
std::endl;
264 std::cout <<
"- Beam slice = " << beamSlice <<
std::endl;
265 if(beamSlice != 9999){
268 std::cout <<
" - Found the beam slice! " << beamSlicePrimaries.size() <<
" beam particles in slice " << beamSlice <<
std::endl;
274 std::cout <<
"Beam particle vertex: " <<
std::endl;
280 std::cout <<
"Beam particle interaction vertex: " <<
std::endl;
298 std::cout <<
"Beam particle has " << daughterTracks.size() <<
" daughter tracks and " << daughterShowers.size() <<
" daughter showers." <<
std::endl;
303 std::cout <<
"The besm slice has " << unassocHits.size() <<
" hits not associated to any PFParticle " <<
std::endl;
unsigned int GetNumberRecoTrackHits(const recob::Track &track, art::Event const &evt, const std::string trackModule) const
Get the number of hits from a given reco track.
std::vector< anab::T0 > GetPFParticleT0(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the T0(s) from a given PFParticle.
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
std::string fPFParticleTag
const recob::Shower * GetPFParticleShower(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the shower associated to this particle. Returns a null pointer if not found.
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
const std::vector< const recob::Hit * > GetPFParticleSliceUnassociatedHits(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
For a given PFParticle find its slice and return all those hits not associated to any PFParticle...
const TVector3 GetPFParticleVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the interaction vertex of a primary PFParticle.
bool IsPFParticleTracklike(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Is the particle track-like?
unsigned int GetNumberRecoShowerHits(const recob::Shower &shower, art::Event const &evt, const std::string showerModule) const
Get the number of hits from a given reco shower.
std::vector< anab::T0 > GetRecoTrackT0(const recob::Track &track, art::Event const &evt, std::string trackModule) const
Get the T0(s) from a given reco track.
unsigned short GetBeamSlice(art::Event const &evt, const std::string particleLabel) const
Try to get the slice tagged as beam. Returns 9999 if no beam slice was found.
std::vector< anab::CosmicTag > GetRecoTrackCosmicTag(const recob::Track &track, art::Event const &evt, std::string trackModule) const
Get the cosmic tag(s) from a given reco track.
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to the primary PFParticles within it.
const simb::MCParticle * GetMCParticleFromRecoTrack(detinfo::DetectorClocksData const &clockData, const recob::Track &track, art::Event const &evt, std::string trackModule) const
bool IsPrimary() const
Returns whether the particle is the root of the flow.
const std::vector< const recob::PFParticle * > GetPFParticlesFromBeamSlice(art::Event const &evt, const std::string particleLabel) const
Return the pointers for the PFParticles in the beam slice. Returns an empty vector is no beam slice w...
std::string fCalorimetryTag
unsigned int GetNumberPFParticleSpacePoints(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the number of space points.
Hierarchical representation of particle flow.
const std::vector< const recob::PFParticle * > GetClearCosmicPFParticles(art::Event const &evt, const std::string particleLabel) const
Get all of the clear cosmic ray particles.
std::vector< anab::CosmicTag > GetPFParticleCosmicTag(const recob::PFParticle &particle, art::Event const &evt, std::string particleLabel) const
Get the cosmic tag(s) from a given PFParticle.
const std::vector< const recob::Shower * > GetPFParticleDaughterShowers(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string showerLabel) const
Get the daughter showers from the PFParticle.
std::string fGeneratorTag
const TVector3 GetPFParticleSecondaryVertex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Function to find the secondary interaction vertex of a primary PFParticle.
const std::vector< const recob::Track * > GetPFParticleDaughterTracks(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the daughter tracks from the PFParticle.
unsigned int GetNumberPFParticleHits(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the number of hits.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
QTextStream & endl(QTextStream &s)