All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MasterAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArControlFlow/MasterAlgorithm.h
3  *
4  * @brief Header file for the master algorithm class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_MASTER_ALGORITHM_H
9 #define LAR_MASTER_ALGORITHM_H 1
10 
11 #include "Pandora/AlgorithmTool.h"
12 #include "Pandora/ExternallyConfiguredAlgorithm.h"
13 
16 
17 #include <unordered_map>
18 
19 namespace lar_content
20 {
21 
22 class StitchingBaseTool;
23 class CosmicRayTaggingBaseTool;
24 class SliceIdBaseTool;
25 class SliceSelectionBaseTool;
27 
28 typedef std::vector<pandora::CaloHitList> SliceVector;
29 typedef std::vector<pandora::PfoList> SliceHypotheses;
30 typedef std::unordered_map<const pandora::ParticleFlowObject *, const pandora::LArTPC *> PfoToLArTPCMap;
31 typedef std::unordered_map<const pandora::ParticleFlowObject *, float> PfoToFloatMap;
32 
33 //------------------------------------------------------------------------------------------------------------------------------------------
34 
35 /**
36  * @brief MasterAlgorithm class
37  */
38 class MasterAlgorithm : public pandora::ExternallyConfiguredAlgorithm
39 {
40 public:
41  /**
42  * @brief Default constructor
43  */
45 
46  /**
47  * @brief External steering parameters class
48  */
49  class ExternalSteeringParameters : public pandora::ExternalParameters
50  {
51  public:
52  pandora::InputBool m_shouldRunAllHitsCosmicReco; ///< Whether to run all hits cosmic-ray reconstruction
53  pandora::InputBool m_shouldRunStitching; ///< Whether to stitch cosmic-ray muons crossing between volumes
54  pandora::InputBool m_shouldRunCosmicHitRemoval; ///< Whether to remove hits from tagged cosmic-rays
55  pandora::InputBool m_shouldRunSlicing; ///< Whether to slice events into separate regions for processing
56  pandora::InputBool m_shouldRunNeutrinoRecoOption; ///< Whether to run neutrino reconstruction for each slice
57  pandora::InputBool m_shouldRunCosmicRecoOption; ///< Whether to run cosmic-ray reconstruction for each slice
58  pandora::InputBool m_shouldPerformSliceId; ///< Whether to identify slices and select most appropriate pfos
59  pandora::InputBool m_printOverallRecoStatus; ///< Whether to print current operation status messages
60  };
61 
62  typedef std::unordered_map<const pandora::ParticleFlowObject *, const pandora::LArTPC *> PfoToLArTPCMap;
63 
64  /**
65  * @brief Shift a Pfo hierarchy by a specified x0 value
66  *
67  * @param pPfo the address of the parent pfo
68  * @param stitchingInfo the source for additional, local, stitching information
69  * @param x0 the x0 correction relative to the input pfo
70  */
71  void ShiftPfoHierarchy(const pandora::ParticleFlowObject *const pParentPfo, const PfoToLArTPCMap &pfoToLArTPCMap, const float x0) const;
72 
73  /**
74  * @brief Stitch together a pair of pfos
75  *
76  * @param pPfoToEnlarge the address of the pfo to enlarge
77  * @param pPfoToDelete the address of the pfo to delete (will become a dangling pointer)
78  * @param stitchingInfo the source for additional, local, stitching information
79  */
80  void StitchPfos(const pandora::ParticleFlowObject *const pPfoToEnlarge, const pandora::ParticleFlowObject *const pPfoToDelete,
81  PfoToLArTPCMap &pfoToLArTPCMap) const;
82 
83 protected:
84  /**
85  * @brief LArTPCHitList class
86  */
88  {
89  public:
90  pandora::CaloHitList m_allHitList; ///< The list of all hits originating from a given LArTPC
91  pandora::CaloHitList m_truncatedHitList; ///< The list of hits confined within LArTPC boundaries for given beam t0 value
92  };
93 
94  typedef std::map<unsigned int, LArTPCHitList> VolumeIdToHitListMap;
95 
96  pandora::StatusCode Run();
97 
98  /**
99  * @brief Initialize pandora worker instances
100  */
101  pandora::StatusCode InitializeWorkerInstances();
102 
103  /**
104  * @brief Copy mc particles in the named input list to all pandora worker instances
105  */
106  pandora::StatusCode CopyMCParticles() const;
107 
108  /**
109  * @brief Get the mapping from lar tpc volume id to lists of all hits, and truncated hits
110  *
111  * @param volumeIdToHitListMap to receive the populated volume id to hit list map
112  */
113  pandora::StatusCode GetVolumeIdToHitListMap(VolumeIdToHitListMap &volumeIdToHitListMap) const;
114 
115  /**
116  * @brief Run the cosmic-ray reconstruction worker instances
117  *
118  * @param volumeIdToHitListMap the volume id to hit list map
119  */
120  pandora::StatusCode RunCosmicRayReconstruction(const VolumeIdToHitListMap &volumeIdToHitListMap) const;
121 
122  /**
123  * @brief Recreate cosmic-ray pfos (created by worker instances) in the master instance
124  *
125  * @param pfoToLArTPCMap to receive the populated pfo to lar tpc map
126  */
127  pandora::StatusCode RecreateCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap) const;
128 
129  /**
130  * @brief Stitch together cosmic-ray pfos crossing between adjacent lar tpcs
131  *
132  * @param pfoToLArTPCMap the pfo to lar tpc map
133  * @param stitchedPfosToX0Map to receive the map of cosmic-ray pfos that have been stitched between lar tpcs to the X0 shift
134  */
135  pandora::StatusCode StitchCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map) const;
136 
137  /**
138  * @brief Tag clear, unambiguous cosmic-ray pfos
139  *
140  * @param stitchedPfosToX0Map a map of cosmic-ray pfos that have been stitched between lar tpcs to the X0 shift
141  * @param clearCosmicRayPfos to receive the list of clear cosmic-ray pfos
142  * @param ambiguousPfos to receive the list of ambiguous cosmic-ray pfos for further analysis
143  */
144  pandora::StatusCode TagCosmicRayPfos(
145  const PfoToFloatMap &stitchedPfosToX0Map, pandora::PfoList &clearCosmicRayPfos, pandora::PfoList &ambiguousPfos) const;
146 
147  /**
148  * @brief Run cosmic-ray hit removal, freeing hits in ambiguous pfos for further processing
149  *
150  * @param ambiguousPfos the list of ambiguous cosmic-ray pfos
151  */
152  pandora::StatusCode RunCosmicRayHitRemoval(const pandora::PfoList &ambiguousPfos) const;
153 
154  /**
155  * @brief Run the event slicing procedures, dividing available hits up into distinct 3D regions
156  *
157  * @param volumeIdToHitListMap the volume id to hit list map
158  * @param sliceVector to receive the populated slice vector
159  */
160  pandora::StatusCode RunSlicing(const VolumeIdToHitListMap &volumeIdToHitListMap, SliceVector &sliceVector) const;
161 
162  /**
163  * @brief Process each slice under different reconstruction hypotheses
164  *
165  * @param sliceVector the slice vector
166  * @param nuSliceHypotheses to receive the vector of slice neutrino hypotheses
167  * @param crSliceHypotheses to receive the vector of slice cosmic-ray hypotheses
168  */
169  pandora::StatusCode RunSliceReconstruction(SliceVector &sliceVector, SliceHypotheses &nuSliceHypotheses, SliceHypotheses &crSliceHypotheses) const;
170 
171  /**
172  * @brief Examine slice hypotheses to identify the most appropriate to provide in final event output
173  *
174  * @param nuSliceHypotheses the vector of slice neutrino hypotheses
175  * @param crSliceHypotheses the vector of slice cosmic-ray hypotheses
176  */
177  pandora::StatusCode SelectBestSliceHypotheses(const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses) const;
178 
179  /**
180  * @brief Reset all worker instances
181  */
182  pandora::StatusCode Reset();
183 
184  /**
185  * @brief Copy a specified calo hit to the provided pandora instance
186  *
187  * @param pPandora the address of the target pandora instance
188  * @param pCaloHit the address of the calo hit
189  */
190  pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::CaloHit *const pCaloHit) const;
191 
192  /**
193  * @brief Copy a specified mc particle to the provided pandora instance
194  *
195  * @param pPandora the address of the target pandora instance
196  * @param pMCParticle the address of the mc particle
197  * @param pMCParticleFactory the address of the mc particle factory, allowing decoration of instances with information beyond that expected by sdk
198  */
199  pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::MCParticle *const pMCParticle,
200  const LArMCParticleFactory *const pMCParticleFactory) const;
201 
202  /**
203  * @brief Recreate a specified list of pfos in the current pandora instance
204  *
205  * @param inputPfoList the input pfo list
206  * @param newPfoList to receive the list of new pfos
207  */
208  pandora::StatusCode Recreate(const pandora::PfoList &inputPfoList, pandora::PfoList &newPfoList) const;
209 
210  /**
211  * @brief Recreate a specified pfo in the current pandora instance
212  *
213  * @param pInputPfo the input pfo
214  * @param pNewParentPfo the new parent of the new output pfo (nullptr if none)
215  * @param newPfoList to receive the list of new pfos
216  */
217  pandora::StatusCode Recreate(const pandora::ParticleFlowObject *const pInputPfo, const pandora::ParticleFlowObject *const pNewParentPfo,
218  pandora::PfoList &newPfoList) const;
219 
220  /**
221  * @brief Create a new calo hit in the current pandora instance, based upon the provided input calo hit
222  *
223  * @param pInputCaloHit the address of the input calo hit
224  * @param pParentCaloHit the address of the parent calo hit
225  *
226  * @return the address of the new calo hit
227  */
228  const pandora::CaloHit *CreateCaloHit(const pandora::CaloHit *const pInputCaloHit, const pandora::CaloHit *const pParentCaloHit) const;
229 
230  /**
231  * @brief Create a new cluster in the current pandora instance, based upon the provided input cluster
232  *
233  * @param pInputCluster the address of the input cluster
234  * @param newCaloHitList the list of calo hits for the new cluster
235  * @param newIsolatedCaloHitList the list of isolated calo hits for the new cluster
236  *
237  * @return the address of the new cluster
238  */
239  const pandora::Cluster *CreateCluster(const pandora::Cluster *const pInputCluster, const pandora::CaloHitList &newCaloHitList,
240  const pandora::CaloHitList &newIsolatedCaloHitList) const;
241 
242  /**
243  * @brief Create a new vertex in the current pandora instance, based upon the provided input vertex
244  *
245  * @param pInputVertex the address of the input vertex
246  *
247  * @return the address of the new vertex
248  */
249  const pandora::Vertex *CreateVertex(const pandora::Vertex *const pInputVertex) const;
250 
251  /**
252  * @brief Create a new pfo in the current pandora instance, based upon the provided input pfo
253  *
254  * @param pInputPfo the address of the input pfo
255  * @param newClusterList the list of clusters for the new pfo
256  * @param newVertexList the list of vertices for the new pfo
257  *
258  * @return the address of the new pfo
259  */
260  const pandora::ParticleFlowObject *CreatePfo(const pandora::ParticleFlowObject *const pInputPfo,
261  const pandora::ClusterList &newClusterList, const pandora::VertexList &newVertexList) const;
262 
263  /**
264  * @brief Create a pandora worker instance to handle a single LArTPC
265  *
266  * @param larTPC the lar tpc
267  * @param gapList the gap list
268  * @param settingsFile the pandora settings file
269  * @param name the pandora instance name
270  *
271  * @return the address of the pandora instance
272  */
273  const pandora::Pandora *CreateWorkerInstance(const pandora::LArTPC &larTPC, const pandora::DetectorGapList &gapList,
274  const std::string &settingsFile, const std::string &name) const;
275 
276  /**
277  * @brief Create a pandora worker instance to handle a number of LArTPCs
278  *
279  * @param larTPCMap the lar tpc map
280  * @param gapList the gap list
281  * @param settingsFile the pandora settings file
282  * @param name the pandora instance name
283  *
284  * @return the address of the pandora instance
285  */
286  const pandora::Pandora *CreateWorkerInstance(const pandora::LArTPCMap &larTPCMap, const pandora::DetectorGapList &gapList,
287  const std::string &settingsFile, const std::string &name) const;
288 
289  /**
290  * @brief Register custom content, such as algorithms or algorithm tools, with a specified pandora instance
291  *
292  * @param pPandora the address of the pandora instance
293  */
294  virtual pandora::StatusCode RegisterCustomContent(const pandora::Pandora *const pPandora) const;
295 
296  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
297 
298  /**
299  * @brief Read settings from external steering parameters block, if present, otherwise from xml as standard
300  *
301  * @param pExternalParameters the address of the external parameters (if present)
302  * @param inputBool the input boolean value, from the external parameters (if present)
303  * @param xmlHandle the xml handle
304  * @param xmlTag the xml tag
305  * @param outputBool to receive the output boolean value
306  */
307  pandora::StatusCode ReadExternalSettings(const ExternalSteeringParameters *const pExternalParameters,
308  const pandora::InputBool inputBool, const pandora::TiXmlHandle xmlHandle, const std::string &xmlTag, bool &outputBool);
309 
310  bool m_workerInstancesInitialized; ///< Whether all worker instances have been initialized
311 
312  unsigned int m_larCaloHitVersion; ///< The LArCaloHit version for LArCaloHitFactory
313 
314  bool m_shouldRunAllHitsCosmicReco; ///< Whether to run all hits cosmic-ray reconstruction
315  bool m_shouldRunStitching; ///< Whether to stitch cosmic-ray muons crossing between volumes
316  bool m_shouldRunCosmicHitRemoval; ///< Whether to remove hits from tagged cosmic-rays
317  bool m_shouldRunSlicing; ///< Whether to slice events into separate regions for processing
318  bool m_shouldRunNeutrinoRecoOption; ///< Whether to run neutrino reconstruction for each slice
319  bool m_shouldRunCosmicRecoOption; ///< Whether to run cosmic-ray reconstruction for each slice
320  bool m_shouldPerformSliceId; ///< Whether to identify slices and select most appropriate pfos
321  bool m_printOverallRecoStatus; ///< Whether to print current operation status messages
322  bool m_visualizeOverallRecoStatus; ///< Whether to display results of current operations
323  bool m_shouldRemoveOutOfTimeHits; ///< Whether to remove out of time hits
324 
325  PandoraInstanceList m_crWorkerInstances; ///< The list of cosmic-ray reconstruction worker instances
326  const pandora::Pandora *m_pSlicingWorkerInstance; ///< The slicing worker instance
327  const pandora::Pandora *m_pSliceNuWorkerInstance; ///< The per-slice neutrino reconstruction worker instance
328  const pandora::Pandora *m_pSliceCRWorkerInstance; ///< The per-slice cosmic-ray reconstruction worker instance
329 
330  bool m_fullWidthCRWorkerWireGaps; ///< Whether wire-type line gaps in cosmic-ray worker instances should cover all drift time
331  bool m_passMCParticlesToWorkerInstances; ///< Whether to pass mc particle details (and links to calo hits) to worker instances
332 
333  typedef std::vector<StitchingBaseTool *> StitchingToolVector;
334  typedef std::vector<CosmicRayTaggingBaseTool *> CosmicRayTaggingToolVector;
335  typedef std::vector<SliceIdBaseTool *> SliceIdToolVector;
336  typedef std::vector<SliceSelectionBaseTool *> SliceSelectionToolVector;
337 
338  StitchingToolVector m_stitchingToolVector; ///< The stitching tool vector
339  CosmicRayTaggingToolVector m_cosmicRayTaggingToolVector; ///< The cosmic-ray tagging tool vector
340  SliceIdToolVector m_sliceIdToolVector; ///< The slice id tool vector
341  SliceSelectionToolVector m_sliceSelectionToolVector; ///< The slice selection tool vector
342 
343  std::string m_filePathEnvironmentVariable; ///< The environment variable providing a list of paths to xml files
344  std::string m_crSettingsFile; ///< The cosmic-ray reconstruction settings file
345  std::string m_nuSettingsFile; ///< The neutrino reconstruction settings file
346  std::string m_slicingSettingsFile; ///< The slicing settings file
347 
348  std::string m_inputMCParticleListName; ///< The input mc particle list name
349  std::string m_inputHitListName; ///< The input hit list name
350  std::string m_recreatedPfoListName; ///< The output recreated pfo list name
351  std::string m_recreatedClusterListName; ///< The output recreated cluster list name
352  std::string m_recreatedVertexListName; ///< The output recreated vertex list name
353 
354  float m_inTimeMaxX0; ///< Cut on X0 to determine whether particle is clear cosmic ray
355  LArCaloHitFactory m_larCaloHitFactory; ///< Factory for creating LArCaloHits during hit copying
356 };
357 
358 //------------------------------------------------------------------------------------------------------------------------------------------
359 //------------------------------------------------------------------------------------------------------------------------------------------
360 
361 /**
362  * @brief StitchingBaseTool class
363  */
364 class StitchingBaseTool : public pandora::AlgorithmTool
365 {
366 public:
367  /**
368  * @brief Run the algorithm tool
369  *
370  * @param pAlgorithm address of the calling algorithm
371  * @param pMultiPfoList the list of pfos in multiple lar tpcs
372  * @param pfoToLArTPCMap the pfo to lar tpc map
373  * @param stitchedPfosToX0Map a map of cosmic-ray pfos that have been stitched between lar tpcs to the X0 shift
374  */
375  virtual void Run(const MasterAlgorithm *const pAlgorithm, const pandora::PfoList *const pMultiPfoList, PfoToLArTPCMap &pfoToLArTPCMap,
376  PfoToFloatMap &stitchedPfosToX0Map) = 0;
377 };
378 
379 //------------------------------------------------------------------------------------------------------------------------------------------
380 //------------------------------------------------------------------------------------------------------------------------------------------
381 
382 /**
383  * @brief CosmicRayTaggingBaseTool class
384  */
385 class CosmicRayTaggingBaseTool : public pandora::AlgorithmTool
386 {
387 public:
388  /**
389  * @brief Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos)
390  *
391  * @param parentCosmicRayPfos the list of parent cosmic-ray pfos
392  * @param ambiguousPfos to receive the list of ambiguous pfos
393  * @param pAlgorithm the address of this master algorithm
394  */
395  virtual void FindAmbiguousPfos(
396  const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm) = 0;
397 };
398 
399 //------------------------------------------------------------------------------------------------------------------------------------------
400 //------------------------------------------------------------------------------------------------------------------------------------------
401 
402 /**
403  * @brief SliceIdBaseTool class
404  */
405 class SliceIdBaseTool : public pandora::AlgorithmTool
406 {
407 public:
408  /**
409  * @brief Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each slice
410  *
411  * @param pAlgorithm the address of the master instance, used to access MCParticles when in training mode
412  * @param nuSliceHypotheses the parent pfos representing the neutrino outcome for each slice
413  * @param crSliceHypotheses the parent pfos representing the cosmic-ray muon outcome for each slice
414  * @param sliceNuPfos to receive the list of selected pfos
415  */
416  virtual void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses,
417  const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos) = 0;
418 };
419 
420 //------------------------------------------------------------------------------------------------------------------------------------------
421 //------------------------------------------------------------------------------------------------------------------------------------------
422 
423 /**
424  * @brief SliceSelectionBaseTool class
425  */
426 class SliceSelectionBaseTool : public pandora::AlgorithmTool
427 {
428 public:
429  /**
430  * @brief Select which slice(s) to use; neutrino or beam slices
431  *
432  * @param pAlgorithm the address of the master instance, used to access MCParticles when in training mode
433  * @param inputSliceVector the initial slice vector
434  * @param outputSliceVector the output slice vector
435  */
436  virtual void SelectSlices(const pandora::Algorithm *const pAlgorithm, const SliceVector &inputSliceVector, SliceVector &outputSliceVector) = 0;
437 };
438 
439 } // namespace lar_content
440 
441 #endif // #ifndef LAR_MASTER_ALGORITHM_H
std::unordered_map< const pandora::ParticleFlowObject *, float > PfoToFloatMap
std::string m_inputMCParticleListName
The input mc particle list name.
pandora::InputBool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
const pandora::ParticleFlowObject * CreatePfo(const pandora::ParticleFlowObject *const pInputPfo, const pandora::ClusterList &newClusterList, const pandora::VertexList &newVertexList) const
Create a new pfo in the current pandora instance, based upon the provided input pfo.
std::vector< pandora::CaloHitList > SliceVector
LArCaloHitFactory m_larCaloHitFactory
Factory for creating LArCaloHits during hit copying.
CosmicRayTaggingToolVector m_cosmicRayTaggingToolVector
The cosmic-ray tagging tool vector.
pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::CaloHit *const pCaloHit) const
Copy a specified calo hit to the provided pandora instance.
std::vector< SliceSelectionBaseTool * > SliceSelectionToolVector
pandora::InputBool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
CosmicRayTaggingBaseTool class.
pandora::StatusCode Recreate(const pandora::PfoList &inputPfoList, pandora::PfoList &newPfoList) const
Recreate a specified list of pfos in the current pandora instance.
pandora::StatusCode ReadExternalSettings(const ExternalSteeringParameters *const pExternalParameters, const pandora::InputBool inputBool, const pandora::TiXmlHandle xmlHandle, const std::string &xmlTag, bool &outputBool)
Read settings from external steering parameters block, if present, otherwise from xml as standard...
const pandora::Pandora * m_pSlicingWorkerInstance
The slicing worker instance.
Header file for the lar calo hit class.
pandora::StatusCode CopyMCParticles() const
Copy mc particles in the named input list to all pandora worker instances.
const pandora::CaloHit * CreateCaloHit(const pandora::CaloHit *const pInputCaloHit, const pandora::CaloHit *const pParentCaloHit) const
Create a new calo hit in the current pandora instance, based upon the provided input calo hit...
bool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
bool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
bool m_shouldRemoveOutOfTimeHits
Whether to remove out of time hits.
pandora::InputBool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
bool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
std::string m_slicingSettingsFile
The slicing settings file.
pandora::StatusCode RunCosmicRayHitRemoval(const pandora::PfoList &ambiguousPfos) const
Run cosmic-ray hit removal, freeing hits in ambiguous pfos for further processing.
virtual void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos)=0
Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each...
std::string m_recreatedVertexListName
The output recreated vertex list name.
std::vector< const pandora::Pandora * > PandoraInstanceList
const pandora::Vertex * CreateVertex(const pandora::Vertex *const pInputVertex) const
Create a new vertex in the current pandora instance, based upon the provided input vertex...
const pandora::Pandora * m_pSliceCRWorkerInstance
The per-slice cosmic-ray reconstruction worker instance.
virtual void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm)=0
Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos)
SliceSelectionToolVector m_sliceSelectionToolVector
The slice selection tool vector.
virtual void SelectSlices(const pandora::Algorithm *const pAlgorithm, const SliceVector &inputSliceVector, SliceVector &outputSliceVector)=0
Select which slice(s) to use; neutrino or beam slices.
pandora::InputBool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
const pandora::Cluster * CreateCluster(const pandora::Cluster *const pInputCluster, const pandora::CaloHitList &newCaloHitList, const pandora::CaloHitList &newIsolatedCaloHitList) const
Create a new cluster in the current pandora instance, based upon the provided input cluster...
bool m_printOverallRecoStatus
Whether to print current operation status messages.
const pandora::Pandora * CreateWorkerInstance(const pandora::LArTPC &larTPC, const pandora::DetectorGapList &gapList, const std::string &settingsFile, const std::string &name) const
Create a pandora worker instance to handle a single LArTPC.
pandora::StatusCode RunSliceReconstruction(SliceVector &sliceVector, SliceHypotheses &nuSliceHypotheses, SliceHypotheses &crSliceHypotheses) const
Process each slice under different reconstruction hypotheses.
std::map< unsigned int, LArTPCHitList > VolumeIdToHitListMap
MasterAlgorithm()
Default constructor.
const pandora::Pandora * m_pSliceNuWorkerInstance
The per-slice neutrino reconstruction worker instance.
std::vector< pandora::PfoList > SliceHypotheses
std::string m_nuSettingsFile
The neutrino reconstruction settings file.
pandora::InputBool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
pandora::StatusCode InitializeWorkerInstances()
Initialize pandora worker instances.
bool m_workerInstancesInitialized
Whether all worker instances have been initialized.
void ShiftPfoHierarchy(const pandora::ParticleFlowObject *const pParentPfo, const PfoToLArTPCMap &pfoToLArTPCMap, const float x0) const
Shift a Pfo hierarchy by a specified x0 value.
StitchingToolVector m_stitchingToolVector
The stitching tool vector.
pandora::StatusCode Reset()
Reset all worker instances.
unsigned int m_larCaloHitVersion
The LArCaloHit version for LArCaloHitFactory.
Header file for the MultiPandoraApi class.
pandora::InputBool m_printOverallRecoStatus
Whether to print current operation status messages.
std::string m_recreatedClusterListName
The output recreated cluster list name.
bool m_visualizeOverallRecoStatus
Whether to display results of current operations.
pandora::StatusCode TagCosmicRayPfos(const PfoToFloatMap &stitchedPfosToX0Map, pandora::PfoList &clearCosmicRayPfos, pandora::PfoList &ambiguousPfos) const
Tag clear, unambiguous cosmic-ray pfos.
std::string m_crSettingsFile
The cosmic-ray reconstruction settings file.
void StitchPfos(const pandora::ParticleFlowObject *const pPfoToEnlarge, const pandora::ParticleFlowObject *const pPfoToDelete, PfoToLArTPCMap &pfoToLArTPCMap) const
Stitch together a pair of pfos.
std::vector< StitchingBaseTool * > StitchingToolVector
std::string m_recreatedPfoListName
The output recreated pfo list name.
bool m_fullWidthCRWorkerWireGaps
Whether wire-type line gaps in cosmic-ray worker instances should cover all drift time...
std::vector< CosmicRayTaggingBaseTool * > CosmicRayTaggingToolVector
LArMCParticleFactory responsible for object creation.
pandora::StatusCode StitchCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map) const
Stitch together cosmic-ray pfos crossing between adjacent lar tpcs.
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::LArTPC * > PfoToLArTPCMap
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to xml files.
SliceIdBaseTool class.
SliceSelectionBaseTool class.
StitchingBaseTool class.
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::LArTPC * > PfoToLArTPCMap
pandora::StatusCode GetVolumeIdToHitListMap(VolumeIdToHitListMap &volumeIdToHitListMap) const
Get the mapping from lar tpc volume id to lists of all hits, and truncated hits.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode RecreateCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap) const
Recreate cosmic-ray pfos (created by worker instances) in the master instance.
MasterAlgorithm class.
bool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
bool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
pandora::InputBool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
virtual pandora::StatusCode RegisterCustomContent(const pandora::Pandora *const pPandora) const
Register custom content, such as algorithms or algorithm tools, with a specified pandora instance...
pandora::StatusCode Run()
pandora::InputBool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
pandora::CaloHitList m_allHitList
The list of all hits originating from a given LArTPC.
then echo fcl name
std::vector< SliceIdBaseTool * > SliceIdToolVector
pandora::StatusCode SelectBestSliceHypotheses(const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses) const
Examine slice hypotheses to identify the most appropriate to provide in final event output...
LArCaloHitFactory responsible for object creation.
Definition: LArCaloHit.h:110
pandora::CaloHitList m_truncatedHitList
The list of hits confined within LArTPC boundaries for given beam t0 value.
PandoraInstanceList m_crWorkerInstances
The list of cosmic-ray reconstruction worker instances.
virtual void Run(const MasterAlgorithm *const pAlgorithm, const pandora::PfoList *const pMultiPfoList, PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map)=0
Run the algorithm tool.
SliceIdToolVector m_sliceIdToolVector
The slice id tool vector.
bool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
pandora::StatusCode RunSlicing(const VolumeIdToHitListMap &volumeIdToHitListMap, SliceVector &sliceVector) const
Run the event slicing procedures, dividing available hits up into distinct 3D regions.
bool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
std::list< Vertex > VertexList
Definition: DCEL.h:182
float m_inTimeMaxX0
Cut on X0 to determine whether particle is clear cosmic ray.
std::string m_inputHitListName
The input hit list name.
bool m_passMCParticlesToWorkerInstances
Whether to pass mc particle details (and links to calo hits) to worker instances. ...
pandora::StatusCode RunCosmicRayReconstruction(const VolumeIdToHitListMap &volumeIdToHitListMap) const
Run the cosmic-ray reconstruction worker instances.