Compute parameters.
59 double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
63 double frame[C::MAXSAMPLES];
71 for(
int iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
72 int gainId = dataFrame.sample(iSample).gainId();
73 if ( dataFrame.isSaturated() != -1 )
79 if (gainId != gainId0) iGainSwitch++ ;
81 frame[iSample] = double(dataFrame.sample(iSample).adc());
83 frame[iSample] = double(((
double)(dataFrame.sample(iSample).adc()) - pedestals[gainId-1]) * gainRatios[gainId-1]);
85 if( frame[iSample]>maxsample ) {
86 maxsample= frame[iSample];
95 double xarray[10]={0.,1.,2.,3.,4.,5.,6.,7.,8.,9.};
96 TGraph
graph(10,xarray,frame);
99 TF1 pulseShape = TF1(
"pulseShape",
100 "[0]*pow((x - [3])/[1],[2])*exp(-[2]*(x - [1] - [3])/[1])",
102 TF1 pedestal = TF1(
"pedestal",
"[0]",0.,2.);
106 TF1 pluseAndPed = TF1(
"pulseAndPed",
"pedestal+pulseShape");
110 double FIT_A=(double)maxsample;
111 pulseShape.SetParameter(0,FIT_A);
112 pulseShape.SetParName(0,
"Amplitude");
114 double FIT_Tp=(double)imax;
115 pulseShape.SetParameter(1,FIT_Tp);
116 pulseShape.SetParName(1,
"t_{P}");
119 pulseShape.SetParameter(2,FIT_ALFA);
120 pulseShape.SetParName(2,
"\\alpha");
123 pulseShape.SetParameter(3,FIT_To);
124 pulseShape.SetParName(3,
"t_{0}");
127 pedestal.SetParameter(0,frame[0]);
128 pedestal.SetParName(0,
"Pedestal");
132 graph.Fit(
"pulseShape",
"QRM");
135 if ( std::string(
gMinuit->fCstatu.Data()) == std::string(
"CONVERGED ") ) {
137 double amplitude_value=pulseShape.GetParameter(0);
139 graph.Fit(
"pedestal",
"QRL");
141 double pedestal_value=pedestal.GetParameter(0);
144 amplitude_ = amplitude_value - pedestal_value;
146 amplitude_ = amplitude_value;
148 pedestal_ = pedestal_value;
149 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)