LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
NeutrinoHierarchyAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
14 
16 
17 using namespace pandora;
18 
19 namespace lar_content
20 {
21 
22 NeutrinoHierarchyAlgorithm::NeutrinoHierarchyAlgorithm() :
23  m_halfWindowLayers(20),
24  m_displayPfoInfoMap(false)
25 {
26 }
27 
28 //------------------------------------------------------------------------------------------------------------------------------------------
29 
30 void NeutrinoHierarchyAlgorithm::SeparatePfos(const PfoInfoMap &pfoInfoMap, PfoVector &assignedPfos, PfoVector &unassignedPfos) const
31 {
32  PfoVector sortedPfos;
33  for (const auto &mapEntry : pfoInfoMap)
34  sortedPfos.push_back(mapEntry.first);
35  std::sort(sortedPfos.begin(), sortedPfos.end(), LArPfoHelper::SortByNHits);
36 
37  for (const Pfo *const pPfo : sortedPfos)
38  {
39  const PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
40 
41  if (pPfoInfo->IsNeutrinoVertexAssociated() || pPfoInfo->GetParentPfo())
42  {
43  assignedPfos.push_back(pPfoInfo->GetThisPfo());
44  }
45  else
46  {
47  unassignedPfos.push_back(pPfoInfo->GetThisPfo());
48  }
49  }
50 }
51 
52 //------------------------------------------------------------------------------------------------------------------------------------------
53 
55 {
56  const ParticleFlowObject *pNeutrinoPfo(nullptr);
57  PfoList candidateDaughterPfoList;
58 
59  try
60  {
61  this->GetNeutrinoPfo(pNeutrinoPfo);
62  this->GetCandidateDaughterPfoList(candidateDaughterPfoList);
63  }
64  catch (StatusCodeException &statusCodeException)
65  {
66  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
67  std::cout << "NeutrinoHierarchyAlgorithm: required input pfos unavailable." << std::endl;
68 
69  if (STATUS_CODE_NOT_FOUND != statusCodeException.GetStatusCode())
70  throw statusCodeException;
71 
72  return STATUS_CODE_SUCCESS;
73  }
74 
75  PfoInfoMap pfoInfoMap;
76 
77  try
78  {
79  if (!pNeutrinoPfo->GetVertexList().empty())
80  {
81  const Vertex *const pNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
82  this->GetInitialPfoInfoMap(candidateDaughterPfoList, pfoInfoMap);
83 
84  for (PfoRelationTool *const pPfoRelationTool : m_algorithmToolVector)
85  pPfoRelationTool->Run(this, pNeutrinoVertex, pfoInfoMap);
86  }
87 
88  this->ProcessPfoInfoMap(pNeutrinoPfo, candidateDaughterPfoList, pfoInfoMap);
89  }
90  catch (StatusCodeException &statusCodeException)
91  {
92  std::cout << "NeutrinoHierarchyAlgorithm: unable to process input neutrino pfo, " << statusCodeException.ToString() << std::endl;
93  }
94 
96  this->DisplayPfoInfoMap(pNeutrinoPfo, pfoInfoMap);
97 
98  for (auto &mapIter : pfoInfoMap)
99  delete mapIter.second;
100 
101  return STATUS_CODE_SUCCESS;
102 }
103 
104 //------------------------------------------------------------------------------------------------------------------------------------------
105 
106 void NeutrinoHierarchyAlgorithm::GetNeutrinoPfo(const ParticleFlowObject *&pNeutrinoPfo) const
107 {
108  const PfoList *pPfoList = nullptr;
109  PANDORA_THROW_RESULT_IF_AND_IF(
110  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_neutrinoPfoListName, pPfoList));
111 
112  if (!pPfoList || pPfoList->empty())
113  {
114  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
115  std::cout << "NeutrinoHierarchyAlgorithm: unable to find pfo list " << m_neutrinoPfoListName << std::endl;
116 
117  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
118  }
119 
120  // ATTN Enforces that only one pfo, of neutrino-type, be in the specified input list
121  pNeutrinoPfo = ((1 == pPfoList->size()) ? *(pPfoList->begin()) : nullptr);
122 
123  if (!pNeutrinoPfo || !LArPfoHelper::IsNeutrino(pNeutrinoPfo))
124  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
125 }
126 
127 //------------------------------------------------------------------------------------------------------------------------------------------
128 
129 void NeutrinoHierarchyAlgorithm::GetCandidateDaughterPfoList(PfoList &candidateDaughterPfoList) const
130 {
131  for (const std::string &daughterPfoListName : m_daughterPfoListNames)
132  {
133  const PfoList *pCandidatePfoList(nullptr);
134 
135  if (STATUS_CODE_SUCCESS == PandoraContentApi::GetList(*this, daughterPfoListName, pCandidatePfoList))
136  {
137  candidateDaughterPfoList.insert(candidateDaughterPfoList.end(), pCandidatePfoList->begin(), pCandidatePfoList->end());
138  }
139  else if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
140  {
141  std::cout << "NeutrinoHierarchyAlgorithm: unable to find pfo list " << daughterPfoListName << std::endl;
142  }
143  }
144 
145  if (candidateDaughterPfoList.empty())
146  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
147 }
148 
149 //------------------------------------------------------------------------------------------------------------------------------------------
150 
151 void NeutrinoHierarchyAlgorithm::GetInitialPfoInfoMap(const PfoList &pfoList, PfoInfoMap &pfoInfoMap) const
152 {
153  const float pitchU{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_U)};
154  const float pitchV{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_V)};
155  const float pitchW{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_W)};
156  const float pitchMax{std::max({pitchU, pitchV, pitchW})};
157  const float layerPitch(pitchMax);
158 
159  for (const ParticleFlowObject *const pPfo : pfoList)
160  {
161  PfoInfo *pPfoInfo(nullptr);
162 
163  try
164  {
165  pPfoInfo = new PfoInfo(pPfo, m_halfWindowLayers, layerPitch);
166  (void)pfoInfoMap.insert(PfoInfoMap::value_type(pPfo, pPfoInfo));
167  }
168  catch (StatusCodeException &)
169  {
170  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
171  std::cout << "NeutrinoHierarchyAlgorithm: Unable to calculate pfo information " << std::endl;
172 
173  delete pPfoInfo;
174  }
175  }
176 }
177 
178 //------------------------------------------------------------------------------------------------------------------------------------------
179 
180 void NeutrinoHierarchyAlgorithm::ProcessPfoInfoMap(const ParticleFlowObject *const pNeutrinoPfo, const PfoList &candidateDaughterPfoList,
181  PfoInfoMap &pfoInfoMap, const unsigned int callDepth) const
182 {
183  PfoVector candidateDaughterPfoVector(candidateDaughterPfoList.begin(), candidateDaughterPfoList.end());
184  std::sort(candidateDaughterPfoVector.begin(), candidateDaughterPfoVector.end(), LArPfoHelper::SortByNHits);
185 
186  // Add neutrino->primary pfo links
187  for (const ParticleFlowObject *const pDaughterPfo : candidateDaughterPfoVector)
188  {
189  PfoInfoMap::const_iterator iter = pfoInfoMap.find(pDaughterPfo);
190 
191  if ((pfoInfoMap.end() != iter) && (iter->second->IsNeutrinoVertexAssociated()))
192  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*this, pNeutrinoPfo, pDaughterPfo));
193  }
194 
195  // Handle exceptional case where vertex selected far from any other particle passing creation thresholds
196  if ((0 == callDepth) && (0 == pNeutrinoPfo->GetNDaughterPfos()))
197  {
198  this->AdjustVertexAndPfoInfo(pNeutrinoPfo, candidateDaughterPfoList, pfoInfoMap);
199  return this->ProcessPfoInfoMap(pNeutrinoPfo, candidateDaughterPfoList, pfoInfoMap, callDepth + 1);
200  }
201 
202  // Add primary pfo->daughter pfo links
203  PfoVector sortedPfos;
204  for (const auto &mapEntry : pfoInfoMap)
205  sortedPfos.push_back(mapEntry.first);
206  std::sort(sortedPfos.begin(), sortedPfos.end(), LArPfoHelper::SortByNHits);
207 
208  for (const Pfo *const pPfo : sortedPfos)
209  {
210  const PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
211 
212  PfoVector daughterPfos(pPfoInfo->GetDaughterPfoList().begin(), pPfoInfo->GetDaughterPfoList().end());
213  std::sort(daughterPfos.begin(), daughterPfos.end(), LArPfoHelper::SortByNHits);
214 
215  for (const ParticleFlowObject *const pDaughterPfo : daughterPfos)
216  PANDORA_THROW_RESULT_IF(
217  STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*this, pPfoInfo->GetThisPfo(), pDaughterPfo));
218  }
219 
220  // Deal with any remaining parent-less pfos
221  for (const ParticleFlowObject *const pRemainingPfo : candidateDaughterPfoVector)
222  {
223  if (!pRemainingPfo->GetParentPfoList().empty())
224  continue;
225 
226  // TODO Most appropriate decision - add as daughter of either i) nearest pfo, or ii) the neutrino (current approach)
227  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*this, pNeutrinoPfo, pRemainingPfo));
228  }
229 }
230 
231 //------------------------------------------------------------------------------------------------------------------------------------------
232 
234  const ParticleFlowObject *const pNeutrinoPfo, const PfoList &candidateDaughterPfoList, PfoInfoMap &pfoInfoMap) const
235 {
236  PfoVector candidateDaughterPfoVector(candidateDaughterPfoList.begin(), candidateDaughterPfoList.end());
237  std::sort(candidateDaughterPfoVector.begin(), candidateDaughterPfoVector.end(), LArPfoHelper::SortByNHits);
238 
239  // TODO Consider deleting the neutrino pfo if there are no daughter pfo candidates
240  if (candidateDaughterPfoVector.empty())
241  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
242 
243  ClusterList daughterClusterList3D;
244  LArPfoHelper::GetThreeDClusterList(candidateDaughterPfoVector.front(), daughterClusterList3D);
245  daughterClusterList3D.sort(LArClusterHelper::SortByNHits);
246 
247  // If no 3D hits, must leave vertex where it was
248  if (daughterClusterList3D.empty())
249  return;
250 
251  const Vertex *pOldNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
252  const CartesianVector newVertexPosition(LArClusterHelper::GetClosestPosition(pOldNeutrinoVertex->GetPosition(), daughterClusterList3D.front()));
253 
254  PandoraContentApi::Vertex::Parameters parameters;
255  parameters.m_position = newVertexPosition;
256  parameters.m_vertexLabel = pOldNeutrinoVertex->GetVertexLabel();
257  parameters.m_vertexType = pOldNeutrinoVertex->GetVertexType();
258  parameters.m_x0 = pOldNeutrinoVertex->GetX0();
259 
260  std::string neutrinoVertexListName(m_neutrinoVertexListName);
261  if (neutrinoVertexListName.empty())
262  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<Vertex>(*this, neutrinoVertexListName));
263 
264  std::string temporaryVertexListName;
265  const VertexList *pTemporaryVertexList(nullptr);
266  const Vertex *pNewNeutrinoVertex(nullptr);
267  PANDORA_THROW_RESULT_IF(
268  STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pTemporaryVertexList, temporaryVertexListName));
269  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*this, parameters, pNewNeutrinoVertex));
270  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*this, neutrinoVertexListName));
271 
272  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RemoveFromPfo(*this, pNeutrinoPfo, pOldNeutrinoVertex));
273  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pNeutrinoPfo, pNewNeutrinoVertex));
274  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete<Vertex>(*this, pOldNeutrinoVertex, neutrinoVertexListName));
275 
276  for (auto &mapIter : pfoInfoMap)
277  delete mapIter.second;
278 
279  pfoInfoMap.clear();
280 
281  for (PfoRelationTool *const pPfoRelationTool : m_algorithmToolVector)
282  pPfoRelationTool->Run(this, pNewNeutrinoVertex, pfoInfoMap);
283 }
284 
285 //------------------------------------------------------------------------------------------------------------------------------------------
286 
287 void NeutrinoHierarchyAlgorithm::DisplayPfoInfoMap(const ParticleFlowObject *const pNeutrinoPfo, const PfoInfoMap &pfoInfoMap) const
288 {
289  bool display(false);
290  PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), false, DETECTOR_VIEW_XZ, -1.f, -1.f, 1.f));
291  std::cout << "-Neutrino Pfo, nDaughters " << pNeutrinoPfo->GetDaughterPfoList().size() << ", nVertices "
292  << pNeutrinoPfo->GetVertexList().size() << std::endl;
293 
294  PfoVector sortedPfos;
295  for (const auto &mapEntry : pfoInfoMap)
296  sortedPfos.push_back(mapEntry.first);
297  std::sort(sortedPfos.begin(), sortedPfos.end(), LArPfoHelper::SortByNHits);
298 
299  for (const Pfo *const pPfo : sortedPfos)
300  {
301  const PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
302 
303  std::cout << "Pfo " << pPfoInfo->GetThisPfo() << ", vtxAssoc " << pPfoInfo->IsNeutrinoVertexAssociated() << ", parent "
304  << pPfoInfo->GetParentPfo() << ", nDaughters " << pPfoInfo->GetDaughterPfoList().size() << " (";
305 
306  for (const ParticleFlowObject *const pDaughterPfo : pPfoInfo->GetDaughterPfoList())
307  std::cout << pDaughterPfo << " ";
308  std::cout << ") " << std::endl;
309 
310  if (pPfoInfo->IsNeutrinoVertexAssociated())
311  {
312  display = true;
313  const PfoList tempPfoList(1, pPfoInfo->GetThisPfo());
314  PANDORA_MONITORING_API(VisualizeParticleFlowObjects(this->GetPandora(), &tempPfoList, "VertexPfo", RED, true, false));
315  }
316  }
317 
318  if (display)
319  {
320  PANDORA_MONITORING_API(VisualizeVertices(this->GetPandora(), &(pNeutrinoPfo->GetVertexList()), "NeutrinoVertex", ORANGE));
321  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
322  display = false;
323  }
324 
325  for (const Pfo *const pPfo : sortedPfos)
326  {
327  const PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
328 
329  if (!pPfoInfo->GetDaughterPfoList().empty())
330  {
331  display = true;
332  const PfoList tempPfoList(1, pPfoInfo->GetThisPfo());
333  PANDORA_MONITORING_API(VisualizeParticleFlowObjects(this->GetPandora(), &tempPfoList, "ParentPfo", RED, true, false));
334  PANDORA_MONITORING_API(
335  VisualizeParticleFlowObjects(this->GetPandora(), &(pPfoInfo->GetDaughterPfoList()), "DaughterPfos", BLUE, true, false));
336  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
337  }
338  }
339 }
340 
341 //------------------------------------------------------------------------------------------------------------------------------------------
342 //------------------------------------------------------------------------------------------------------------------------------------------
343 
344 NeutrinoHierarchyAlgorithm::PfoInfo::PfoInfo(const pandora::ParticleFlowObject *const pPfo, const unsigned int halfWindowLayers, const float layerPitch) :
345  m_pThisPfo(pPfo),
346  m_pCluster3D(nullptr),
347  m_pVertex3D(nullptr),
348  m_pSlidingFitResult3D(nullptr),
349  m_isNeutrinoVertexAssociated(false),
350  m_isInnerLayerAssociated(false),
351  m_pParentPfo(nullptr)
352 {
353  ClusterList clusterList3D;
354  LArPfoHelper::GetThreeDClusterList(pPfo, clusterList3D);
355 
356  if (1 != clusterList3D.size())
357  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
358 
359  m_pCluster3D = *(clusterList3D.begin());
360  m_pSlidingFitResult3D = new ThreeDSlidingFitResult(m_pCluster3D, halfWindowLayers, layerPitch);
361 
363  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
364 }
365 
366 //------------------------------------------------------------------------------------------------------------------------------------------
367 
369  m_pThisPfo(rhs.m_pThisPfo),
372  m_pSlidingFitResult3D(nullptr),
377 {
378  if (!rhs.m_pSlidingFitResult3D)
379  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
380 
383 }
384 
385 //------------------------------------------------------------------------------------------------------------------------------------------
386 
388 {
389  if (this != &rhs)
390  {
391  if (!rhs.m_pSlidingFitResult3D)
392  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
393 
394  m_pThisPfo = rhs.m_pThisPfo;
396  m_pVertex3D = rhs.m_pVertex3D;
401 
402  delete m_pSlidingFitResult3D;
405  }
406 
407  return *this;
408 }
409 
410 //------------------------------------------------------------------------------------------------------------------------------------------
411 
413 {
414  delete m_pSlidingFitResult3D;
415 }
416 
417 //------------------------------------------------------------------------------------------------------------------------------------------
418 
419 void NeutrinoHierarchyAlgorithm::PfoInfo::SetNeutrinoVertexAssociation(const bool isNeutrinoVertexAssociated)
420 {
421  m_isNeutrinoVertexAssociated = isNeutrinoVertexAssociated;
422 }
423 
424 //------------------------------------------------------------------------------------------------------------------------------------------
425 
427 {
428  m_isInnerLayerAssociated = isInnerLayerAssociated;
429 }
430 
431 //------------------------------------------------------------------------------------------------------------------------------------------
432 
433 void NeutrinoHierarchyAlgorithm::PfoInfo::SetParentPfo(const pandora::ParticleFlowObject *const pParentPfo)
434 {
435  if (m_pParentPfo)
436  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
437 
438  m_pParentPfo = pParentPfo;
439 }
440 
441 //------------------------------------------------------------------------------------------------------------------------------------------
442 
444 {
445  m_pParentPfo = nullptr;
446 }
447 
448 //------------------------------------------------------------------------------------------------------------------------------------------
449 
450 void NeutrinoHierarchyAlgorithm::PfoInfo::AddDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo)
451 {
452  if (m_daughterPfoList.end() != std::find(m_daughterPfoList.begin(), m_daughterPfoList.end(), pDaughterPfo))
453  throw StatusCodeException(STATUS_CODE_ALREADY_PRESENT);
454 
455  m_daughterPfoList.push_back(pDaughterPfo);
456 }
457 
458 //------------------------------------------------------------------------------------------------------------------------------------------
459 
460 void NeutrinoHierarchyAlgorithm::PfoInfo::RemoveDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo)
461 {
462  PfoList::iterator eraseIter = std::find(m_daughterPfoList.begin(), m_daughterPfoList.end(), pDaughterPfo);
463 
464  if (m_daughterPfoList.end() == eraseIter)
465  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
466 
467  m_daughterPfoList.erase(eraseIter);
468 }
469 
470 //------------------------------------------------------------------------------------------------------------------------------------------
471 //------------------------------------------------------------------------------------------------------------------------------------------
472 
473 StatusCode NeutrinoHierarchyAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
474 {
475  AlgorithmToolVector algorithmToolVector;
476  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle, "PfoRelationTools", algorithmToolVector));
477 
478  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
479  {
480  PfoRelationTool *const pPfoRelationTool(dynamic_cast<PfoRelationTool *>(*iter));
481 
482  if (!pPfoRelationTool)
483  return STATUS_CODE_INVALID_PARAMETER;
484 
485  m_algorithmToolVector.push_back(pPfoRelationTool);
486  }
487 
488  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "NeutrinoPfoListName", m_neutrinoPfoListName));
489 
490  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "DaughterPfoListNames", m_daughterPfoListNames));
491 
492  PANDORA_RETURN_RESULT_IF_AND_IF(
493  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "NeutrinoVertexListName", m_neutrinoVertexListName));
494 
495  PANDORA_RETURN_RESULT_IF_AND_IF(
496  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitHalfWindow", m_halfWindowLayers));
497 
498  PANDORA_RETURN_RESULT_IF_AND_IF(
499  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "DisplayPfoInfoMap", m_displayPfoInfoMap));
500 
501  return STATUS_CODE_SUCCESS;
502 }
503 
504 } // namespace lar_content
void SetInnerLayerAssociation(const bool isInnerLayerAssociated)
Set the inner layer association flag.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
const pandora::ParticleFlowObject * GetThisPfo() const
Get the address of the pfo.
unsigned int GetLayerFitHalfWindow() const
Get the layer fit half window.
intermediate_table::iterator iterator
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
const pandora::Cluster * m_pCluster3D
The address of the three dimensional cluster.
PfoInfo & operator=(const PfoInfo &rhs)
Assignment operator.
void ProcessPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const pandora::PfoList &candidateDaughterPfoList, PfoInfoMap &pfoInfoMap, const unsigned int callDepth=0) const
Process the information in a pfo info map, creating pfo parent/daughter links.
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
Header file for the pfo helper class.
bool m_isNeutrinoVertexAssociated
Whether the pfo is associated with the neutrino vertex.
PfoRelationToolVector m_algorithmToolVector
The algorithm tool vector.
const pandora::ParticleFlowObject * m_pThisPfo
The address of the pfo.
bool m_displayPfoInfoMap
Whether to display the pfo info map (if monitoring is enabled)
void DisplayPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const PfoInfoMap &pfoInfoMap) const
Display the information in a pfo info map, visualising pfo parent/daughter links. ...
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
intermediate_table::const_iterator const_iterator
void SeparatePfos(const NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap, pandora::PfoVector &assignedPfos, pandora::PfoVector &unassignedPfos) const
Query the pfo info map and separate/extract pfos currently either acting as parents or associated wit...
unsigned int m_halfWindowLayers
The number of layers to use for half-window of sliding fit.
std::string m_neutrinoVertexListName
The neutrino vertex list name - if not specified will assume current list.
bool m_isInnerLayerAssociated
If associated, whether association to parent (vtx or pfo) is at sliding fit inner layer...
void RemoveDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo)
Remove a daughter pfo.
void AdjustVertexAndPfoInfo(const pandora::ParticleFlowObject *const pNeutrinoPfo, const pandora::PfoList &candidateDaughterPfoList, PfoInfoMap &pfoInfoMap) const
Adjust neutrino vertex to ensure agreement with at least one pfo (first in sorted input list) ...
TFile f
Definition: plotHisto.C:6
Header file for the geometry helper class.
ThreeDSlidingFitResult * m_pSlidingFitResult3D
The three dimensional sliding fit result.
pandora::PfoList m_daughterPfoList
The daughter pfo list.
Header file for the cluster helper class.
void SetParentPfo(const pandora::ParticleFlowObject *const pParentPfo)
Set the parent pfo.
std::unordered_map< const pandora::ParticleFlowObject *, PfoInfo * > PfoInfoMap
float GetLayerPitch() const
Get the layer pitch, units cm.
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
void GetNeutrinoPfo(const pandora::ParticleFlowObject *&pNeutrinoPfo) const
Get the address of the input neutrino pfo - enforces only one pfo present in input list; can return N...
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
PfoInfo(const pandora::ParticleFlowObject *const pPfo, const unsigned int halfWindowLayers, const float layerPitch)
Constructor.
Header file for the neutrino hierarchy algorithm class.
std::string m_neutrinoPfoListName
The neutrino pfo list name.
const pandora::Vertex * m_pVertex3D
The address of the three dimensional vertex.
pandora::StringVector m_daughterPfoListNames
The list of daughter pfo list names.
void SetNeutrinoVertexAssociation(const bool isNeutrinoVertexAssociated)
Set the neutrino vertex association flag.
const TwoDSlidingFitResult & GetFirstFitResult() const
Get the first sliding fit result for this cluster.
void AddDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo)
Add a daughter pfo.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
const pandora::ParticleFlowObject * m_pParentPfo
The address of the parent pfo.
static pandora::CartesianVector GetClosestPosition(const pandora::CartesianVector &position, const pandora::ClusterList &clusterList)
Get closest position in a list of clusters to a specified input position vector.
void GetCandidateDaughterPfoList(pandora::PfoList &candidateDaughterPfoList) const
Get the list of candidate daughter pfos.
NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo
std::list< Vertex > VertexList
Definition: DCEL.h:169
void GetInitialPfoInfoMap(const pandora::PfoList &pfoList, PfoInfoMap &pfoInfoMap) const
Process a provided pfo list and populate an initial pfo info map.