4 #include "messagefacility/MessageLogger/MessageLogger.h"
22 mf::LogInfo(
"RawDigitBinAverageAlg") <<
"RawDigitBinAverageAlg configured\n";
31 size_t binsToAverage)
const
33 size_t halfBinsToAverage(binsToAverage/2);
37 for(
size_t idx = 0; idx < halfBinsToAverage; idx++) runningSum += dataVec[idx];
40 std::vector<float> meanVec;
42 meanVec.resize(dataVec.size(), 0);
43 std::vector<float>::iterator meanVecItr = meanVec.begin();
46 for(RawDigitVector::iterator dataItr = dataVec.begin(); dataItr != dataVec.end(); dataItr++)
50 size_t count = std::min(2 * halfBinsToAverage, std::min(startOffset + halfBinsToAverage + 1, halfBinsToAverage + stopOffset - 1));
52 if (startOffset >= halfBinsToAverage) runningSum -= *(dataItr - halfBinsToAverage);
53 if (stopOffset > halfBinsToAverage) runningSum += *(dataItr + halfBinsToAverage);
55 *meanVecItr++ = runningSum / float(count);
58 std::transform(meanVec.begin(),meanVec.end(),dataVec.begin(),[](
const float& val){
return std::round(val);});
66 std::transform(dataVec.begin(),dataVec.end()-1,dataVec.begin()+1,dataVec.begin(),[](
const short&
first,
const short& last){
return std::round(
float(first+last)/2.);});
raw::RawDigit::ADCvector_t RawDigitVector
RawDigitBinAverageAlg(fhicl::ParameterSet const &pset)
~RawDigitBinAverageAlg()
Destructor.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
void doTwoBinAverage(RawDigitVector &) const
void doBinAverage(RawDigitVector &, size_t) const
std::size_t count(Cont const &cont)
process_name can override from command line with o or output caldata