ClusterAssociation.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTwoDReco/LArCosmicRay/ClusterAssociation.h
3  *
4  * @brief Header file for the lar cluster association class
5  *
6  * $Log: $
7  */
8 #ifndef LAR_CLUSTER_ASSOCIATION_H
9 #define LAR_CLUSTER_ASSOCIATION_H 1
10 
12 
13 namespace lar_content
14 {
15 /**
16  * @brief ClusterAssociation class
17  */
19 {
20 public:
21  /**
22  * @brief Default constructor
23  */
25 
26  /**
27  * @brief Constructor
28  *
29  * @param upstreamMergePoint the upstream merge point
30  * @param upstreamMergeDirection the cluster direction at the upstream merge point
31  * @param downstreamMergePoint the downstream merge point
32  * @param downstreamMergeDirection the cluster direction at the downstream merge point
33  */
34  ClusterAssociation(const pandora::CartesianVector &upstreamMergePoint, const pandora::CartesianVector &upstreamMergeDirection,
35  const pandora::CartesianVector &downstreamMergePoint, const pandora::CartesianVector &downstreamMergeDirection);
36 
37  /**
38  * @brief Returns the upstream cluster merge point
39  *
40  * @return the upstream merge point
41  */
42  const pandora::CartesianVector GetUpstreamMergePoint() const;
43 
44  /**
45  * @brief Returns the cluster direction at the upstream merge point
46  *
47  * @return the cluster direction at the upstream merge point
48  */
49  const pandora::CartesianVector GetUpstreamMergeDirection() const;
50 
51  /**
52  * @brief Returns the downstream cluster merge point
53  *
54  * @return the downstream merge point
55  */
56  const pandora::CartesianVector GetDownstreamMergePoint() const;
57 
58  /**
59  * @brief Returns the cluster direction at the downstream merge point
60  *
61  * @return the cluster direction at the downstream merge point
62  */
63  const pandora::CartesianVector GetDownstreamMergeDirection() const;
64 
65  /**
66  * @brief Returns the unit vector of the line connecting the upstream and downstream merge points (upstream -> downstream)
67  *
68  * @return the unit displacement vector from the upstream merge point to the downstream merge point
69  */
70  const pandora::CartesianVector GetConnectingLineDirection() const;
71 
72  /**
73  * @brief Set the upstream merge point
74  *
75  * @param upstreamMergePoint the new upstream merge point
76  */
77  void SetUpstreamMergePoint(const pandora::CartesianVector &upstreamMergePoint);
78 
79  /**
80  * @brief Set the downstream merge point
81  *
82  * @param downstreamMergePoint the new downstream merge point
83  */
84  void SetDownstreamMergePoint(const pandora::CartesianVector &downstreamMergePoint);
85 
86  bool operator==(const ClusterAssociation &clusterAssociation) const;
87  bool operator<(const ClusterAssociation &clusterAssociation) const;
88 
89 protected:
90  /**
91  * @brief Update the connecting line
92  */
93  void UpdateConnectingLine();
94 
95  pandora::CartesianVector m_upstreamMergePoint; ///< The upstream cluster point to be used in the merging process
96  pandora::CartesianVector m_upstreamMergeDirection; ///< The upstream cluster direction at the upstream merge point (points in the direction of the downstream cluster)
97  pandora::CartesianVector m_downstreamMergePoint; ///< The downstream cluster point to be used in the merging process
98  pandora::CartesianVector m_downstreamMergeDirection; ///< The downstream cluster direction at the downstream merge point (points in the direction of the upstream cluster)
99  pandora::CartesianVector m_connectingLineDirection; ///< The unit vector of the line connecting the upstream and downstream merge points (upstream -> downstream)
100 };
101 
102 //------------------------------------------------------------------------------------------------------------------------------------------
103 //------------------------------------------------------------------------------------------------------------------------------------------
104 
105 /**
106  * @brief ClusterPairAssociation class
107  */
109 {
110 public:
111  /**
112  * @brief Default constructor
113  */
115 
116  /**
117  * @brief Constructor
118  *
119  * @param upstreamMergePoint the upstream merge point
120  * @param upstreamMergeDirection the cluster direction at the upstream merge point
121  * @param downstreamMergePoint the downstream merge point
122  * @param downstreamMergeDirection the cluster direction at the downstream merge point
123  * @param pUpstreamCluster the address of the upstream cluster
124  * @param pDownstreamCluster the address of the downstream cluster
125  */
126  ClusterPairAssociation(const pandora::CartesianVector &upstreamMergePoint, const pandora::CartesianVector &upstreamMergeDirection,
127  const pandora::CartesianVector &downstreamMergePoint, const pandora::CartesianVector &downstreamMergeDirection,
128  const pandora::Cluster *pUpstreamCluster, const pandora::Cluster *pDownstreamCluster);
129 
130  /**
131  * @brief Returns the address of the upstream cluster
132  *
133  * @return the address of the upstream cluster
134  */
135  const pandora::Cluster *GetUpstreamCluster() const;
136 
137  /**
138  * @brief Returns the address of the downstream cluster
139  *
140  * @return the address of the downstream cluster
141  */
142  const pandora::Cluster *GetDownstreamCluster() const;
143 
144 private:
145  const pandora::Cluster *m_pUpstreamCluster; ///< The address of the upstream cluster
146  const pandora::Cluster *m_pDownstreamCluster; ///< The address of the downstream cluster
147 };
148 
149 //------------------------------------------------------------------------------------------------------------------------------------------
150 
152  m_upstreamMergePoint(pandora::CartesianVector(0.f, 0.f, 0.f)),
153  m_upstreamMergeDirection(pandora::CartesianVector(0.f, 0.f, 0.f)),
154  m_downstreamMergePoint(pandora::CartesianVector(0.f, 0.f, 0.f)),
155  m_downstreamMergeDirection(pandora::CartesianVector(0.f, 0.f, 0.f)),
156  m_connectingLineDirection(pandora::CartesianVector(0.f, 0.f, 0.f))
157 {
158 }
159 
160 //------------------------------------------------------------------------------------------------------------------------------------------
161 
162 inline ClusterAssociation::ClusterAssociation(const pandora::CartesianVector &upstreamMergePoint, const pandora::CartesianVector &upstreamMergeDirection,
163  const pandora::CartesianVector &downstreamMergePoint, const pandora::CartesianVector &downstreamMergeDirection) :
164  m_upstreamMergePoint(upstreamMergePoint),
165  m_upstreamMergeDirection(upstreamMergeDirection),
166  m_downstreamMergePoint(downstreamMergePoint),
167  m_downstreamMergeDirection(downstreamMergeDirection),
168  m_connectingLineDirection(0.f, 0.f, 0.f)
169 {
170  const pandora::CartesianVector connectingLineDirection(
172  m_connectingLineDirection = connectingLineDirection.GetUnitVector();
173 }
174 
175 //------------------------------------------------------------------------------------------------------------------------------------------
176 
177 inline bool ClusterAssociation::operator==(const ClusterAssociation &clusterAssociation) const
178 {
179  return (m_upstreamMergePoint == clusterAssociation.GetUpstreamMergePoint() &&
180  m_upstreamMergeDirection == clusterAssociation.GetUpstreamMergeDirection() &&
181  m_downstreamMergePoint == clusterAssociation.GetDownstreamMergePoint() &&
183 }
184 
185 //------------------------------------------------------------------------------------------------------------------------------------------
186 
187 inline bool ClusterAssociation::operator<(const ClusterAssociation &clusterAssociation) const
188 {
190 }
191 
192 //------------------------------------------------------------------------------------------------------------------------------------------
193 
194 inline const pandora::CartesianVector ClusterAssociation::GetUpstreamMergePoint() const
195 {
196  return m_upstreamMergePoint;
197 }
198 
199 //------------------------------------------------------------------------------------------------------------------------------------------
200 
201 inline const pandora::CartesianVector ClusterAssociation::GetUpstreamMergeDirection() const
202 {
204 }
205 
206 //------------------------------------------------------------------------------------------------------------------------------------------
207 
208 inline const pandora::CartesianVector ClusterAssociation::GetDownstreamMergePoint() const
209 {
210  return m_downstreamMergePoint;
211 }
212 
213 //------------------------------------------------------------------------------------------------------------------------------------------
214 
215 inline const pandora::CartesianVector ClusterAssociation::GetDownstreamMergeDirection() const
216 {
218 }
219 
220 //------------------------------------------------------------------------------------------------------------------------------------------
221 
222 inline const pandora::CartesianVector ClusterAssociation::GetConnectingLineDirection() const
223 {
225 }
226 
227 //------------------------------------------------------------------------------------------------------------------------------------------
228 
229 inline void ClusterAssociation::SetUpstreamMergePoint(const pandora::CartesianVector &upstreamMergePoint)
230 {
231  m_upstreamMergePoint = upstreamMergePoint;
232  this->UpdateConnectingLine();
233 }
234 
235 //------------------------------------------------------------------------------------------------------------------------------------------
236 
237 inline void ClusterAssociation::SetDownstreamMergePoint(const pandora::CartesianVector &downstreamMergePoint)
238 {
239  m_downstreamMergePoint = downstreamMergePoint;
240  this->UpdateConnectingLine();
241 }
242 
243 //------------------------------------------------------------------------------------------------------------------------------------------
244 
246 {
247  const pandora::CartesianVector connectingLineDirection(
249  m_connectingLineDirection = connectingLineDirection.GetUnitVector();
250 }
251 
252 //------------------------------------------------------------------------------------------------------------------------------------------
253 //------------------------------------------------------------------------------------------------------------------------------------------
254 
255 inline ClusterPairAssociation::ClusterPairAssociation(const pandora::CartesianVector &upstreamMergePoint,
256  const pandora::CartesianVector &upstreamMergeDirection, const pandora::CartesianVector &downstreamMergePoint,
257  const pandora::CartesianVector &downstreamMergeDirection, const pandora::Cluster *pUpstreamCluster, const pandora::Cluster *pDownstreamCluster) :
258  ClusterAssociation(upstreamMergePoint, upstreamMergeDirection, downstreamMergePoint, downstreamMergeDirection),
259  m_pUpstreamCluster(pUpstreamCluster),
260  m_pDownstreamCluster(pDownstreamCluster)
261 {
262 }
263 
264 //------------------------------------------------------------------------------------------------------------------------------------------
265 
267 {
268 }
269 
270 //------------------------------------------------------------------------------------------------------------------------------------------
271 
272 inline const pandora::Cluster *ClusterPairAssociation::GetUpstreamCluster() const
273 {
274  return m_pUpstreamCluster;
275 }
276 
277 //------------------------------------------------------------------------------------------------------------------------------------------
278 
279 inline const pandora::Cluster *ClusterPairAssociation::GetDownstreamCluster() const
280 {
281  return m_pDownstreamCluster;
282 }
283 
284 } // namespace lar_content
285 
286 #endif // #ifndef LAR_CLUSTER_ASSOCIATION_H
ClusterAssociation class.
pandora::CartesianVector m_downstreamMergeDirection
The downstream cluster direction at the downstream merge point (points in the direction of the upstre...
ClusterPairAssociation()
Default constructor.
pandora::CartesianVector m_downstreamMergePoint
The downstream cluster point to be used in the merging process.
const pandora::CartesianVector GetDownstreamMergeDirection() const
Returns the cluster direction at the downstream merge point.
void UpdateConnectingLine()
Update the connecting line.
pandora::CartesianVector m_connectingLineDirection
The unit vector of the line connecting the upstream and downstream merge points (upstream -> downstre...
const pandora::CartesianVector GetUpstreamMergePoint() const
Returns the upstream cluster merge point.
static bool SortCoordinatesByPosition(const pandora::CartesianVector &lhs, const pandora::CartesianVector &rhs)
Sort cartesian vectors by their position (use Z, followed by X, followed by Y)
const pandora::Cluster * GetUpstreamCluster() const
Returns the address of the upstream cluster.
ClusterAssociation()
Default constructor.
Header file for the cluster helper class.
pandora::CartesianVector m_upstreamMergeDirection
The upstream cluster direction at the upstream merge point (points in the direction of the downstream...
pandora::CartesianVector m_upstreamMergePoint
The upstream cluster point to be used in the merging process.
ClusterPairAssociation class.
void SetUpstreamMergePoint(const pandora::CartesianVector &upstreamMergePoint)
Set the upstream merge point.
const pandora::CartesianVector GetDownstreamMergePoint() const
Returns the downstream cluster merge point.
void SetDownstreamMergePoint(const pandora::CartesianVector &downstreamMergePoint)
Set the downstream merge point.
bool operator==(const ClusterAssociation &clusterAssociation) const
bool operator<(const ClusterAssociation &clusterAssociation) const
const pandora::Cluster * GetDownstreamCluster() const
Returns the address of the downstream cluster.
const pandora::Cluster * m_pUpstreamCluster
The address of the upstream cluster.
const pandora::Cluster * m_pDownstreamCluster
The address of the downstream cluster.
const pandora::CartesianVector GetConnectingLineDirection() const
Returns the unit vector of the line connecting the upstream and downstream merge points (upstream -> ...
const pandora::CartesianVector GetUpstreamMergeDirection() const
Returns the cluster direction at the upstream merge point.