50 const size_t roiStartTick,
52 const size_t eventCount,
56 const Waveform& waveform = dataRange.data();
60 const size_t plane = wids[0].Plane;
63 findHitCandidates(waveform.begin(), waveform.end(), roiStartTick, plane, hitCandidateVec);
71 const size_t roiStartTick,
72 const size_t planeIdx,
78 auto maxItr = std::max_element(startItr, stopItr);
80 float maxValue = *maxItr;
85 auto firstItr =
std::distance(startItr, maxItr) > 2 ? maxItr - 1 : startItr;
87 while (firstItr != startItr) {
92 if (*firstItr < *(firstItr + 1) && *firstItr <= *(firstItr - 1))
break;
100 findHitCandidates(startItr, firstItr + 1, roiStartTick, planeIdx, hitCandidateVec);
103 auto lastItr =
std::distance(maxItr, stopItr) > 2 ? maxItr + 1 : stopItr - 1;
105 while (lastItr != stopItr - 1) {
110 if (*lastItr <= *(lastItr + 1) && *lastItr < *(lastItr - 1))
break;
119 hitCandidate.
startTick = roiStartTick + firstTime;
120 hitCandidate.
stopTick = roiStartTick + lastTime;
121 hitCandidate.
maxTick = roiStartTick + firstTime;
122 hitCandidate.
minTick = roiStartTick + lastTime;
125 hitCandidate.
hitCenter = roiStartTick + maxTime;
129 hitCandidateVec.push_back(hitCandidate);
145 const recob::Wire::RegionsOfInterest_t::datarange_t& rangeData,
150 if (hitCandidateVec.empty())
return;
155 int lastTick = hitCandidateVec.front().stopTick;
158 for (
const auto& hitCandidate : hitCandidateVec) {
160 if (
int(hitCandidate.startTick) - lastTick > 1) {
161 mergedHitsVec.emplace_back(groupedHitVec);
163 groupedHitVec.clear();
167 groupedHitVec.emplace_back(hitCandidate);
169 lastTick = hitCandidate.stopTick;
173 if (!groupedHitVec.empty()) mergedHitsVec.emplace_back(groupedHitVec);
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
art framework interface to geometry description
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static int max(int a, int b)
Description of geometry of one entire detector.
This provides an interface for tools which are tasked with finding candidate hits on input waveforms...
auto const & get(AssnsNode< L, R, D > const &r)