27 fSampling = (timeService->OpticalClock().Frequency())*500./64;
31 std::vector< recob::OpHit > ret;
34 double FWHM=1, Area=1, phelec, fasttotal=3./4., rms=0, amplitude=0, time=0;
35 unsigned short frame=1;
36 int histogram_number = 0;
38 for(
auto const& wvf : waveforms) {
42 wvfHist =
new TH1D(
histname.str().c_str(),
"Histogram", wvf.size(),0, double(wvf.size()));
43 for(
unsigned int i=0;i<wvf.size();i++){
44 wvfHist->SetBinContent(i,wvf[i]);
53 time = wvf.TimeStamp() + (double)timebin/
fSampling;
65 histogram_number += 1;
76 baseline+=h->GetBinContent(i);
77 rms+=pow((h->GetBinContent(i)),2.0);
80 baseline=baseline/cnt;
81 rms=sqrt(rms/cnt-baseline*baseline);
84 if(pdtype==
"pmt" || pdtype ==
"barepmt"){
94 double aux = h->GetMaximum();
96 size_t time_end,
bin, binmax = h->GetMaximumBin();
99 if(type==
"pmt" || type ==
"barepmt"){
109 if(aux<threshold)
return false;
113 aux = h->GetBinContent(bin);
120 aux = h->GetBinContent(bin);
124 Area=(h->Integral(time,time_end))/
fSampling;
127 aux = h->GetBinContent(time);
130 h->SetBinContent(bin,0.0);
132 aux = h->GetBinContent(bin);
141 int wavelength = (int)h->GetNbinsX();
148 input = (
float*)malloc(
sizeof(*input)*wavelength);
149 output = (
float*)malloc(
sizeof(*output)*wavelength);
151 for(
int i=0; i<wavelength; i++){
152 input[i] = h->GetBinContent(i);
153 output[i] = input[i];
158 TV1D_denoise(input, output, (
const int)wavelength, (
const float)lambda);
162 for(
int i=0; i<wavelength; i++){
163 if(output[i])h->SetBinContent(i,output[i]);
174 const float twolambda=2.0*
lambda;
175 const float minlambda=-
lambda;
179 do output[k0++]=vmin;
while (k0<=
kminus);
180 umax=(vmin=input[
kminus=k=k0])+(umin=lambda)-vmax;
181 }
else if (umax>0.0) {
182 do output[k0++]=vmax;
while (k0<=kplus);
183 umin=(vmax=input[kplus=k=k0])+(umax=minlambda)-vmin;
186 do output[k0++]=vmin;
while(k0<=k);
190 if ((umin+=input[k+1]-vmin)<minlambda) {
191 do output[k0++]=vmin;
while (k0<=
kminus);
192 vmax=(vmin=input[kplus=
kminus=k=k0])+twolambda;
193 umin=
lambda; umax=minlambda;
194 }
else if ((umax+=input[k+1]-vmax)>
lambda) {
195 do output[k0++]=vmax;
while (k0<=kplus);
196 vmin=(vmax=input[kplus=
kminus=k=k0])-twolambda;
197 umin=
lambda; umax=minlambda;
204 if (umax<=minlambda) {
205 vmax+=(umax+
lambda)/((kplus=k)-k0+1);
bool findPeak(TH1D *h, size_t &time, double &Area, double rms, double &litude, std::string type)
double lambda(double a, double b, double c)
process_name eventweight kplus
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::vector< recob::OpHit > MakeHits(const std::vector< raw::OpDetWaveform > &waveforms)
void subtractBaseline(TH1D *hist, std::string pdtype, double &rms)
opHitFinderSBND(fhicl::ParameterSet const &p, const detinfo::DetectorClocks *timeService)
std::string fInputModuleName
Class used for the conversion of times between different formats and references.
void TV1D_denoise(float *input, float *&output, const int width, const float lambda)
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
std::stringstream histname
process_name eventweight kminus
std::string pdType(size_t ch) const override
double fPulsePolarityArapuca