LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
StandardPandora_module.cc
Go to the documentation of this file.
1 
8 
10 
11 #include <string>
12 
13 namespace lar_pandora {
14 
18  class StandardPandora : public LArPandora {
19  public:
26 
31 
32  private:
35  void RunPandoraInstances();
36  void ResetPandoraInstances();
38 
44  void ProvideExternalSteeringParameters(const pandora::Pandora* const pPandora) const;
45  };
46 
48 
49 } // namespace lar_pandora
50 
51 //------------------------------------------------------------------------------------------------------------------------------------------
52 // implementation follows
53 
54 #include "cetlib_except/exception.h"
55 
56 #include "Api/PandoraApi.h"
57 
63 
64 #ifdef LIBTORCH_DL
66 #endif
67 
68 namespace lar_pandora {
69 
71 
72  //------------------------------------------------------------------------------------------------------------------------------------------
73 
75  {
76  this->DeletePandoraInstances();
77  }
78 
79  //------------------------------------------------------------------------------------------------------------------------------------------
80 
82  {
83  m_pPrimaryPandora = new pandora::Pandora();
84  PANDORA_THROW_RESULT_IF(
85  pandora::STATUS_CODE_SUCCESS, !=, LArContent::RegisterAlgorithms(*m_pPrimaryPandora));
86 #ifdef LIBTORCH_DL
87  PANDORA_THROW_RESULT_IF(
88  pandora::STATUS_CODE_SUCCESS, !=, LArDLContent::RegisterAlgorithms(*m_pPrimaryPandora));
89 #endif
90  PANDORA_THROW_RESULT_IF(
91  pandora::STATUS_CODE_SUCCESS, !=, LArContent::RegisterBasicPlugins(*m_pPrimaryPandora));
92 
93  // ATTN Potentially ill defined, unless coordinate system set up to ensure that all drift volumes have same wire angles and pitches
94  PANDORA_THROW_RESULT_IF(
95  pandora::STATUS_CODE_SUCCESS,
96  !=,
97  PandoraApi::SetPseudoLayerPlugin(*m_pPrimaryPandora, new lar_content::LArPseudoLayerPlugin));
98  PANDORA_THROW_RESULT_IF(
99  pandora::STATUS_CODE_SUCCESS,
100  !=,
101  PandoraApi::SetLArTransformationPlugin(*m_pPrimaryPandora,
103 
105  }
106 
107  //------------------------------------------------------------------------------------------------------------------------------------------
108 
110  {
111  cet::search_path sp("FW_SEARCH_PATH");
112  std::string fullConfigFileName;
113 
114  if (!sp.find_file(m_configFile, fullConfigFileName))
115  throw cet::exception("StandardPandora")
116  << " ConfigurePrimaryPandoraInstance - Failed to find xml configuration file "
117  << m_configFile << " in FW search path";
118 
120  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS,
121  !=,
122  PandoraApi::ReadSettings(*m_pPrimaryPandora, fullConfigFileName));
123  }
124 
125  //------------------------------------------------------------------------------------------------------------------------------------------
126 
128  {
129  PANDORA_THROW_RESULT_IF(
130  pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::ProcessEvent(*m_pPrimaryPandora));
131  }
132 
133  //------------------------------------------------------------------------------------------------------------------------------------------
134 
136  {
137  PANDORA_THROW_RESULT_IF(
138  pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::Reset(*m_pPrimaryPandora));
139  }
140 
141  //------------------------------------------------------------------------------------------------------------------------------------------
142 
144  {
146  }
147 
148  //------------------------------------------------------------------------------------------------------------------------------------------
149 
151  const pandora::Pandora* const pPandora) const
152  {
153  auto* const pEventSteeringParameters =
156  pEventSteeringParameters->m_shouldRunStitching = m_shouldRunStitching;
157  pEventSteeringParameters->m_shouldRunCosmicHitRemoval = m_shouldRunCosmicHitRemoval;
158  pEventSteeringParameters->m_shouldRunSlicing = m_shouldRunSlicing;
159  pEventSteeringParameters->m_shouldRunNeutrinoRecoOption = m_shouldRunNeutrinoRecoOption;
160  pEventSteeringParameters->m_shouldRunCosmicRecoOption = m_shouldRunCosmicRecoOption;
161  pEventSteeringParameters->m_shouldPerformSliceId = m_shouldPerformSliceId;
162  pEventSteeringParameters->m_printOverallRecoStatus = m_printOverallRecoStatus;
163  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS,
164  !=,
165  pandora::ExternallyConfiguredAlgorithm::SetExternalParameters(
166  *pPandora, "LArMaster", pEventSteeringParameters));
167 
168 #ifdef LIBTORCH_DL
169  auto* const pEventSettingsParametersCopy =
170  new lar_content::MasterAlgorithm::ExternalSteeringParameters(*pEventSteeringParameters);
171  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS,
172  !=,
173  pandora::ExternallyConfiguredAlgorithm::SetExternalParameters(
174  *pPandora, "LArDLMaster", pEventSettingsParametersCopy));
175 #endif
176  }
177 
178 } // namespace lar_pandora
void ProvideExternalSteeringParameters(const pandora::Pandora *const pPandora) const
Pass external steering parameters, read from fhicl parameter set, to LArMaster Pandora algorithm...
Header file detailing content for use with particle flow reconstruction at liquid argon time projecti...
void DeletePandoraInstances()
Delete pandora instances.
Base producer module for reconstructing recob::PFParticles from recob::Hits.
static void DeletePandoraInstances(const pandora::Pandora *const pPrimaryPandora)
Delete all pandora instances associated with (and including) a specified primary pandora instance...
bool m_shouldRunAllHitsCosmicReco
Steering: whether to run all hits cosmic-ray reconstruction.
Definition: LArPandora.h:45
void ProcessEvent(G4int iProp, size_t nEv)
Definition: errprop.cc:171
bool m_shouldRunCosmicHitRemoval
Steering: whether to remove hits from tagged cosmic-rays.
Definition: LArPandora.h:48
pandora::InputBool m_shouldRunAllHitsCosmicReco
Whether to run all hits cosmic-ray reconstruction.
bool m_shouldRunNeutrinoRecoOption
Steering: whether to run neutrino reconstruction for each slice.
Definition: LArPandora.h:52
const pandora::Pandora * m_pPrimaryPandora
The address of the primary pandora instance.
Definition: ILArPandora.h:85
void ResetPandoraInstances()
Reset all associated pandora instances.
void RunPandoraInstances()
Run all associated pandora instances.
Header file for the master algorithm class.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
bool m_printOverallRecoStatus
Steering: whether to print current operation status messages.
Definition: LArPandora.h:58
static void AddPrimaryPandoraInstance(const pandora::Pandora *const pPrimaryPandora)
Declare a new primary pandora instance and receive the relevant multi pandora book-keeping instance...
ntupleExperimental Reset()
static pandora::StatusCode RegisterBasicPlugins(const pandora::Pandora &pandora)
Register the basic lar content plugins with pandora.
Definition: LArContent.cc:484
Header file for the rotational transformation plugin class.
Header file for the MultiPandoraApi class.
bool m_shouldRunCosmicRecoOption
Steering: whether to run cosmic-ray reconstruction for each slice.
Definition: LArPandora.h:54
std::string m_configFile
The config file.
Definition: LArPandora.h:42
static pandora::StatusCode RegisterAlgorithms(const pandora::Pandora &pandora)
Register all the lar content algorithms and tools with pandora.
Definition: LArContent.cc:468
bool m_shouldRunStitching
Steering: whether to stitch cosmic-ray muons crossing between volumes.
Definition: LArPandora.h:47
void ConfigurePandoraInstances()
Configure pandora instances.
void CreatePandoraInstances()
Create pandora instances.
Header file detailing content for use with particle flow reconstruction at liquid argon time projecti...
bool m_shouldRunSlicing
Steering: whether to slice events into separate regions for processing.
Definition: LArPandora.h:50
Header file for the lar pseudo layer plugin class.
LArPandora class.
Definition: LArPandora.h:24
static pandora::StatusCode RegisterAlgorithms(const pandora::Pandora &pandora)
Register all the lar dl content algorithms and tools with pandora.
Definition: LArDLContent.cc:91
StandardPandora(fhicl::ParameterSet const &pset)
Constructor.
bool m_shouldPerformSliceId
Steering: whether to identify slices and select most appropriate pfos.
Definition: LArPandora.h:56
LarPandoraPseudoLayerPlugin class.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33