Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lar_pandora::LArPandoraExternalEventBuilding Class Reference
Inheritance diagram for lar_pandora::LArPandoraExternalEventBuilding:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 LArPandoraExternalEventBuilding (fhicl::ParameterSet const &pset)
 
 LArPandoraExternalEventBuilding (LArPandoraExternalEventBuilding const &)=delete
 
 LArPandoraExternalEventBuilding (LArPandoraExternalEventBuilding &&)=delete
 
LArPandoraExternalEventBuildingoperator= (LArPandoraExternalEventBuilding const &)=delete
 
LArPandoraExternalEventBuildingoperator= (LArPandoraExternalEventBuilding &&)=delete
 
void produce (art::Event &evt) override
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Types

typedef std::map< art::Ptr< recob::PFParticle >, art::Ptr< larpandoraobj::PFParticleMetadata > > PFParticleToMetadata
 

Private Member Functions

void CollectPFParticles (const art::Event &evt, PFParticleToMetadata &particlesToMetadata, PFParticleVector &particles) const
 Collect PFParticles from the ART event and their mapping to metadata objects. More...
 
void BuildPFParticleMap (const PFParticleToMetadata &particlesToMetadata, PFParticleMap &particleMap) const
 Build mapping from ID to PFParticle for fast navigation through the hierarchy. More...
 
void CollectClearCosmicRays (const PFParticleVector &allParticles, const PFParticleToMetadata &particlesToMetadata, const PFParticleMap &particleMap, PFParticleVector &clearCosmics) const
 Collect PFParticles that have been identified as clear cosmic ray muons by pandora. More...
 
void CollectSlices (const PFParticleVector &allParticles, const PFParticleToMetadata &particlesToMetadata, const PFParticleMap &particleMap, SliceVector &slices) const
 Collect slices. More...
 
void CollectConsolidatedParticles (const PFParticleVector &allParticles, const PFParticleVector &clearCosmics, const SliceVector &slices, PFParticleVector &consolidatedParticles) const
 Get the consolidated collection of particles based on the slice ids. More...
 
float GetMetadataValue (const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata, const std::string &key) const
 Query a metadata object for a given key and return the corresponding value. More...
 
bool IsTarget (const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata) const
 Query a metadata object to see if it is a target particle. More...
 

Private Attributes

std::string m_inputProducerLabel
 Label for the Pandora instance that produced the collections we want to consolidated. More...
 
std::string m_trackProducerLabel
 Label for the track producer using the Pandora instance that produced the collections we want to consolidate. More...
 
std::string m_showerProducerLabel
 Label for the shower producer using the Pandora instance that produced the collections we want to consolidate. More...
 
std::string m_hitProducerLabel
 Label for the hit producer that was used as input to the Pandora instance specified. More...
 
bool m_shouldProduceT0s
 If we should produce T0s (relevant when stitching over multiple drift volumes) More...
 
art::InputTag m_pandoraTag
 The input tag for the pandora producer. More...
 
std::unique_ptr< SliceIdBaseToolm_sliceIdTool
 The slice id tool. More...
 
bool m_useTestBeamMode
 If we should expect a test-beam (instead of a neutrino) slice. More...
 
std::string m_targetKey
 The metadata key for a PFParticle to determine if it is the target. More...
 
std::string m_scoreKey
 The metadata key for the score of the target slice from Pandora. More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 32 of file LArPandoraExternalEventBuilding_module.cc.

Member Typedef Documentation

Definition at line 45 of file LArPandoraExternalEventBuilding_module.cc.

Constructor & Destructor Documentation

lar_pandora::LArPandoraExternalEventBuilding::LArPandoraExternalEventBuilding ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 137 of file LArPandoraExternalEventBuilding_module.cc.

137  :
138  EDProducer{pset},
139  m_inputProducerLabel(pset.get<std::string>("InputProducerLabel")),
140  m_trackProducerLabel(pset.get<std::string>("TrackProducerLabel")),
141  m_showerProducerLabel(pset.get<std::string>("ShowerProducerLabel")),
142  m_hitProducerLabel(pset.get<std::string>("HitProducerLabel")),
143  m_shouldProduceT0s(pset.get<bool>("ShouldProduceT0s")),
145  m_sliceIdTool(art::make_tool<SliceIdBaseTool>(pset.get<fhicl::ParameterSet>("SliceIdTool"))),
146  m_useTestBeamMode(pset.get<bool>("ShouldUseTestBeamMode", false)),
147  m_targetKey(m_useTestBeamMode ? "IsTestBeam" : "IsNeutrino"),
148  m_scoreKey(m_useTestBeamMode ? "TestBeamScore" : "NuScore")
149 {
150  produces< std::vector<recob::PFParticle> >();
151  produces< std::vector<recob::SpacePoint> >();
152  produces< std::vector<recob::Cluster> >();
153  produces< std::vector<recob::Vertex> >();
154  produces< std::vector<recob::Slice> >();
155  produces< std::vector<recob::Track> >();
156  produces< std::vector<recob::Shower> >();
157  produces< std::vector<recob::PCAxis> >();
158  produces< std::vector<larpandoraobj::PFParticleMetadata> >();
159 
160  produces< art::Assns<recob::PFParticle, recob::SpacePoint> >();
161  produces< art::Assns<recob::PFParticle, recob::Cluster> >();
162  produces< art::Assns<recob::PFParticle, recob::Vertex> >();
163  produces< art::Assns<recob::PFParticle, recob::Slice> >();
164  produces< art::Assns<recob::PFParticle, recob::Track> >();
165  produces< art::Assns<recob::PFParticle, recob::Shower> >();
166  produces< art::Assns<recob::PFParticle, recob::PCAxis> >();
167  produces< art::Assns<recob::PFParticle, larpandoraobj::PFParticleMetadata> >();
168  produces< art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta> >();
169  produces< art::Assns<recob::Shower, recob::Hit> >();
170  produces< art::Assns<recob::Shower, recob::PCAxis> >();
171  produces< art::Assns<recob::SpacePoint, recob::Hit> >();
172  produces< art::Assns<recob::Cluster, recob::Hit> >();
173  produces< art::Assns<recob::Slice, recob::Hit> >();
174 
175  if (m_shouldProduceT0s)
176  {
177  produces< std::vector<anab::T0> >();
178  produces< art::Assns<recob::PFParticle, anab::T0> >();
179  }
180  }
std::unique_ptr< SliceIdBaseTool > m_sliceIdTool
The slice id tool.
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::string m_trackProducerLabel
Label for the track producer using the Pandora instance that produced the collections we want to cons...
std::string m_showerProducerLabel
Label for the shower producer using the Pandora instance that produced the collections we want to con...
std::string m_hitProducerLabel
Label for the hit producer that was used as input to the Pandora instance specified.
std::string m_targetKey
The metadata key for a PFParticle to determine if it is the target.
std::string m_scoreKey
The metadata key for the score of the target slice from Pandora.
bool m_useTestBeamMode
If we should expect a test-beam (instead of a neutrino) slice.
bool m_shouldProduceT0s
If we should produce T0s (relevant when stitching over multiple drift volumes)
art::InputTag m_pandoraTag
The input tag for the pandora producer.
std::string m_inputProducerLabel
Label for the Pandora instance that produced the collections we want to consolidated.
lar_pandora::LArPandoraExternalEventBuilding::LArPandoraExternalEventBuilding ( LArPandoraExternalEventBuilding const &  )
delete
lar_pandora::LArPandoraExternalEventBuilding::LArPandoraExternalEventBuilding ( LArPandoraExternalEventBuilding &&  )
delete

Member Function Documentation

void lar_pandora::LArPandoraExternalEventBuilding::BuildPFParticleMap ( const PFParticleToMetadata particlesToMetadata,
PFParticleMap particleMap 
) const
private

Build mapping from ID to PFParticle for fast navigation through the hierarchy.

Parameters
particlesToMetadatathe input mapping from PFParticles to their metadata
particleMapthe output mapping from ID to PFParticle

Definition at line 236 of file LArPandoraExternalEventBuilding_module.cc.

237 {
238  for (const auto &entry : particlesToMetadata)
239  {
240  if (!particleMap.insert(PFParticleMap::value_type(entry.first->Self(), entry.first)).second)
241  throw cet::exception("LArPandoraExternalEventBuilding") << "Repeated PFParticles" << std::endl;
242  }
243 }
QList< Entry > entry
QCollection::Item first()
Definition: qglist.cpp:807
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
void lar_pandora::LArPandoraExternalEventBuilding::CollectClearCosmicRays ( const PFParticleVector allParticles,
const PFParticleToMetadata particlesToMetadata,
const PFParticleMap particleMap,
PFParticleVector clearCosmics 
) const
private

Collect PFParticles that have been identified as clear cosmic ray muons by pandora.

Parameters
allParticlesinput vector of all particles
particlesToMetadatathe input mapping from PFParticles to their metadata
particleMapthe input mapping from ID to PFParticle
clearCosmicsthe output vector of clear cosmic rays

Definition at line 247 of file LArPandoraExternalEventBuilding_module.cc.

248 {
249  for (const auto &part : allParticles)
250  {
251  // Get the parent of the particle
252  const auto parentIt(particlesToMetadata.find(LArPandoraHelper::GetParentPFParticle(particleMap, part)));
253  if (parentIt == particlesToMetadata.end())
254  throw cet::exception("LArPandoraExternalEventBuilding") << "Found PFParticle without metadata" << std::endl;
255 
256  // ATTN particles without the "IsClearCosmic" parameter are not clear cosmics
257  try
258  {
259  if (static_cast<bool>(std::round(this->GetMetadataValue(parentIt->second, "IsClearCosmic"))))
260  clearCosmics.push_back(part);
261  }
262  catch (const cet::exception &)
263  {
264  }
265  }
266 }
static art::Ptr< recob::PFParticle > GetParentPFParticle(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the top-level parent particle by navigating up the chain of parent/daughter associations...
float GetMetadataValue(const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata, const std::string &key) const
Query a metadata object for a given key and return the corresponding value.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
void lar_pandora::LArPandoraExternalEventBuilding::CollectConsolidatedParticles ( const PFParticleVector allParticles,
const PFParticleVector clearCosmics,
const SliceVector slices,
PFParticleVector consolidatedParticles 
) const
private

Get the consolidated collection of particles based on the slice ids.

Parameters
allParticlesinput vector of all particles
clearCosmicsthe input vector of clear cosmic ray muons
slicesthe input vector of slices
consolidatedParticlesthe output vector of particles to include in the consolidated output

Definition at line 360 of file LArPandoraExternalEventBuilding_module.cc.

361 {
362  PFParticleVector collectedParticles;
363  collectedParticles.insert(collectedParticles.end(), clearCosmics.begin(), clearCosmics.end());
364 
365  for (const auto &slice : slices)
366  {
367  const PFParticleVector &particles(slice.IsTaggedAsTarget() ? slice.GetTargetHypothesis() : slice.GetCosmicRayHypothesis());
368  collectedParticles.insert(collectedParticles.end(), particles.begin(), particles.end());
369  }
370 
371  // ATTN the collected particles are the ones we want to output, but here we loop over all particles to ensure that the consolidated
372  // particles have the same ordering.
373  for (const auto &part : allParticles)
374  {
375  if (std::find(collectedParticles.begin(), collectedParticles.end(), part) != collectedParticles.end())
376  consolidatedParticles.push_back(part);
377  }
378 }
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
void lar_pandora::LArPandoraExternalEventBuilding::CollectPFParticles ( const art::Event evt,
PFParticleToMetadata particlesToMetadata,
PFParticleVector particles 
) const
private

Collect PFParticles from the ART event and their mapping to metadata objects.

Parameters
evtthe ART event
particlesToMetadatathe output mapping from PFParticles to their metadata
particlesthe output vector of particles

Definition at line 212 of file LArPandoraExternalEventBuilding_module.cc.

213 {
215  evt.getByLabel(m_pandoraTag, pfParticleHandle);
216 
217  art::FindManyP<larpandoraobj::PFParticleMetadata> pfParticleMetadataAssoc(pfParticleHandle, evt, m_pandoraTag);
218 
219  for (unsigned int i = 0; i < pfParticleHandle->size(); ++i)
220  {
221  const art::Ptr<recob::PFParticle> part(pfParticleHandle, i);
222  const auto &metadata(pfParticleMetadataAssoc.at(part.key()));
223 
224  particles.push_back(part);
225 
226  if (metadata.size() != 1)
227  throw cet::exception("LArPandora") << " LArPandoraExternalEventBuilding::CollectPFParticles -- Found a PFParticle without exactly 1 metadata associated." << std::endl;
228 
229  if (!particlesToMetadata.insert(PFParticleToMetadata::value_type(part, metadata.front())).second)
230  throw cet::exception("LArPandoraExternalEventBuilding") << "Repeated PFParticles" << std::endl;
231  }
232 }
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
art::InputTag m_pandoraTag
The input tag for the pandora producer.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
void lar_pandora::LArPandoraExternalEventBuilding::CollectSlices ( const PFParticleVector allParticles,
const PFParticleToMetadata particlesToMetadata,
const PFParticleMap particleMap,
SliceVector slices 
) const
private

Collect slices.

Parameters
allParticlesinput vector of all particles
particlesToMetadatathe input mapping from PFParticles to their metadata
particleMapthe input mapping from ID to PFParticle
slicesthe output vector of slices

Definition at line 270 of file LArPandoraExternalEventBuilding_module.cc.

271 {
272  std::map<unsigned int, float> targetScores;
273  std::map<unsigned int, PFParticleVector> crHypotheses;
274  std::map<unsigned int, PFParticleVector> targetHypotheses;
275  std::vector<unsigned int> usedSliceIds;
276 
277  // Collect the slice information
278  for (const auto &part : allParticles)
279  {
280  // Find the parent PFParticle
281  const auto parentIt(particlesToMetadata.find(LArPandoraHelper::GetParentPFParticle(particleMap, part)));
282  if (parentIt == particlesToMetadata.end())
283  throw cet::exception("LArPandoraExternalEventBuilding") << "Found PFParticle without metadata" << std::endl;
284 
285  // Skip PFParticles that are clear cosmics
286  try
287  {
288  if (static_cast<bool>(std::round(this->GetMetadataValue(parentIt->second, "IsClearCosmic"))))
289  continue;
290  }
291  catch (const cet::exception &)
292  {
293  }
294 
295  const unsigned int sliceId(static_cast<unsigned int>(std::round(this->GetMetadataValue(parentIt->second, "SliceIndex"))));
296  const float targetScore(this->GetMetadataValue(parentIt->second, m_scoreKey));
297 
298  // Keep track of the slice IDs we have used, and their corresponding score
299  if (std::find(usedSliceIds.begin(), usedSliceIds.end(), sliceId) == usedSliceIds.end())
300  {
301  usedSliceIds.push_back(sliceId);
302 
303  // ATTN all PFParticles in the same slice will have the same targetScore
304  targetScores[sliceId] = targetScore;
305  }
306 
307  if (this->IsTarget(parentIt->second))
308  {
309  targetHypotheses[sliceId].push_back(part);
310  }
311  else
312  {
313  crHypotheses[sliceId].push_back(part);
314  }
315  }
316 
317  // Sort the slice IDs to ensure reproducibility
318  std::sort(usedSliceIds.begin(), usedSliceIds.end());
319 
320  // ATTN: we need to ensure that for each slice there is a cosmic and neutrino hypothesis, even if the pass created no PFOs
321  // in such a case we add an empty vector of pfparticles
322  const PFParticleVector emptyPFParticleVector;
323 
324  // Produce the slices
325  for (const unsigned int sliceId : usedSliceIds)
326  {
327  // Get the target score
328  const auto targetScoresIter(targetScores.find(sliceId));
329  if (targetScoresIter == targetScores.end())
330  throw cet::exception("LArPandoraExternalEventBuilding") << "Scrambled slice information - can't find target score with id = " << sliceId << std::endl;
331 
332  PFParticleVector targetPFParticleVector, crPFParticleVector;
333 
334  // Get the target hypothesis
335  const auto targetHypothesisIter(targetHypotheses.find(sliceId));
336  targetPFParticleVector = ((targetHypothesisIter == targetHypotheses.end()) ? emptyPFParticleVector : targetHypothesisIter->second);
337 
338  // Get the cosmic hypothesis
339  const auto crHypothesisIter(crHypotheses.find(sliceId));
340  crPFParticleVector = ((crHypothesisIter == crHypotheses.end()) ? emptyPFParticleVector : crHypothesisIter->second);
341  slices.emplace_back(targetScoresIter->second, targetPFParticleVector, crPFParticleVector);
342  }
343 }
static art::Ptr< recob::PFParticle > GetParentPFParticle(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the top-level parent particle by navigating up the chain of parent/daughter associations...
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::string m_scoreKey
The metadata key for the score of the target slice from Pandora.
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
float GetMetadataValue(const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata, const std::string &key) const
Query a metadata object for a given key and return the corresponding value.
bool IsTarget(const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata) const
Query a metadata object to see if it is a target particle.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
float lar_pandora::LArPandoraExternalEventBuilding::GetMetadataValue ( const art::Ptr< larpandoraobj::PFParticleMetadata > &  metadata,
const std::string key 
) const
private

Query a metadata object for a given key and return the corresponding value.

Parameters
metadatathe metadata object to query
keythe key to search for
Returns
the value in the metadata corresponding to the input key

Definition at line 347 of file LArPandoraExternalEventBuilding_module.cc.

348 {
349  const auto &propertiesMap(metadata->GetPropertiesMap());
350  const auto &it(propertiesMap.find(key));
351 
352  if (it == propertiesMap.end())
353  throw cet::exception("LArPandoraExternalEventBuilding") << "No key \"" << key << "\" found in metadata properties map" << std::endl;
354 
355  return it->second;
356 }
def key(type, name=None)
Definition: graph.py:13
const PropertiesMap & GetPropertiesMap() const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
bool lar_pandora::LArPandoraExternalEventBuilding::IsTarget ( const art::Ptr< larpandoraobj::PFParticleMetadata > &  metadata) const
private

Query a metadata object to see if it is a target particle.

Parameters
metadatathe metadata object to query
Returns
boolean - if the particle is a target

Definition at line 382 of file LArPandoraExternalEventBuilding_module.cc.

383 {
384  try
385  {
386  return static_cast<bool>(std::round(this->GetMetadataValue(metadata, m_targetKey)));
387  }
388  catch (const cet::exception &)
389  {
390  return false;
391  }
392 }
std::string m_targetKey
The metadata key for a PFParticle to determine if it is the target.
float GetMetadataValue(const art::Ptr< larpandoraobj::PFParticleMetadata > &metadata, const std::string &key) const
Query a metadata object for a given key and return the corresponding value.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
LArPandoraExternalEventBuilding& lar_pandora::LArPandoraExternalEventBuilding::operator= ( LArPandoraExternalEventBuilding const &  )
delete
LArPandoraExternalEventBuilding& lar_pandora::LArPandoraExternalEventBuilding::operator= ( LArPandoraExternalEventBuilding &&  )
delete
void lar_pandora::LArPandoraExternalEventBuilding::produce ( art::Event evt)
overridevirtual

Implements art::EDProducer.

Definition at line 184 of file LArPandoraExternalEventBuilding_module.cc.

185 {
186  PFParticleVector particles;
187  PFParticleToMetadata particlesToMetadata;
188  this->CollectPFParticles(evt, particlesToMetadata, particles);
189 
190  PFParticleMap particleMap;
191  this->BuildPFParticleMap(particlesToMetadata, particleMap);
192 
193  PFParticleVector clearCosmics;
194  this->CollectClearCosmicRays(particles, particlesToMetadata, particleMap, clearCosmics);
195 
197  this->CollectSlices(particles, particlesToMetadata, particleMap, slices);
198 
199  m_sliceIdTool->ClassifySlices(slices, evt);
200 
201  PFParticleVector consolidatedParticles;
202  this->CollectConsolidatedParticles(particles, clearCosmics, slices, consolidatedParticles);
203 
205  const LArPandoraEvent consolidatedEvent(LArPandoraEvent(this, &evt, labels, m_shouldProduceT0s), consolidatedParticles);
206 
207  consolidatedEvent.WriteToEvent();
208 }
void CollectSlices(const PFParticleVector &allParticles, const PFParticleToMetadata &particlesToMetadata, const PFParticleMap &particleMap, SliceVector &slices) const
Collect slices.
void CollectPFParticles(const art::Event &evt, PFParticleToMetadata &particlesToMetadata, PFParticleVector &particles) const
Collect PFParticles from the ART event and their mapping to metadata objects.
std::unique_ptr< SliceIdBaseTool > m_sliceIdTool
The slice id tool.
std::map< art::Ptr< recob::PFParticle >, art::Ptr< larpandoraobj::PFParticleMetadata > > PFParticleToMetadata
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
void CollectClearCosmicRays(const PFParticleVector &allParticles, const PFParticleToMetadata &particlesToMetadata, const PFParticleMap &particleMap, PFParticleVector &clearCosmics) const
Collect PFParticles that have been identified as clear cosmic ray muons by pandora.
std::string m_trackProducerLabel
Label for the track producer using the Pandora instance that produced the collections we want to cons...
std::string m_showerProducerLabel
Label for the shower producer using the Pandora instance that produced the collections we want to con...
std::string m_hitProducerLabel
Label for the hit producer that was used as input to the Pandora instance specified.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
std::vector< Slice > SliceVector
Definition: Slice.h:68
bool m_shouldProduceT0s
If we should produce T0s (relevant when stitching over multiple drift volumes)
std::string m_inputProducerLabel
Label for the Pandora instance that produced the collections we want to consolidated.
void BuildPFParticleMap(const PFParticleToMetadata &particlesToMetadata, PFParticleMap &particleMap) const
Build mapping from ID to PFParticle for fast navigation through the hierarchy.
void CollectConsolidatedParticles(const PFParticleVector &allParticles, const PFParticleVector &clearCosmics, const SliceVector &slices, PFParticleVector &consolidatedParticles) const
Get the consolidated collection of particles based on the slice ids.

Member Data Documentation

std::string lar_pandora::LArPandoraExternalEventBuilding::m_hitProducerLabel
private

Label for the hit producer that was used as input to the Pandora instance specified.

Definition at line 116 of file LArPandoraExternalEventBuilding_module.cc.

std::string lar_pandora::LArPandoraExternalEventBuilding::m_inputProducerLabel
private

Label for the Pandora instance that produced the collections we want to consolidated.

Definition at line 113 of file LArPandoraExternalEventBuilding_module.cc.

art::InputTag lar_pandora::LArPandoraExternalEventBuilding::m_pandoraTag
private

The input tag for the pandora producer.

Definition at line 118 of file LArPandoraExternalEventBuilding_module.cc.

std::string lar_pandora::LArPandoraExternalEventBuilding::m_scoreKey
private

The metadata key for the score of the target slice from Pandora.

Definition at line 122 of file LArPandoraExternalEventBuilding_module.cc.

bool lar_pandora::LArPandoraExternalEventBuilding::m_shouldProduceT0s
private

If we should produce T0s (relevant when stitching over multiple drift volumes)

Definition at line 117 of file LArPandoraExternalEventBuilding_module.cc.

std::string lar_pandora::LArPandoraExternalEventBuilding::m_showerProducerLabel
private

Label for the shower producer using the Pandora instance that produced the collections we want to consolidate.

Definition at line 115 of file LArPandoraExternalEventBuilding_module.cc.

std::unique_ptr<SliceIdBaseTool> lar_pandora::LArPandoraExternalEventBuilding::m_sliceIdTool
private

The slice id tool.

Definition at line 119 of file LArPandoraExternalEventBuilding_module.cc.

std::string lar_pandora::LArPandoraExternalEventBuilding::m_targetKey
private

The metadata key for a PFParticle to determine if it is the target.

Definition at line 121 of file LArPandoraExternalEventBuilding_module.cc.

std::string lar_pandora::LArPandoraExternalEventBuilding::m_trackProducerLabel
private

Label for the track producer using the Pandora instance that produced the collections we want to consolidate.

Definition at line 114 of file LArPandoraExternalEventBuilding_module.cc.

bool lar_pandora::LArPandoraExternalEventBuilding::m_useTestBeamMode
private

If we should expect a test-beam (instead of a neutrino) slice.

Definition at line 120 of file LArPandoraExternalEventBuilding_module.cc.


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