Compute parameters.
56 double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
60 double frame[C::MAXSAMPLES];
68 for(
int iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
69 int gainId = dataFrame.sample(iSample).gainId();
70 if ( dataFrame.isSaturated() != -1 )
76 if (gainId != gainId0) iGainSwitch++ ;
78 frame[iSample] = double(dataFrame.sample(iSample).adc());
80 frame[iSample] = double(((
double)(dataFrame.sample(iSample).adc()) - pedestals[gainId-1]) * gainRatios[gainId-1]);
82 if( frame[iSample]>maxsample ) {
83 maxsample= frame[iSample];
92 double xarray[10]={0.,1.,2.,3.,4.,5.,6.,7.,8.,9.};
93 TGraph
graph(10,xarray,frame);
96 TF1 pulseShape = TF1(
"pulseShape",
97 "[0]*pow((x - [3])/[1],[2])*exp(-[2]*(x - [1] - [3])/[1])",
99 TF1 pedestal = TF1(
"pedestal",
"[0]",0.,2.);
103 TF1 pluseAndPed = TF1(
"pulseAndPed",
"pedestal+pulseShape");
107 double FIT_A=(double)maxsample;
108 pulseShape.SetParameter(0,FIT_A);
109 pulseShape.SetParName(0,
"Amplitude");
111 double FIT_Tp=(double)imax;
112 pulseShape.SetParameter(1,FIT_Tp);
113 pulseShape.SetParName(1,
"t_{P}");
116 pulseShape.SetParameter(2,FIT_ALFA);
117 pulseShape.SetParName(2,
"\\alpha");
120 pulseShape.SetParameter(3,FIT_To);
121 pulseShape.SetParName(3,
"t_{0}");
124 pedestal.SetParameter(0,frame[0]);
125 pedestal.SetParName(0,
"Pedestal");
129 graph.Fit(
"pulseShape",
"QRM");
134 double amplitude_value=pulseShape.GetParameter(0);
136 graph.Fit(
"pedestal",
"QRL");
138 double pedestal_value=pedestal.GetParameter(0);
141 amplitude_ = amplitude_value - pedestal_value;
143 amplitude_ = amplitude_value;
145 pedestal_ = pedestal_value;
146 jitter_ = pulseShape.GetParameter(3);
int gainId(sample_type sample)
get the gainId (2 bits)
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)