8 #include "art/Utilities/ToolMacros.h"
9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #include "art_root_io/TFileService.h"
11 #include "messagefacility/MessageLogger/MessageLogger.h"
12 #include "cetlib_except/exception.h"
18 #include "art/Utilities/make_tool.h"
19 #include "icarus_signal_processing/WaveformTools.h"
20 #include "icarus_signal_processing/Filters/ICARUSFFT.h"
36 void configure(
const fhicl::ParameterSet& pset)
override;
54 std::unique_ptr<icarus_signal_processing::ICARUSFFT<double>>
fFFT;
81 cet::search_path sp(
"FW_SEARCH_PATH");
87 throw cet::exception(
"File not found");
95 while (std::getline(inFile,line))
99 std::stringstream linestream(line);
100 linestream >> channel >> constant;
102 if (channel%1000==0)
std::cout<<
"Channel "<<channel<<
" correction factor "<<
fdQdxCalib[channel]<<std::endl;
107 fSignalShaping = art::ServiceHandle<icarusutil::SignalShapingICARUSService>();
110 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
111 fFFT = std::make_unique<icarus_signal_processing::ICARUSFFT<double>>(detProp.NumberTimeSamples());
117 double const samplingRate,
126 size_t dataSize = waveform.size();
134 size_t binOffset = 0;
136 float normFactor = 1. / deconNorm;
137 bool applyNormFactor =
std::abs(normFactor - 1.) > std::numeric_limits<float>::epsilon() ?
true :
false;
140 std::copy(waveform.begin(),waveform.end(),rawAdcLessPedVec.begin()+binOffset);
145 std::vector<float> holder;
147 for(
size_t roiIdx = 0; roiIdx < roiVec.size(); roiIdx++)
149 const auto& roi = roiVec[roiIdx];
152 size_t roiLen = roi.second - roi.first + 1;
154 holder.resize(roiLen);
156 std::copy(rawAdcLessPedVec.begin()+binOffset+roi.first, rawAdcLessPedVec.begin()+binOffset+roiLen, holder.begin());
157 if (applyNormFactor)
std::transform(holder.begin(),holder.end(),holder.begin(), std::bind(std::multiplies<float>(),std::placeholders::_1,normFactor));
164 fWaveformTool.getTruncatedMean(holder, truncMean, nTrunc, range);
166 std::transform(holder.begin(),holder.end(),holder.begin(), std::bind(std::minus<float>(),std::placeholders::_1,truncMean));
173 for (
size_t iholder = 0; iholder < holder.size(); ++iholder){
174 holder[iholder] *= constant;
180 ROIVec.
add_range(roi.first, std::move(holder));
Utilities related to art service access.
This provides an interface for tools which are tasked with running the deconvolution algorithm...
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
std::vector< SigProcPrecision > TimeVec
Description of geometry of one entire detector.
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
unsigned int ChannelID_t
Type representing the ID of a readout channel.
art framework interface to geometry description
BEGIN_PROLOG could also be cout