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"
55 void produce(art::Event&
e)
override;
66 fTrackLabel(
p.get<art::InputTag>(
"TrackLabel",
"pandoraTrack")),
67 fPassBadHits(
p.get<
bool>(
"PassBadHits",
false))
69 produces<std::vector<recob::Hit>>();
70 produces<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
77 std::unique_ptr<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>> assn(
new art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>);
78 std::unique_ptr<std::vector<recob::Hit>> outHits(
new std::vector<recob::Hit>);
81 art::PtrMaker<recob::Hit> hitPtrMaker{e};
84 art::Handle<std::vector<recob::Track>> track_handle;
85 e.getByLabel(fTrackLabel, track_handle);
87 std::vector<art::Ptr<recob::Track>>
tracks;
88 art::fill_ptr_vector(tracks, track_handle);
90 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmHits(tracks, e, fTrackLabel);
92 for (
unsigned i = 0; i < tracks.size(); i++) {
96 const std::vector<art::Ptr<recob::Hit>> &trkHits = fmHits.at(i);
97 const std::vector<const recob::TrackHitMeta*> &trkHitMetas = fmHits.data(i);
99 for (
unsigned i_hit = 0; i_hit < trkHits.size(); i_hit++) {
104 bool badhit = (meta.
Index() == std::numeric_limits<unsigned int>::max()) ||
106 if (!badhit || fPassBadHits) {
108 outHits->push_back(hit);
109 art::Ptr<recob::Hit> thisHitPtr = hitPtrMaker(outHits->size()-1);
111 assn->addSingle(tracks[i], thisHitPtr, meta);
117 e.put(std::move(outHits));
118 e.put(std::move(assn));
Data product for reconstructed trajectory in space.
ClusterModuleLabel join with tracks
Declaration of signal hit object.
bool HasValidPoint(size_t i) const
process_name use argoneut_mc_hitfinder track
TrackHitFilter(fhicl::ParameterSet const &p)
Access the description of detector geometry.
Collection of exceptions for Geometry system.
Data product for reconstructed trajectory in space.
TrackHitFilter & operator=(TrackHitFilter const &)=delete
Provides recob::Track data product.
void produce(art::Event &e) override
Declaration of basic channel signal object.
art::InputTag fTrackLabel
2D representation of charge deposited in the TDC/wire plane
Class defining a sparse vector (holes are zeroes)
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: