8 #include "art/Utilities/ToolMacros.h"
32 std::vector<float>::const_iterator,
46 : fRoiThreshold(pset.
get<float>(
"RoiThreshold", 5.))
51 const size_t roiStartTick,
53 const size_t eventCount,
57 const Waveform& waveform = dataRange.data();
61 const size_t plane = wids[0].Plane;
64 findHitCandidates(waveform.begin(), waveform.end(), roiStartTick, plane, hitCandidateVec);
71 std::vector<float>::const_iterator stopItr,
72 const size_t roiStartTick,
73 const size_t planeIdx,
79 auto maxItr = std::max_element(startItr, stopItr);
81 float maxValue = *maxItr;
86 auto firstItr =
std::distance(startItr, maxItr) > 2 ? maxItr - 1 : startItr;
88 while (firstItr != startItr) {
93 if (*firstItr < *(firstItr + 1) && *firstItr <= *(firstItr - 1))
break;
101 findHitCandidates(startItr, firstItr + 1, roiStartTick, planeIdx, hitCandidateVec);
104 auto lastItr =
std::distance(maxItr, stopItr) > 2 ? maxItr + 1 : stopItr - 1;
106 while (lastItr != stopItr - 1) {
111 if (*lastItr <= *(lastItr + 1) && *lastItr < *(lastItr - 1))
break;
120 hitCandidate.
startTick = roiStartTick + firstTime;
121 hitCandidate.
stopTick = roiStartTick + lastTime;
122 hitCandidate.
maxTick = roiStartTick + firstTime;
123 hitCandidate.
minTick = roiStartTick + lastTime;
126 hitCandidate.
hitCenter = roiStartTick + maxTime;
127 hitCandidate.
hitSigma = std::max(2.,
float(lastTime - firstTime) / 6.);
130 hitCandidateVec.push_back(hitCandidate);
146 const recob::Wire::RegionsOfInterest_t::datarange_t& rangeData,
151 if (hitCandidateVec.empty())
return;
156 int lastTick = hitCandidateVec.front().stopTick;
159 for (
const auto& hitCandidate : hitCandidateVec) {
161 if (
int(hitCandidate.startTick) - lastTick > 1) {
162 mergedHitsVec.emplace_back(groupedHitVec);
164 groupedHitVec.clear();
168 groupedHitVec.emplace_back(hitCandidate);
170 lastTick = hitCandidate.stopTick;
174 if (!groupedHitVec.empty()) mergedHitsVec.emplace_back(groupedHitVec);
Utilities related to art service access.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Description of geometry of one entire detector.
This provides an interface for tools which are tasked with finding candidate hits on input waveforms...
art framework interface to geometry description