LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArPandoraEvent.h
Go to the documentation of this file.
1 
7 #ifndef LAR_PANDORA_EVENT_H
8 #define LAR_PANDORA_EVENT_H 1
9 
11 
13 
24 
26 
28 
29 #include <memory>
30 #include <algorithm>
31 #include <map>
32 
33 namespace lar_pandora
34 {
35 
36 typedef std::vector< art::Ptr<larpandoraobj::PFParticleMetadata> > MetadataVector;
37 typedef std::map< art::Ptr<recob::PFParticle>, std::vector< art::Ptr<larpandoraobj::PFParticleMetadata> > > PFParticlesToMetadata;
38 
39 typedef std::vector< art::Ptr<recob::PCAxis> > PCAxisVector;
40 typedef std::map< art::Ptr<recob::PFParticle>, std::vector< art::Ptr<recob::PCAxis> > > PFParticlesToPCAxes;
41 typedef std::map< art::Ptr<recob::PFParticle>, std::vector< art::Ptr<recob::PFParticle> > > PFParticlesToPFParticles;
42 typedef std::map< art::Ptr<recob::Shower>, std::vector< art::Ptr<recob::PCAxis> > > ShowersToPCAxes;
43 typedef std::map< art::Ptr<recob::SpacePoint>, std::vector< art::Ptr<recob::Hit> > > SpacePointsToHitVector;
44 
49 {
50 public:
54  class Labels
55  {
56  public:
60  enum LabelType
61  {
85  };
86 
91  Labels(const std::string &pfParticleProducerLabel, const std::string &hitProducerLabel);
92 
98  Labels(const std::string &pfParticleProducerLabel, const std::string &trackProducerLabel, const std::string &showerProducerLabel,
99  const std::string &hitProducerLabel);
100 
101  const std::string &GetLabel(const LabelType &type) const;
102 
103  void SetSpacePointProducerLabel(const std::string &label);
104  void SetClusterProducerLabel(const std::string &label);
105  void SetVertexProducerLabel(const std::string &label);
106  void SetTrackProducerLabel(const std::string &label);
107  void SetShowerProducerLabel(const std::string &label);
108  void SetT0ProducerLabel(const std::string &label);
109  void SetMetadataProducerLabel(const std::string &label);
110  void SetPCAxisProducerLabel(const std::string &label);
111 
112  void SetPFParticleToSpacePointProducerLabel(const std::string &label);
113  void SetPFParticleToClusterProducerLabel(const std::string &label);
114  void SetPFParticleToVertexProducerLabel(const std::string &label);
115  void SetPFParticleToTrackProducerLabel(const std::string &label);
116  void SetPFParticleToShowerProducerLabel(const std::string &label);
117  void SetPFParticleToT0ProducerLabel(const std::string &label);
118  void SetPFParticleToMetadataProducerLabel(const std::string &label);
119  void SetPFParticleToPCAxisProducerLabel(const std::string &label);
120  void SetSpacePointToHitProducerLabel(const std::string &label);
121  void SetClusterToHitProducerLabel(const std::string &label);
122  void SetTrackToHitProducerLabel(const std::string &label);
123  void SetShowerToHitProducerLabel(const std::string &label);
124  void SetShowerToPCAxisProducerLabel(const std::string &label);
125 
126  private:
127  std::map<LabelType, std::string> m_labels;
128  };
129 
139  LArPandoraEvent(art::EDProducer *pProducer, art::Event *pEvent, const Labels &inputLabels, const bool shouldProduceT0s = false, const size_t shift = 100000);
140 
148  LArPandoraEvent(const LArPandoraEvent &event, const PFParticleVector &selectedPFParticles);
149 
156  LArPandoraEvent FilterByPdgCode(const bool shouldProduceNeutrinos) const;
157 
165  LArPandoraEvent FilterByCRTag(const bool shouldProduceNeutrinos, const std::string &tagProducerLabel) const;
166 
170  void WriteToEvent() const;
171 
176 
177 private:
181  enum Pdg
182  {
183  nue = 12,
184  numu = 14,
185  nutau = 16
186  };
187 
191  void GetCollections();
192 
200  template <typename T>
201  void GetCollection(const Labels::LabelType &inputLabel, art::Handle<std::vector<T> > &outputHandle, std::vector<art::Ptr<T> > &outputCollection) const;
202 
210  template <typename T, typename U>
211  void GetAssociationMap(const Labels::LabelType &inputLabel, art::Handle<std::vector<T> > &inputHandleT,
212  std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &outputAssociationMap) const;
213 
217  void GetPFParticleHierarchy();
218 
224  void GetPrimaryPFParticles(PFParticleVector &primaryPFParticles) const;
225 
233  void GetFilteredParticlesByPdgCode(const bool shouldProduceNeutrinos, const PFParticleVector &inputPFParticles, PFParticleVector &outputPFParticles) const;
234 
243  void GetFilteredParticlesByCRTag(const bool shouldProduceNeutrinos, const std::string &tagProducerLabel, const PFParticleVector &inputPFParticles,
244  PFParticleVector &outputPFParticles) const;
245 
253  void GetFilteredHierarchyMap(const PFParticleVector &filteredParticles, const PFParticlesToPFParticles &unfilteredPFParticleDaughterMap,
254  PFParticlesToPFParticles &outputPFParticleDaughterMap) const;
255 
261  void GetIdToPFParticleMap(std::map< size_t, art::Ptr<recob::PFParticle> > &idToPFParticleMap) const;
262 
269  void GetDownstreamPFParticles(const PFParticleVector &inputPFParticles, PFParticleVector &downstreamPFParticles) const;
270 
277  void GetDownstreamPFParticles(const art::Ptr<recob::PFParticle> &part, PFParticleVector &downstreamPFParticles) const;
278 
284  void FillPFParticleToOriginIdMap(const std::map<art::Ptr<recob::PFParticle>, unsigned int> &existingMap);
285 
293  template <typename T, typename U>
294  void CollectAssociated(const art::Ptr<T> &anObject, const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationTtoU,
295  std::vector<art::Ptr<U> > &associatedU) const;
296 
307  template <typename T, typename U>
308  void GetFilteredAssociationMap(const std::vector<art::Ptr<T> > &collectionT, const std::vector<art::Ptr<U> > &collectionU,
309  const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &inputAssociationTtoU, std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &outputAssociationTtoU) const;
310 
316  template <typename T>
317  void WriteCollection(const std::vector<art::Ptr<T> > &collection) const;
318 
327  template <typename T, typename U>
328  void WriteAssociation(const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationMap, const std::vector<art::Ptr<T> > &collectionT,
329  const std::vector<art::Ptr<U> > &collectionU, const bool thisProducesU = true) const;
330 
337  void MergePFParticleToOriginIdMap(std::map<art::Ptr<recob::PFParticle>, unsigned int> &mapToMerge, const std::map<art::Ptr<recob::PFParticle>,
338  unsigned int> &mapToAdd) const;
339 
346  template <typename T>
347  void MergeCollection(std::vector<art::Ptr<T> > &collectionToMerge, const std::vector<art::Ptr<T> > &collection) const;
348 
355  template <typename T, typename U>
356  void MergeAssociation(std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationToMerge, const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &association) const;
357 
361 
362  std::map<art::Ptr<recob::PFParticle>, unsigned int> m_pfParticleToOriginIdMap;
363 
365  const size_t m_shift;
366 
367  // Collections
375  MetadataVector m_metadata;
376  PCAxisVector m_pcAxes;
378 
379  // Association maps
386  PFParticlesToMetadata m_pfParticleMetadataMap;
387  PFParticlesToPCAxes m_pfParticlePCAxisMap;
388 
389  SpacePointsToHitVector m_spacePointHitMap;
393 
394  ShowersToPCAxes m_showerPCAxisMap;
395 
396  PFParticlesToPFParticles m_pfParticleDaughterMap;
397 };
398 
399 //------------------------------------------------------------------------------------------------------------------------------------------
400 
401 template <typename T>
402 inline void LArPandoraEvent::GetCollection(const Labels::LabelType &inputLabel, art::Handle<std::vector<T> > &outputHandle, std::vector<art::Ptr<T> > &outputCollection) const
403 {
404  m_pEvent->getByLabel(m_labels.GetLabel(inputLabel), outputHandle);
405 
406  for (unsigned int i = 0; i != outputHandle->size(); i++)
407  {
408  art::Ptr< T > object(outputHandle, i);
409  outputCollection.push_back(object);
410  }
411 }
412 
413 //------------------------------------------------------------------------------------------------------------------------------------------
414 
415 template <typename T, typename U>
416 inline void LArPandoraEvent::GetAssociationMap(const Labels::LabelType &inputLabel, art::Handle<std::vector<T> > &inputHandleT,
417  std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &outputAssociationMap) const
418 {
419  art::FindManyP< U > assoc(inputHandleT, (*m_pEvent), m_labels.GetLabel(inputLabel));
420 
421  for (unsigned int iT = 0; iT < inputHandleT->size(); iT++)
422  {
423  art::Ptr<T> objectT(inputHandleT, iT);
424 
425  if (outputAssociationMap.find(objectT) == outputAssociationMap.end())
426  {
427  std::vector< art::Ptr< U > > emptyVect;
428  outputAssociationMap.insert(typename std::map< art::Ptr< T >, std::vector< art::Ptr< U > > >::value_type(objectT, emptyVect));
429  }
430 
431  for (art::Ptr<U> objectU : assoc.at(objectT.key()))
432  outputAssociationMap[objectT].push_back(objectU);
433  }
434 }
435 
436 //------------------------------------------------------------------------------------------------------------------------------------------
437 
438 template <typename T, typename U>
439 inline void LArPandoraEvent::CollectAssociated(const art::Ptr<T> &anObject, const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationTtoU,
440  std::vector<art::Ptr<U> > &associatedU) const
441 {
442  if (associationTtoU.find(anObject) == associationTtoU.end())
443  throw cet::exception("LArPandora") << " LArPandoraEvent::CollectAssociated -- Can not find association for object supplied." << std::endl;
444 
445  std::vector<art::Ptr<U> > associatedObjects = associationTtoU.at(anObject);
446  associatedU.insert(associatedU.end(), associatedObjects.begin(), associatedObjects.end());
447 }
448 
449 //------------------------------------------------------------------------------------------------------------------------------------------
450 
451 template <typename T, typename U>
452 inline void LArPandoraEvent::GetFilteredAssociationMap(const std::vector<art::Ptr<T> > &collectionT, const std::vector<art::Ptr<U> > &collectionU,
453  const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &inputAssociationTtoU, std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &outputAssociationTtoU) const
454 {
455  for (art::Ptr< T > objectT : collectionT)
456  {
457  std::vector<art::Ptr<U> > emptyVector;
458  if (!outputAssociationTtoU.insert(typename std::map<art::Ptr<T>, std::vector<art::Ptr<U> > >::value_type(objectT, emptyVector)).second)
459  throw cet::exception("LArPandora") << " LArPandoraEvent::GetFilteredAssociationMap -- Can not have multiple association map entries for a single object." << std::endl;
460 
461  for (art::Ptr< U > objectU : inputAssociationTtoU.at(objectT))
462  {
463  typename std::vector<art::Ptr<U> >::const_iterator associatedObjectIter = std::find(collectionU.begin(), collectionU.end(), objectU);
464  if (associatedObjectIter == collectionU.end())
465  continue;
466 
467  outputAssociationTtoU[objectT].push_back(objectU);
468  }
469  }
470 }
471 
472 //------------------------------------------------------------------------------------------------------------------------------------------
473 
474 template <typename T>
475 inline void LArPandoraEvent::WriteCollection(const std::vector<art::Ptr<T> > &collection) const
476 {
477  std::unique_ptr<std::vector<T> > output(new std::vector<T>);
478 
479  for (art::Ptr<T> object : collection)
480  output->push_back(*object);
481 
482  m_pEvent->put(std::move(output));
483 }
484 
485 template <>
487 {
488  std::unique_ptr<std::vector<recob::PFParticle> > output(new std::vector<recob::PFParticle>);
489 
490  for (art::Ptr<recob::PFParticle> part : collection)
491  {
492 
493  if (part->Self() >= m_shift)
494  throw cet::exception("LArPandora") << " LArPandoraEvent::WriteCollection -- PFParticle ID exceeds shift value of " << m_shift << ". Can't merge the collections!" << std::endl;
495 
497  throw cet::exception("LArPandora") << " LArPandoraEvent::WriteCollection -- Can't find supplied PFParticle in the PFParticle to origin ID map." << std::endl;
498 
499  const size_t offset(m_shift * m_pfParticleToOriginIdMap.at(part));
500  const size_t adjustedSelf(part->Self() + offset);
501 
502  size_t adjustedParent = part->Parent();
504  adjustedParent += offset;
505 
506  const std::vector<size_t> &daughters(part->Daughters());
507  std::vector<size_t> adjustedDaughters;
508  for (unsigned int d = 0; d < daughters.size(); d++)
509  adjustedDaughters.push_back(daughters[d] + offset);
510 
511  recob::PFParticle adjustedPart(part->PdgCode(), adjustedSelf, adjustedParent, adjustedDaughters);
512  output->push_back(adjustedPart);
513  }
514 
515  m_pEvent->put(std::move(output));
516 }
517 
518 //------------------------------------------------------------------------------------------------------------------------------------------
519 
520 template <typename T, typename U>
521 inline void LArPandoraEvent::WriteAssociation(const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationMap, const std::vector<art::Ptr<T> > &collectionT,
522  const std::vector<art::Ptr<U> > &collectionU, const bool thisProducesU) const
523 {
524  const art::PtrMaker<T> makePtrT(*m_pEvent, *m_pProducer);
525  std::unique_ptr<art::Assns<T, U> > outputAssn(new art::Assns<T, U>);
526 
527  for (typename std::map<art::Ptr<T>, std::vector<art::Ptr<U> > >::const_iterator it = associationMap.begin(); it != associationMap.end(); ++it)
528  {
529  typename std::vector<art::Ptr<T> >::const_iterator itT = std::find(collectionT.begin(), collectionT.end(), it-> first);
530  if (itT == collectionT.end())
531  throw cet::exception("LArPandora") << " LArPandoraEvent::WriteAssociation -- association map contains object not in collectionT." << std::endl;
532 
533  art::Ptr<T> newObjectT(makePtrT(std::distance(collectionT.begin(), itT)));
534 
535  for (const art::Ptr<U> &objectU : it->second)
536  {
537  if (thisProducesU)
538  {
539  const art::PtrMaker<U> makePtrU(*m_pEvent, *m_pProducer);
540 
541  typename std::vector<art::Ptr<U> >::const_iterator itU = std::find(collectionU.begin(), collectionU.end(), objectU);
542  if (itU == collectionU.end())
543  throw cet::exception("LArPandora") << " LArPandoraEvent::WriteAssociation -- association map contains object not in collectionU." << std::endl;
544 
545  art::Ptr<U> newObjectU(makePtrU(std::distance(collectionU.begin(), itU)));
546  util::CreateAssn(*m_pProducer, *m_pEvent, newObjectU, newObjectT, *outputAssn);
547  }
548  else
549  {
550  util::CreateAssn(*m_pProducer, *m_pEvent, objectU, newObjectT, *outputAssn);
551  }
552  }
553  }
554 
555  m_pEvent->put(std::move(outputAssn));
556 }
557 
558 //------------------------------------------------------------------------------------------------------------------------------------------
559 
560 template <typename T>
561 inline void LArPandoraEvent::MergeCollection(std::vector<art::Ptr<T> > &collectionToMerge, const std::vector<art::Ptr<T> > &collection) const
562 {
563  collectionToMerge.insert(collectionToMerge.end(), collection.begin(), collection.end());
564 }
565 
566 //------------------------------------------------------------------------------------------------------------------------------------------
567 
568 template <typename T, typename U>
569 inline void LArPandoraEvent::MergeAssociation(std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &associationToMerge,
570  const std::map<art::Ptr<T>, std::vector<art::Ptr<U> > > &association) const
571 {
572  associationToMerge.insert(association.begin(), association.end());
573 }
574 
575 } // namespace lar_pandora
576 
577 #endif // #ifndef LAR_PANDORA_EVENT_H
key_type key() const
Definition: Ptr.h:356
void GetPFParticleHierarchy()
Get the mapping from PFParticles to their daughters.
ShowersToHits m_showerHitMap
The input associations: Shower -> Hit.
std::map< art::Ptr< recob::SpacePoint >, std::vector< art::Ptr< recob::Hit > > > SpacePointsToHitVector
void GetFilteredAssociationMap(const std::vector< art::Ptr< T > > &collectionT, const std::vector< art::Ptr< U > > &collectionU, const std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &inputAssociationTtoU, std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &outputAssociationTtoU) const
Gets the mapping between two filtered collections.
SpacePointVector m_spacePoints
The input collection of SpacePoints.
MetadataVector m_metadata
The input collection of PFParticle metadata.
void WriteAssociation(const std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &associationMap, const std::vector< art::Ptr< T > > &collectionT, const std::vector< art::Ptr< U > > &collectionU, const bool thisProducesU=true) const
Write a given association to the event.
void SetSpacePointToHitProducerLabel(const std::string &label)
ShowerVector m_showers
The input collection of Showers.
LArPandoraEvent class.
void SetVertexProducerLabel(const std::string &label)
std::map< art::Ptr< recob::PFParticle >, ClusterVector > PFParticlesToClusters
LArPandoraEvent(art::EDProducer *pProducer, art::Event *pEvent, const Labels &inputLabels, const bool shouldProduceT0s=false, const size_t shift=100000)
Constructor from an art::Event.
const std::string & GetLabel(const LabelType &type) const
static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
Definition: PFParticle.h:61
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
Declaration of signal hit object.
LabelType
Label type enumeration.
ClustersToHits m_clusterHitMap
The input associations: Cluster -> Hit.
void SetPFParticleToShowerProducerLabel(const std::string &label)
PFParticlesToVertices m_pfParticleVertexMap
The input associations: PFParticle -> Vertex.
PFParticlesToMetadata m_pfParticleMetadataMap
The input associations: PFParticle -> Metadata.
void SetClusterProducerLabel(const std::string &label)
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
ShowersToPCAxes m_showerPCAxisMap
The input associations: PCAxis -> Shower.
void SetMetadataProducerLabel(const std::string &label)
void FillPFParticleToOriginIdMap(const std::map< art::Ptr< recob::PFParticle >, unsigned int > &existingMap)
Fills the PFParticleToOriginIdMap using an existing map from another LArPandoraEvent.
void GetAssociationMap(const Labels::LabelType &inputLabel, art::Handle< std::vector< T > > &inputHandleT, std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &outputAssociationMap) const
Get the mapping between two collections using the specified label.
Labels(const std::string &pfParticleProducerLabel, const std::string &hitProducerLabel)
Minimal parametrised constructor. Sets all collection labels to be the same as the PFParticle produce...
void SetPFParticleToVertexProducerLabel(const std::string &label)
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > > PFParticlesToMetadata
void GetCollections()
Get the collections and associations from m_pEvent with the required labels.
void GetCollection(const Labels::LabelType &inputLabel, art::Handle< std::vector< T > > &outputHandle, std::vector< art::Ptr< T > > &outputCollection) const
Gets a given collection from m_pEvent with the label supplied.
VertexVector m_vertices
The input collection of Vertices.
void SetPFParticleToSpacePointProducerLabel(const std::string &label)
std::vector< art::Ptr< recob::Track > > TrackVector
PFParticlesToPFParticles m_pfParticleDaughterMap
The mapping from parent to daughter PFParticles.
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
LArPandoraEvent FilterByPdgCode(const bool shouldProduceNeutrinos) const
Produce a copy of the event keeping only the collections that are associated with a top-level particl...
std::map< art::Ptr< recob::PFParticle >, unsigned int > m_pfParticleToOriginIdMap
Mapping between PFParticles, and an ID for the LArPandoraEvent from which they originated (to keep tr...
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void WriteCollection(const std::vector< art::Ptr< T > > &collection) const
Write a given collection to the event.
void SetPFParticleToPCAxisProducerLabel(const std::string &label)
HitVector m_hits
The input collection of Hits.
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::PFParticle > > > PFParticlesToPFParticles
PFParticlesToT0s m_pfParticleT0Map
The input associations: PFParticle -> T0.
void GetFilteredParticlesByCRTag(const bool shouldProduceNeutrinos, const std::string &tagProducerLabel, const PFParticleVector &inputPFParticles, PFParticleVector &outputPFParticles) const
Filters PFParticles based on their Pdg from the inputPFParticles.
PFParticlesToSpacePoints m_pfParticleSpacePointMap
The input associations: PFParticle -> SpacePoint.
Provides recob::Track data product.
void SetTrackProducerLabel(const std::string &label)
std::map< art::Ptr< recob::PFParticle >, T0Vector > PFParticlesToT0s
std::map< art::Ptr< recob::Cluster >, HitVector > ClustersToHits
void MergeAssociation(std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &associationToMerge, const std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &association) const
Append an association to another association.
std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > MetadataVector
TString part[npart]
Definition: Style.C:32
TrackVector m_tracks
The input collection of Tracks.
PFParticlesToTracks m_pfParticleTrackMap
The input associations: PFParticle -> Track.
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
void SetSpacePointProducerLabel(const std::string &label)
std::vector< art::Ptr< anab::T0 > > T0Vector
Float_t d
Definition: plot.C:237
void SetPFParticleToMetadataProducerLabel(const std::string &label)
art::Event * m_pEvent
The event to consider.
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
std::vector< art::Ptr< recob::PCAxis > > PCAxisVector
Declaration of cluster object.
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
void GetFilteredHierarchyMap(const PFParticleVector &filteredParticles, const PFParticlesToPFParticles &unfilteredPFParticleDaughterMap, PFParticlesToPFParticles &outputPFParticleDaughterMap) const
Filters the hierarchy map using a given vector of filteredParticles.
void SetClusterToHitProducerLabel(const std::string &label)
std::vector< art::Ptr< recob::Shower > > ShowerVector
std::vector< art::Ptr< recob::SpacePoint > > SpacePointVector
T0Vector m_t0s
The input collection of T0s.
std::vector< art::Ptr< recob::Hit > > HitVector
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
void SetShowerProducerLabel(const std::string &label)
void MergeCollection(std::vector< art::Ptr< T > > &collectionToMerge, const std::vector< art::Ptr< T > > &collection) const
Append a collection onto an other collection.
PCAxisVector m_pcAxes
The input collection of PCAxes.
SpacePointsToHitVector m_spacePointHitMap
The input associations: SpacePoint -> Hit.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
ClusterVector m_clusters
The input collection of Clusters.
void GetFilteredParticlesByPdgCode(const bool shouldProduceNeutrinos, const PFParticleVector &inputPFParticles, PFParticleVector &outputPFParticles) const
Filters PFParticles based on their Pdg from the inputPFParticles.
void GetDownstreamPFParticles(const PFParticleVector &inputPFParticles, PFParticleVector &downstreamPFParticles) const
Get particles downstream of any particle in an input vector.
PFParticleVector m_pfParticles
The input collection of PFParticles.
void SetShowerToHitProducerLabel(const std::string &label)
void SetPFParticleToClusterProducerLabel(const std::string &label)
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
void MergePFParticleToOriginIdMap(std::map< art::Ptr< recob::PFParticle >, unsigned int > &mapToMerge, const std::map< art::Ptr< recob::PFParticle >, unsigned int > &mapToAdd) const
Merge two PFParticle to origin ID maps ensuring no ID collisions.
Utility object to perform functions of association.
void GetIdToPFParticleMap(std::map< size_t, art::Ptr< recob::PFParticle > > &idToPFParticleMap) const
Produce a mapping between PFParticles and their ID.
art::EDProducer * m_pProducer
The producer which should write the output collections and associations.
void CollectAssociated(const art::Ptr< T > &anObject, const std::map< art::Ptr< T >, std::vector< art::Ptr< U > > > &associationTtoU, std::vector< art::Ptr< U > > &associatedU) const
Collects all objects of type U associated to a given object of type T.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Class to handle the required producer labels.
void SetT0ProducerLabel(const std::string &label)
LArPandoraEvent FilterByCRTag(const bool shouldProduceNeutrinos, const std::string &tagProducerLabel) const
Produce a copy of the event keeping only the collections that are associated with a top-level particl...
TracksToHits m_trackHitMap
The input associations: Track -> Hit.
void SetPCAxisProducerLabel(const std::string &label)
Labels m_labels
A set of labels describing the producers for each input collection.
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
void SetShowerToPCAxisProducerLabel(const std::string &label)
std::map< art::Ptr< recob::Shower >, std::vector< art::Ptr< recob::PCAxis > > > ShowersToPCAxes
PFParticlesToPCAxes m_pfParticlePCAxisMap
The input associations: PFParticle -> PCAxis.
void SetPFParticleToT0ProducerLabel(const std::string &label)
LArPandoraEvent Merge(const LArPandoraEvent &other) const
Merge collections from two events into one.
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< recob::PCAxis > > > PFParticlesToPCAxes
helper function for LArPandoraInterface producer module
PFParticlesToClusters m_pfParticleClusterMap
The input associations: PFParticle -> Cluster.
void SetTrackToHitProducerLabel(const std::string &label)
Definition: fwd.h:25
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void SetPFParticleToTrackProducerLabel(const std::string &label)
Event finding and building.
const size_t m_shift
Amount by which to shift PFParticle IDs when merging two reconstructions of the same event...
void GetPrimaryPFParticles(PFParticleVector &primaryPFParticles) const
Filters primary PFParticles from the m_pfParticles.
std::map< LabelType, std::string > m_labels
Map holding the labels.
std::vector< art::Ptr< recob::Vertex > > VertexVector
bool m_shouldProduceT0s
If T0s should be produced (usually only true for use cases with multiple drift volumes) ...
PFParticlesToShowers m_pfParticleShowerMap
The input associations: PFParticle -> Shower.
void WriteToEvent() const
Write (put) the collections in this LArPandoraEvent to the art::Event.