DUNEAnaPFParticleUtils.h
Go to the documentation of this file.
1 /**
2  *
3  * @file dunereco/AnaUtils/DUNEAnaPFParticleUtils.h
4  *
5  * @brief Utility containing helpful functions for end users to access information about PFParticles
6 */
7 
8 #ifndef DUNE_ANA_PFPARTICLE_UTILS_H
9 #define DUNE_ANA_PFPARTICLE_UTILS_H
10 
12 
14 
15 #include <string>
16 #include <vector>
17 
29 
30 namespace dune_ana
31 {
32 /**
33  *
34  * @brief DUNEAnaPFParticleUtils class
35  *
36 */
38 {
39 public:
40  /**
41  * @brief Get the T0(s) associated with the particle.
42  *
43  * @param pParticle particle for which we want the T0
44  * @param evt is the underlying art event
45  * @param label is the label for the PFParticle producer
46  *
47  * @return vector of art::Ptrs to the T0(s)
48  */
49  static std::vector<art::Ptr<anab::T0>> GetT0(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label);
50 
51  /**
52  * @brief Get the Cosmic Tag(s) associated with the particle.
53  *
54  * @param pParticle particle for which we want the cosmic tag
55  * @param evt is the underlying art event
56  * @param label is the label for the PFParticle producer
57  *
58  * @return vector of art::Ptrs to the cosmic tag(s)
59  */
60  static std::vector<art::Ptr<anab::CosmicTag>> GetCosmicTag(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label);
61 
62  /**
63  * @brief Get the child particles (one step down in the hierarchy) of this particle.
64  *
65  * @param pParticle particle for which we want the child particles
66  * @param evt is the underlying art event
67  * @param label is the label for the PFParticle producer
68  *
69  * @return vector of art::Ptrs to the child particles
70  */
71  static std::vector<art::Ptr<recob::PFParticle>> GetChildParticles(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label);
72 
73  /**
74  * @brief Get the hits associated to this particle.
75  *
76  * @param pParticle particle for which we want the hits
77  * @param evt is the underlying art event
78  * @param label is the label for the PFParticle producer
79  *
80  * @return vector of art::Ptrs to the hits
81  */
82  static std::vector<art::Ptr<recob::Hit>> GetHits(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label);
83 
84  /**
85  * @brief Get the hits associated to this particle in a given view.
86  *
87  * @param pParticle particle for which we want the hits
88  * @param evt is the underlying art event
89  * @param label is the label for the PFParticle producer
90  * @param view is the view for which we want the hits
91  *
92  * @return vector of art::Ptrs to the hits
93  */
94  static std::vector<art::Ptr<recob::Hit>> GetViewHits(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label, const unsigned short &view);
95 
96  /**
97  * @brief Get the spacepoints associated to this particle.
98  *
99  * @param pParticle particle for which we want the spacepoints
100  * @param evt is the underlying art event
101  * @param label is the label for the PFParticle producer
102  *
103  * @return vector of art::Ptrs to the spacepoints
104  */
105  static std::vector<art::Ptr<recob::SpacePoint>> GetSpacePoints(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &label);
106 
107  /**
108  * @brief Get the track associated to this particle. Should only be called if IsTrack method succeeds
109  *
110  * @param pParticle particle for which we want the track
111  * @param evt is the underlying art event
112  * @param particleLabel is the label for the PFParticle producer
113  * @param trackLabel is the label for the Track producer
114  *
115  * @return art::Ptr to the track
116  */
117  static art::Ptr<recob::Track> GetTrack(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel);
118 
119  /**
120  * @brief Get the shower associated to this particle. Should only be called if IsShower method succeeds
121  *
122  * @param pParticle particle for which we want the shower
123  * @param evt is the underlying art event
124  * @param particleLabel is the label for the PFParticle producer
125  * @param trackLabel is the label for the Shower producer
126  *
127  * @return art::Ptr to the shower
128  */
129  static art::Ptr<recob::Shower> GetShower(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel);
130 
131  /**
132  * @brief Get the vertex associated to this particle.
133  *
134  * @param pParticle particle for which we want the vertex
135  * @param evt is the underlying art event
136  * @param label is the label for the PFParticle producer
137  *
138  * @return art::Ptr to the vertex
139  */
140  static art::Ptr<recob::Vertex> GetVertex(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel);
141 
142  /**
143  * @brief Get the slice associated to this particle.
144  *
145  * @param pParticle particle for which we want the slice
146  * @param evt is the underlying art event
147  * @param label is the label for the PFParticle producer
148  *
149  * @return art::Ptr to the slice
150  */
151  static art::Ptr<recob::Slice> GetSlice(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel);
152 
153  /**
154  * @brief Get the metadata associated to this particle.
155  *
156  * @param pParticle particle for which we want the slice
157  * @param evt is the underlying art event
158  * @param label is the label for the PFParticle producer
159  *
160  * @return art::Ptr to the metadata
161  */
163 
164  /**
165  * @brief Check if this particle has an associated track
166  *
167  * @param pParticle particle for which we want the track-like confirmation
168  * @param evt is the underlying art event
169  * @param particleLabel is the label for the PFParticle producer
170  * @param trackLabel is the label for the track producer
171  *
172  * @return bool stating if the object is track-like
173  */
174  static bool IsTrack(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel);
175 
176  /**
177  * @brief Check if this particle has an associated shower
178  *
179  * @param pParticle particle for which we want the shower-like confirmation
180  * @param evt is the underlying art event
181  * @param particleLabel is the label for the PFParticle producer
182  * @param showerLabel is the label for the shower producer
183  *
184  * @return bool stating if the object is shower-like
185  */
186  static bool IsShower(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel);
187 
188  /**
189  * @brief Check if this particle is a clear cosmic ray
190  *
191  * @param pParticle particle for which we want the clear cosmic confirmation
192  * @param evt is the underlying art event
193  * @param particleLabel is the label for the PFParticle producer
194  *
195  * @return bool stating if the object is a clear cosmic ray
196  */
197  static bool IsClearCosmic(const art::Ptr<recob::PFParticle> &pParticle, const art::Event &evt, const std::string &pParticleLabel);
198 
199  /**
200  * @brief Check if this particle is a neutrino
201  *
202  * @param pParticle particle for which we want the neutrino confirmation
203  *
204  * @return bool stating if the object is a neutrino
205  */
206  static bool IsNeutrino(const art::Ptr<recob::PFParticle> &pParticle);
207 };
208 
209 } // namespace dune_ana
210 
211 #endif // DUNE_ANA_PFPARTICLE_UTILS_H
212 
DUNEAnaUtilsBase class containing some template functions.
static std::vector< art::Ptr< anab::T0 > > GetT0(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the T0(s) associated with the particle.
static art::Ptr< recob::Track > GetTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Get the track associated to this particle. Should only be called if IsTrack method succeeds...
static art::Ptr< recob::Slice > GetSlice(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Get the slice associated to this particle.
std::string string
Definition: nybbler.cc:12
static bool IsClearCosmic(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Check if this particle is a clear cosmic ray.
static bool IsShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Check if this particle has an associated shower.
static std::vector< art::Ptr< recob::Hit > > GetViewHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label, const unsigned short &view)
Get the hits associated to this particle in a given view.
static art::Ptr< recob::Shower > GetShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Get the shower associated to this particle. Should only be called if IsShower method succeeds...
static std::vector< art::Ptr< recob::PFParticle > > GetChildParticles(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the child particles (one step down in the hierarchy) of this particle.
DUNEAnaPFParticleUtils class.
static std::vector< art::Ptr< recob::SpacePoint > > GetSpacePoints(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the spacepoints associated to this particle.
static bool IsNeutrino(const art::Ptr< recob::PFParticle > &pParticle)
Check if this particle is a neutrino.
Base class containing functionality to extract products from the event.
static art::Ptr< larpandoraobj::PFParticleMetadata > GetMetadata(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the metadata associated to this particle.
Declaration of signal hit object.
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the hits associated to this particle.
Provides recob::Track data product.
static art::Ptr< recob::Vertex > GetVertex(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Get the vertex associated to this particle.
static bool IsTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Check if this particle has an associated track.
static std::vector< art::Ptr< anab::CosmicTag > > GetCosmicTag(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the Cosmic Tag(s) associated with the particle.
TCEvent evt
Definition: DataStructs.cxx:7