double zzz = (tFD-strip_t0-Get_Track_T0())*drift_velocity; // chech --> // This Z assign Z=0.5 to the cathode and Z=0 to G1 CHECK
set_APV25_Z(zzz);
if(Get_APV25_Q(iS)>qcut && Get_APV25_T(iS)!=0){ Set_APV25_X(iS,iS*pitch+0.5*pitch+x_min); }
33 {
34
35
36
37 double maxbin = histo_q_vs_t->GetMaximumBin();
39
40
41
42
43 double minbin = 0;
44 for(int ibin = maxbin; ibin > 1; ibin--){
45 if(histo_q_vs_t->GetBinContent(ibin) < 0.1 * QMaxHisto) {
46 minbin = ibin;
47 break;
48 }
49 }
50 double startvalues[5] = {0};
51 double fitlimup[5] = {0};
52 double fitlimlow[5] = {0};
53
54 double meanfirstbin = (histo_q_vs_t->GetBinContent(minbin-1) + histo_q_vs_t->GetBinContent(minbin-2) + histo_q_vs_t->GetBinContent(minbin-3))/3.;
55 double sigma_MFB = TMath::Sqrt( ( pow(histo_q_vs_t->GetBinContent(minbin-1) - meanfirstbin, 2) + pow(histo_q_vs_t->GetBinContent(minbin-2) - meanfirstbin,2) + pow(histo_q_vs_t->GetBinContent(minbin-3)- meanfirstbin,2)) / 3.);
56 if(sigma_MFB < TMath::Abs(meanfirstbin)) sigma_MFB = TMath::Abs(meanfirstbin);
57
58 startvalues[0] = meanfirstbin;
59 startvalues[1] = QMaxHisto;
60 startvalues[2] = 0.5* (minbin + maxbin) *
tstep;
61 startvalues[3] = 0.5*
tstep;
62
63
64 fitlimlow[0] = startvalues[0] - 2 * sigma_MFB;
65 fitlimlow[1] = startvalues[1] - 0.3 * startvalues[1];
66 fitlimlow[2] = minbin *
tstep;
67 fitlimlow[3] = 0.1*
tstep;
68
69 fitlimup[0] = startvalues[0] + 2 * sigma_MFB;
70 fitlimup[1] = startvalues[1] + 0.3 * startvalues[1];
71 fitlimup[2] = maxbin *
tstep;
72 fitlimup[3] = 0.9*
tstep;
73
74
75
76
77
78
79
80
81
82 double minFD = minbin - 4;
83 double maxFD = maxbin + 0;
84
85 TF1 f_FD(
"f_FD",
"[0] + [1]/(1+TMath::Exp(-(x - [2])/[3]))", minFD*
tstep, maxFD*
tstep);
86 f_FD.SetParameters(startvalues[0], startvalues[1], startvalues[2], startvalues[3]);
87 f_FD.SetParLimits(0, fitlimlow[0], fitlimup[0]);
88 f_FD.SetParLimits(1, fitlimlow[1], fitlimup[1]);
89 f_FD.SetParLimits(2, fitlimlow[2], fitlimup[2]);
90 f_FD.SetParLimits(3, fitlimlow[3], fitlimup[3]);
91
92 gStyle->SetOptFit(1111);
93 histo_q_vs_t->Fit("f_FD","WQRB");
94
95 double tFD = 0;
96 tFD = gRandom->Gaus(f_FD.GetParameter(2), 8);
97 double dtFD = 0.;
98 dtFD = f_FD.GetParError(2);
100
101
106
107
108
109
110
111
112
113
114
115
116
117
118 return tFD;
119}
void set_FD_par(int i, double p)