8 #include "art/Utilities/ToolMacros.h"
9 #include "art/Utilities/make_tool.h"
10 #include "messagefacility/MessageLogger/MessageLogger.h"
11 #include "cetlib_except/exception.h"
39 std::vector<float>::const_iterator,
77 fInd1Window = pset.get<
unsigned int >(
"Ind1Window");
78 fInd2Window = pset.get<
unsigned int >(
"Ind2Window");
79 fColWindow = pset.get<
unsigned int >(
"ColWindow");
88 fColFall = pset.get<
int >(
"ColFall");
109 const Waveform& waveform = rangeData.data();
117 int localbellow,rising;
120 int lastcomputedmean,
count;
122 int localminidx,localmin;
132 unsigned int window=0;
133 int abovecut(0),fall(0);
134 unsigned int width(0);
144 for(
unsigned int j=0;j<window;j++)
146 lastcomputedmean=(count>=0)? 0 : count/window;
182 if(waveform[i]-lastcomputedmean>threshold)
195 if(waveform[i]-lastcomputedmean>peakheight)
197 peakheight=waveform[i]-lastcomputedmean;
208 if(waveform[i]-(peakheight+lastcomputedmean)<-1)
213 if(localbellow>abovecut)
216 if(waveform[i]<localmin) {localmin=waveform[i];localminidx=i;}
220 for(
int l=0;l<rise;l++)
223 if(waveform[i+l+1]-waveform[i+l]>0) rising++;
224 else if(waveform[i+l+1]-waveform[i+l]<0) rising--;
295 if(i>=window && window) {
296 if(waveform[i]-count/window>-10)
299 count-=waveform[i-window];
338 std::vector<float>::const_iterator stopItr,
347 auto maxItr = std::max_element(startItr, stopItr);
349 float maxValue = *maxItr;
352 if (maxValue > roiThreshold)
355 auto firstItr =
std::distance(startItr,maxItr) > 2 ? maxItr - 1 : startItr;
357 while(firstItr != startItr)
360 if (*firstItr < -roiThreshold)
break;
363 if (*firstItr < *(firstItr+1) && *firstItr <= *(firstItr-1))
break;
371 findHitCandidates(startItr, firstItr + 1, roiStartTick, roiThreshold, hitCandidateVec);
374 auto lastItr =
std::distance(maxItr,stopItr) > 2 ? maxItr + 1 : stopItr - 1;
376 while(lastItr != stopItr - 1)
379 if (*lastItr < -roiThreshold)
break;
382 if (*lastItr <= *(lastItr+1) && *lastItr < *(lastItr-1))
break;
391 hitCandidate.
startTick = roiStartTick + firstTime;
392 hitCandidate.
stopTick = roiStartTick + lastTime;
393 hitCandidate.
maxTick = roiStartTick + firstTime;
394 hitCandidate.
minTick = roiStartTick + lastTime;
397 hitCandidate.
hitCenter = roiStartTick + maxTime;
398 hitCandidate.
hitSigma = std::max(2.,
float(lastTime - firstTime) / 6.);
401 hitCandidateVec.push_back(hitCandidate);
416 if (hitCandidateVec.empty())
return;
424 size_t lastStopTick = hitCandidateVec.front().stopTick;
427 for(
const auto& hitCandidate : hitCandidateVec)
435 mergedHitsVec.emplace_back(groupedHitVec);
437 groupedHitVec.clear();
441 groupedHitVec.emplace_back(hitCandidate);
443 lastStopTick = hitCandidate.stopTick;
448 if (!groupedHitVec.empty()) mergedHitsVec.emplace_back(groupedHitVec);
464 std::vector<HitCandidate>::iterator hiter;
465 std::vector<HitCandidate> hlist;
468 for(
unsigned int j=0;j<how.size();j++)
482 for(hiter=hlist.begin();hiter!=hlist.end();hiter++)
492 for(
int l=0;l<nsamp/2;l++)
494 if(first-nsamp/2+l<4095) {
495 if(holder[first-nsamp/2+l+1]-holder[first-nsamp/2+l]>0) upordown++;
496 else if(holder[first-nsamp/2+l+1]-holder[first-nsamp/2+l]<0) upordown--;
515 for(hiter=hlist.begin();hiter!=hlist.end();hiter++)
525 for(
int l=0;l<nsamp/2;l++)
527 if(last+nsamp/2-l>0) {
528 if(holder[last+nsamp/2-l]-holder[last+nsamp/2-l-1]>0) upordown++;
529 else if(holder[last+nsamp/2-l]-holder[last+nsamp/2-l-1]<0) upordown--;
Utilities related to art service access.
unsigned int PlaneID_t
Type for the ID number.
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.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
auto begin(FixedBins< T, C > const &) noexcept
This provides an interface for tools which are tasked with finding candidate hits on input waveforms...
std::size_t count(Cont const &cont)
art framework interface to geometry description