22 #include "art/Framework/Core/ModuleMacros.h"
23 #include "art/Framework/Core/EDProducer.h"
24 #include "art/Framework/Principal/Event.h"
25 #include "art/Framework/Services/Registry/ServiceHandle.h"
26 #include "canvas/Utilities/InputTag.h"
27 #include "messagefacility/MessageLogger/MessageLogger.h"
43 explicit HitSelector(fhicl::ParameterSet
const & pset);
47 virtual void reconfigure(fhicl::ParameterSet
const & pset);
48 virtual void produce(art::Event &
e);
88 mf::LogInfo(
"HitSelector") <<
"HitSelector configured\n";
140 art::Handle< std::vector<recob::Hit> > hitHandle;
145 art::FindOneP<raw::RawDigit> hitToRawDigitAssns(hitHandle, evt,
fHitProducerLabel);
151 hitToWireAssns.isValid(),
152 hitToRawDigitAssns.isValid()
156 if (hitHandle.isValid())
161 art::fill_ptr_vector(hitPtrVec, hitHandle);
163 int lastHitIndex = 0;
166 for(
const auto& curHitPtr : hitPtrVec)
169 if (!hitSnippetVec.empty() && lastHitIndex >= curHitPtr->LocalIndex())
172 int plane = hitSnippetVec.front()->WireID().Plane;
175 if (hitSnippetVec.size() > 1)
178 std::sort(hitSnippetVec.begin(),hitSnippetVec.end(),[](
const auto&
left,
const auto&
right){
return left->PeakAmplitude() >
right->PeakAmplitude();});
180 float maxPulseHeight = hitSnippetVec.front()->PeakAmplitude();
186 for(
size_t idx = 0; idx < hitSnippetVec.size(); idx++)
188 art::Ptr<recob::Hit> hitPtr = hitSnippetVec[idx];
190 float pulseHeight = hitPtr->PeakAmplitude();
191 float pulseWid = hitPtr->RMS();
192 int numDOF = hitPtr->DegreesOfFreedom();
199 art::Ptr<recob::Wire> wire = hitToWireAssns.at(hitPtr.key());
200 art::Ptr<raw::RawDigit> rawdigits = hitToRawDigitAssns.at(hitPtr.key());
202 hcol.emplace_back(*hitPtr, wire, rawdigits);
210 art::Ptr<recob::Hit> hitPtr = hitSnippetVec.front();
212 float pulseHeight = hitPtr->PeakAmplitude();
213 float pulseWid = hitPtr->RMS();
217 art::Ptr<recob::Wire> wire = hitToWireAssns.at(hitPtr.key());
218 art::Ptr<raw::RawDigit> rawdigits = hitToRawDigitAssns.at(hitPtr.key());
220 hcol.emplace_back(*hitPtr, wire, rawdigits);
224 hitSnippetVec.clear();
227 lastHitIndex = curHitPtr->LocalIndex();
228 hitSnippetVec.push_back(curHitPtr);
242 mf::LogInfo(
"HitSelector")
243 <<
"HitSelector statistics:\n"
std::vector< float > fMinPulseHeightMulti
Multi hit snippets, minimum pulse height per plane.
Utilities related to art service access.
virtual void beginJob()
Begin job method.
int fNumEvent
Number of events seen.
Declaration of signal hit object.
art::InputTag fHitProducerLabel
The full collection of hits.
std::vector< float > fMinPulseWidthMulti
Multi hit snippets, minimum pulse width per plane.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
virtual ~HitSelector()
Destructor.
Helper functions to create a hit.
virtual void reconfigure(fhicl::ParameterSet const &pset)
A class handling a collection of hits and its associations.
std::vector< art::Ptr< recob::Hit >> HitPtrVector
std::vector< float > fMinPulseHeightSingle
Single hit snippets, minimum pulse height per plane.
std::vector< float > fMinPulseWidthSingle
Single hit snippets, minimum pulse width per plane.
std::vector< float > fMinMaxPulseHeighMulti
Max pulse height of a pulse train must be this large.
HitSelector(fhicl::ParameterSet const &pset)
virtual void produce(art::Event &e)
virtual void endJob()
End job method.
art framework interface to geometry description