LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TrackClusterCreationAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 TrackClusterCreationAlgorithm::TrackClusterCreationAlgorithm() :
21  m_mergeBackFilteredHits(true),
22  m_maxGapLayers(2),
23  m_maxCaloHitSeparationSquared(1.3f * 1.3f),
24  m_minCaloHitSeparationSquared(0.4f * 0.4f),
25  m_closeSeparationSquared(0.9f * 0.9f)
26 {
27 }
28 
29 //------------------------------------------------------------------------------------------------------------------------------------------
30 
32 {
33  const CaloHitList *pCaloHitList = NULL;
34  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pCaloHitList));
35 
36  OrderedCaloHitList selectedCaloHitList, rejectedCaloHitList;
37  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->FilterCaloHits(pCaloHitList, selectedCaloHitList, rejectedCaloHitList));
38 
39  HitAssociationMap forwardHitAssociationMap, backwardHitAssociationMap;
40  this->MakePrimaryAssociations(selectedCaloHitList, forwardHitAssociationMap, backwardHitAssociationMap);
41  this->MakeSecondaryAssociations(selectedCaloHitList, forwardHitAssociationMap, backwardHitAssociationMap);
42 
43  HitJoinMap hitJoinMap;
44  HitToClusterMap hitToClusterMap;
45  this->IdentifyJoins(selectedCaloHitList, forwardHitAssociationMap, backwardHitAssociationMap, hitJoinMap);
46  this->CreateClusters(selectedCaloHitList, hitJoinMap, hitToClusterMap);
47 
49  this->CreateClusters(rejectedCaloHitList, hitJoinMap, hitToClusterMap);
50 
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->AddFilteredCaloHits(selectedCaloHitList, rejectedCaloHitList, hitToClusterMap));
52 
53  return STATUS_CODE_SUCCESS;
54 }
55 
56 //------------------------------------------------------------------------------------------------------------------------------------------
57 
58 StatusCode TrackClusterCreationAlgorithm::FilterCaloHits(const CaloHitList *const pCaloHitList, OrderedCaloHitList &selectedCaloHitList, OrderedCaloHitList& rejectedCaloHitList) const
59 {
60  CaloHitList availableHitList;
61 
62  for (const CaloHit *const pCaloHit : *pCaloHitList)
63  {
64  if (PandoraContentApi::IsAvailable(*this, pCaloHit))
65  availableHitList.push_back(pCaloHit);
66  }
67 
68  if (availableHitList.empty())
69  return STATUS_CODE_SUCCESS;
70 
71  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, selectedCaloHitList.Add(availableHitList));
72 
73  for (OrderedCaloHitList::const_iterator iter = selectedCaloHitList.begin(), iterEnd = selectedCaloHitList.end(); iter != iterEnd; ++iter)
74  {
75  CaloHitVector caloHits(iter->second->begin(), iter->second->end());
76  std::sort(caloHits.begin(), caloHits.end(), LArClusterHelper::SortHitsByPosition);
77 
78  for (const CaloHit *const pCaloHitI : caloHits)
79  {
80  bool useCaloHit(true);
81 
82  for (const CaloHit *const pCaloHitJ : caloHits)
83  {
84  if (pCaloHitI == pCaloHitJ)
85  continue;
86 
87  if ((pCaloHitI->GetMipEquivalentEnergy() < pCaloHitJ->GetMipEquivalentEnergy()) &&
88  ((pCaloHitI->GetPositionVector() - pCaloHitJ->GetPositionVector()).GetMagnitudeSquared() < m_minCaloHitSeparationSquared))
89  {
90  useCaloHit = false;
91  break;
92  }
93  }
94 
95  if (!useCaloHit)
96  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, rejectedCaloHitList.Add(pCaloHitI));
97  }
98  }
99 
100  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, selectedCaloHitList.Remove(rejectedCaloHitList));
101  return STATUS_CODE_SUCCESS;
102 }
103 
104 //------------------------------------------------------------------------------------------------------------------------------------------
105 
106 StatusCode TrackClusterCreationAlgorithm::AddFilteredCaloHits(const OrderedCaloHitList &selectedCaloHitList, const OrderedCaloHitList& rejectedCaloHitList,
107  HitToClusterMap &hitToClusterMap) const
108 {
109  for (OrderedCaloHitList::const_iterator iter = rejectedCaloHitList.begin(), iterEnd = rejectedCaloHitList.end(); iter != iterEnd; ++iter)
110  {
111  CaloHitList *pCaloHitList = NULL;
112  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, selectedCaloHitList.GetCaloHitsInPseudoLayer(iter->first, pCaloHitList));
113 
114  CaloHitSet unavailableHits;
115 
116  CaloHitVector inputAvailableHits(iter->second->begin(), iter->second->end());
117  std::sort(inputAvailableHits.begin(), inputAvailableHits.end(), LArClusterHelper::SortHitsByPosition);
118 
119  CaloHitVector clusteredHits(pCaloHitList->begin(), pCaloHitList->end());
120  std::sort(clusteredHits.begin(), clusteredHits.end(), LArClusterHelper::SortHitsByPosition);
121 
122  bool carryOn(true);
123 
124  while (carryOn)
125  {
126  carryOn = false;
127  CaloHitVector newClusteredHits;
128 
129  for (const CaloHit *const pCaloHitI : inputAvailableHits)
130  {
131  if (unavailableHits.count(pCaloHitI))
132  continue;
133 
134  if (hitToClusterMap.end() != hitToClusterMap.find(pCaloHitI))
135  continue;
136 
137  const CaloHit *pClosestHit = NULL;
138  float closestSeparationSquared(m_minCaloHitSeparationSquared);
139 
140  for (const CaloHit *const pCaloHitJ : clusteredHits)
141  {
142  if (pCaloHitI->GetMipEquivalentEnergy() > pCaloHitJ->GetMipEquivalentEnergy())
143  continue;
144 
145  const float separationSquared((pCaloHitI->GetPositionVector() - pCaloHitJ->GetPositionVector()).GetMagnitudeSquared());
146 
147  if (separationSquared < closestSeparationSquared)
148  {
149  closestSeparationSquared = separationSquared;
150  pClosestHit = pCaloHitJ;
151  }
152  }
153 
154  if (!pClosestHit)
155  continue;
156 
157  HitToClusterMap::const_iterator mapIter = hitToClusterMap.find(pClosestHit);
158 
159  if (hitToClusterMap.end() == mapIter)
160  throw StatusCodeException(STATUS_CODE_FAILURE);
161 
162  const Cluster *const pCluster = mapIter->second;
163  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToCluster(*this, pCluster, pCaloHitI));
164  (void) hitToClusterMap.insert(HitToClusterMap::value_type(pCaloHitI, pCluster));
165 
166  newClusteredHits.push_back(pCaloHitI);
167  carryOn = true;
168  }
169 
170  for (const CaloHit *const pCaloHit : newClusteredHits)
171  {
172  clusteredHits.push_back(pCaloHit);
173  unavailableHits.insert(pCaloHit);
174  }
175  }
176  }
177 
178  return STATUS_CODE_SUCCESS;
179 }
180 
181 //------------------------------------------------------------------------------------------------------------------------------------------
182 
183 void TrackClusterCreationAlgorithm::MakePrimaryAssociations(const OrderedCaloHitList &orderedCaloHitList, HitAssociationMap &forwardHitAssociationMap,
184  HitAssociationMap &backwardHitAssociationMap) const
185 {
186  for (OrderedCaloHitList::const_iterator iterI = orderedCaloHitList.begin(), iterIEnd = orderedCaloHitList.end(); iterI != iterIEnd; ++iterI)
187  {
188  unsigned int nLayersConsidered(0);
189 
190  CaloHitVector caloHitsI(iterI->second->begin(), iterI->second->end());
191  std::sort(caloHitsI.begin(), caloHitsI.end(), LArClusterHelper::SortHitsByPosition);
192 
193  for (OrderedCaloHitList::const_iterator iterJ = iterI, iterJEnd = orderedCaloHitList.end(); (nLayersConsidered++ <= m_maxGapLayers + 1) && (iterJ != iterJEnd); ++iterJ)
194  {
195  if (iterJ->first == iterI->first || iterJ->first > iterI->first + m_maxGapLayers + 1)
196  continue;
197 
198  CaloHitVector caloHitsJ(iterJ->second->begin(), iterJ->second->end());
199  std::sort(caloHitsJ.begin(), caloHitsJ.end(), LArClusterHelper::SortHitsByPosition);
200 
201  for (const CaloHit *const pCaloHitI : caloHitsI)
202  {
203  for (const CaloHit *const pCaloHitJ : caloHitsJ)
204  this->CreatePrimaryAssociation(pCaloHitI, pCaloHitJ, forwardHitAssociationMap, backwardHitAssociationMap);
205  }
206  }
207  }
208 }
209 
210 //------------------------------------------------------------------------------------------------------------------------------------------
211 
212 void TrackClusterCreationAlgorithm::MakeSecondaryAssociations(const OrderedCaloHitList &orderedCaloHitList, HitAssociationMap &forwardHitAssociationMap,
213  HitAssociationMap &backwardHitAssociationMap) const
214 {
215  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
216  {
217  CaloHitVector caloHits(iter->second->begin(), iter->second->end());
218  std::sort(caloHits.begin(), caloHits.end(), LArClusterHelper::SortHitsByPosition);
219 
220  for (const CaloHit *const pCaloHit : caloHits)
221  {
222  HitAssociationMap::const_iterator fwdIter = forwardHitAssociationMap.find(pCaloHit);
223  const CaloHit *const pForwardHit((forwardHitAssociationMap.end() == fwdIter) ? NULL : fwdIter->second.GetPrimaryTarget());
224 
225  HitAssociationMap::const_iterator fwdCheckIter = backwardHitAssociationMap.find(pForwardHit);
226  const CaloHit *const pForwardHitCheck((backwardHitAssociationMap.end() == fwdCheckIter) ? NULL : fwdCheckIter->second.GetPrimaryTarget());
227 
228  if ((NULL != pForwardHit) && (pForwardHitCheck != pCaloHit))
229  this->CreateSecondaryAssociation(pCaloHit, pForwardHit, forwardHitAssociationMap, backwardHitAssociationMap);
230 
231  HitAssociationMap::const_iterator bwdIter = backwardHitAssociationMap.find(pCaloHit);
232  const CaloHit *const pBackwardHit((backwardHitAssociationMap.end() == bwdIter) ? NULL : bwdIter->second.GetPrimaryTarget());
233 
234  HitAssociationMap::const_iterator bwdCheckIter = forwardHitAssociationMap.find(pBackwardHit);
235  const CaloHit *const pBackwardHitCheck((forwardHitAssociationMap.end() == bwdCheckIter) ? NULL : bwdCheckIter->second.GetPrimaryTarget());
236 
237  if ((NULL != pBackwardHit) && (pBackwardHitCheck != pCaloHit))
238  this->CreateSecondaryAssociation(pBackwardHit, pCaloHit, forwardHitAssociationMap, backwardHitAssociationMap);
239  }
240  }
241 }
242 
243 //------------------------------------------------------------------------------------------------------------------------------------------
244 
245 void TrackClusterCreationAlgorithm::IdentifyJoins(const OrderedCaloHitList &orderedCaloHitList, const HitAssociationMap &forwardHitAssociationMap,
246  const HitAssociationMap &backwardHitAssociationMap, HitJoinMap &hitJoinMap) const
247 {
248  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
249  {
250  CaloHitVector caloHits(iter->second->begin(), iter->second->end());
251  std::sort(caloHits.begin(), caloHits.end(), LArClusterHelper::SortHitsByPosition);
252 
253  for (const CaloHit *const pCaloHit : caloHits)
254  {
255  const CaloHit *const pForwardJoinHit = this->GetJoinHit(pCaloHit, forwardHitAssociationMap, backwardHitAssociationMap);
256  const CaloHit *const pBackwardJoinHit = this->GetJoinHit(pForwardJoinHit, backwardHitAssociationMap, forwardHitAssociationMap);
257 
258  if ((NULL == pForwardJoinHit) || (NULL == pBackwardJoinHit) || (pBackwardJoinHit != pCaloHit))
259  continue;
260 
261  HitJoinMap::const_iterator joinIter = hitJoinMap.find(pCaloHit);
262 
263  if (hitJoinMap.end() == joinIter)
264  hitJoinMap.insert(HitJoinMap::value_type(pCaloHit, pForwardJoinHit));
265 
266  if ((hitJoinMap.end() != joinIter) && (joinIter->second != pForwardJoinHit))
267  throw StatusCodeException(STATUS_CODE_FAILURE);
268  }
269  }
270 }
271 
272 //------------------------------------------------------------------------------------------------------------------------------------------
273 
274 void TrackClusterCreationAlgorithm::CreateClusters(const OrderedCaloHitList &orderedCaloHitList, const HitJoinMap &hitJoinMap, HitToClusterMap& hitToClusterMap) const
275 {
276  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
277  {
278  CaloHitVector caloHits(iter->second->begin(), iter->second->end());
279  std::sort(caloHits.begin(), caloHits.end(), LArClusterHelper::SortHitsByPosition);
280 
281  for (const CaloHit *const pCaloHit : caloHits)
282  {
283  const Cluster *pCluster = NULL;
284 
285  HitToClusterMap::const_iterator mapIter = hitToClusterMap.find(pCaloHit);
286 
287  if (hitToClusterMap.end() == mapIter)
288  {
289  PandoraContentApi::Cluster::Parameters parameters;
290  parameters.m_caloHitList.push_back(pCaloHit);
291  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, parameters, pCluster));
292  hitToClusterMap.insert(HitToClusterMap::value_type(pCaloHit, pCluster));
293  }
294  else
295  {
296  pCluster = mapIter->second;
297  }
298 
299  HitJoinMap::const_iterator joinIter = hitJoinMap.find(pCaloHit);
300 
301  if (hitJoinMap.end() == joinIter)
302  continue;
303 
304  if (hitToClusterMap.end() != hitToClusterMap.find(joinIter->second))
305  throw StatusCodeException(STATUS_CODE_FAILURE);
306 
307  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToCluster(*this, pCluster, joinIter->second));
308  hitToClusterMap.insert(HitToClusterMap::value_type(joinIter->second, pCluster));
309  }
310  }
311 }
312 
313 //------------------------------------------------------------------------------------------------------------------------------------------
314 
315 void TrackClusterCreationAlgorithm::CreatePrimaryAssociation(const CaloHit *const pCaloHitI, const CaloHit *const pCaloHitJ, HitAssociationMap &forwardHitAssociationMap,
316  HitAssociationMap &backwardHitAssociationMap) const
317 {
318  const float distanceSquared((pCaloHitJ->GetPositionVector() - pCaloHitI->GetPositionVector()).GetMagnitudeSquared());
319 
320  if (distanceSquared > m_maxCaloHitSeparationSquared)
321  return;
322 
323  HitAssociationMap::iterator forwardIter = forwardHitAssociationMap.find(pCaloHitI);
324 
325  if (forwardHitAssociationMap.end() == forwardIter)
326  {
327  forwardHitAssociationMap.insert(HitAssociationMap::value_type(pCaloHitI, HitAssociation(pCaloHitJ, distanceSquared)));
328  }
329  else if (distanceSquared < forwardIter->second.GetPrimaryDistanceSquared())
330  {
331  forwardIter->second = HitAssociation(pCaloHitJ, distanceSquared);
332  }
333 
334  HitAssociationMap::iterator backwardIter = backwardHitAssociationMap.find(pCaloHitJ);
335 
336  if (backwardHitAssociationMap.end() == backwardIter)
337  {
338  backwardHitAssociationMap.insert(HitAssociationMap::value_type(pCaloHitJ, HitAssociation(pCaloHitI, distanceSquared)));
339  }
340  else if (distanceSquared < backwardIter->second.GetPrimaryDistanceSquared())
341  {
342  backwardIter->second = HitAssociation(pCaloHitI, distanceSquared);
343  }
344 }
345 
346 //------------------------------------------------------------------------------------------------------------------------------------------
347 
348 void TrackClusterCreationAlgorithm::CreateSecondaryAssociation(const CaloHit *const pCaloHitI, const CaloHit *const pCaloHitJ, HitAssociationMap &forwardHitAssociationMap,
349  HitAssociationMap &backwardHitAssociationMap) const
350 {
351  HitAssociationMap::iterator forwardIter = forwardHitAssociationMap.find(pCaloHitI);
352  HitAssociationMap::iterator backwardIter = backwardHitAssociationMap.find(pCaloHitJ);
353 
354  if ((forwardHitAssociationMap.end() == forwardIter) || (backwardHitAssociationMap.end() == backwardIter))
355  return;
356 
357  HitAssociation &forwardAssociation(forwardIter->second);
358  HitAssociation &backwardAssociation(backwardIter->second);
359 
360  if ((forwardAssociation.GetPrimaryTarget() != pCaloHitJ) && (backwardAssociation.GetPrimaryTarget() == pCaloHitI))
361  {
362  if ((backwardAssociation.GetPrimaryDistanceSquared() < forwardAssociation.GetSecondaryDistanceSquared()) &&
363  (backwardAssociation.GetPrimaryDistanceSquared() < m_closeSeparationSquared))
364  {
365  forwardAssociation.SetSecondaryTarget(pCaloHitJ, backwardAssociation.GetPrimaryDistanceSquared());
366  }
367  }
368 
369  if ((backwardAssociation.GetPrimaryTarget() != pCaloHitI) && (forwardAssociation.GetPrimaryTarget() == pCaloHitJ))
370  {
371  if ((forwardAssociation.GetPrimaryDistanceSquared() < backwardAssociation.GetSecondaryDistanceSquared()) &&
372  (forwardAssociation.GetPrimaryDistanceSquared() < m_closeSeparationSquared))
373  {
374  backwardAssociation.SetSecondaryTarget(pCaloHitI, forwardAssociation.GetPrimaryDistanceSquared());
375  }
376  }
377 }
378 
379 //------------------------------------------------------------------------------------------------------------------------------------------
380 
381 const CaloHit *TrackClusterCreationAlgorithm::GetJoinHit(const CaloHit *const pCaloHit, const HitAssociationMap &hitAssociationMapI,
382  const HitAssociationMap &hitAssociationMapJ) const
383 {
384  HitAssociationMap::const_iterator iterI = hitAssociationMapI.find(pCaloHit);
385 
386  if (hitAssociationMapI.end() == iterI)
387  return NULL;
388 
389  const CaloHit *const pPrimaryTarget = iterI->second.GetPrimaryTarget();
390  const CaloHit *const pSecondaryTarget = iterI->second.GetSecondaryTarget();
391 
392  if (NULL == pSecondaryTarget)
393  return pPrimaryTarget;
394 
395  unsigned int primaryNSteps(0), secondaryNSteps(0);
396  const CaloHit *const pPrimaryTrace = this->TraceHitAssociation(pPrimaryTarget, hitAssociationMapI, hitAssociationMapJ, primaryNSteps);
397  const CaloHit *const pSecondaryTrace = this->TraceHitAssociation(pSecondaryTarget, hitAssociationMapI, hitAssociationMapJ, secondaryNSteps);
398 
399  if ((pPrimaryTrace == pSecondaryTrace) || (secondaryNSteps < 5))
400  return pPrimaryTarget;
401 
402  return NULL;
403 }
404 
405 //------------------------------------------------------------------------------------------------------------------------------------------
406 
407 const CaloHit *TrackClusterCreationAlgorithm::TraceHitAssociation(const CaloHit *const pCaloHit, const HitAssociationMap &hitAssociationMapI,
408  const HitAssociationMap &hitAssociationMapJ, unsigned int &nSteps) const
409 {
410  nSteps = 0;
411  const CaloHit *pThisHit = pCaloHit;
412  const CaloHit *pLastHit = pCaloHit;
413 
414  while (true)
415  {
416  ++nSteps;
417  pThisHit = pLastHit;
418  HitAssociationMap::const_iterator iterI = hitAssociationMapI.find(pThisHit);
419 
420  if (hitAssociationMapI.end() == iterI)
421  break;
422 
423  pLastHit = iterI->second.GetPrimaryTarget();
424  HitAssociationMap::const_iterator iterJ = hitAssociationMapJ.find(pLastHit);
425 
426  if (hitAssociationMapJ.end() == iterJ)
427  break;
428 
429  if (iterJ->second.GetPrimaryTarget() != pThisHit)
430  break;
431  }
432 
433  return pThisHit;
434 }
435 
436 //------------------------------------------------------------------------------------------------------------------------------------------
437 
438 StatusCode TrackClusterCreationAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
439 {
440  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
441  "MergeBackFilteredHits", m_mergeBackFilteredHits));
442 
443  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
444  "MaxGapLayers", m_maxGapLayers));
445 
446  float maxCaloHitSeparation = std::sqrt(m_maxCaloHitSeparationSquared);
447  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
448  "MaxCaloHitSeparation", maxCaloHitSeparation));
449  m_maxCaloHitSeparationSquared = maxCaloHitSeparation * maxCaloHitSeparation;
450 
451  float minCaloHitSeparation = std::sqrt(m_minCaloHitSeparationSquared);
452  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
453  "MinCaloHitSeparation", minCaloHitSeparation));
454  m_minCaloHitSeparationSquared = minCaloHitSeparation * minCaloHitSeparation;
455 
456  float closeSeparation = std::sqrt(m_closeSeparationSquared);
457  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
458  "CloseSeparation", closeSeparation));
459  m_closeSeparationSquared = closeSeparation * closeSeparation;
460 
461  return STATUS_CODE_SUCCESS;
462 }
463 
464 } // namespace lar_content
pandora::StatusCode FilterCaloHits(const pandora::CaloHitList *const pCaloHitList, pandora::OrderedCaloHitList &selectedCaloHitList, pandora::OrderedCaloHitList &rejectedCaloHitList) const
Filter out low pulse height hits in close proximity to high pulse height hits.
intermediate_table::iterator iterator
float m_maxCaloHitSeparationSquared
Square of maximum calo hit separation.
pandora::StatusCode AddFilteredCaloHits(const pandora::OrderedCaloHitList &selectedCaloHitList, const pandora::OrderedCaloHitList &rejectedCaloHitList, HitToClusterMap &hitToClusterMap) const
Merge previously filtered hits back into their associated clusters.
void IdentifyJoins(const pandora::OrderedCaloHitList &orderedCaloHitList, const HitAssociationMap &forwardHitAssociationMap, const HitAssociationMap &backwardHitAssociationMap, HitJoinMap &hitJoinMap) const
Identify final hit joins for use in cluster formation.
TFile f
Definition: plotHisto.C:6
float GetSecondaryDistanceSquared() const
Get the secondary distance squared.
Header file for the cluster creation algorithm class.
intermediate_table::const_iterator const_iterator
void MakePrimaryAssociations(const pandora::OrderedCaloHitList &orderedCaloHitList, HitAssociationMap &forwardHitAssociationMap, HitAssociationMap &backwardHitAssociationMap) const
Control primary association formation.
std::unordered_map< const pandora::CaloHit *, const pandora::CaloHit * > HitJoinMap
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
Header file for the cluster helper class.
const pandora::CaloHit * GetPrimaryTarget() const
Get the primary target.
float GetPrimaryDistanceSquared() const
Get the primary distance squared.
void SetSecondaryTarget(const pandora::CaloHit *const pSecondaryTarget, const float secondaryDistanceSquared)
Set secondary target.
void CreateClusters(const pandora::OrderedCaloHitList &orderedCaloHitList, const HitJoinMap &hitJoinMap, HitToClusterMap &hitToClusterMap) const
Final cluster formation.
void CreatePrimaryAssociation(const pandora::CaloHit *const pCaloHitI, const pandora::CaloHit *const pCaloHitJ, HitAssociationMap &forwardHitAssociationMap, HitAssociationMap &backwardHitAssociationMap) const
Create primary association if appropriate, hitI<->hitJ.
std::unordered_map< const pandora::CaloHit *, HitAssociation > HitAssociationMap
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
unsigned int m_maxGapLayers
Maximum number of layers for a gap.
const pandora::CaloHit * GetJoinHit(const pandora::CaloHit *const pCaloHit, const HitAssociationMap &hitAssociationMapI, const HitAssociationMap &hitAssociationMapJ) const
Get hit to join by tracing associations via map I, checking via map J.
bool m_mergeBackFilteredHits
Merge rejected hits into their associated clusters.
void MakeSecondaryAssociations(const pandora::OrderedCaloHitList &orderedCaloHitList, HitAssociationMap &forwardHitAssociationMap, HitAssociationMap &backwardHitAssociationMap) const
Control secondary association formation.
void CreateSecondaryAssociation(const pandora::CaloHit *const pCaloHitI, const pandora::CaloHit *const pCaloHitJ, HitAssociationMap &forwardHitAssociationMap, HitAssociationMap &backwardHitAssociationMap) const
Create secondary association if appropriate, hitI<->hitJ.
float m_minCaloHitSeparationSquared
Square of minimum calo hit separation.
float m_closeSeparationSquared
Length scale (squared) for close hit separation.
const pandora::CaloHit * TraceHitAssociation(const pandora::CaloHit *const pCaloHit, const HitAssociationMap &hitAssociationMapI, const HitAssociationMap &hitAssociationMapJ, unsigned int &nSteps) const
Get last hit obtained by tracing associations via map I, checking via map J.