15 #include "art/Framework/Core/EDProducer.h"
16 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "canvas/Persistency/Common/Assns.h"
20 #include "canvas/Persistency/Common/FindManyP.h"
21 #include "canvas/Persistency/Common/Ptr.h"
22 #include "fhiclcpp/ParameterSet.h"
32 virtual void produce(art::Event &
e);
45 , fChiAlg(
p.get< fhicl::ParameterSet >(
"Chi2PIDAlg"))
47 fTrackModuleLabel =
p.get< std::string >(
"TrackModuleLabel");
48 fCalorimetryModuleLabel =
p.get< std::string >(
"CalorimetryModuleLabel");
50 produces< std::vector<anab::ParticleID> >();
51 produces< art::Assns<recob::Track, anab::ParticleID> >();
56 art::Handle< std::vector<recob::Track> > trackListHandle;
57 evt.getByLabel(fTrackModuleLabel,trackListHandle);
59 std::vector<art::Ptr<recob::Track> > tracklist;
60 art::fill_ptr_vector(tracklist, trackListHandle);
62 art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
66 std::unique_ptr< std::vector<anab::ParticleID> > particleidcol(
new std::vector<anab::ParticleID>);
67 std::unique_ptr< art::Assns<recob::Track, anab::ParticleID> > assn(
new art::Assns<recob::Track, anab::ParticleID>);
69 if (fmcal.isValid()) {
70 std::vector<art::Ptr<anab::Calorimetry>> calovec(1, art::Ptr<anab::Calorimetry>());
71 for (
size_t trkIter = 0; trkIter < tracklist.size(); ++trkIter){
72 for (
size_t i = 0; i<fmcal.at(trkIter).size(); ++i){
73 calovec[0] = fmcal.at(trkIter)[i];
75 particleidcol->push_back(pidout);
80 evt.put(std::move(particleidcol));
81 evt.put(std::move(assn));
std::string fCalorimetryModuleLabel
std::string fTrackModuleLabel
Chi2ParticleID(fhicl::ParameterSet const &p)
Provides recob::Track data product.
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
virtual void produce(art::Event &e)