LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ClusterAssociation.h
Go to the documentation of this file.
1 
8 #ifndef LAR_CLUSTER_ASSOCIATION_H
9 #define LAR_CLUSTER_ASSOCIATION_H 1
10 
12 
13 namespace lar_content
14 {
19 {
20 public:
25 
34  ClusterAssociation(const pandora::CartesianVector &upstreamMergePoint, const pandora::CartesianVector &upstreamMergeDirection,
35  const pandora::CartesianVector &downstreamMergePoint, const pandora::CartesianVector &downstreamMergeDirection);
36 
42  const pandora::CartesianVector GetUpstreamMergePoint() const;
43 
49  const pandora::CartesianVector GetUpstreamMergeDirection() const;
50 
56  const pandora::CartesianVector GetDownstreamMergePoint() const;
57 
63  const pandora::CartesianVector GetDownstreamMergeDirection() const;
64 
70  const pandora::CartesianVector GetConnectingLineDirection() const;
71 
77  void SetUpstreamMergePoint(const pandora::CartesianVector &upstreamMergePoint);
78 
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:
93  void UpdateConnectingLine();
94 
95  pandora::CartesianVector m_upstreamMergePoint;
96  pandora::CartesianVector m_upstreamMergeDirection;
97  pandora::CartesianVector m_downstreamMergePoint;
98  pandora::CartesianVector m_downstreamMergeDirection;
99  pandora::CartesianVector m_connectingLineDirection;
100 };
101 
102 //------------------------------------------------------------------------------------------------------------------------------------------
103 //------------------------------------------------------------------------------------------------------------------------------------------
104 
109 {
110 public:
115 
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 
135  const pandora::Cluster *GetUpstreamCluster() const;
136 
142  const pandora::Cluster *GetDownstreamCluster() const;
143 
144 private:
145  const pandora::Cluster *m_pUpstreamCluster;
146  const pandora::Cluster *m_pDownstreamCluster;
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 
268  m_pUpstreamCluster(nullptr),
269  m_pDownstreamCluster(nullptr)
270 {
271 }
272 
273 //------------------------------------------------------------------------------------------------------------------------------------------
274 
275 inline const pandora::Cluster *ClusterPairAssociation::GetUpstreamCluster() const
276 {
277  return m_pUpstreamCluster;
278 }
279 
280 //------------------------------------------------------------------------------------------------------------------------------------------
281 
282 inline const pandora::Cluster *ClusterPairAssociation::GetDownstreamCluster() const
283 {
284  return m_pDownstreamCluster;
285 }
286 
287 } // namespace lar_content
288 
289 #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.
TFile f
Definition: plotHisto.C:6
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.