LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArPointingCluster.h
Go to the documentation of this file.
1 
8 #ifndef LAR_POINTING_CLUSTER_H
9 #define LAR_POINTING_CLUSTER_H 1
10 
13 
14 namespace lar_content
15 {
16 
21 {
22 public:
26  class Vertex
27  {
28  public:
32  Vertex();
33 
43  Vertex(const pandora::Cluster *const pCluster, const pandora::CartesianVector &position, const pandora::CartesianVector &direction,
44  const float rms, const bool isInner);
45 
51  Vertex(const Vertex &rhs);
52 
57  ~Vertex();
58 
64  const pandora::Cluster *GetCluster() const;
65 
71  const pandora::CartesianVector &GetPosition() const;
72 
78  const pandora::CartesianVector &GetDirection() const;
79 
85  float GetRms() const;
86 
92  bool IsInnerVertex() const;
93 
99  bool IsInitialized() const;
100 
106  Vertex &operator=(const Vertex &rhs);
107 
108  private:
109  const pandora::Cluster *m_pCluster;
110  pandora::CartesianVector m_position;
111  pandora::CartesianVector m_direction;
112  float m_rms;
113  bool m_isInner;
115  };
116 
124  LArPointingCluster(const pandora::Cluster *const pCluster, const unsigned int fitHalfLayerWindow = 10, const float fitLayerPitch = 0.3f);
125 
131  LArPointingCluster(const TwoDSlidingFitResult &slidingFitResult);
132 
138  LArPointingCluster(const ThreeDSlidingFitResult &slidingFitResult);
139 
145  const pandora::Cluster *GetCluster() const;
146 
152  const Vertex &GetInnerVertex() const;
153 
159  const Vertex &GetOuterVertex() const;
160 
166  float GetLengthSquared() const;
167 
173  float GetLength() const;
174 
175 private:
181  void BuildPointingCluster(const TwoDSlidingFitResult &slidingFitResult);
182 
188  void BuildPointingCluster(const ThreeDSlidingFitResult &slidingFitResult);
189 
190  const pandora::Cluster *m_pCluster;
193 };
194 
195 typedef std::vector<LArPointingCluster> LArPointingClusterList;
196 typedef std::vector<LArPointingCluster::Vertex> LArPointingClusterVertexList;
197 typedef std::unordered_map<const pandora::Cluster *, LArPointingCluster> LArPointingClusterMap;
198 
199 //------------------------------------------------------------------------------------------------------------------------------------------
200 
201 inline const pandora::Cluster *LArPointingCluster::GetCluster() const
202 {
203  return m_pCluster;
204 }
205 
206 //------------------------------------------------------------------------------------------------------------------------------------------
207 
209 {
210  return m_innerVertex;
211 }
212 
213 //------------------------------------------------------------------------------------------------------------------------------------------
214 
216 {
217  return m_outerVertex;
218 }
219 
220 //------------------------------------------------------------------------------------------------------------------------------------------
221 
223 {
224  return (m_outerVertex.GetPosition() - m_innerVertex.GetPosition()).GetMagnitudeSquared();
225 }
226 
227 //------------------------------------------------------------------------------------------------------------------------------------------
228 
229 inline float LArPointingCluster::GetLength() const
230 {
231  return std::sqrt(this->GetLengthSquared());
232 }
233 
234 //------------------------------------------------------------------------------------------------------------------------------------------
235 //------------------------------------------------------------------------------------------------------------------------------------------
236 
237 inline const pandora::Cluster *LArPointingCluster::Vertex::GetCluster() const
238 {
239  if (!m_isInitialized)
240  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
241 
242  return m_pCluster;
243 }
244 
245 //------------------------------------------------------------------------------------------------------------------------------------------
246 
247 inline const pandora::CartesianVector &LArPointingCluster::Vertex::GetPosition() const
248 {
249  if (!m_isInitialized)
250  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
251 
252  return m_position;
253 }
254 
255 //------------------------------------------------------------------------------------------------------------------------------------------
256 
257 inline const pandora::CartesianVector &LArPointingCluster::Vertex::GetDirection() const
258 {
259  if (!m_isInitialized)
260  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
261 
262  return m_direction;
263 }
264 
265 //------------------------------------------------------------------------------------------------------------------------------------------
266 
268 {
269  if (!m_isInitialized)
270  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
271 
272  return m_rms;
273 }
274 
275 //------------------------------------------------------------------------------------------------------------------------------------------
276 
278 {
279  if (!m_isInitialized)
280  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
281 
282  return m_isInner;
283 }
284 
285 //------------------------------------------------------------------------------------------------------------------------------------------
286 
288 {
289  return m_isInitialized;
290 }
291 
292 } // namespace lar_content
293 
294 #endif // #ifndef LAR_POINTING_CLUSTER_H
std::unordered_map< const pandora::Cluster *, LArPointingCluster > LArPointingClusterMap
std::vector< LArPointingCluster > LArPointingClusterList
float GetLength() const
Get length of pointing cluster.
const pandora::Cluster * m_pCluster
The address of the cluster.
LArPointingCluster class.
Vertex & operator=(const Vertex &rhs)
Vertex assigment operator.
void BuildPointingCluster(const TwoDSlidingFitResult &slidingFitResult)
Build the pointing cluster object from the sliding fit result.
const pandora::Cluster * GetCluster() const
Get the address of the cluster.
std::vector< LArPointingCluster::Vertex > LArPointingClusterVertexList
TFile f
Definition: plotHisto.C:6
const pandora::Cluster * m_pCluster
The address of the cluster.
const pandora::Cluster * GetCluster() const
Get the address of the cluster.
LArPointingCluster(const pandora::Cluster *const pCluster, const unsigned int fitHalfLayerWindow=10, const float fitLayerPitch=0.3f)
Constructor.
Vertex m_innerVertex
The inner vertex.
bool IsInitialized() const
Whether the vertex has been initialized.
const Vertex & GetOuterVertex() const
Get the outer vertex.
Vertex m_outerVertex
The outer vertex.
Header file for the lar two dimensional sliding fit result class.
const Vertex & GetInnerVertex() const
Get the inner vertex.
bool m_isInner
Whether this is the inner vertex.
float GetLengthSquared() const
Get length squared of pointing cluster.
Header file for the lar three dimensional sliding fit result class.
const pandora::CartesianVector & GetDirection() const
Get the vertex direction.
float GetRms() const
Get rms from vertex fit.
bool IsInnerVertex() const
Is this the inner vertex.
bool m_isInitialized
Whether the vertex has been initialized.
pandora::CartesianVector m_direction
The vertex direction.
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
pandora::CartesianVector m_position
The vertex position.