All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCTruthAssociations.cpp
Go to the documentation of this file.
1 /**
2  * @file MCTruthAssociations.cpp
3  * @brief Does something with the tracks (implementation file).
4  * @author Tracy Usher (usher@slac.stanford.edu
5  * @date October 24, 2017
6  * @see MCTruthAssociations.h
7  *
8  */
9 
10 #include "MCTruthAssociations.h"
11 
12 // LArSoft libraries
13 #include "nusimdata/SimulationBase/MCTruth.h"
16 #include "messagefacility/MessageLogger/MessageLogger.h"
17 
18 // nutools
20 
21 // canvas libraries
22 #include "canvas/Persistency/Common/FindMany.h"
23 
24 // ROOT libraries
25 #include "TVector3.h"
26 
27 // C/C++ standard libraries
28 #include <algorithm> // std::count_if()
29 
30 namespace truth
31 {
32 
33 MCTruthAssociations::MCTruthAssociations(const fhicl::ParameterSet& config)
34 {
35  fMinHitEnergyFraction = config.get<float>("MinHitEnergyFraction", 0.);
36 }
37 
39  const MCParticleVec& mcPartVec,
40  const MCTruthAssns& truthToPartAssns,
42 {
43  // Keep track of input services
45 
46  fHitPartAssnsVec.clear();
47 
48  // Loop through the input vector of associations
49  for(const HitParticleAssociations* partToHitAssns : partToHitAssnsVec)
50  {
51  // Note that one element of our struct is non copiable which means
52  // we need to construct in place before filling
53  fHitPartAssnsVec.emplace_back();
54 
55  HitPartAssnsStruct& hitPartAssns = fHitPartAssnsVec.back();
56 
57  // Clear the maps in case they were previously filled
58  hitPartAssns.fHitToPartVecMap.clear();
59  hitPartAssns.fPartToHitVecMap.clear();
60 
61  // Build out the maps between hits/particles
62  for(HitParticleAssociations::const_iterator partHitItr = partToHitAssns->begin(); partHitItr != partToHitAssns->end(); ++partHitItr)
63  {
64  const art::Ptr<simb::MCParticle>& mcParticle = partHitItr->first;
65  const art::Ptr<recob::Hit>& recoHit = partHitItr->second;
66  const anab::BackTrackerHitMatchingData* data = partHitItr->data;
67 
68  hitPartAssns.fHitToPartVecMap[recoHit.get()].insert(PartMatchDataPair(mcParticle.get(),data));
69  hitPartAssns.fPartToHitVecMap[mcParticle.get()].insert(HitMatchDataPair(recoHit.get(),data));
70  }
71 
72  mf::LogDebug("MCTruthAssociations") << "Built maps with " << hitPartAssns.fHitToPartVecMap.size() << " hits, " << hitPartAssns.fPartToHitVecMap.size() << "\n";
73  }
74 
75  // Note that there is only one instance of MCTruth <--> MCParticle associations so we do this external to the above loop
77  fMCTruthVec.clear();
78  fTrackIDToMCTruthIndex.clear();
79 
80  for(const auto& mcParticle : mcPartVec)
81  {
82  fParticleList.Add(mcParticle.get());
83 
84  try
85  {
86  art::Ptr<simb::MCTruth> mcTruth = truthToPartAssns.at(mcParticle.key());
87 
88  // Add to the list
89  if (std::find(fMCTruthVec.begin(),fMCTruthVec.end(),mcTruth) == fMCTruthVec.end())
90  fMCTruthVec.push_back(mcTruth);
91 
92  fTrackIDToMCTruthIndex[mcParticle->TrackId()] = mcTruth;
93  }
94  catch(...)
95  {
96  mf::LogDebug("MCTruthAssociations") << ">>>> No MCTruth found for particle: " << *mcParticle << "\n";
97  }
98  }
99 
100  // Follow former backtracker convention of resetting the eve id calculator each event...
101  // Note that the calculator is stored as a unique_ptr (mutable) so memory ok
103 
104  return;
105 }
106 
108 {
109  return fParticleList;
110 }
111 
112 // Return a pointer to the simb::MCParticle object corresponding to the given TrackID
113 const simb::MCParticle* MCTruthAssociations::TrackIDToParticle(int const& id) const
114 {
115  // Pointer to return
116  const simb::MCParticle* mcParticle(0);
117 
119 
120  if (partItr != fParticleList.end()) mcParticle = partItr->second;
121 
122  if(!mcParticle)
123  {
124  mf::LogWarning("MCTruthAssociations") << "can't find particle with track id "
125  << id << " in MCTruthParticleList"
126  << " returning null pointer";
127  }
128 
129  return mcParticle;
130 }
131 
132 const simb::MCParticle* MCTruthAssociations::TrackIDToMotherParticle(int const& id) const
133 {
134  // get the mother id from the particle navigator
135  // the EveId was adopted in the Rebuild method
136  return this->TrackIDToParticle(fParticleList.EveId(abs(id)));
137 }
138 
139 // Get art::Ptr<> to simb::MCTruth and related information
140 const art::Ptr<simb::MCTruth>& MCTruthAssociations::TrackIDToMCTruth(int const& id) const
141 {
142  // find the entry in the MCTruth collection for this track id
143  MCTruthTrackIDMap::const_iterator trackTruthItr = fTrackIDToMCTruthIndex.find(abs(id));
144 
145  if (trackTruthItr == fTrackIDToMCTruthIndex.end())
146  throw cet::exception("MCTruthAssociations") << "attempting to find MCTruth index for "
147  << "out of range value: " << id
148  << "/" << fMCTruthVec.size() << "\n";
149 
150  return trackTruthItr->second;
151 }
152 
153 const art::Ptr<simb::MCTruth>& MCTruthAssociations::ParticleToMCTruth(const simb::MCParticle* p) const
154 {
155  return this->TrackIDToMCTruth(p->TrackId());
156 }
157 
158 std::vector<const simb::MCParticle*> MCTruthAssociations::MCTruthToParticles(art::Ptr<simb::MCTruth> const& mct) const
159 {
160  std::vector<const simb::MCParticle*> ret;
161 
162  // I'm slightly uncertain what is going on here since I naively would think a track ID is
163  // unique to an MCParticle... but this is what was done previously so copied here...
164  // sim::ParticleList::value_type is a pair (track ID, particle pointer)
165  for (const MCTruthParticleList::value_type& TrackIDpair : fParticleList)
166  {
167  if (TrackIDToMCTruth(TrackIDpair.first) == mct) ret.push_back(TrackIDpair.second);
168  }
169 
170  return ret;
171 }
172 
174 {
175  return fMCTruthVec;
176 }
177 
178 // this method will return the Geant4 track IDs of
179 // the particles contributing ionization electrons to the identified hit
180 std::vector<TrackIDE> MCTruthAssociations::HitToTrackID(const recob::Hit* hit) const
181 {
182  std::vector<TrackIDE> trackIDEs;
183 
184  // Apply brute force loop through all possible collections
185  for(const auto& hitPartAssns : fHitPartAssnsVec)
186  {
187  HitToPartVecMap::const_iterator hitMatchPairItr = hitPartAssns.fHitToPartVecMap.find(hit);
188 
189  if (hitMatchPairItr != hitPartAssns.fHitToPartVecMap.end())
190  {
191  size_t nTrackIDEs(hitMatchPairItr->second.size());
192 
193  trackIDEs.reserve(nTrackIDEs);
194 
195  for (const auto& matchPair : hitMatchPairItr->second)
196  {
197  const simb::MCParticle* part = matchPair.first;
198  const anab::BackTrackerHitMatchingData* data = matchPair.second;
199 
200  TrackIDE trackIDE;
201 
202  trackIDE.trackID = part->TrackId();
203  trackIDE.energyFrac = data->ideFraction;
204  trackIDE.energy = data->energy;
205  trackIDE.numElectrons = data->numElectrons;
206 
207  trackIDEs.emplace_back(trackIDE);
208  }
209 
210  break;
211  }
212  }
213 
214  return trackIDEs;
215 }
216 
217 std::vector<TrackIDE> MCTruthAssociations::HitToTrackID(const art::Ptr<recob::Hit>& hit) const
218 {
219  return HitToTrackID(hit.get());
220 }
221 
222 //----------------------------------------------------------------------
223 const std::vector<std::vector<art::Ptr<recob::Hit>>> MCTruthAssociations::TrackIDsToHits(std::vector<art::Ptr<recob::Hit>> const& allHits,
224  std::vector<int> const& tkIDs) const
225 {
226  // returns a subset of the hits in the allhits collection that are matched
227  // to MC particles listed in tkIDs
228 
229  // temporary vector of TrackIDs and Ptrs to hits so only one
230  // loop through the (possibly large) allhits collection is needed
231  std::unordered_map<int, std::vector<art::Ptr<recob::Hit>>> trackIDHitVecMap;
232 
233  for(const auto& hit : allHits)
234  {
235  std::vector<TrackIDE> trackIDEVec = this->HitToTrackID(hit.get());
236 
237  for(const auto trackIDE : trackIDEVec)
238  {
239  for(auto trackID : tkIDs)
240  {
241  if(trackID == trackIDE.trackID && trackIDE.energyFrac > fMinHitEnergyFraction)
242  {
243  trackIDHitVecMap[trackID].push_back(hit);
244  }
245  }
246  }
247  }
248 
249  // now build the truHits vector that will be returned to the caller
250  std::vector<std::vector<art::Ptr<recob::Hit>>> truHits;
251 
252  for(const auto& trackHitPair : trackIDHitVecMap) truHits.emplace_back(trackHitPair.second);
253 
254  return truHits;
255 }
256 
257 //----------------------------------------------------------------------
258 // the particle list is assumed to have adopted the appropriate EveIdCalculator prior to
259 // having been passed to this method. It is likely that the EmEveIdCalculator is
260 // the one you always want to use
261 std::vector<TrackIDE> MCTruthAssociations::HitToEveID(const art::Ptr<recob::Hit>& hit) const
262 {
263  std::vector<TrackIDE> trackIDEVec = this->HitToTrackID(hit.get());
264 
265  // Need the particle list, want the "biggest" one to make sure we have all the particles
266  const MCTruthParticleList& particleList = getParticleList();
267 
268  // Create a map which will go between eve ids and TrackIDEs
269  std::unordered_map<int, TrackIDE> idToTrackIDEMap;
270 
271  for(const auto& trackID : trackIDEVec)
272  {
273  int eveTrackID = particleList.EveId(trackID.trackID);
274  TrackIDE& eveTrackIDE = idToTrackIDEMap[eveTrackID];
275 
276  eveTrackIDE.trackID = eveTrackID;
277  eveTrackIDE.energyFrac += trackID.energyFrac;
278  eveTrackIDE.energy += trackID.energy;
279  eveTrackIDE.numElectrons += trackID.numElectrons;
280  }
281 
282  // Now create an output container and move info to it
283  std::vector<TrackIDE> eveTrackIDEVec;
284 
285  for(const auto& eveIDEPair : idToTrackIDEMap) eveTrackIDEVec.emplace_back(eveIDEPair.second);
286 
287  return eveTrackIDEVec;
288 }
289 
290 // method to return the XYZ position of the weighted average energy deposition for a given hit
291 std::vector<double> MCTruthAssociations::HitToXYZ(art::Ptr<recob::Hit> const& hit) const
292 {
293  mf::LogWarning("MCTruthAssociations") << " ** HitToXYZ currently not implemented in MCTruthAssociations, return a zero point";
294  return std::vector<double>() = {0.,0.,0.};
295 }
296 
297 // method to return the XYZ position of a space point (unweighted average XYZ of component hits).
298 std::vector<double> MCTruthAssociations::SpacePointHitsToXYZ(art::PtrVector<recob::Hit> const& hits) const
299 {
300  mf::LogWarning("MCTruthAssociations") << " ** SpacePointHitsToXYZ currently not implemented in MCTruthAssociations, return a zero point";
301  return std::vector<double>() = {0.,0.,0.};
302 }
303 
304 // method to return the fraction of hits in a collection that come from the specified Geant4 track ids
305 double MCTruthAssociations::HitCollectionPurity(std::set<int> trackIDs,
306  const std::vector< art::Ptr<recob::Hit> >& hitVec) const
307 {
308  // get the list of EveIDs that correspond to the hits in this collection
309  // if the EveID shows up in the input list of trackIDs, then it counts
310  float total = hitVec.size();;
311  float desired = 0.;
312 
313  // don't have to check the plane in the hits collection because
314  // those are assumed to be from the object we are testing and will
315  // the correct plane by definition then.
316  for(const auto& hit : hitVec)
317  {
318  std::vector<TrackIDE> hitTrackIDEVec = this->HitToTrackID(hit.get());
319 
320  for(const auto& trackIDE : hitTrackIDEVec)
321  {
322  if (trackIDs.find(trackIDE.trackID) != trackIDs.end())
323  {
324  desired += 1.;
325  break;
326  }
327  }
328  }
329 
330  double purity = 0.;
331  if(total > 0) purity = desired/total;
332 
333  return purity;
334 }
335 
336 // method to return the fraction of all hits in an event from a specific set of Geant4 track IDs that are
337 // represented in a collection of hits
338 double MCTruthAssociations::HitCollectionEfficiency(std::set<int> trackIDs,
339  const std::vector< art::Ptr<recob::Hit> >& hitVec,
340  const std::vector< art::Ptr<recob::Hit> >& allHitVec,
341  const geo::View_t& view) const
342 {
343  // get the list of EveIDs that correspond to the hits in this collection
344  // and the energy associated with the desired trackID
345  float desired = 0.;
346  float total = 0.;
347 
348  // don't have to check the view in the hits collection because
349  // those are assumed to be from the object we are testing and will
350  // the correct view by definition then.
351  for(const auto& hit : hitVec)
352  {
353  std::vector<TrackIDE> hitTrackIDs = this->HitToTrackID(hit);
354 
355  // don't worry about hits where the energy fraction for the chosen
356  // trackID is < 0.1
357  // also don't double count if this hit has more than one of the
358  // desired track IDs associated with it
359  for(const auto& trackIDE : hitTrackIDs)
360  {
361  if (trackIDs.find(trackIDE.trackID) != trackIDs.end() &&
362  trackIDE.energyFrac >= fMinHitEnergyFraction)
363  {
364  desired += 1.;
365  break;
366  }
367  }
368  }
369 
370  // now figure out how many hits in the whole collection are associated with this id
371  for(const auto& hit : allHitVec)
372  {
373 
374  // check that we are looking at the appropriate view here
375  // in the case of 3D objects we take all hits
376  if(hit->View() != view && view != geo::k3D ) continue;
377 
378  std::vector<TrackIDE> hitTrackIDs = this->HitToTrackID(hit);
379 
380  for (const auto& trackIDE : hitTrackIDs)
381  {
382  if (trackIDs.find(trackIDE.trackID) != trackIDs.end() &&
383  trackIDE.energyFrac >= fMinHitEnergyFraction)
384  {
385  total += 1.;
386  break;
387  }
388  }
389  }
390 
391  double efficiency = 0.;
392  if(total > 0.) efficiency = desired/total;
393 
394  return efficiency;
395 }
396 
397 // method to return the fraction of charge in a collection that come from the specified Geant4 track ids
399  const std::vector< art::Ptr<recob::Hit> >& hitVec) const
400 {
401  // get the list of EveIDs that correspond to the hits in this collection
402  // if the EveID shows up in the input list of trackIDs, then it counts
403  float total = 0;
404  float desired = 0.;
405 
406  // don't have to check the view in the hits collection because
407  // those are assumed to be from the object we are testing and will
408  // the correct view by definition then.
409  for(const auto& hit : hitVec)
410  {
411  std::vector<TrackIDE> hitTrackIDEVec = this->HitToTrackID(hit);
412 
413  total += hit->Integral();
414 
415  for(const auto& trackIDE : hitTrackIDEVec)
416  {
417  if (trackIDs.find(trackIDE.trackID) != trackIDs.end())
418  {
419  desired += hit->Integral();
420  break;
421  }
422  }
423 
424  }
425 
426  double purity = 0.;
427  if(total > 0) purity = desired/total;
428 
429  return purity;
430 }
431 
432 // method to return the fraction of all charge in an event from a specific set of Geant4 track IDs that are
433 // represented in a collection of hits
435  const std::vector< art::Ptr<recob::Hit> >& hitVec,
436  const std::vector< art::Ptr<recob::Hit> >& allHitVec,
437  const geo::View_t& view) const
438 {
439  // get the list of EveIDs that correspond to the hits in this collection
440  // and the energy associated with the desired trackID
441  float desired = 0.;
442  float total = 0.;
443 
444  // don't have to check the view in the hits collection because
445  // those are assumed to be from the object we are testing and will
446  // the correct view by definition then.
447  for(const auto& hit : hitVec)
448  {
449  std::vector<TrackIDE> hitTrackIDs = this->HitToTrackID(hit);
450 
451  // don't worry about hits where the energy fraction for the chosen
452  // trackID is < 0.1
453  // also don't double count if this hit has more than one of the
454  // desired track IDs associated with it
455  for(const auto& trackIDE : hitTrackIDs)
456  {
457  if (trackIDs.find(trackIDE.trackID) != trackIDs.end() &&
458  trackIDE.energyFrac >= fMinHitEnergyFraction)
459  {
460  desired += hit->Integral();
461  break;
462  }
463  }
464  }
465 
466  // now figure out how many hits in the whole collection are associated with this id
467  for(const auto& hit : allHitVec)
468  {
469 
470  // check that we are looking at the appropriate view here
471  // in the case of 3D objects we take all hits
472  if(hit->View() != view && view != geo::k3D ) continue;
473 
474  std::vector<TrackIDE> hitTrackIDs = this->HitToTrackID(hit);
475 
476  for (const auto& trackIDE : hitTrackIDs)
477  {
478  if (trackIDs.find(trackIDE.trackID) != trackIDs.end() &&
479  trackIDE.energyFrac >= fMinHitEnergyFraction)
480  {
481  total += hit->Integral();
482  break;
483  }
484  }
485  }
486 
487  double efficiency = 0.;
488  if(total > 0.) efficiency = desired/total;
489 
490  return efficiency;
491 }
492 
493 // method to return all EveIDs corresponding to the current sim::ParticleList
495 {
496  std::set<int> eveIDs;
497  const MCTruthParticleList& particleList = getParticleList();
498 
499  for(const auto& pl : particleList) eveIDs.insert(particleList.EveId(pl.first));
500 
501  return eveIDs;
502 }
503 
504 // method to return all TrackIDs corresponding to the current sim::ParticleList
506 {
507  // fParticleList::value_type is a pair (track, particle pointer)
508  std::set<int> trackIDs;
509  const MCTruthParticleList& particleList = getParticleList();
510 
511  for (const auto& pl: particleList) trackIDs.insert(pl.first);
512 
513  return trackIDs;
514 }
515 
516 // method to return all EveIDs corresponding to the given list of hits
517 std::set<int> MCTruthAssociations::GetSetOfEveIDs(const std::vector< art::Ptr<recob::Hit> >& hitVec) const
518 {
519  std::set<int> eveIDs;
520 
521  for(const auto& hit : hitVec)
522  {
523  const std::vector<TrackIDE> ideVec = HitToEveID(hit);
524 
525  // loop over the ides and extract the track ids
526  for(const auto& trackIDE : ideVec) eveIDs.insert(trackIDE.trackID);
527  }
528 
529  return eveIDs;
530 }
531 
532 // method to return all TrackIDs corresponding to the given list of hits
533 std::set<int> MCTruthAssociations::GetSetOfTrackIDs(std::vector< art::Ptr<recob::Hit> > const& hitVec) const
534 {
535  std::set<int> trackIDs;
536 
537  for(const auto& hit : hitVec)
538  {
539  std::vector<TrackIDE> trackIDEVec = this->HitToTrackID(hit);
540 
541  for(const auto& trackIDE : trackIDEVec) trackIDs.insert(trackIDE.trackID);
542  }
543 
544  return trackIDs;
545 }
546 
547 // Length of reconstructed track.
548 //----------------------------------------------------------------------------
550 {
551  return track->Length();
552 }
553 
554 // Length of MC particle.
555 //----------------------------------------------------------------------------
557  const simb::MCParticle& part, double dx,
558  TVector3& start, TVector3& end, TVector3& startmom, TVector3& endmom,
559  unsigned int tpc, unsigned int cstat) const
560 {
561  // Get fiducial volume boundary.
562  double xmin = -0.1;
563  double xmax = 2.*fGeometry->DetHalfWidth() + 0.1;
564  double ymin = -fGeometry->DetHalfHeight() + 0.1;
565  double ymax = fGeometry->DetHalfHeight() + 0.1;
566  double zmin = -0.1;
567  double zmax = fGeometry->DetLength() + 0.1;
568 
569  double readOutWindowSize = detProp.ReadOutWindowSize();
570 
571  double result = 0.;
572  TVector3 disp;
573  int n = part.NumberTrajectoryPoints();
574  bool first = true;
575 
576  // Loop over the complete collection of trajectory points
577  for(int i = 0; i < n; ++i)
578  {
579  TVector3 pos = part.Position(i).Vect();
580 
581  // Make fiducial cuts.
582  // There are two sets here:
583  // 1) We check the original x,y,z position of the trajectory points and require they be
584  // within the confines of the physical TPC
585  // 2) We then check the timing of the presumed hit and make sure it lies within the
586  // readout window for this simulation
587 
588  if(pos.X() >= xmin &&
589  pos.X() <= xmax &&
590  pos.Y() >= ymin &&
591  pos.Y() <= ymax &&
592  pos.Z() >= zmin &&
593  pos.Z() <= zmax)
594  {
595  pos[0] += dx;
596  double ticks = detProp.ConvertXToTicks(pos[0], 0, 0, 0);
597 
598  if(ticks >= 0. && ticks < readOutWindowSize)
599  {
600  if(first)
601  {
602  start = pos;
603  startmom = part.Momentum(i).Vect();
604  }
605  else
606  {
607  disp -= pos;
608  result += disp.Mag();
609  }
610  first = false;
611  disp = pos;
612  end = pos;
613  endmom = part.Momentum(i).Vect();
614  }
615  }
616  }
617 
618  return result;
619 }
620 
621 } // end of namespace
std::pair< const simb::MCParticle *, const anab::BackTrackerHitMatchingData * > PartMatchDataPair
art::Assns< simb::MCParticle, recob::Hit, anab::BackTrackerHitMatchingData > HitParticleAssociations
list_type::const_iterator const_iterator
std::pair< const recob::Hit *, const anab::BackTrackerHitMatchingData * > HitMatchDataPair
MCTruthTruthVec fMCTruthVec
all the MCTruths for the event
double HitChargeCollectionEfficiency(std::set< int >, std::vector< art::Ptr< recob::Hit > > const &, std::vector< art::Ptr< recob::Hit > > const &, geo::View_t const &) const
std::vector< art::Ptr< simb::MCTruth >> MCTruthTruthVec
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
const geo::GeometryCore * geometry
const std::vector< std::vector< art::Ptr< recob::Hit > > > TrackIDsToHits(std::vector< art::Ptr< recob::Hit >> const &, std::vector< int > const &) const
HitToPartVecMap fHitToPartVecMap
Mapping from hits to associated MCParticle/data pairs.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
HitPartAssnsList fHitPartAssnsVec
Container for the (multiple) associations.
pdgs p
Definition: selectors.fcl:22
Ionization energy from a Geant4 track.
std::vector< TrackIDE > HitToEveID(art::Ptr< recob::Hit > const &hit) const
process_name use argoneut_mc_hitfinder track
MCTruthTrackIDMap fTrackIDToMCTruthIndex
map of track ids to MCTruthList entry
process_name hit
Definition: cheaterreco.fcl:51
PartToHitVecMap fPartToHitVecMap
Mapping from MCParticle to associated hit/data pairs.
art::FindOneP< simb::MCTruth > MCTruthAssns
std::vector< art::Ptr< simb::MCParticle >> MCParticleVec
tick ticks
Alias for common language habits.
Definition: electronics.h:78
MCTruthAssociations(fhicl::ParameterSet const &config)
float numElectrons
number of electrons from the particle detected on the wires
const simb::MCParticle * TrackIDToMotherParticle(int const &id) const
std::vector< TrackIDE > HitToTrackID(const recob::Hit *) const
int EveId(const int trackID) const
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:135
list_type::value_type value_type
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
double length(const recob::Track *) const
T abs(T value)
float energy
energy from the particle with this trackID [MeV]
Example routine for calculating the &quot;ultimate e-m mother&quot; of a particle in a simulated event...
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.
std::set< int > GetSetOfTrackIDs() const
This algorithm attempts to decode Track and Hit &lt;–&gt; MCParticle assocations.
std::set< int > GetSetOfEveIDs() const
void AdoptEveIdCalculator(MCTruthEveIdCalculator *) const
double HitCollectionPurity(std::set< int >, std::vector< art::Ptr< recob::Hit > > const &) const
const art::Ptr< simb::MCTruth > & TrackIDToMCTruth(int const &id) const
int trackID
Geant4 supplied trackID.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
double ConvertXToTicks(double X, int p, int t, int c) const
double HitCollectionEfficiency(std::set< int >, std::vector< art::Ptr< recob::Hit > > const &, std::vector< art::Ptr< recob::Hit > > const &, geo::View_t const &) const
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
double HitChargeCollectionPurity(std::set< int >, std::vector< art::Ptr< recob::Hit > > const &) const
const simb::MCParticle * TrackIDToParticle(int const &id) const
Description of geometry of one entire detector.
const art::Ptr< simb::MCTruth > & ParticleToMCTruth(const simb::MCParticle *p) const
iterator find(const key_type &key)
const MCTruthParticleList & getParticleList() const
void Add(const simb::MCParticle *value)
std::vector< const HitParticleAssociations * > HitParticleAssociationsVec
std::vector< double > HitToXYZ(art::Ptr< recob::Hit > const &hit) const
std::vector< double > SpacePointHitsToXYZ(art::PtrVector< recob::Hit > const &hits) const
MCTruthParticleList fParticleList
ParticleList to map track ID to.
float energyFrac
fraction of hit energy from the particle with this trackID
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
std::vector< const simb::MCParticle * > MCTruthToParticles(art::Ptr< simb::MCTruth > const &mct) const
geo::GeometryCore const * fGeometry
void setup(const HitParticleAssociationsVec &, const MCParticleVec &, const MCTruthAssns &, const geo::GeometryCore &)
auto const detProp
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
const MCTruthTruthVec & MCTruthVector() const