CVNProtoDUNEUtils.h
Go to the documentation of this file.
1 #ifndef CVN_PROTODUNE_UTILS_H
2 #define CVN_PROTODUNE_UTILS_H
3 
4 ///////////////////////////////////////////////////////////////
5 // CVNProtoDUNEUtils
6 // - Class to help producing images and graphs for specific
7 // particles and slices for ProtoDUNE events
8 // - Had to copy some of these from protoduneana to avoid
9 // having a circular dependency
10 //
11 // Leigh Whitehead - leigh.howard.whitehead@cern.ch
12 ///////////////////////////////////////////////////////////////
13 
14 #include <map>
15 
21 
23 
24 namespace cvn {
25 
27 
28  public:
29 
32 
33  /*** ---------- Slice functions ---------- ***/
34 
35  // Get the hits from the slice (using the slice object)
36  const std::vector<const recob::Hit*> GetRecoSliceHits(const recob::Slice &slice, art::Event const &evt, const std::string sliceModule) const;
37  const std::vector<const recob::Hit*> GetRecoSliceHits(unsigned int sliceID, art::Event const &evt, const std::string sliceModule) const;
38 
39  // A map of all hits in each slice
40  const std::map<unsigned int, std::vector<const recob::Hit*>> GetRecoSliceHitMap(art::Event const &evt, const std::string sliceModule) const;
41  /*** ------------------------------------- ***/
42 
43  /*** -------- Particle functions --------- ***/
44 
45  /// Try to get the slice tagged as beam. Returns 9999 if no beam slice was found
46  unsigned short GetBeamSlice(art::Event const &evt, const std::string particleLabel) const;
47 
48  /// Get a map of slice index to the primary PFParticles within it
49  const std::map<unsigned int,std::vector<const recob::PFParticle*>> GetPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const;
50 
51  /// Get a map of slice index to all of the PFParticles within it
52  const std::map<unsigned int,std::vector<const recob::PFParticle*>> GetAllPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const;
53 
54  /// Get the reconstructed slice number associated with a particle
55  unsigned short GetPFParticleSliceIndex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const;
56 
57  /// Get the reconstructed slice associated with a particle
58  const recob::Slice* GetPFParticleSlice(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const;
59 
60  /// Get the SpacePoints associated to the PFParticle
61  const std::vector<const recob::SpacePoint*> GetPFParticleSpacePoints(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const;
62 
63  /// Use the pandora metadata to tell us if this is a beam particle or not
64  bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const;
65 
66  /*** ------------------------------------- ***/
67  private:
68 
69  /// Helper to get the slice map and avoid code repetition
70  const std::map<unsigned int,std::vector<const recob::PFParticle*>> SliceMapHelper(art::Event const &evt, const std::string particleLabel, bool primaryOnly) const;
71 
72  /// Get the metadata associated to a PFParticle from pandora
73  const std::map<std::string,float> GetPFParticleMetaData(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const;
74  };
75 
76 }
77 
78 #endif
const std::map< unsigned int, std::vector< const recob::PFParticle * > > SliceMapHelper(art::Event const &evt, const std::string particleLabel, bool primaryOnly) const
Helper to get the slice map and avoid code repetition.
const std::map< std::string, float > GetPFParticleMetaData(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the metadata associated to a PFParticle from pandora.
std::string string
Definition: nybbler.cc:12
Utility class for truth labels.
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetAllPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to all of the PFParticles within it.
unsigned short GetPFParticleSliceIndex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the reconstructed slice number associated with a particle.
const std::vector< const recob::Hit * > GetRecoSliceHits(const recob::Slice &slice, art::Event const &evt, const std::string sliceModule) const
const std::vector< const recob::SpacePoint * > GetPFParticleSpacePoints(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the SpacePoints associated to the PFParticle.
const recob::Slice * GetPFParticleSlice(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the reconstructed slice associated with a particle.
Declaration of signal hit object.
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
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.
const std::map< unsigned int, std::vector< const recob::Hit * > > GetRecoSliceHitMap(art::Event const &evt, const std::string sliceModule) const
TCEvent evt
Definition: DataStructs.cxx:7
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
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.