Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
MasterAlgorithm.h
Go to the documentation of this file.
1
8#ifndef LAR_MASTER_ALGORITHM_H
9#define LAR_MASTER_ALGORITHM_H 1
10
13
16
17#include <unordered_map>
18
19namespace lar_content
20{
21
22class StitchingBaseTool;
23class CosmicRayTaggingBaseTool;
24class SliceIdBaseTool;
25class SliceSelectionBaseTool;
26class LArMCParticleFactory;
27
28typedef std::vector<pandora::CaloHitList> SliceVector;
29typedef std::vector<pandora::PfoList> SliceHypotheses;
30typedef std::unordered_map<const pandora::ParticleFlowObject *, const pandora::LArTPC *> PfoToLArTPCMap;
31typedef std::unordered_map<const pandora::ParticleFlowObject *, float> PfoToFloatMap;
32
33//------------------------------------------------------------------------------------------------------------------------------------------
34
39{
40public:
45
61
62 typedef std::unordered_map<const pandora::ParticleFlowObject *, const pandora::LArTPC *> PfoToLArTPCMap;
63
71 void ShiftPfoHierarchy(const pandora::ParticleFlowObject *const pParentPfo, const PfoToLArTPCMap &pfoToLArTPCMap, const float x0) const;
72
80 void StitchPfos(const pandora::ParticleFlowObject *const pPfoToEnlarge, const pandora::ParticleFlowObject *const pPfoToDelete,
81 PfoToLArTPCMap &pfoToLArTPCMap) const;
82
83protected:
93
94 typedef std::map<unsigned int, LArTPCHitList> VolumeIdToHitListMap;
95
97
102
107
114
121
128
135 pandora::StatusCode StitchCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map) const;
136
145 const PfoToFloatMap &stitchedPfosToX0Map, pandora::PfoList &clearCosmicRayPfos, pandora::PfoList &ambiguousPfos) const;
146
153
160 pandora::StatusCode RunSlicing(const VolumeIdToHitListMap &volumeIdToHitListMap, SliceVector &sliceVector) const;
161
169 pandora::StatusCode RunSliceReconstruction(SliceVector &sliceVector, SliceHypotheses &nuSliceHypotheses, SliceHypotheses &crSliceHypotheses) const;
170
177 pandora::StatusCode SelectBestSliceHypotheses(const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses) const;
178
183
190 pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::CaloHit *const pCaloHit) const;
191
199 pandora::StatusCode Copy(const pandora::Pandora *const pPandora, const pandora::MCParticle *const pMCParticle,
200 const LArMCParticleFactory *const pMCParticleFactory) const;
201
208 pandora::StatusCode Recreate(const pandora::PfoList &inputPfoList, pandora::PfoList &newPfoList) const;
209
217 pandora::StatusCode Recreate(const pandora::ParticleFlowObject *const pInputPfo, const pandora::ParticleFlowObject *const pNewParentPfo,
218 pandora::PfoList &newPfoList) const;
219
228 const pandora::CaloHit *CreateCaloHit(const pandora::CaloHit *const pInputCaloHit, const pandora::CaloHit *const pParentCaloHit) const;
229
239 const pandora::Cluster *CreateCluster(const pandora::Cluster *const pInputCluster, const pandora::CaloHitList &newCaloHitList,
240 const pandora::CaloHitList &newIsolatedCaloHitList) const;
241
249 const pandora::Vertex *CreateVertex(const pandora::Vertex *const pInputVertex) const;
250
261 const pandora::ClusterList &newClusterList, const pandora::VertexList &newVertexList) const;
262
274 const std::string &settingsFile, const std::string &name) const;
275
287 const std::string &settingsFile, const std::string &name) const;
288
294 virtual pandora::StatusCode RegisterCustomContent(const pandora::Pandora *const pPandora) const;
295
297
308 const pandora::InputBool inputBool, const pandora::TiXmlHandle xmlHandle, const std::string &xmlTag, bool &outputBool);
309
311
312 unsigned int m_larCaloHitVersion;
313
324
329
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
342
344 std::string m_crSettingsFile;
345 std::string m_nuSettingsFile;
347
349 std::string m_inputHitListName;
353
356};
357
358//------------------------------------------------------------------------------------------------------------------------------------------
359//------------------------------------------------------------------------------------------------------------------------------------------
360
365{
366public:
375 virtual void Run(const MasterAlgorithm *const pAlgorithm, const pandora::PfoList *const pMultiPfoList, PfoToLArTPCMap &pfoToLArTPCMap,
376 PfoToFloatMap &stitchedPfosToX0Map) = 0;
377};
378
379//------------------------------------------------------------------------------------------------------------------------------------------
380//------------------------------------------------------------------------------------------------------------------------------------------
381
386{
387public:
395 virtual void FindAmbiguousPfos(
396 const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm) = 0;
397};
398
399//------------------------------------------------------------------------------------------------------------------------------------------
400//------------------------------------------------------------------------------------------------------------------------------------------
401
406{
407public:
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
427{
428public:
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
Header file for the algorithm tool class.
Header file for the externally configured algorithm class.
Header file for the lar calo hit class.
Header file for the MultiPandoraApi class.
std::vector< const pandora::Pandora * > PandoraInstanceList
CosmicRayTaggingBaseTool class.
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)
LArCaloHitFactory responsible for object creation.
Definition LArCaloHit.h:111
LArMCParticleFactory responsible for object creation.
pandora::InputBool m_printOverallRecoStatus
Whether to print current operation status messages.
pandora::InputBool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
pandora::InputBool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
pandora::InputBool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
pandora::InputBool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
pandora::InputBool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
pandora::InputBool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
pandora::InputBool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
MasterAlgorithm class.
const pandora::Pandora * m_pSliceNuWorkerInstance
The per-slice neutrino reconstruction worker instance.
bool m_printOverallRecoStatus
Whether to print current operation status messages.
std::string m_nuSettingsFile
The neutrino reconstruction settings file.
bool m_workerInstancesInitialized
Whether all worker instances have been initialized.
std::vector< StitchingBaseTool * > StitchingToolVector
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.
bool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
pandora::StatusCode RunCosmicRayHitRemoval(const pandora::PfoList &ambiguousPfos) const
Run cosmic-ray hit removal, freeing hits in ambiguous pfos for further processing.
bool m_fullWidthCRWorkerWireGaps
Whether wire-type line gaps in cosmic-ray worker instances should cover all drift time.
const pandora::Pandora * m_pSlicingWorkerInstance
The slicing worker instance.
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::string m_recreatedVertexListName
The output recreated vertex list name.
bool m_shouldRunCosmicHitRemoval
Whether to remove hits from tagged cosmic-rays.
bool m_shouldPerformSliceId
Whether to identify slices and select most appropriate pfos.
pandora::StatusCode Recreate(const pandora::PfoList &inputPfoList, pandora::PfoList &newPfoList) const
Recreate a specified list of pfos in the current pandora instance.
pandora::StatusCode StitchCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map) const
Stitch together cosmic-ray pfos crossing between adjacent lar tpcs.
const pandora::Pandora * m_pSliceCRWorkerInstance
The per-slice cosmic-ray reconstruction worker instance.
pandora::StatusCode RecreateCosmicRayPfos(PfoToLArTPCMap &pfoToLArTPCMap) const
Recreate cosmic-ray pfos (created by worker instances) in the master instance.
std::string m_inputMCParticleListName
The input mc particle list 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.
std::vector< CosmicRayTaggingBaseTool * > CosmicRayTaggingToolVector
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::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.
bool m_passMCParticlesToWorkerInstances
Whether to pass mc particle details (and links to calo hits) to worker instances.
pandora::StatusCode Reset()
Reset all worker instances.
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.
bool m_shouldRunNeutrinoRecoOption
Whether to run neutrino reconstruction for each slice.
bool m_shouldRunCosmicRecoOption
Whether to run cosmic-ray reconstruction for each slice.
LArCaloHitFactory m_larCaloHitFactory
Factory for creating LArCaloHits during hit copying.
unsigned int m_larCaloHitVersion
The LArCaloHit version for LArCaloHitFactory.
virtual pandora::StatusCode RegisterCustomContent(const pandora::Pandora *const pPandora) const
Register custom content, such as algorithms or algorithm tools, with a specified pandora instance.
std::vector< SliceSelectionBaseTool * > SliceSelectionToolVector
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::string m_recreatedPfoListName
The output recreated pfo list name.
void ShiftPfoHierarchy(const pandora::ParticleFlowObject *const pParentPfo, const PfoToLArTPCMap &pfoToLArTPCMap, const float x0) const
Shift a Pfo hierarchy by a specified x0 value.
pandora::StatusCode CopyMCParticles() const
Copy mc particles in the named input list to all pandora worker instances.
std::string m_inputHitListName
The input hit list name.
bool m_shouldRemoveOutOfTimeHits
Whether to remove out of time hits.
pandora::StatusCode RunSlicing(const VolumeIdToHitListMap &volumeIdToHitListMap, SliceVector &sliceVector) const
Run the event slicing procedures, dividing available hits up into distinct 3D regions.
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::LArTPC * > PfoToLArTPCMap
pandora::StatusCode Run()
Run the algorithm.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to xml files.
std::string m_slicingSettingsFile
The slicing settings file.
SliceSelectionToolVector m_sliceSelectionToolVector
The slice selection tool vector.
pandora::StatusCode RunSliceReconstruction(SliceVector &sliceVector, SliceHypotheses &nuSliceHypotheses, SliceHypotheses &crSliceHypotheses) const
Process each slice under different reconstruction hypotheses.
bool m_shouldRunSlicing
Whether to slice events into separate regions for processing.
bool m_visualizeOverallRecoStatus
Whether to display results of current operations.
pandora::StatusCode RunCosmicRayReconstruction(const VolumeIdToHitListMap &volumeIdToHitListMap) const
Run the cosmic-ray reconstruction worker instances.
PandoraInstanceList m_crWorkerInstances
The list of cosmic-ray reconstruction worker instances.
pandora::CaloHitList m_allHitList
The list of all hits originating from a given LArTPC.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
std::string m_recreatedClusterListName
The output recreated cluster list name.
CosmicRayTaggingToolVector m_cosmicRayTaggingToolVector
The cosmic-ray tagging tool vector.
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.
std::map< unsigned int, LArTPCHitList > VolumeIdToHitListMap
pandora::StatusCode InitializeWorkerInstances()
Initialize pandora worker instances.
pandora::CaloHitList m_truncatedHitList
The list of hits confined within LArTPC boundaries for given beam t0 value.
float m_inTimeMaxX0
Cut on X0 to determine whether particle is clear cosmic ray.
SliceIdToolVector m_sliceIdToolVector
The slice id tool vector.
StitchingToolVector m_stitchingToolVector
The stitching tool vector.
bool m_shouldRunStitching
Whether to stitch cosmic-ray muons crossing between volumes.
pandora::StatusCode GetVolumeIdToHitListMap(VolumeIdToHitListMap &volumeIdToHitListMap) const
Get the mapping from lar tpc volume id to lists of all hits, and truncated hits.
pandora::StatusCode TagCosmicRayPfos(const PfoToFloatMap &stitchedPfosToX0Map, pandora::PfoList &clearCosmicRayPfos, pandora::PfoList &ambiguousPfos) const
Tag clear, unambiguous cosmic-ray pfos.
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.
MasterAlgorithm()
Default constructor.
SliceIdBaseTool class.
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...
SliceSelectionBaseTool class.
virtual void SelectSlices(const pandora::Algorithm *const pAlgorithm, const SliceVector &inputSliceVector, SliceVector &outputSliceVector)=0
Select which slice(s) to use; neutrino or beam slices.
StitchingBaseTool class.
virtual void Run(const MasterAlgorithm *const pAlgorithm, const pandora::PfoList *const pMultiPfoList, PfoToLArTPCMap &pfoToLArTPCMap, PfoToFloatMap &stitchedPfosToX0Map)=0
Run the algorithm tool.
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
AlgorithmTool class. Algorithm tools will tend to be tailored for specific parent algorithms,...
CaloHit class.
Definition CaloHit.h:26
Cluster class.
Definition Cluster.h:31
Externally configured algorithm class. Provides ability for external specification of algorithm-defin...
LArTPC class.
Definition LArTPC.h:26
MCParticle class.
Definition MCParticle.h:26
Pandora class.
Definition Pandora.h:40
ParticleFlowObject class.
Vertex class.
Definition Vertex.h:26
std::unordered_map< const pandora::ParticleFlowObject *, float > PfoToFloatMap
std::vector< pandora::CaloHitList > SliceVector
std::vector< pandora::PfoList > SliceHypotheses
std::unordered_map< const pandora::ParticleFlowObject *, const pandora::LArTPC * > PfoToLArTPCMap
MANAGED_CONTAINER< const Cluster * > ClusterList
std::map< unsigned int, const LArTPC * > LArTPCMap
MANAGED_CONTAINER< const DetectorGap * > DetectorGapList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const Vertex * > VertexList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList