LArPandoraEvent.h
Go to the documentation of this file.
1 /**
2  * @file larpandora/LArPandoraEventBuilding/LArPandoraEvent.h
3  *
4  * @brief A description of all outputs from an instance of pandora with functionality to filter and merge multiple output
5  */
6 
7 #ifndef LAR_PANDORA_EVENT_H
8 #define LAR_PANDORA_EVENT_H 1
9 
13 
15 
29 
31 
32 #include <memory>
33 #include <algorithm>
34 #include <map>
35 
36 namespace lar_pandora
37 {
38 
39 /**
40  * @brief LArPandoraEvent class
41  */
43 {
44 public:
45  /**
46  * @brief Shorthand for a collection of objects of type T
47  */
48  template <typename T>
49  using Collection = std::vector< art::Ptr<T> >;
50 
51  template <typename R, typename D>
52  using PairVector = std::vector< std::pair< art::Ptr<R>, D > >;
53 
54  /**
55  * @brief General purpose short-hand with optional D parameter
56  */
57  template <typename L, typename R, typename D>
58  using Association = std::map< art::Ptr<L>, PairVector<R, D> >;
59 
60  // Collection typedef specializations
72 
73  // Association typedef specializations
83 
90 
91  /**
92  * @brief Class to handle the required producer labels
93  */
94  class Labels
95  {
96  public:
97  /**
98  * @brief Label type enumeration
99  */
101  {
128  };
129 
130  /**
131  * @brief Minimal parametrised constructor.
132  * Sets all collection labels to be the same as the PFParticle producer label
133  */
134  Labels(const std::string &pfParticleProducerLabel, const std::string &hitProducerLabel);
135 
136  /**
137  * @brief Track / Shower parametrised constructor.
138  * Sets all collection labels to be the same as the PFParticle producer label,
139  * except those relating to track and shower production, which are supplied.
140  */
141  Labels(const std::string &pfParticleProducerLabel, const std::string &trackProducerLabel, const std::string &showerProducerLabel,
142  const std::string &hitProducerLabel);
143 
144  /**
145  * @brief Get the label of a given type
146  *
147  * @param type the label type to retrieve
148  *
149  * @return the label
150  */
151  const std::string & GetLabel(const LabelType type) const;
152 
153  /**
154  * @brief Set the label of a given type
155  *
156  * @param type the label type to set
157  * @param label the label to set
158  */
159  void SetLabel(const LabelType type, const std::string &label);
160 
161  private:
162  std::map<LabelType, std::string> m_labels; ///< Map holding the labels
163  };
164 
165  /**
166  * @brief Constructor from an art::Event
167  *
168  * @param pProducer pointer to the producer to write the output
169  * @param pEvent pointer to the event to process
170  * @param inputLabel labels for the producers of the input collections
171  * @param shouldProduceT0s if T0s should be produced (usually only for multiple drift volume use cases)
172  */
173  LArPandoraEvent(art::EDProducer *pProducer, art::Event *pEvent, const Labels &inputLabels, const bool shouldProduceT0s = false);
174 
175  /**
176  * @brief Construct by copying an existing LArPandoraEvent, replacing the collections and associations
177  * by any objects associated with a PFParticle in the selection supplied.
178  *
179  * @param event input event to copy and filter
180  * @param pfParticleVector input vector of selected particles
181  */
182  LArPandoraEvent(const LArPandoraEvent &event, const PFParticleVector &selectedPFParticles);
183 
184  /**
185  * @brief Write (put) the collections in this LArPandoraEvent to the art::Event
186  */
187  void WriteToEvent() const;
188 
189 private:
190  /**
191  * @brief Get the collections and associations from m_pEvent with the required labels
192  */
193  void GetCollections();
194 
195  /**
196  * @brief Gets a given collection from m_pEvent with the label supplied
197  *
198  * @param inputLabel a label for the producer of the collection required
199  * @param outputCollection the required collection
200  */
201  template <typename T>
202  void GetCollection(const Labels::LabelType &inputLabel, Collection<T> &outputCollection) const;
203 
204  /**
205  * @brief Get the mapping between two collections with metadata using the specified label
206  *
207  * @param collectionL the collection from which the associations should be retrieved
208  * @param inputLabel a label for the producer of the association required
209  * @param outputAssociationMap output mapping between the two data types supplied (L -> R + D)
210  */
211  template <typename L, typename R, typename D>
212  void GetAssociationMap(const Collection<L> &collectionL, const Labels::LabelType &inputLabel,
213  Association<L, R, D> &outputAssociationMap) const;
214 
215  /**
216  * @brief Get the mapping between two collections with metadata using the specified label
217  *
218  * @param collectionL the collection from which the associations should be retrieved
219  * @param inputLabel a label for the producer of the association required
220  * @param outputAssociationMap output mapping between the two data types supplied (L -> R no metadata)
221  */
222  template <typename L, typename R>
223  void GetAssociationMap(const Collection<L> &collectionL, const Labels::LabelType &inputLabel,
224  Association<L, R, void*> &outputAssociationMap) const;
225 
226  /**
227  * @brief Collects all objects of type R with metadata D associated to a given object of type L
228  *
229  * @param anObject an input object of type L with which we want to collect associated objects of type R with metadata D
230  * @param associationLtoR the general input association between objects of type L and R
231  * @param associatedR output vector of objects of type R associated with anObject
232  */
233  template <typename L, typename R, typename D>
234  void CollectAssociated(const art::Ptr<L> &anObject, const Association<L, R, D> &associationLtoR, Collection<R> &associatedR) const;
235 
236  /**
237  * @brief Gets the filtered mapping from objets in collectionL to objects that also exist in collectionR using a "superset" input association
238  *
239  * @param collectionL a first filtered collection
240  * @param collectionR a second filtered collection
241  * @param inputAssociationLtoR mapping between the two unfiltered collections
242  * @param outputAssociationLtoR mapping between the two filtered collections
243  *
244  * @return mapping between the filtered collections
245  */
246  template <typename L, typename R, typename D>
247  void GetFilteredAssociationMap(const Collection<L> &collectionL, const Collection<R> &collectionR,
248  const Association<L, R, D> &inputAssociationLtoR, Association<L, R, D> &outputAssociationLtoR) const;
249 
250  /**
251  * @brief Write a given collection to the event
252  *
253  * @param collection the collection to write
254  */
255  template <typename T>
256  void WriteCollection(const Collection<T> &collection) const;
257 
258  /**
259  * @brief Write a given association to the event
260  *
261  * @param associationMap the association to write from objects of type L -> R + D
262  * @param collectionL the collection of type L that has been written
263  * @param collectionR the collection of type R that has been written
264  * @param thisProducesR will this producer produce collectionR of was it produced by a different module?
265  */
266  template <typename L, typename R, typename D>
267  void WriteAssociation(const Association<L, R, D> &associationMap, const Collection<L> &collectionL, const Collection<R> &collectionR,
268  const bool thisProducesR = true) const;
269 
270  /**
271  * @brief Write a given association to the event
272  *
273  * @param associationMap the association to write from objects of type L -> R (no metadata)
274  * @param collectionL the collection of type L that has been written
275  * @param collectionR the collection of type R that has been written
276  * @param thisProducesR will this producer produce collectionR of was it produced by a different module?
277  */
278  template <typename L, typename R>
279  void WriteAssociation(const Association<L, R, void*> &associationMap, const Collection<L> &collectionL, const Collection<R> &collectionR,
280  const bool thisProducesR = true) const;
281 
282  /**
283  * @brief Get the index of an objet in a given collection
284  *
285  * @param object the object to search for
286  * @param collection the collection to search through
287  *
288  * @return the index of the object in the collection
289  */
290  template<typename T>
291  size_t GetIndex(const art::Ptr<T> object, const Collection<T> &collection) const;
292 
293  art::EDProducer *m_pProducer; ///< The producer which should write the output collections and associations
294  art::Event *m_pEvent; ///< The event to consider
295  Labels m_labels; ///< A set of labels describing the producers for each input collection
296  bool m_shouldProduceT0s; ///< If T0s should be produced (usually only true for use cases with multiple drift volumes)
297 
298  // Collections
299  PFParticleCollection m_pfParticles; ///< The input collection of PFParticles
300  SpacePointCollection m_spacePoints; ///< The input collection of SpacePoints
301  ClusterCollection m_clusters; ///< The input collection of Clusters
302  VertexCollection m_vertices; ///< The input collection of Vertices
303  SliceCollection m_slices; ///< The input collection of Slices
304  TrackCollection m_tracks; ///< The input collection of Tracks
305  ShowerCollection m_showers; ///< The input collection of Showers
306  T0Collection m_t0s; ///< The input collection of T0s
307  PFParticleMetadataCollection m_metadata; ///< The input collection of PFParticle metadata
308  PCAxisCollection m_pcAxes; ///< The input collection of PCAxes
309  HitCollection m_hits; ///< The input collection of Hits
310 
311  // Association maps
312  PFParticleToSpacePointAssoc m_pfParticleSpacePointMap; ///< The input associations: PFParticle -> SpacePoint
313  PFParticleToClusterAssoc m_pfParticleClusterMap; ///< The input associations: PFParticle -> Cluster
314  PFParticleToVertexAssoc m_pfParticleVertexMap; ///< The input associations: PFParticle -> Vertex
315  PFParticleToSliceAssoc m_pfParticleSliceMap; ///< The input associations: PFParticle -> Slice
316  PFParticleToTrackAssoc m_pfParticleTrackMap; ///< The input associations: PFParticle -> Track
317  PFParticleToShowerAssoc m_pfParticleShowerMap; ///< The input associations: PFParticle -> Shower
318  PFParticleToT0Assoc m_pfParticleT0Map; ///< The input associations: PFParticle -> T0
319  PFParticleToPFParticleMetadataAssoc m_pfParticleMetadataMap; ///< The input associations: PFParticle -> Metadata
320  PFParticleToPCAxisAssoc m_pfParticlePCAxisMap; ///< The input associations: PFParticle -> PCAxis
321  SpacePointToHitAssoc m_spacePointHitMap; ///< The input associations: SpacePoint -> Hit
322  ClusterToHitAssoc m_clusterHitMap; ///< The input associations: Cluster -> Hit
323  SliceToHitAssoc m_sliceHitMap; ///< The input associations: Slice -> Hit
324  TrackToHitAssoc m_trackHitMap; ///< The input associations: Track -> Hit
325  ShowerToHitAssoc m_showerHitMap; ///< The input associations: Shower -> Hit
326  ShowerToPCAxisAssoc m_showerPCAxisMap; ///< The input associations: PCAxis -> Shower
327 };
328 
329 //------------------------------------------------------------------------------------------------------------------------------------------
330 
331 template <typename T>
332 inline void LArPandoraEvent::GetCollection(const Labels::LabelType &inputLabel, Collection<T> &outputCollection) const
333 {
334  const auto &handle(m_pEvent->getValidHandle<std::vector<T> >(m_labels.GetLabel(inputLabel)));
335 
336  for (unsigned int i = 0; i != handle->size(); i++)
337  outputCollection.emplace_back(handle, i);
338 }
339 
340 //------------------------------------------------------------------------------------------------------------------------------------------
341 
342 template <typename L, typename R, typename D>
343 inline void LArPandoraEvent::GetAssociationMap(const Collection<L> &collectionL, const Labels::LabelType &inputLabel,
344  Association<L, R, D> &outputAssociationMap) const
345 {
346  const auto &assocHandle(m_pEvent->getValidHandle<art::Assns<L, R, D> >(m_labels.GetLabel(inputLabel)));
347 
348  // Check that there are no associaions from objects not in collectionL
349  for (const auto &entry : *assocHandle)
350  {
351  auto it(std::find(collectionL.begin(), collectionL.end(), entry.first));
352  if (it == collectionL.end())
353  throw cet::exception("LArPandora") << " LArPandoraEvent::GetAssociationMap -- Found object in association that isn't in the supplied collection" << std::endl;
354  }
355 
356  // Ensure there is an entry for every object of type L
357  for (const auto &objectL : collectionL)
358  outputAssociationMap[objectL];
359 
360  // Fill the association map
361  for (const auto &entry : *assocHandle)
362  outputAssociationMap.at(entry.first).emplace_back(entry.second, *entry.data);
363 }
364 
365 //------------------------------------------------------------------------------------------------------------------------------------------
366 
367 template <typename L, typename R>
368 inline void LArPandoraEvent::GetAssociationMap(const Collection<L> &collectionL, const Labels::LabelType &inputLabel,
369  Association<L, R, void*> &outputAssociationMap) const
370 {
371  const auto &assocHandle(m_pEvent->getValidHandle<art::Assns<L, R> >(m_labels.GetLabel(inputLabel)));
372 
373  // Check that there are no associaions from objects not in collectionL
374  for (const auto &entry : *assocHandle)
375  {
376  auto it(std::find(collectionL.begin(), collectionL.end(), entry.first));
377  if (it == collectionL.end())
378  throw cet::exception("LArPandora") << " LArPandoraEvent::GetAssociationMap -- Found object in association that isn't in the supplied collection" << std::endl;
379  }
380 
381  // Ensure there is an entry for every object of type L
382  for (const auto &objectL : collectionL)
383  outputAssociationMap[objectL];
384 
385  // Fill the association map
386  for (const auto &entry : *assocHandle)
387  outputAssociationMap.at(entry.first).emplace_back(entry.second, nullptr);
388 }
389 
390 //------------------------------------------------------------------------------------------------------------------------------------------
391 
392 template <typename L, typename R, typename D>
393 inline void LArPandoraEvent::CollectAssociated(const art::Ptr<L> &anObject, const Association<L, R, D> &associationLtoR,
394  Collection<R> &associatedR) const
395 {
396  if (associationLtoR.find(anObject) == associationLtoR.end())
397  throw cet::exception("LArPandora") << " LArPandoraEvent::CollectAssociated -- Can not find association for object supplied." << std::endl;
398 
399  for (const auto &entry : associationLtoR.at(anObject))
400  {
401  // Ensure we don't repeat objects in the output collection
402  if (std::find(associatedR.begin(), associatedR.end(), entry.first) == associatedR.end())
403  associatedR.push_back(entry.first);
404  }
405 }
406 
407 //------------------------------------------------------------------------------------------------------------------------------------------
408 
409 template <typename L, typename R, typename D>
410 inline void LArPandoraEvent::GetFilteredAssociationMap(const Collection<L> &collectionL, const Collection<R> &collectionR,
411  const Association<L, R, D> &inputAssociationLtoR, Association<L, R, D> &outputAssociationLtoR) const
412 {
413  for (const auto &objectL : collectionL)
414  {
415  if (inputAssociationLtoR.find(objectL) == inputAssociationLtoR.end())
416  throw cet::exception("LArPandora") << " LArPandoraEvent::GetFilteredAssociationMap -- Can not find association for object in supplied collection." << std::endl;
417 
418  if (outputAssociationLtoR.find(objectL) != outputAssociationLtoR.end())
419  throw cet::exception("LArPandora") << " LArPandoraEvent::GetFilteredAssociationMap -- Repeated objects in input collectionL" << std::endl;
420 
421  for (const auto &entry : inputAssociationLtoR.at(objectL))
422  {
423  if (std::find(collectionR.begin(), collectionR.end(), entry.first) == collectionR.end())
424  continue;
425 
426  outputAssociationLtoR[objectL].push_back(entry);
427  }
428  }
429 }
430 
431 //------------------------------------------------------------------------------------------------------------------------------------------
432 
433 template <typename T>
434 inline void LArPandoraEvent::WriteCollection(const Collection<T> &collection) const
435 {
436  std::unique_ptr<std::vector<T> > output(new std::vector<T>);
437 
438  for (const auto &object : collection)
439  output->push_back(*object);
440 
441  m_pEvent->put(std::move(output));
442 }
443 
444 //------------------------------------------------------------------------------------------------------------------------------------------
445 
446 template <typename L, typename R, typename D>
447 inline void LArPandoraEvent::WriteAssociation(const Association<L, R, D> &associationMap, const Collection<L> &collectionL,
448  const Collection<R> &collectionR, const bool thisProducesR) const
449 {
450  // The output assocation to populate
451  std::unique_ptr<art::Assns<L, R, D> > outputAssn(new art::Assns<L, R, D>);
452 
453  // NB. The art::Ptrs in the stored collections refer to the producer that originally created the objects (e.g. Pandora pat-rec). To make
454  // correct associations, we need to make new art::Ptrs to refer to the *copies* of the objects made by this producer. This is done using
455  // the PtrMaker utility.
456  const art::PtrMaker<L> makePtrL(*m_pEvent);
457 
458  for (auto it = associationMap.begin(); it != associationMap.end(); ++it)
459  {
460  const auto indexL(this->GetIndex(it->first, collectionL));
461  const auto outputPtrL(makePtrL(indexL));
462 
463  for (const auto &entry : it->second)
464  {
465  const auto &objectR(entry.first);
466  const auto &objectD(entry.second);
467 
468  if (thisProducesR)
469  {
470  const art::PtrMaker<R> makePtrR(*m_pEvent);
471  const auto indexR(this->GetIndex(objectR, collectionR));
472  outputAssn->addSingle(outputPtrL, makePtrR(indexR), objectD);
473  }
474  else
475  {
476  outputAssn->addSingle(outputPtrL, objectR, objectD);
477  }
478  }
479  }
480 
481  m_pEvent->put(std::move(outputAssn));
482 }
483 
484 //------------------------------------------------------------------------------------------------------------------------------------------
485 
486 template <typename L, typename R>
487 inline void LArPandoraEvent::WriteAssociation(const Association<L, R, void*> &associationMap, const Collection<L> &collectionL,
488  const Collection<R> &collectionR, const bool thisProducesR) const
489 {
490  // The output assocation to populate
491  std::unique_ptr<art::Assns<L, R> > outputAssn(new art::Assns<L, R>);
492 
493  // NB. The art::Ptrs in the stored collections refer to the producer that originally created the objects (e.g. Pandora pat-rec). To make
494  // correct associations, we need to make new art::Ptrs to refer to the *copies* of the objects made by this producer. This is done using
495  // the PtrMaker utility.
496  const art::PtrMaker<L> makePtrL(*m_pEvent);
497 
498  for (auto it = associationMap.begin(); it != associationMap.end(); ++it)
499  {
500  const auto indexL(this->GetIndex(it->first, collectionL));
501  const auto outputPtrL(makePtrL(indexL));
502 
503  for (const auto &entry : it->second)
504  {
505  const auto &objectR(entry.first);
506 
507  if (thisProducesR)
508  {
509  const art::PtrMaker<R> makePtrR(*m_pEvent);
510  const auto indexR(this->GetIndex(objectR, collectionR));
511  outputAssn->addSingle(outputPtrL, makePtrR(indexR));
512  }
513  else
514  {
515  outputAssn->addSingle(outputPtrL, objectR);
516  }
517  }
518  }
519 
520  m_pEvent->put(std::move(outputAssn));
521 }
522 
523 //------------------------------------------------------------------------------------------------------------------------------------------
524 
525 template<typename T>
526 inline size_t LArPandoraEvent::GetIndex(const art::Ptr<T> object, const Collection<T> &collection) const
527 {
528  const auto it(std::find(collection.begin(), collection.end(), object));
529  if (it == collection.end())
530  throw cet::exception("LArPandora") << " LArPandoraEvent::GetIndex -- Can't find input object in the supplied collection." << std::endl;
531 
532  return static_cast<size_t>(std::distance(collection.begin(), it));
533 }
534 
535 } // namespace lar_pandora
536 
537 #endif // #ifndef LAR_PANDORA_EVENT_H
Association< recob::PFParticle, recob::PCAxis, void * > PFParticleToPCAxisAssoc
HitCollection m_hits
The input collection of Hits.
void WriteAssociation(const Association< L, R, D > &associationMap, const Collection< L > &collectionL, const Collection< R > &collectionR, const bool thisProducesR=true) const
Write a given association to the event.
PFParticleToVertexAssoc m_pfParticleVertexMap
The input associations: PFParticle -> Vertex.
QList< Entry > entry
Collection< recob::Cluster > ClusterCollection
LArPandoraEvent class.
ClusterCollection m_clusters
The input collection of Clusters.
T0Collection m_t0s
The input collection of T0s.
std::string string
Definition: nybbler.cc:12
SliceToHitAssoc m_sliceHitMap
The input associations: Slice -> Hit.
SpacePointToHitAssoc m_spacePointHitMap
The input associations: SpacePoint -> Hit.
Association< recob::Cluster, recob::Hit, void * > ClusterToHitAssoc
Association< recob::PFParticle, recob::SpacePoint, void * > PFParticleToSpacePointAssoc
PFParticleToTrackAssoc m_pfParticleTrackMap
The input associations: PFParticle -> Track.
Collection< larpandoraobj::PFParticleMetadata > PFParticleMetadataCollection
PFParticleToClusterAssoc m_pfParticleClusterMap
The input associations: PFParticle -> Cluster.
PFParticleToPCAxisAssoc m_pfParticlePCAxisMap
The input associations: PFParticle -> PCAxis.
Class to keep data related to recob::Hit associated with recob::Track.
void GetFilteredAssociationMap(const Collection< L > &collectionL, const Collection< R > &collectionR, const Association< L, R, D > &inputAssociationLtoR, Association< L, R, D > &outputAssociationLtoR) const
Gets the filtered mapping from objets in collectionL to objects that also exist in collectionR using ...
Association< recob::Shower, recob::PCAxis, void * > ShowerToPCAxisAssoc
void SetLabel(const LabelType type, const std::string &label)
Set the label of a given type.
LArPandoraEvent(art::EDProducer *pProducer, art::Event *pEvent, const Labels &inputLabels, const bool shouldProduceT0s=false)
Constructor from an art::Event.
Association< recob::PFParticle, recob::Track, void * > PFParticleToTrackAssoc
PCAxisCollection m_pcAxes
The input collection of PCAxes.
PFParticleCollection m_pfParticles
The input collection of PFParticles.
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 GetCollections()
Get the collections and associations from m_pEvent with the required labels.
ClusterToHitAssoc m_clusterHitMap
The input associations: Cluster -> Hit.
std::vector< art::Ptr< T > > Collection
Shorthand for a collection of objects of type T.
void CollectAssociated(const art::Ptr< L > &anObject, const Association< L, R, D > &associationLtoR, Collection< R > &associatedR) const
Collects all objects of type R with metadata D associated to a given object of type L...
Association< recob::Slice, recob::Hit, void * > SliceToHitAssoc
Collection< recob::PCAxis > PCAxisCollection
std::vector< std::pair< art::Ptr< R >, D > > PairVector
QCollection::Item first()
Definition: qglist.cpp:807
Association< recob::Track, recob::Hit, recob::TrackHitMeta > TrackToHitAssoc
PFParticleToPFParticleMetadataAssoc m_pfParticleMetadataMap
The input associations: PFParticle -> Metadata.
Collection< recob::SpacePoint > SpacePointCollection
Collection< recob::Hit > HitCollection
SpacePointCollection m_spacePoints
The input collection of SpacePoints.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
ShowerToHitAssoc m_showerHitMap
The input associations: Shower -> Hit.
def move(depos, offset)
Definition: depos.py:107
Association< recob::PFParticle, anab::T0, void * > PFParticleToT0Assoc
Collection< anab::T0 > T0Collection
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
Association< recob::SpacePoint, recob::Hit, void * > SpacePointToHitAssoc
art::Event * m_pEvent
The event to consider.
PFParticleToT0Assoc m_pfParticleT0Map
The input associations: PFParticle -> T0.
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
Association< recob::PFParticle, recob::Shower, void * > PFParticleToShowerAssoc
Association< recob::PFParticle, recob::Vertex, void * > PFParticleToVertexAssoc
Association< recob::PFParticle, larpandoraobj::PFParticleMetadata, void * > PFParticleToPFParticleMetadataAssoc
Collection< recob::Slice > SliceCollection
Collection< recob::Shower > ShowerCollection
PFParticleToSliceAssoc m_pfParticleSliceMap
The input associations: PFParticle -> Slice.
void GetAssociationMap(const Collection< L > &collectionL, const Labels::LabelType &inputLabel, Association< L, R, D > &outputAssociationMap) const
Get the mapping between two collections with metadata using the specified label.
Declaration of signal hit object.
ShowerToPCAxisAssoc m_showerPCAxisMap
The input associations: PCAxis -> Shower.
art::EDProducer * m_pProducer
The producer which should write the output collections and associations.
Association< recob::Shower, recob::Hit, void * > ShowerToHitAssoc
Association< recob::PFParticle, recob::Cluster, void * > PFParticleToClusterAssoc
Class to handle the required producer labels.
TrackToHitAssoc m_trackHitMap
The input associations: Track -> Hit.
Provides recob::Track data product.
SliceCollection m_slices
The input collection of Slices.
PFParticleToShowerAssoc m_pfParticleShowerMap
The input associations: PFParticle -> Shower.
Labels m_labels
A set of labels describing the producers for each input collection.
std::map< art::Ptr< L >, PairVector< R, D > > Association
General purpose short-hand with optional D parameter.
void GetCollection(const Labels::LabelType &inputLabel, Collection< T > &outputCollection) const
Gets a given collection from m_pEvent with the label supplied.
Collection< recob::PFParticle > PFParticleCollection
Collection< recob::Vertex > VertexCollection
void WriteCollection(const Collection< T > &collection) const
Write a given collection to the event.
VertexCollection m_vertices
The input collection of Vertices.
helper function for LArPandoraInterface producer module
const std::string & GetLabel(const LabelType type) const
Get the label of a given type.
ShowerCollection m_showers
The input collection of Showers.
PFParticleMetadataCollection m_metadata
The input collection of PFParticle metadata.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.
TrackCollection m_tracks
The input collection of Tracks.
Collection< recob::Track > TrackCollection
size_t GetIndex(const art::Ptr< T > object, const Collection< T > &collection) const
Get the index of an objet in a given collection.
Association< recob::PFParticle, recob::Slice, void * > PFParticleToSliceAssoc
std::map< LabelType, std::string > m_labels
Map holding the labels.
PFParticleToSpacePointAssoc m_pfParticleSpacePointMap
The input associations: PFParticle -> SpacePoint.
bool m_shouldProduceT0s
If T0s should be produced (usually only true for use cases with multiple drift volumes) ...
void WriteToEvent() const
Write (put) the collections in this LArPandoraEvent to the art::Event.