10 #include "art/Framework/Core/EDProducer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
21 #include "LArReco/TrajectoryMCSFitter.h"
43 void produce(art::Event&
e)
override;
52 const static std::vector<int>
PIDs {13, 211, 321, 2212};
53 const static std::vector<std::string>
names {
"muon",
"pion",
"kaon",
"proton"};
58 fMCSCalculator(
p.get<fhicl::ParameterSet>(
"MCS")),
59 fTrackLabel(
p.get<art::InputTag>(
"TrackLabel",
"pandoraTrack")),
60 fMinTrackLength(
p.get<
float>(
"MinTrackLength", 10.))
62 for (
unsigned i = 0; i <
names.size(); i++) {
63 produces<std::vector<recob::MCSFitResult>>(
names[i]);
64 produces<art::Assns<recob::Track, recob::MCSFitResult>>(
names[i]);
72 art::Handle<std::vector<recob::Track>> track_handle;
73 e.getByLabel(fTrackLabel, track_handle);
75 std::vector<art::Ptr<recob::Track>>
tracks;
76 art::fill_ptr_vector(tracks, track_handle);
78 for (
unsigned i = 0; i <
PIDs.size(); i++) {
79 std::unique_ptr<std::vector<recob::MCSFitResult>> mcscol(
new std::vector<recob::MCSFitResult>);
80 std::unique_ptr<art::Assns<recob::Track, recob::MCSFitResult>> assn(
new art::Assns<recob::Track, recob::MCSFitResult>);
82 for (
const art::Ptr<recob::Track>
track: tracks) {
83 if (fMinTrackLength > 0. &&
track->Length() < fMinTrackLength)
continue;
85 mcscol->push_back(fMCSCalculator.fitMcs(*
track,
PIDs[i]));
89 e.put(std::move(mcscol),
names[i]);
90 e.put(std::move(assn),
names[i]);
ClusterModuleLabel join with tracks
trkf::sbn::TrajectoryMCSFitter fMCSCalculator
process_name use argoneut_mc_hitfinder track
MCSFitAllPID(fhicl::ParameterSet const &p)
static const std::vector< int > PIDs
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.
static const std::vector< std::string > names
void produce(art::Event &e) override
art::InputTag fTrackLabel
MCSFitAllPID & operator=(MCSFitAllPID const &)=delete