10 #include "art/Persistency/Common/PtrMaker.h"
15 #include "art/Framework/Core/EDProducer.h"
16 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
19 #include "canvas/Persistency/Common/Ptr.h"
20 #include "canvas/Persistency/Common/Assns.h"
21 #include "canvas/Utilities/InputTag.h"
23 #include "fhiclcpp/types/Atom.h"
24 #include "fhiclcpp/types/Sequence.h"
25 #include "fhiclcpp/types/Name.h"
26 #include "fhiclcpp/types/Comment.h"
27 #include "messagefacility/MessageLogger/MessageLogger.h"
58 (
"collections of particle flow objects to be made into showers")
68 produces<std::vector<recob::Shower>>();
69 produces<art::Assns<recob::PFParticle, recob::Shower>>();
72 virtual void produce(art::Event& event)
override;
78 std::vector<art::Ptr<recob::PFParticle>>
collectPFOs
79 (art::Event
const& event)
const;
96 std::vector<art::Ptr<recob::PFParticle>> particles =
collectPFOs(event);
101 auto showers = std::make_unique<std::vector<recob::Shower>>();
103 = std::make_unique<art::Assns<recob::PFParticle, recob::Shower>>();
108 unsigned int nShowers = particles.size();
110 art::PtrMaker<recob::Shower> ptrMaker(event);
112 for (
unsigned int i = 0; i < nShowers; ++i) {
135 PFOshowerAssns->addSingle(particles[i], ptrMaker(i));
139 mf::LogInfo(
"AssnsChainShowerMaker")
140 <<
"Created " << showers->size() <<
" showers from " << particles.size()
141 <<
" particle flow objects and " << PFOshowerAssns->size()
142 <<
" associations from " <<
particleTags.size() <<
" collections";
144 event.put(std::move(showers));
145 event.put(std::move(PFOshowerAssns));
151 std::vector<art::Ptr<recob::PFParticle>>
154 std::vector<art::Ptr<recob::PFParticle>> allPFOs;
156 for (
auto const& tag: particleTags) {
157 auto PFOs =
event.getValidHandle<std::vector<recob::PFParticle>>(tag);
159 std::size_t
const nPFOs = PFOs->size();
160 for (std::size_t i = 0; i < nPFOs; ++i)
161 allPFOs.emplace_back(PFOs, i);
fhicl::Sequence< art::InputTag > particles
BEGIN_PROLOG vertical distance to the surface Name
Creates some dummy showers and associations to PFParticle objects.
virtual void produce(art::Event &event) override
std::vector< art::InputTag > particleTags
List of PFParticle tags.
art::EDProducer::Table< Config > Parameters
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
std::vector< art::Ptr< recob::PFParticle > > collectPFOs(art::Event const &event) const
Returns a list of PFParticle objects to be made into showers.
AssnsChainShowerMaker(Parameters const &config)