8 #include "art/Utilities/ToolMacros.h"
9 #include "art_root_io/TFileService.h"
10 #include "messagefacility/MessageLogger/MessageLogger.h"
11 #include "cetlib_except/exception.h"
32 void configure(
const fhicl::ParameterSet& pset)
override;
66 std::vector<unsigned short> uin;
67 std::vector<unsigned short> vin;
68 std::vector<unsigned short> zin;
70 fNumBinsHalf = pset.get<
unsigned short > (
"NumBinsHalf", 3);
71 fThreshold = pset.get< std::vector<unsigned short> >(
"Threshold" );
72 fNumSigma = pset.get< std::vector<int> > (
"NumSigma" );
73 uin = pset.get< std::vector<unsigned short> >(
"uPlaneROIPad" );
74 vin = pset.get< std::vector<unsigned short> >(
"vPlaneROIPad" );
75 zin = pset.get< std::vector<unsigned short> >(
"zPlaneROIPad" );
77 if(uin.size() != 2 || vin.size() != 2 || zin.size() != 2) {
78 throw art::Exception(art::errors::Configuration)
79 <<
"u/v/z plane ROI pad size != 2";
93 fSignalShaping = art::ServiceHandle<icarusutil::SignalShapingICARUSService>();
106 size_t stopBin(numBins);
108 float rawNoise = std::max(rmsNoise,
double(elecNoise));
111 float stopThreshold = startThreshold;
114 float runningSum = std::accumulate(waveform.begin(),waveform.begin()+numBins, 0.);
116 size_t roiStartBin(0);
117 bool roiCandStart(
false);
126 runningSum -= waveform[startBin++];
129 runningSum += waveform[stopBin++];
134 if (fabs(runningSum) < stopThreshold)
138 roiCandStart =
false;
144 if (fabs(runningSum) > startThreshold)
153 if (roiCandStart) roiVec.push_back(
CandidateROI(roiStartBin, waveform.size() - 1));
156 for(
auto& roi : roiVec)
161 roi.second = std::min(roi.second +
fPostROIPad[planeID.
Plane], waveform.size() - 1);
165 if(roiVec.size() > 1)
171 size_t startRoi = roiVec.front().first;
172 size_t stopRoi = startRoi;
174 for(
auto& roi : roiVec)
176 if (roi.first <= stopRoi) stopRoi = roi.second;
181 startRoi = roi.first;
182 stopRoi = roi.second;
Utilities related to art service access.
The data type to uniquely identify a Plane.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
art framework interface to geometry description