LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CollectionMerging_module.cc
Go to the documentation of this file.
1 
10 
11 #include "fhiclcpp/ParameterSet.h"
12 
13 #include <memory>
14 
15 namespace lar_pandora
16 {
17 
19 {
20 public:
21  explicit CollectionMerging(fhicl::ParameterSet const &pset);
22 
23  CollectionMerging(CollectionMerging const &) = delete;
27 
28  void produce(art::Event &evt) override;
29 
30 private:
34 
38 
42 
43  std::string m_AllHitProducerLabel;
45 
48 
51 };
52 
54 
55 } // namespace lar_pandora
56 
57 //------------------------------------------------------------------------------------------------------------------------------------------
58 // implementation follows
59 
68 
70 
71 namespace lar_pandora
72 {
73 
75  m_AllHitsCRProducerLabel(pset.get<std::string>("AllHitsCRProducerLabel")),
76  m_AllHitsCRTrackProducerLabel(pset.get<std::string>("AllHitsCRTrackProducerLabel")),
77  m_AllHitsCRShowerProducerLabel(pset.get<std::string>("AllHitsCRShowerProducerLabel")),
78  m_CRRemHitsCRProducerLabel(pset.get<std::string>("CRRemHitsCRProducerLabel")),
79  m_CRRemHitsCRTrackProducerLabel(pset.get<std::string>("CRRemHitsCRTrackProducerLabel")),
80  m_CRRemHitsCRShowerProducerLabel(pset.get<std::string>("CRRemHitsCRShowerProducerLabel")),
81  m_CRRemHitsNuProducerLabel(pset.get<std::string>("CRRemHitsNuProducerLabel")),
82  m_CRRemHitsNuTrackProducerLabel(pset.get<std::string>("CRRemHitsNuTrackProducerLabel")),
83  m_CRRemHitsNuShowerProducerLabel(pset.get<std::string>("CRRemHitsNuShowerProducerLabel")),
84  m_AllHitProducerLabel(pset.get<std::string>("AllHitProducerLabel")),
85  m_CRRemHitProducerLabel(pset.get<std::string>("CRRemHitProducerLabel")),
86  m_ClearCRTagProducerLabel(pset.get<std::string>("ClearCRTagProducerLabel")),
87  m_NuIdCRTagProducerLabel(pset.get<std::string>("NuIdCRTagProducerLabel")),
88  m_ShouldProduceNeutrinos(pset.get<bool>("ShouldProduceNeutrinos", true)),
89  m_ShouldProduceT0s(pset.get<bool>("ShouldProduceT0s", false))
90 {
91  produces< std::vector<recob::PFParticle> >();
92  produces< std::vector<recob::SpacePoint> >();
93  produces< std::vector<recob::Cluster> >();
94  produces< std::vector<recob::Vertex> >();
95  produces< std::vector<recob::Track> >();
96  produces< std::vector<recob::Shower> >();
97  produces< std::vector<recob::PCAxis> >();
98  produces< std::vector<larpandoraobj::PFParticleMetadata> >();
99 
100  produces< art::Assns<recob::PFParticle, recob::SpacePoint> >();
101  produces< art::Assns<recob::PFParticle, recob::Cluster> >();
102  produces< art::Assns<recob::PFParticle, recob::Vertex> >();
103  produces< art::Assns<recob::PFParticle, recob::Track> >();
104  produces< art::Assns<recob::PFParticle, recob::Shower> >();
105  produces< art::Assns<recob::PFParticle, recob::PCAxis> >();
106  produces< art::Assns<recob::PFParticle, larpandoraobj::PFParticleMetadata> >();
107  produces< art::Assns<recob::Track, recob::Hit> >();
108  produces< art::Assns<recob::Shower, recob::Hit> >();
109  produces< art::Assns<recob::Shower, recob::PCAxis> >();
110  produces< art::Assns<recob::SpacePoint, recob::Hit> >();
111  produces< art::Assns<recob::Cluster, recob::Hit> >();
112 
113  if (m_ShouldProduceT0s)
114  {
115  produces< std::vector<anab::T0> >();
116  produces< art::Assns<recob::PFParticle, anab::T0> >();
117  }
118 }
119 
120 //------------------------------------------------------------------------------------------------------------------------------------------
121 
123 {
125  const lar_pandora::LArPandoraEvent allHitsCREvent(this, &evt, allHitsCRLabels, m_ShouldProduceT0s);
126 
128  const lar_pandora::LArPandoraEvent crRemHitsCREvent(this, &evt, crRemHitsCRLabels, m_ShouldProduceT0s);
129 
131  const lar_pandora::LArPandoraEvent crRemHitsNuEvent(this, &evt, crRemHitsNuLabels, m_ShouldProduceT0s);
132 
134  {
135  const lar_pandora::LArPandoraEvent filteredCRRemHitsNuEvent(crRemHitsNuEvent.FilterByCRTag(m_ShouldProduceNeutrinos, m_NuIdCRTagProducerLabel));
136  filteredCRRemHitsNuEvent.WriteToEvent();
137  }
138  else
139  {
141  const lar_pandora::LArPandoraEvent filteredCRRemHitsCREvent(crRemHitsCREvent.FilterByCRTag(m_ShouldProduceNeutrinos, m_NuIdCRTagProducerLabel));
142  const lar_pandora::LArPandoraEvent mergedEvent(filteredAllHitsCREvent.Merge(filteredCRRemHitsCREvent));
143  mergedEvent.WriteToEvent();
144  }
145 }
146 
147 } // namespace lar_pandora
LArPandoraEvent class.
bool m_ShouldProduceT0s
If we should produce T0s (relevant when stitching over multiple drift volumes)
std::string m_CRRemHitsNuProducerLabel
Label of the pandora instance that ran Nu reco on CR removed hits.
Declaration of signal hit object.
std::string m_CRRemHitsCRShowerProducerLabel
Label of the shower producer using the pandora instance that ran CR reco on CR removed hits...
STL namespace.
std::string m_AllHitProducerLabel
Label of the primary hit producer.
CollectionMerging(fhicl::ParameterSet const &pset)
std::string m_AllHitsCRProducerLabel
Label of the pandora instance that ran CR reco on all hits.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
A description of all outputs from an instance of pandora with functionality to filter and merge multi...
bool m_ShouldProduceNeutrinos
If we should produce collections related to neutrino top-level PFParticles.
Declaration of cluster object.
Provides recob::Track data product.
std::string m_CRRemHitProducerLabel
Label of the CR removed hit producer.
CollectionMerging & operator=(CollectionMerging const &)=delete
std::string m_CRRemHitsNuTrackProducerLabel
Label of the track producer using the pandora instance that ran Nu reco on CR removed hits...
std::string m_AllHitsCRTrackProducerLabel
Label of the track producer using the pandora instance that ran CR reco on all hits.
std::string m_NuIdCRTagProducerLabel
Label of the neutrino-ID CR tag producer.
void produce(art::Event &evt) override
Class to handle the required producer labels.
std::string m_CRRemHitsCRProducerLabel
Label of the pandora instance that ran CR reco on CR removed hits.
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...
std::string m_AllHitsCRShowerProducerLabel
Label of the shower producer using the pandora instance that ran CR reco on all hits.
std::string m_CRRemHitsCRTrackProducerLabel
Label of the track producer using the pandora instance that ran CR reco on CR removed hits...
std::string m_CRRemHitsNuShowerProducerLabel
Label of the shower producer using the pandora instance that ran Nu reco on CR removed hits...
void WriteToEvent() const
Write (put) the collections in this LArPandoraEvent to the art::Event.
std::string m_ClearCRTagProducerLabel
Label of the unabiguous CR tag producer.