LArShowerPfo.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArObjects/LArShowerPfo.h
3  *
4  * @brief Header file for the lar pfo class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_SHOWER_PFO_H
9 #define LAR_SHOWER_PFO_H 1
10 
11 #include "Objects/ParticleFlowObject.h"
12 
13 #include "Pandora/ObjectCreation.h"
14 #include "Pandora/ObjectFactory.h"
15 
16 #include <string>
17 
18 namespace lar_content
19 {
20 
21 /**
22  * @brief lar pfo parameters
23  */
24 class LArShowerPfoParameters : public object_creation::ParticleFlowObject::Parameters
25 {
26 public:
27  pandora::InputCartesianVector m_showerLength; ///< Shower length and widths from 3d shower fit
28  pandora::InputCartesianVector m_showerCentroid; ///< Shower centroid from 3d shower fit
29  pandora::InputFloat m_showerOpeningAngle; ///< Shower opening angle
30  pandora::InputCartesianVector m_showerDirection; ///< Shower direction, also the primary eigen vector
31  pandora::InputCartesianVector m_showerSecondaryVector; ///< Shower secondary eigen vector
32  pandora::InputCartesianVector m_showerTertiaryVector; ///< Shower teriary eigen vector
33  pandora::InputCartesianVector m_showerEigenValues; ///< Shower eigenvalues from 3d PCA
34  pandora::InputCartesianVector m_showerVertex; ///< Shower starting point
35 };
36 
37 //------------------------------------------------------------------------------------------------------------------------------------------
38 
39 /**
40  * @brief lar pfo object
41  */
43 {
44 public:
45  /**
46  * @brief Constructor
47  *
48  * @param parameters the lar pfo parameters
49  */
50  LArShowerPfo(const LArShowerPfoParameters &parameters);
51 
52  /**
53  * @brief Get the shower length and width from 3d shower fit
54  *
55  * @return the shower length and width from 3d shower fit
56  */
57  const pandora::CartesianVector &GetShowerLength() const;
58 
59  /**
60  * @brief Get the shower centroid from the 3d shower fit
61  *
62  * @return the shower centroid from the 3d shower fit
63  */
64  const pandora::CartesianVector &GetShowerCentroid() const;
65 
66  /**
67  * @brief Get the shower opening angle from 3d shower fit
68  *
69  * @return the shower opening angle from 3d shower fit
70  */
71  float GetShowerOpeningAngle() const;
72 
73  /**
74  * @brief Get the shower direction, also the primary eigen vector from 3d shower fit
75  *
76  * @return the shower direction, also the primary eigen vector from 3d shower fit
77  */
78  const pandora::CartesianVector &GetShowerDirection() const;
79 
80  /**
81  * @brief Get the shower secondary eigen vector from 3d shower fit
82  *
83  * @return the shower secondary eigen vector from 3d shower fit
84  */
85  const pandora::CartesianVector &GetShowerSecondaryVector() const;
86 
87  /**
88  * @brief Get the shower tertiary eigen vector from 3d shower fit
89  *
90  * @return the shower tertiary eigen vector from 3d shower fit
91  */
92  const pandora::CartesianVector &GetShowerTertiaryVector() const;
93 
94  /**
95  * @brief Get the shower eigen values from 3d PCA
96  *
97  * @return the shower eigen values from 3d PCA
98  */
99  const pandora::CartesianVector &GetShowerEigenValues() const;
100 
101  /**
102  * @brief Get the shower starting point from 3d shower fit
103  *
104  * @return the shower starting point from 3d shower fit
105  */
106  const pandora::CartesianVector &GetShowerVertex() const;
107 
108 private:
109  pandora::CartesianVector m_showerLength; ///< Shower length and widths from 3d shower fit
110  pandora::CartesianVector m_showerCentroid; ///< Shower centroid from 3d shower fit
111  float m_showerOpeningAngle; ///< Shower opening angle
112  pandora::CartesianVector m_showerDirection; ///< Shower direction, primary eigen vector
113  pandora::CartesianVector m_showerSecondaryVector; ///< Shower secondary eigen vector
114  pandora::CartesianVector m_showerTertiaryVector; ///< Shower tertiary eigen vector
115  pandora::CartesianVector m_showerEigenValues; ///< Shower eigenvalues from 3d PCA
116  pandora::CartesianVector m_showerVertex; ///< Shower starting point
117 };
118 
119 //------------------------------------------------------------------------------------------------------------------------------------------
120 
121 /**
122  * @brief lar pfo object factory responsible for pfo creation
123  */
124 class LArShowerPfoFactory : public pandora::ObjectFactory<object_creation::ParticleFlowObject::Parameters, object_creation::ParticleFlowObject::Object>
125 {
126 public:
127  /**
128  * @brief Create new parameters instance on the heap (memory-management to be controlled by user)
129  *
130  * @return the address of the new parameters instance
131  */
132  Parameters *NewParameters() const;
133 
134  /**
135  * @brief Read any additional (derived class only) object parameters from file using the specified file reader
136  *
137  * @param parameters the parameters to pass in constructor
138  * @param fileReader the file reader, used to extract any additional parameters from file
139  */
140  pandora::StatusCode Read(Parameters &parameters, pandora::FileReader &fileReader) const;
141 
142  /**
143  * @brief Persist any additional (derived class only) object parameters using the specified file writer
144  *
145  * @param pObject the address of the object to persist
146  * @param fileWriter the file writer
147  */
148  pandora::StatusCode Write(const Object *const pObject, pandora::FileWriter &fileWriter) const;
149 
150  /**
151  * @brief Create an object with the given parameters
152  *
153  * @param parameters the parameters to pass in constructor
154  * @param pObject to receive the address of the object created
155  */
156  pandora::StatusCode Create(const Parameters &parameters, const Object *&pObject) const;
157 };
158 
159 //------------------------------------------------------------------------------------------------------------------------------------------
160 //------------------------------------------------------------------------------------------------------------------------------------------
161 
163  object_creation::ParticleFlowObject::Object(parameters),
164  m_showerLength(parameters.m_showerLength.Get()),
165  m_showerCentroid(parameters.m_showerCentroid.Get()),
166  m_showerOpeningAngle(parameters.m_showerOpeningAngle.Get()),
167  m_showerDirection(parameters.m_showerDirection.Get()),
170  m_showerEigenValues(parameters.m_showerEigenValues.Get()),
171  m_showerVertex(parameters.m_showerVertex.Get())
172 {
173 }
174 
175 //------------------------------------------------------------------------------------------------------------------------------------------
176 
177 inline const pandora::CartesianVector &LArShowerPfo::GetShowerLength() const
178 {
179  return m_showerLength;
180 }
181 
182 //------------------------------------------------------------------------------------------------------------------------------------------
183 
184 inline const pandora::CartesianVector &LArShowerPfo::GetShowerCentroid() const
185 {
186  return m_showerCentroid;
187 }
188 
189 //------------------------------------------------------------------------------------------------------------------------------------------
190 
192 {
193  return m_showerOpeningAngle;
194 }
195 
196 //------------------------------------------------------------------------------------------------------------------------------------------
197 
198 inline const pandora::CartesianVector &LArShowerPfo::GetShowerDirection() const
199 {
200  return m_showerDirection;
201 }
202 
203 //------------------------------------------------------------------------------------------------------------------------------------------
204 
205 inline const pandora::CartesianVector &LArShowerPfo::GetShowerSecondaryVector() const
206 {
208 }
209 
210 //------------------------------------------------------------------------------------------------------------------------------------------
211 
212 inline const pandora::CartesianVector &LArShowerPfo::GetShowerTertiaryVector() const
213 {
214  return m_showerTertiaryVector;
215 }
216 
217 //------------------------------------------------------------------------------------------------------------------------------------------
218 
219 inline const pandora::CartesianVector &LArShowerPfo::GetShowerEigenValues() const
220 {
221  return m_showerEigenValues;
222 }
223 
224 //------------------------------------------------------------------------------------------------------------------------------------------
225 
226 inline const pandora::CartesianVector &LArShowerPfo::GetShowerVertex() const
227 {
228  return m_showerVertex;
229 }
230 
231 //------------------------------------------------------------------------------------------------------------------------------------------
232 
233 inline LArShowerPfoFactory::Parameters *LArShowerPfoFactory::NewParameters() const
234 {
235  return (new LArShowerPfoParameters);
236 }
237 
238 //------------------------------------------------------------------------------------------------------------------------------------------
239 
240 inline pandora::StatusCode LArShowerPfoFactory::Create(const Parameters &parameters, const Object *&pObject) const
241 {
242  const LArShowerPfoParameters &larPfoParameters(dynamic_cast<const LArShowerPfoParameters &>(parameters));
243  pObject = new LArShowerPfo(larPfoParameters);
244 
245  return pandora::STATUS_CODE_SUCCESS;
246 }
247 
248 //------------------------------------------------------------------------------------------------------------------------------------------
249 
250 inline pandora::StatusCode LArShowerPfoFactory::Read(Parameters &, pandora::FileReader &) const
251 {
252  // TODO: Provide this functionality if necessary
253 
254  return pandora::STATUS_CODE_SUCCESS;
255 }
256 
257 //------------------------------------------------------------------------------------------------------------------------------------------
258 
259 inline pandora::StatusCode LArShowerPfoFactory::Write(const pandora::ParticleFlowObject *, pandora::FileWriter &) const
260 {
261  // TODO: Provide this functionality if necessary
262 
263  return pandora::STATUS_CODE_SUCCESS;
264 }
265 
266 } // namespace lar_content
267 
268 #endif // #ifndef LAR_SHOWER_PFO_H
pandora::StatusCode Create(const Parameters &parameters, const Object *&pObject) const
Create an object with the given parameters.
Definition: LArShowerPfo.h:240
const pandora::CartesianVector & GetShowerSecondaryVector() const
Get the shower secondary eigen vector from 3d shower fit.
Definition: LArShowerPfo.h:205
pandora::InputFloat m_showerOpeningAngle
Shower opening angle.
Definition: LArShowerPfo.h:29
const pandora::CartesianVector & GetShowerDirection() const
Get the shower direction, also the primary eigen vector from 3d shower fit.
Definition: LArShowerPfo.h:198
pandora::InputCartesianVector m_showerCentroid
Shower centroid from 3d shower fit.
Definition: LArShowerPfo.h:28
pandora::InputCartesianVector m_showerTertiaryVector
Shower teriary eigen vector.
Definition: LArShowerPfo.h:32
pandora::CartesianVector m_showerDirection
Shower direction, primary eigen vector.
Definition: LArShowerPfo.h:112
pandora::StatusCode Read(Parameters &parameters, pandora::FileReader &fileReader) const
Read any additional (derived class only) object parameters from file using the specified file reader...
Definition: LArShowerPfo.h:250
pandora::StatusCode Write(const Object *const pObject, pandora::FileWriter &fileWriter) const
Persist any additional (derived class only) object parameters using the specified file writer...
Definition: LArShowerPfo.h:259
pandora::InputCartesianVector m_showerVertex
Shower starting point.
Definition: LArShowerPfo.h:34
pandora::CartesianVector m_showerEigenValues
Shower eigenvalues from 3d PCA.
Definition: LArShowerPfo.h:115
pandora::InputCartesianVector m_showerDirection
Shower direction, also the primary eigen vector.
Definition: LArShowerPfo.h:30
LArShowerPfo(const LArShowerPfoParameters &parameters)
Constructor.
Definition: LArShowerPfo.h:162
lar pfo object factory responsible for pfo creation
Definition: LArShowerPfo.h:124
const pandora::CartesianVector & GetShowerTertiaryVector() const
Get the shower tertiary eigen vector from 3d shower fit.
Definition: LArShowerPfo.h:212
pandora::CartesianVector m_showerLength
Shower length and widths from 3d shower fit.
Definition: LArShowerPfo.h:109
Definition: manual.c:13
pandora::InputCartesianVector m_showerEigenValues
Shower eigenvalues from 3d PCA.
Definition: LArShowerPfo.h:33
struct Object Object
Object type.
Definition: manual.c:5
const pandora::CartesianVector & GetShowerLength() const
Get the shower length and width from 3d shower fit.
Definition: LArShowerPfo.h:177
pandora::InputCartesianVector m_showerLength
Shower length and widths from 3d shower fit.
Definition: LArShowerPfo.h:27
Parameters * NewParameters() const
Create new parameters instance on the heap (memory-management to be controlled by user) ...
Definition: LArShowerPfo.h:233
float m_showerOpeningAngle
Shower opening angle.
Definition: LArShowerPfo.h:111
float GetShowerOpeningAngle() const
Get the shower opening angle from 3d shower fit.
Definition: LArShowerPfo.h:191
pandora::InputCartesianVector m_showerSecondaryVector
Shower secondary eigen vector.
Definition: LArShowerPfo.h:31
pandora::CartesianVector m_showerCentroid
Shower centroid from 3d shower fit.
Definition: LArShowerPfo.h:110
const pandora::CartesianVector & GetShowerCentroid() const
Get the shower centroid from the 3d shower fit.
Definition: LArShowerPfo.h:184
hadnt Write("hadnt")
const pandora::CartesianVector & GetShowerVertex() const
Get the shower starting point from 3d shower fit.
Definition: LArShowerPfo.h:226
const pandora::CartesianVector & GetShowerEigenValues() const
Get the shower eigen values from 3d PCA.
Definition: LArShowerPfo.h:219
pandora::CartesianVector m_showerSecondaryVector
Shower secondary eigen vector.
Definition: LArShowerPfo.h:113
pandora::CartesianVector m_showerVertex
Shower starting point.
Definition: LArShowerPfo.h:116
pandora::CartesianVector m_showerTertiaryVector
Shower tertiary eigen vector.
Definition: LArShowerPfo.h:114