LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_pandora::LArPandora Class Referenceabstract

LArPandora class. More...

#include "LArPandora.h"

Inheritance diagram for lar_pandora::LArPandora:
lar_pandora::ILArPandora art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper lar_pandora::StandardPandora

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 LArPandora (fhicl::ParameterSet const &pset)
 Constructor. More...
 
void beginJob ()
 
void produce (art::Event &evt)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

virtual void CreatePandoraInstances ()=0
 Create pandora instances. More...
 
virtual void ConfigurePandoraInstances ()=0
 Configure pandora instances. More...
 
virtual void DeletePandoraInstances ()=0
 Delete pandora instances. More...
 
virtual void RunPandoraInstances ()=0
 Run all associated pandora instances. More...
 
virtual void ResetPandoraInstances ()=0
 Reset all associated pandora instances. More...
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Protected Attributes

std::string m_configFile
 The config file. More...
 
bool m_shouldRunAllHitsCosmicReco
 Steering: whether to run all hits cosmic-ray reconstruction. More...
 
bool m_shouldRunStitching
 Steering: whether to stitch cosmic-ray muons crossing between volumes. More...
 
bool m_shouldRunCosmicHitRemoval
 Steering: whether to remove hits from tagged cosmic-rays. More...
 
bool m_shouldRunSlicing
 Steering: whether to slice events into separate regions for processing. More...
 
bool m_shouldRunNeutrinoRecoOption
 Steering: whether to run neutrino reconstruction for each slice. More...
 
bool m_shouldRunCosmicRecoOption
 Steering: whether to run cosmic-ray reconstruction for each slice. More...
 
bool m_shouldPerformSliceId
 Steering: whether to identify slices and select most appropriate pfos. More...
 
bool m_shouldProduceAllOutcomes
 Steering: whether to produce all reconstruction outcomes. More...
 
bool m_printOverallRecoStatus
 Steering: whether to print current operation status messages. More...
 
const pandora::Pandora * m_pPrimaryPandora
 The address of the primary pandora instance. More...
 

Private Member Functions

void CreatePandoraInput (art::Event &evt, IdToHitMap &idToHitMap)
 Create pandora input hits, mc particles etc. More...
 
void ProcessPandoraOutput (art::Event &evt, const IdToHitMap &idToHitMap)
 Process pandora output particle flow objects. More...
 

Private Attributes

std::string m_generatorModuleLabel
 The generator module label. More...
 
std::string m_geantModuleLabel
 The geant module label. More...
 
std::string m_simChannelModuleLabel
 The SimChannel producer module label. More...
 
std::string m_hitfinderModuleLabel
 The hit finder module label. More...
 
std::string m_backtrackerModuleLabel
 The back tracker module label. More...
 
std::string m_allOutcomesInstanceLabel
 The instance label for all outcomes. More...
 
bool m_enableProduction
 Whether to persist output products. More...
 
bool m_enableDetectorGaps
 Whether to pass detector gap information to Pandora instances. More...
 
bool m_enableMCParticles
 Whether to pass mc information to Pandora instances to aid development. More...
 
bool m_lineGapsCreated
 Book-keeping: whether line gap creation has been called. More...
 
LArPandoraInput::Settings m_inputSettings
 The lar pandora input settings. More...
 
LArPandoraOutput::Settings m_outputSettings
 The lar pandora output settings. More...
 
LArDriftVolumeMap m_driftVolumeMap
 The map from volume id to drift volume. More...
 

Detailed Description

LArPandora class.

Definition at line 25 of file LArPandora.h.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

lar_pandora::LArPandora::LArPandora ( fhicl::ParameterSet const &  pset)

Constructor.

Parameters
psetthe parameter set

Definition at line 45 of file LArPandora.cxx.

References fhicl::ParameterSet::get(), m_allOutcomesInstanceLabel, lar_pandora::LArPandoraInput::Settings::m_dEdX_mip, lar_pandora::LArPandoraInput::Settings::m_dx_cm, m_enableProduction, m_hitfinderModuleLabel, lar_pandora::LArPandoraOutput::Settings::m_hitfinderModuleLabel, m_inputSettings, lar_pandora::LArPandoraInput::Settings::m_int_cm, lar_pandora::LArPandoraOutput::Settings::m_isNeutrinoRecoOnlyNoSlicing, lar_pandora::LArPandoraInput::Settings::m_mips_if_negative, lar_pandora::LArPandoraInput::Settings::m_mips_max, lar_pandora::LArPandoraInput::Settings::m_mips_to_gev, m_outputSettings, lar_pandora::LArPandoraOutput::Settings::m_pProducer, lar_pandora::LArPandoraInput::Settings::m_rad_cm, lar_pandora::LArPandoraInput::Settings::m_recombination_factor, m_shouldProduceAllOutcomes, m_shouldRunCosmicRecoOption, m_shouldRunNeutrinoRecoOption, m_shouldRunSlicing, m_shouldRunStitching, lar_pandora::LArPandoraOutput::Settings::m_shouldRunStitching, lar_pandora::LArPandoraInput::Settings::m_uidOffset, lar_pandora::LArPandoraInput::Settings::m_useBirksCorrection, and lar_pandora::LArPandoraInput::Settings::m_useHitWidths.

45  :
46  ILArPandora(pset),
47  m_configFile(pset.get<std::string>("ConfigFile")),
48  m_shouldRunAllHitsCosmicReco(pset.get<bool>("ShouldRunAllHitsCosmicReco")),
49  m_shouldRunStitching(pset.get<bool>("ShouldRunStitching")),
50  m_shouldRunCosmicHitRemoval(pset.get<bool>("ShouldRunCosmicHitRemoval")),
51  m_shouldRunSlicing(pset.get<bool>("ShouldRunSlicing")),
52  m_shouldRunNeutrinoRecoOption(pset.get<bool>("ShouldRunNeutrinoRecoOption")),
53  m_shouldRunCosmicRecoOption(pset.get<bool>("ShouldRunCosmicRecoOption")),
54  m_shouldPerformSliceId(pset.get<bool>("ShouldPerformSliceId")),
55  m_shouldProduceAllOutcomes(pset.get<bool>("ProduceAllOutcomes", false)),
56  m_printOverallRecoStatus(pset.get<bool>("PrintOverallRecoStatus", false)),
57  m_generatorModuleLabel(pset.get<std::string>("GeneratorModuleLabel", "")),
58  m_geantModuleLabel(pset.get<std::string>("GeantModuleLabel", "largeant")),
59  m_simChannelModuleLabel(pset.get<std::string>("SimChannelModuleLabel", m_geantModuleLabel)),
60  m_hitfinderModuleLabel(pset.get<std::string>("HitFinderModuleLabel")),
61  m_backtrackerModuleLabel(pset.get<std::string>("BackTrackerModuleLabel","")),
62  m_allOutcomesInstanceLabel(pset.get<std::string>("AllOutcomesInstanceLabel", "allOutcomes")),
63  m_enableProduction(pset.get<bool>("EnableProduction", true)),
64  m_enableDetectorGaps(pset.get<bool>("EnableLineGaps", true)),
65  m_enableMCParticles(pset.get<bool>("EnableMCParticles", false)),
66  m_lineGapsCreated(false)
67 {
68  m_inputSettings.m_useHitWidths = pset.get<bool>("UseHitWidths", true);
69  m_inputSettings.m_useBirksCorrection = pset.get<bool>("UseBirksCorrection", false);
70  m_inputSettings.m_uidOffset = pset.get<int>("UidOffset", 100000000);
71  m_inputSettings.m_dx_cm = pset.get<double>("DefaultHitWidth", 0.5);
72  m_inputSettings.m_int_cm = pset.get<double>("InteractionLength", 84.);
73  m_inputSettings.m_rad_cm = pset.get<double>("RadiationLength", 14.);
74  m_inputSettings.m_dEdX_mip = pset.get<double>("dEdXmip", 2.);
75  m_inputSettings.m_mips_max = pset.get<double>("MipsMax", 50.);
76  m_inputSettings.m_mips_if_negative = pset.get<double>("MipsIfNegative", 0.);
77  m_inputSettings.m_mips_to_gev = pset.get<double>("MipsToGeV", 3.5e-4);
78  m_inputSettings.m_recombination_factor = pset.get<double>("RecombinationFactor", 0.63);
83 
85  {
86  // Set up the instance names to produces
87  std::vector<std::string> instanceNames({""});
89  instanceNames.push_back(m_allOutcomesInstanceLabel);
90 
91  for (const std::string &instanceName : instanceNames)
92  {
93  produces< std::vector<recob::PFParticle> >(instanceName);
94  produces< std::vector<recob::SpacePoint> >(instanceName);
95  produces< std::vector<recob::Cluster> >(instanceName);
96  produces< std::vector<recob::Vertex> >(instanceName);
97  produces< std::vector<larpandoraobj::PFParticleMetadata> >(instanceName);
98  produces< std::vector<recob::Slice> >(instanceName);
99 
100  produces< art::Assns<recob::PFParticle, larpandoraobj::PFParticleMetadata> >(instanceName);
101  produces< art::Assns<recob::PFParticle, recob::SpacePoint> >(instanceName);
102  produces< art::Assns<recob::PFParticle, recob::Cluster> >(instanceName);
103  produces< art::Assns<recob::PFParticle, recob::Vertex> >(instanceName);
104  produces< art::Assns<recob::PFParticle, recob::Slice> >(instanceName);
105  produces< art::Assns<recob::SpacePoint, recob::Hit> >(instanceName);
106  produces< art::Assns<recob::Cluster, recob::Hit> >(instanceName);
107  produces< art::Assns<recob::Slice, recob::Hit> >(instanceName);
108 
110  {
111  produces< std::vector<anab::T0> >(instanceName);
112  produces< art::Assns<recob::PFParticle, anab::T0> >(instanceName);
113  }
114  }
115  }
116 }
std::string m_allOutcomesInstanceLabel
The instance label for all outcomes.
Definition: LArPandora.h:61
bool m_shouldRunAllHitsCosmicReco
Steering: whether to run all hits cosmic-ray reconstruction.
Definition: LArPandora.h:41
bool m_shouldProduceAllOutcomes
Steering: whether to produce all reconstruction outcomes.
Definition: LArPandora.h:48
bool m_isNeutrinoRecoOnlyNoSlicing
If we are running the neutrino reconstruction only with no slicing.
std::string m_backtrackerModuleLabel
The back tracker module label.
Definition: LArPandora.h:59
bool m_lineGapsCreated
Book-keeping: whether line gap creation has been called.
Definition: LArPandora.h:66
bool m_shouldRunCosmicHitRemoval
Steering: whether to remove hits from tagged cosmic-rays.
Definition: LArPandora.h:43
std::string m_hitfinderModuleLabel
The hit finder module label.
bool m_shouldRunNeutrinoRecoOption
Steering: whether to run neutrino reconstruction for each slice.
Definition: LArPandora.h:45
bool m_printOverallRecoStatus
Steering: whether to print current operation status messages.
Definition: LArPandora.h:49
std::string m_generatorModuleLabel
The generator module label.
Definition: LArPandora.h:55
std::string m_geantModuleLabel
The geant module label.
Definition: LArPandora.h:56
bool m_shouldRunCosmicRecoOption
Steering: whether to run cosmic-ray reconstruction for each slice.
Definition: LArPandora.h:46
std::string m_configFile
The config file.
Definition: LArPandora.h:39
bool m_enableDetectorGaps
Whether to pass detector gap information to Pandora instances.
Definition: LArPandora.h:64
bool m_shouldRunStitching
Steering: whether to stitch cosmic-ray muons crossing between volumes.
Definition: LArPandora.h:42
LArPandoraInput::Settings m_inputSettings
The lar pandora input settings.
Definition: LArPandora.h:68
LArPandoraOutput::Settings m_outputSettings
The lar pandora output settings.
Definition: LArPandora.h:69
ILArPandora(fhicl::ParameterSet const &pset)
Constructor.
Definition: ILArPandora.h:87
bool m_shouldRunSlicing
Steering: whether to slice events into separate regions for processing.
Definition: LArPandora.h:44
bool m_enableMCParticles
Whether to pass mc information to Pandora instances to aid development.
Definition: LArPandora.h:65
bool m_enableProduction
Whether to persist output products.
Definition: LArPandora.h:63
std::string m_simChannelModuleLabel
The SimChannel producer module label.
Definition: LArPandora.h:57
bool m_shouldPerformSliceId
Steering: whether to identify slices and select most appropriate pfos.
Definition: LArPandora.h:47
std::string m_hitfinderModuleLabel
The hit finder module label.
Definition: LArPandora.h:58

Member Function Documentation

void lar_pandora::LArPandora::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 120 of file LArPandora.cxx.

References lar_pandora::ILArPandora::ConfigurePandoraInstances(), lar_pandora::LArPandoraInput::CreatePandoraDetectorGaps(), lar_pandora::ILArPandora::CreatePandoraInstances(), lar_pandora::LArPandoraInput::CreatePandoraLArTPCs(), lar_pandora::LArPandoraGeometry::LoadDetectorGaps(), lar_pandora::LArPandoraGeometry::LoadGeometry(), m_driftVolumeMap, m_enableDetectorGaps, m_inputSettings, m_outputSettings, lar_pandora::LArPandoraInput::Settings::m_pPrimaryPandora, lar_pandora::LArPandoraOutput::Settings::m_pPrimaryPandora, and lar_pandora::ILArPandora::m_pPrimaryPandora.

121 {
122  LArDriftVolumeList driftVolumeList;
124 
125  this->CreatePandoraInstances();
126 
127  if (!m_pPrimaryPandora)
128  throw cet::exception("LArPandora") << " LArPandora::beginJob - failed to create primary Pandora instance " << std::endl;
129 
132 
133  // Pass basic LArTPC information to pandora instances
135 
136  // If using global drift volume approach, pass details of gaps between daughter volumes to the pandora instance
138  {
139  LArDetectorGapList listOfGaps;
141  LArPandoraInput::CreatePandoraDetectorGaps(m_inputSettings, driftVolumeList, listOfGaps);
142  }
143 
144  // Parse Pandora settings xml files
146 }
static void CreatePandoraDetectorGaps(const Settings &settings, const LArDriftVolumeList &driftVolumeList, const LArDetectorGapList &listOfGaps)
Create pandora line gaps to cover dead regions between TPCs in a global drift volume approach...
const pandora::Pandora * m_pPrimaryPandora
std::vector< LArDetectorGap > LArDetectorGapList
std::vector< LArDriftVolume > LArDriftVolumeList
const pandora::Pandora * m_pPrimaryPandora
static void LoadGeometry(LArDriftVolumeList &outputVolumeList, LArDriftVolumeMap &outputVolumeMap)
Load drift volume geometry.
const pandora::Pandora * m_pPrimaryPandora
The address of the primary pandora instance.
Definition: ILArPandora.h:82
LArDriftVolumeMap m_driftVolumeMap
The map from volume id to drift volume.
Definition: LArPandora.h:71
virtual void CreatePandoraInstances()=0
Create pandora instances.
bool m_enableDetectorGaps
Whether to pass detector gap information to Pandora instances.
Definition: LArPandora.h:64
LArPandoraInput::Settings m_inputSettings
The lar pandora input settings.
Definition: LArPandora.h:68
static void CreatePandoraLArTPCs(const Settings &settings, const LArDriftVolumeList &driftVolumeList)
Create pandora LArTPCs to represent the different drift volumes in use.
LArPandoraOutput::Settings m_outputSettings
The lar pandora output settings.
Definition: LArPandora.h:69
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual void ConfigurePandoraInstances()=0
Configure pandora instances.
static void LoadDetectorGaps(LArDetectorGapList &listOfGaps)
Load the 2D gaps that go with the chosen geometry.
virtual void lar_pandora::ILArPandora::ConfigurePandoraInstances ( )
protectedpure virtualinherited

Configure pandora instances.

Implemented in lar_pandora::StandardPandora.

Referenced by beginJob().

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
void lar_pandora::LArPandora::CreatePandoraInput ( art::Event evt,
IdToHitMap idToHitMap 
)
privatevirtual

Create pandora input hits, mc particles etc.

Parameters
evtthe art event
idToHitMapto receive the populated pandora hit id to art hit map

Implements lar_pandora::ILArPandora.

Definition at line 161 of file LArPandora.cxx.

References lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(), lar_pandora::LArPandoraHelper::CollectGeneratorMCParticles(), lar_pandora::LArPandoraHelper::CollectHits(), lar_pandora::LArPandoraHelper::CollectMCParticles(), lar_pandora::LArPandoraHelper::CollectSimChannels(), lar_pandora::LArPandoraInput::CreatePandoraHits2D(), lar_pandora::LArPandoraInput::CreatePandoraMCLinks2D(), lar_pandora::LArPandoraInput::CreatePandoraMCParticles(), lar_pandora::LArPandoraInput::CreatePandoraReadoutGaps(), art::Event::isRealData(), m_backtrackerModuleLabel, m_driftVolumeMap, m_enableDetectorGaps, m_enableMCParticles, m_geantModuleLabel, m_generatorModuleLabel, m_hitfinderModuleLabel, m_inputSettings, m_lineGapsCreated, and m_simChannelModuleLabel.

Referenced by produce().

162 {
163  // ATTN Should complete gap creation in begin job callback, but channel status service functionality unavailable at that point
165  {
167  m_lineGapsCreated = true;
168  }
169 
170  HitVector artHits;
171  SimChannelVector artSimChannels;
172  HitsToTrackIDEs artHitsToTrackIDEs;
173  MCParticleVector artMCParticleVector;
174  RawMCParticleVector generatorArtMCParticleVector;
175  MCTruthToMCParticles artMCTruthToMCParticles;
176  MCParticlesToMCTruth artMCParticlesToMCTruth;
177 
179 
180  if (m_enableMCParticles && !evt.isRealData())
181  {
182  LArPandoraHelper::CollectMCParticles(evt, m_geantModuleLabel, artMCParticleVector);
183 
184  if (!m_generatorModuleLabel.empty())
185  LArPandoraHelper::CollectGeneratorMCParticles(evt, m_generatorModuleLabel, generatorArtMCParticleVector);
186 
187  LArPandoraHelper::CollectMCParticles(evt, m_geantModuleLabel, artMCTruthToMCParticles, artMCParticlesToMCTruth);
188 
190  if (!artSimChannels.empty())
191  {
192  LArPandoraHelper::BuildMCParticleHitMaps(artHits, artSimChannels, artHitsToTrackIDEs);
193  }
194  else
195  {
196  if (m_backtrackerModuleLabel.empty())
197  {
198  throw cet::exception("LArPandora") << "LArPandora::CreatePandoraInput - Can't build MCParticle to Hit map." << std::endl <<
199  "No SimChannels found with label \"" << m_simChannelModuleLabel << "\", and BackTrackerModuleLabel isn't set in FHiCL." << std::endl;
200  }
201 
203  }
204  }
205 
207 
208  if (m_enableMCParticles && !evt.isRealData())
209  {
210  LArPandoraInput::CreatePandoraMCParticles(m_inputSettings, artMCTruthToMCParticles, artMCParticlesToMCTruth, generatorArtMCParticleVector);
211  LArPandoraInput::CreatePandoraMCLinks2D(m_inputSettings, idToHitMap, artHitsToTrackIDEs);
212  }
213 }
std::map< art::Ptr< recob::Hit >, TrackIDEVector > HitsToTrackIDEs
static void CreatePandoraMCParticles(const Settings &settings, const MCTruthToMCParticles &truthToParticles, const MCParticlesToMCTruth &particlesToTruth, const RawMCParticleVector &generatorMCParticleVector)
Create the Pandora MC particles from the MC particles.
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::string m_backtrackerModuleLabel
The back tracker module label.
Definition: LArPandora.h:59
bool isRealData() const
Definition: Event.h:83
static void CreatePandoraHits2D(const Settings &settings, const LArDriftVolumeMap &driftVolumeMap, const HitVector &hitVector, IdToHitMap &idToHitMap)
Create the Pandora 2D hits from the ART hits.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static void CollectGeneratorMCParticles(const art::Event &evt, const std::string &label, RawMCParticleVector &particleVector)
Collect a vector of MCParticle objects from the generator in the ART event record. ATTN: This function is needed as accessing generator (opposed to Geant4) level MCParticles requires use of MCTruth block.
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
bool m_lineGapsCreated
Book-keeping: whether line gap creation has been called.
Definition: LArPandora.h:66
std::vector< art::Ptr< sim::SimChannel > > SimChannelVector
static void BuildMCParticleHitMaps(const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
LArDriftVolumeMap m_driftVolumeMap
The map from volume id to drift volume.
Definition: LArPandora.h:71
std::string m_generatorModuleLabel
The generator module label.
Definition: LArPandora.h:55
std::string m_geantModuleLabel
The geant module label.
Definition: LArPandora.h:56
static void CreatePandoraMCLinks2D(const Settings &settings, const HitMap &hitMap, const HitsToTrackIDEs &hitToParticleMap)
Create links between the 2D hits and Pandora MC particles.
std::vector< art::Ptr< recob::Hit > > HitVector
static void CollectSimChannels(const art::Event &evt, const std::string &label, SimChannelVector &simChannelVector)
Collect a vector of SimChannel objects from the ART event record.
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
static void CreatePandoraReadoutGaps(const Settings &settings, const LArDriftVolumeMap &driftVolumeMap)
Create pandora line gaps to cover any (continuous regions of) bad channels.
bool m_enableDetectorGaps
Whether to pass detector gap information to Pandora instances.
Definition: LArPandora.h:64
std::vector< simb::MCParticle > RawMCParticleVector
LArPandoraInput::Settings m_inputSettings
The lar pandora input settings.
Definition: LArPandora.h:68
bool m_enableMCParticles
Whether to pass mc information to Pandora instances to aid development.
Definition: LArPandora.h:65
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
std::string m_simChannelModuleLabel
The SimChannel producer module label.
Definition: LArPandora.h:57
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string m_hitfinderModuleLabel
The hit finder module label.
Definition: LArPandora.h:58
virtual void lar_pandora::ILArPandora::CreatePandoraInstances ( )
protectedpure virtualinherited

Create pandora instances.

Implemented in lar_pandora::StandardPandora.

Referenced by beginJob().

CurrentProcessingContext const * art::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
virtual void lar_pandora::ILArPandora::DeletePandoraInstances ( )
protectedpure virtualinherited

Delete pandora instances.

Implemented in lar_pandora::StandardPandora.

EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References B, and art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
Int_t B
Definition: plot.C:25
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void lar_pandora::LArPandora::ProcessPandoraOutput ( art::Event evt,
const IdToHitMap idToHitMap 
)
privatevirtual

Process pandora output particle flow objects.

Parameters
evtthe art event
idToHitMapthe pandora hit id to art hit map

Implements lar_pandora::ILArPandora.

Definition at line 217 of file LArPandora.cxx.

References m_allOutcomesInstanceLabel, lar_pandora::LArPandoraOutput::Settings::m_allOutcomesInstanceLabel, m_enableProduction, m_outputSettings, m_shouldProduceAllOutcomes, lar_pandora::LArPandoraOutput::Settings::m_shouldProduceAllOutcomes, and lar_pandora::LArPandoraOutput::ProduceArtOutput().

Referenced by produce().

218 {
219  if (m_enableProduction)
220  {
223 
225  {
229  }
230  }
231 }
std::string m_allOutcomesInstanceLabel
The instance label for all outcomes.
Definition: LArPandora.h:61
std::string m_allOutcomesInstanceLabel
The label for the instance producing all outcomes.
bool m_shouldProduceAllOutcomes
Steering: whether to produce all reconstruction outcomes.
Definition: LArPandora.h:48
static void ProduceArtOutput(const Settings &settings, const IdToHitMap &idToHitMap, art::Event &evt)
Convert the Pandora PFOs into ART clusters and write into ART event.
LArPandoraOutput::Settings m_outputSettings
The lar pandora output settings.
Definition: LArPandora.h:69
bool m_shouldProduceAllOutcomes
If all outcomes should be produced in separate collections (choose false if you only require the cons...
bool m_enableProduction
Whether to persist output products.
Definition: LArPandora.h:63
void lar_pandora::LArPandora::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 150 of file LArPandora.cxx.

References CreatePandoraInput(), ProcessPandoraOutput(), lar_pandora::ILArPandora::ResetPandoraInstances(), and lar_pandora::ILArPandora::RunPandoraInstances().

151 {
152  IdToHitMap idToHitMap;
153  this->CreatePandoraInput(evt, idToHitMap);
154  this->RunPandoraInstances();
155  this->ProcessPandoraOutput(evt, idToHitMap);
156  this->ResetPandoraInstances();
157 }
void CreatePandoraInput(art::Event &evt, IdToHitMap &idToHitMap)
Create pandora input hits, mc particles etc.
Definition: LArPandora.cxx:161
std::map< int, art::Ptr< recob::Hit > > IdToHitMap
Definition: ILArPandora.h:20
void ProcessPandoraOutput(art::Event &evt, const IdToHitMap &idToHitMap)
Process pandora output particle flow objects.
Definition: LArPandora.cxx:217
virtual void ResetPandoraInstances()=0
Reset all associated pandora instances.
virtual void RunPandoraInstances()=0
Run all associated pandora instances.
virtual void lar_pandora::ILArPandora::ResetPandoraInstances ( )
protectedpure virtualinherited

Reset all associated pandora instances.

Implemented in lar_pandora::StandardPandora.

Referenced by produce().

virtual void lar_pandora::ILArPandora::RunPandoraInstances ( )
protectedpure virtualinherited

Run all associated pandora instances.

Implemented in lar_pandora::StandardPandora.

Referenced by produce().

void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

std::string lar_pandora::LArPandora::m_allOutcomesInstanceLabel
private

The instance label for all outcomes.

Definition at line 61 of file LArPandora.h.

Referenced by LArPandora(), and ProcessPandoraOutput().

std::string lar_pandora::LArPandora::m_backtrackerModuleLabel
private

The back tracker module label.

Definition at line 59 of file LArPandora.h.

Referenced by CreatePandoraInput().

std::string lar_pandora::LArPandora::m_configFile
protected

The config file.

Definition at line 39 of file LArPandora.h.

Referenced by lar_pandora::StandardPandora::ConfigurePandoraInstances().

LArDriftVolumeMap lar_pandora::LArPandora::m_driftVolumeMap
private

The map from volume id to drift volume.

Definition at line 71 of file LArPandora.h.

Referenced by beginJob(), and CreatePandoraInput().

bool lar_pandora::LArPandora::m_enableDetectorGaps
private

Whether to pass detector gap information to Pandora instances.

Definition at line 64 of file LArPandora.h.

Referenced by beginJob(), and CreatePandoraInput().

bool lar_pandora::LArPandora::m_enableMCParticles
private

Whether to pass mc information to Pandora instances to aid development.

Definition at line 65 of file LArPandora.h.

Referenced by CreatePandoraInput().

bool lar_pandora::LArPandora::m_enableProduction
private

Whether to persist output products.

Definition at line 63 of file LArPandora.h.

Referenced by LArPandora(), and ProcessPandoraOutput().

std::string lar_pandora::LArPandora::m_geantModuleLabel
private

The geant module label.

Definition at line 56 of file LArPandora.h.

Referenced by CreatePandoraInput().

std::string lar_pandora::LArPandora::m_generatorModuleLabel
private

The generator module label.

Definition at line 55 of file LArPandora.h.

Referenced by CreatePandoraInput().

std::string lar_pandora::LArPandora::m_hitfinderModuleLabel
private

The hit finder module label.

Definition at line 58 of file LArPandora.h.

Referenced by CreatePandoraInput(), and LArPandora().

LArPandoraInput::Settings lar_pandora::LArPandora::m_inputSettings
private

The lar pandora input settings.

Definition at line 68 of file LArPandora.h.

Referenced by beginJob(), CreatePandoraInput(), and LArPandora().

bool lar_pandora::LArPandora::m_lineGapsCreated
private

Book-keeping: whether line gap creation has been called.

Definition at line 66 of file LArPandora.h.

Referenced by CreatePandoraInput().

LArPandoraOutput::Settings lar_pandora::LArPandora::m_outputSettings
private

The lar pandora output settings.

Definition at line 69 of file LArPandora.h.

Referenced by beginJob(), LArPandora(), and ProcessPandoraOutput().

bool lar_pandora::LArPandora::m_printOverallRecoStatus
protected

Steering: whether to print current operation status messages.

Definition at line 49 of file LArPandora.h.

Referenced by lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldPerformSliceId
protected

Steering: whether to identify slices and select most appropriate pfos.

Definition at line 47 of file LArPandora.h.

Referenced by lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldProduceAllOutcomes
protected

Steering: whether to produce all reconstruction outcomes.

Definition at line 48 of file LArPandora.h.

Referenced by LArPandora(), and ProcessPandoraOutput().

bool lar_pandora::LArPandora::m_shouldRunAllHitsCosmicReco
protected

Steering: whether to run all hits cosmic-ray reconstruction.

Definition at line 41 of file LArPandora.h.

Referenced by lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldRunCosmicHitRemoval
protected

Steering: whether to remove hits from tagged cosmic-rays.

Definition at line 43 of file LArPandora.h.

Referenced by lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldRunCosmicRecoOption
protected

Steering: whether to run cosmic-ray reconstruction for each slice.

Definition at line 46 of file LArPandora.h.

Referenced by LArPandora(), and lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldRunNeutrinoRecoOption
protected

Steering: whether to run neutrino reconstruction for each slice.

Definition at line 45 of file LArPandora.h.

Referenced by LArPandora(), and lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldRunSlicing
protected

Steering: whether to slice events into separate regions for processing.

Definition at line 44 of file LArPandora.h.

Referenced by LArPandora(), and lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

bool lar_pandora::LArPandora::m_shouldRunStitching
protected

Steering: whether to stitch cosmic-ray muons crossing between volumes.

Definition at line 42 of file LArPandora.h.

Referenced by LArPandora(), and lar_pandora::StandardPandora::ProvideExternalSteeringParameters().

std::string lar_pandora::LArPandora::m_simChannelModuleLabel
private

The SimChannel producer module label.

Definition at line 57 of file LArPandora.h.

Referenced by CreatePandoraInput().


The documentation for this class was generated from the following files: