LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
NeutrinoHierarchyAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_NEUTRINO_HIERARCHY_ALGORITHM_H
9 #define LAR_NEUTRINO_HIERARCHY_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 #include <unordered_map>
16 
17 namespace lar_content
18 {
19 
20 class PfoRelationTool;
21 
22 //------------------------------------------------------------------------------------------------------------------------------------------
23 
27 class NeutrinoHierarchyAlgorithm : public pandora::Algorithm
28 {
29 public:
34 
38  class PfoInfo
39  {
40  public:
48  PfoInfo(const pandora::ParticleFlowObject *const pPfo, const unsigned int halfWindowLayers, const float layerPitch);
49 
55  PfoInfo(const PfoInfo &rhs);
56 
62  PfoInfo &operator=(const PfoInfo &rhs);
63 
67  ~PfoInfo();
68 
74  const pandora::ParticleFlowObject *GetThisPfo() const;
75 
81  const pandora::Cluster *GetCluster3D() const;
82 
89 
95  bool IsNeutrinoVertexAssociated() const;
96 
102  bool IsInnerLayerAssociated() const;
103 
109  const pandora::ParticleFlowObject *GetParentPfo() const;
110 
116  const pandora::PfoList &GetDaughterPfoList() const;
117 
123  void SetNeutrinoVertexAssociation(const bool isNeutrinoVertexAssociated);
124 
130  void SetInnerLayerAssociation(const bool isInnerLayerAssociated);
131 
137  void SetParentPfo(const pandora::ParticleFlowObject *const pParentPfo);
138 
142  void RemoveParentPfo();
143 
149  void AddDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo);
150 
156  void RemoveDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo);
157 
158  private:
159  const pandora::ParticleFlowObject *m_pThisPfo;
160  const pandora::Cluster *m_pCluster3D;
161  const pandora::Vertex *m_pVertex3D;
163 
166  const pandora::ParticleFlowObject *m_pParentPfo;
167  pandora::PfoList m_daughterPfoList;
168  };
169 
170  typedef std::unordered_map<const pandora::ParticleFlowObject*, PfoInfo*> PfoInfoMap;
171 
179  void SeparatePfos(const NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap, pandora::PfoVector &assignedPfos, pandora::PfoVector &unassignedPfos) const;
180 
181 private:
182  pandora::StatusCode Run();
183 
189  void GetNeutrinoPfo(const pandora::ParticleFlowObject *&pNeutrinoPfo) const;
190 
196  void GetCandidateDaughterPfoList(pandora::PfoList &candidateDaughterPfoList) const;
197 
204  void GetInitialPfoInfoMap(const pandora::PfoList &pfoList, PfoInfoMap &pfoInfoMap) const;
205 
213  void ProcessPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const pandora::PfoList &candidateDaughterPfoList,
214  const PfoInfoMap &pfoInfoMap) const;
215 
222  void DisplayPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const PfoInfoMap &pfoInfoMap) const;
223 
224  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
225 
226  typedef std::vector<PfoRelationTool*> PfoRelationToolVector;
227  PfoRelationToolVector m_algorithmToolVector;
228 
229  std::string m_neutrinoPfoListName;
230  pandora::StringVector m_daughterPfoListNames;
231 
232  unsigned int m_halfWindowLayers;
234 };
235 
236 //------------------------------------------------------------------------------------------------------------------------------------------
237 
241 class PfoRelationTool : public pandora::AlgorithmTool
242 {
243 public:
251  virtual void Run(NeutrinoHierarchyAlgorithm *const pAlgorithm, const pandora::Vertex *const pNeutrinoVertex, NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap) = 0;
252 };
253 
254 //------------------------------------------------------------------------------------------------------------------------------------------
255 
256 inline const pandora::ParticleFlowObject *NeutrinoHierarchyAlgorithm::PfoInfo::GetThisPfo() const
257 {
258  return m_pThisPfo;
259 }
260 
261 //------------------------------------------------------------------------------------------------------------------------------------------
262 
263 inline const pandora::Cluster *NeutrinoHierarchyAlgorithm::PfoInfo::GetCluster3D() const
264 {
265  return m_pCluster3D;
266 }
267 
268 //------------------------------------------------------------------------------------------------------------------------------------------
269 
271 {
272  return m_pSlidingFitResult3D;
273 }
274 
275 //------------------------------------------------------------------------------------------------------------------------------------------
276 
278 {
280 }
281 
282 //------------------------------------------------------------------------------------------------------------------------------------------
283 
285 {
287 }
288 
289 //------------------------------------------------------------------------------------------------------------------------------------------
290 
291 inline const pandora::ParticleFlowObject *NeutrinoHierarchyAlgorithm::PfoInfo::GetParentPfo() const
292 {
293  return m_pParentPfo;
294 }
295 
296 //------------------------------------------------------------------------------------------------------------------------------------------
297 
298 inline const pandora::PfoList &NeutrinoHierarchyAlgorithm::PfoInfo::GetDaughterPfoList() const
299 {
300  return m_daughterPfoList;
301 }
302 
303 } // namespace lar_content
304 
305 #endif // #ifndef LAR_NEUTRINO_HIERARCHY_ALGORITHM_H
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.
const pandora::Cluster * m_pCluster3D
The address of the three dimensional cluster.
PfoInfo & operator=(const PfoInfo &rhs)
Assignment operator.
const ThreeDSlidingFitResult * GetSlidingFitResult3D() const
Get the address of the three dimensional sliding fit result.
bool m_isNeutrinoVertexAssociated
Whether the pfo is associated with the neutrino vertex.
std::unordered_map< const pandora::ParticleFlowObject *, PfoInfo * > PfoInfoMap
const pandora::Cluster * GetCluster3D() const
Get the address of the three dimensional cluster.
PfoRelationToolVector m_algorithmToolVector
The algorithm tool vector.
std::vector< PfoRelationTool * > PfoRelationToolVector
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 ProcessPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const pandora::PfoList &candidateDaughterPfoList, const PfoInfoMap &pfoInfoMap) const
Process the information in a pfo info map, creating pfo parent/daughter links.
void DisplayPfoInfoMap(const pandora::ParticleFlowObject *const pNeutrinoPfo, const PfoInfoMap &pfoInfoMap) const
Display the information in a pfo info map, visualising pfo parent/daughter links. ...
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.
bool m_isInnerLayerAssociated
If associated, whether association to parent (vtx or pfo) is at sliding fit inner layer...
bool IsInnerLayerAssociated() const
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.
const pandora::ParticleFlowObject * GetParentPfo() const
Get the address of the parent pfo.
ThreeDSlidingFitResult * m_pSlidingFitResult3D
The three dimensional sliding fit result.
pandora::PfoList m_daughterPfoList
The daughter pfo list.
const pandora::PfoList & GetDaughterPfoList() const
Get the daughter pfo list.
bool IsNeutrinoVertexAssociated() const
Whether the pfo is associated with the neutrino vertex.
void SetParentPfo(const pandora::ParticleFlowObject *const pParentPfo)
Set the parent pfo.
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...
PfoInfo(const pandora::ParticleFlowObject *const pPfo, const unsigned int halfWindowLayers, const float layerPitch)
Constructor.
Header file for the lar three dimensional sliding fit result 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.
void AddDaughterPfo(const pandora::ParticleFlowObject *const pDaughterPfo)
Add a daughter pfo.
const pandora::ParticleFlowObject * m_pParentPfo
The address of the parent pfo.
void GetCandidateDaughterPfoList(pandora::PfoList &candidateDaughterPfoList) const
Get the list of candidate daughter pfos.
void GetInitialPfoInfoMap(const pandora::PfoList &pfoList, PfoInfoMap &pfoInfoMap) const
Process a provided pfo list and populate an initial pfo info map.