33 sprintf (fcn_name,
"fermi%d", numtraces);
34 fermi =
new TF1(fcn_name,
"[0]/(exp(-(x-[1])/[2])+1)+[3]", 0, 1024);
36 sprintf (hst_name,
"trace%d", numtraces);
37 trace =
new TH1D(hst_name, hst_name, 1024, -0.5, 1023.5);
53 for (
int mid=1+n; mid<voltage.size()-
n; mid++)
56 if( mid < 420 || mid > 460 )
continue;
58 for (
int bin=mid-n; bin<mid+
n; bin++)
69 return MaxSum/(2.0*n+1.0);
77 for (
int mid=1+n; mid<voltage.size()-
n; mid++)
80 if( mid < 420 || mid > 460 )
continue;
82 for (
int bin=mid-n; bin<mid+
n; bin++)
100 int bin = trace->GetMaximumBin();
101 height = trace->GetBinContent(bin);
108 for(
int i=bin;
i>0;--
i)
111 if(trace->GetBinContent(
i) < height/2.0)
114 time = trace->GetBinCenter(
i);
123 heightCompare =
new TH2D(
"heightCompare",
"heightCompare", 1000, -0.5, 999.5, 1000, -0.5, 999.5);
124 timeCompare =
new TH2D(
"timeCompare",
"timeCompare", 1000, -0.5, 999.5, 1000, -0.5, 999.5);
125 heightDiff =
new TH1D(
"heightDiff",
"heightDiff", 1000, -499.5, 500.5);
126 timeDiff =
new TH1D(
"timeDiff",
"timeDiff", 1000, -499.5, 500.5);
128 double X = trace->GetBinCenter(bin);
130 fermi->SetParameter(0,height);
131 fermi->SetParameter(1,X-2);
132 fermi->SetParameter(2,5);
133 fermi->SetParameter(3,2);
134 fermi->SetRange(5,X+2);
135 trace->Fit(fermi,
"WWR",
"",5,X+2);
137 double ht = trace->GetFunction(fcn_name)->GetParameter(0);
138 double tm = trace->GetFunction(fcn_name)->GetParameter(1);
145 height = trace->GetFunction(fcn_name)->GetParameter(0);
146 time = trace->GetFunction(fcn_name)->GetParameter(1);
156 bool belowThreshold =
true;
158 for(
int i=0;
i<voltage.size();
i++)
160 if ( belowThreshold && -voltage[
i] >= thrup )
163 belowThreshold =
false;
166 else if ( !belowThreshold && -voltage[
i] < thrdown )
168 belowThreshold =
true;
182 bool belowThreshold =
true;
187 for(
int i=0;
i<voltage.size();
i++)
189 if ( belowThreshold && voltage[
i] >= thrup )
192 belowThreshold =
false;
195 else if ( !belowThreshold && voltage[
i] < thrdown )
198 belowThreshold =
true;
208 for(
int i=0;
i!=voltage.size(); ++
i)
210 double vol = sign*voltage[
i];
211 trace->SetBinContent(
i+1,vol);