33 gSystem->Load(
"libSTAT");
36 TVectorD fitParam, fitParam1,fitParam2;
37 TVectorD errParam, errParam1,errParam2;
38 TMatrixD covMatrix,covMatrix1,covMatrix2;
42 TFile
f(
"driftitsTPC.root");
43 TTree *
tree = (TTree*)f.Get(
"Test");
44 tree->SetAlias(
"side",
"(-1+(pTPC.fP[1]>0)*2)");
45 tree->SetAlias(
"z",
"(pTPC.fP[1]+0.0)");
46 tree->SetAlias(
"dr",
"(1-abs(pTPC.fP[1])/250.)");
47 tree->SetAlias(
"tl",
"(pTPC.fP[3]+pITS.fP[3])*0.5");
48 tree->SetAlias(
"sa",
"sin(pTPC.fAlpha+0.)");
49 tree->SetAlias(
"ca",
"cos(pTPC.fAlpha+0.)");
51 tree->SetAlias(
"dz",
"(pTPC.fP[1]-pITS.fP[1])");
52 tree->SetAlias(
"dy",
"(pTPC.fP[0]-pITS.fP[0])");
53 tree->SetAlias(
"dtl",
"(pTPC.fP[3]-pITS.fP[3])");
54 tree->SetAlias(
"etl",
"sqrt(pITS.fC[9]+0.)");
55 tree->SetAlias(
"ez",
"sqrt(pITS.fC[2]+0.)");
61 TCut cut0(
"abs(dy)<1&&abs(pTPC.fP[1])>10");
64 TCut cut38009(
"run==38009");
65 TCut cut38010(
"run==38010");
66 TCut cut38286(
"run==38286");
67 TCut cut38532(
"run==38532");
68 TCut cut38576(
"run==38576");
69 TCut cut38586(
"run==38586");
70 TCut cut38591(
"run==38591");
71 TCut cut45639(
"run==45639");
72 TCut cut46993(
"run==46993");
73 TCut cut47164(
"run==47164");
74 TCut cut47175(
"run==47175");
75 TCut cut47180(
"run==47180");
76 TCut cut47274(
"run==47274");
77 TCut cutA = cut38591+cut0;
135 Int_t *nsort=
new Int_t[
npoints];
136 Int_t nruns =
toolkit.Freq(npoints,np,nsort,kTRUE);
143 TString fstringTl1=
"";
144 fstringTl1+=
"(side)++";
145 fstringTl1+=
"(tl)++";
146 fstringTl1+=
"side*(tl)++";
149 TString fstringZ1=
"";
150 fstringZ1+=
"(side)++";
151 fstringZ1+=
"(-side*(250.0-side*z))++";
152 fstringZ1+=
"((250.-side*z))++";
156 fstringZ1+=
"side*sa++";
157 fstringZ1+=
"side*ca++";
160 strTl1->Tokenize(
"+")->Print();
161 printf(
"Tl1: Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
162 tree->SetAlias(
"fitTl1",strTl1->Data());
166 strZ1->Tokenize(
"+")->Print();
167 printf(
"Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
168 tree->SetAlias(
"fitZ1",strZ1->Data());
170 cut1 =
"abs(dz-fitZ1)<2 && abs(dtl-fitTl1)<0.02";
176 TString fstringTl2=
"";
177 fstringTl2+=
"(side)++";
178 fstringTl2+=
"(tl)++";
179 fstringTl2+=
"(side*tl)++";
181 fstringTl2+=
"(sa)++";
182 fstringTl2+=
"(side*sa)++";
183 fstringTl2+=
"(ca)++";
184 fstringTl2+=
"(side*ca)++";
186 fstringTl2+=
"(sa*tl)++";
187 fstringTl2+=
"(side*sa*tl)++";
188 fstringTl2+=
"(ca*tl)++";
189 fstringTl2+=
"(side*ca*tl)++";
194 TString fstringZ2=
"";
195 fstringZ2+=
"(side)++";
196 fstringZ2+=
"(-side*(250.0-side*z))++";
197 fstringZ2+=
"((250.-side*z))++";
201 fstringZ2+=
"side*sa++";
202 fstringZ2+=
"side*ca++";
206 strTl2->Tokenize(
"+")->Print();
207 printf(
"Tl2: Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
208 tree->SetAlias(
"fitTl2",strTl2->Data());
212 strZ2->Tokenize(
"+")->Print();
213 printf(
"Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
214 tree->SetAlias(
"fitZ2",strZ2->Data());
216 cut2 =
"abs(dz-fitZ2)<2 && abs(dtl-fitTl2)<0.02";
225 TLinearFitter fitter1(5,
"hyp4");
239 for (Int_t jc =0;jc<10;jc++) xxx[jc]=0;
244 fitter1.AddPoint(xxx,
vdz[i],
vez[i]);
245 for (Int_t jc =0;jc<10;jc++) xxx[jc]=0;
248 fitter1.AddPoint(xxx,
vdtl[i],
vetl[i]);
251 fitter1.GetParameters(fitParam1);
252 fitter1.GetErrors(errParam1);
256 TString fstrP1f1 =
"";
257 TString fstrP3f1 =
"";
258 fstrP1f1+=fitParam1[1];fstrP1f1+=
"-side*(250.0-side*z)*(";fstrP1f1+=fitParam1[2];
259 fstrP1f1+=
")+side*("; fstrP1f1+=fitParam1[4]; fstrP1f1+=
")";
261 fstrP3f1+=fitParam1[0];fstrP3f1+=
"+tl*(";fstrP3f1+=fitParam1[2];
262 fstrP3f1+=
")+side*("; fstrP3f1+=fitParam1[3]; fstrP3f1+=
")";
264 tree->SetAlias(
"fP1f1",fstrP1f1->Data());
265 tree->SetAlias(
"fP3f1",fstrP3f1->Data());
276 TLinearFitter fitter2(7,
"hyp6");
296 for (Int_t jc =0;jc<10;jc++) xxx[jc]=0;
303 fitter2.AddPoint(xxx,
vdz[i],
vez[i]);
305 for (Int_t jc =0;jc<10;jc++) xxx[jc]=0;
309 xxx[5] = vtl[i]*
vsa[i];
310 fitter2.AddPoint(xxx,
vdtl[i],
vetl[i]);
313 fitter2.GetParameters(fitParam2);
314 fitter2.GetErrors(errParam2);
322 TString fstrP1f2 =
"";
323 TString fstrP3f2 =
"";
324 fstrP1f2+=fitParam2[1];fstrP1f2+=
"-side*(250.0-side*z)*(";fstrP1f2+=fitParam2[2];
325 fstrP1f2+=
")+side*("; fstrP1f2+=fitParam2[4];
326 fstrP1f2+=
")-side*side*(250.0-side*z)*("; fstrP1f2+=fitParam2[5];
327 fstrP1f2+=
")-side*(250.0-side*z)*sa*tl*(";fstrP1f2+=fitParam2[6];fstrP1f2+=
")";
329 fstrP3f2+=fitParam2[0];fstrP3f2+=
"+tl*(";fstrP3f2+=fitParam2[2];
330 fstrP3f2+=
")+side*("; fstrP3f2+=fitParam2[3];
331 fstrP3f2+=
")+side*tl*("; fstrP3f2+=fitParam2[5];
332 fstrP3f2+=
")*tl*sa*("; fstrP3f2+=fitParam2[6];fstrP3f2+=
")";
335 tree->SetAlias(
"fP1f2",fstrP1f2->Data());
336 tree->SetAlias(
"fP3f2",fstrP3f2->Data());
370 strP3->Tokenize(
"+")->Print();
371 printf(
"Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
373 tree->Draw(
"dtl-fitP3",cut0+cut38009);
380 fstringP3+=
"tl*(run<40000)++";
381 fstringP3+=
"tl*(abs(run-45600)<200)++";
382 fstringP3+=
"tl*(run>46000)++";
386 fstringP3+=
"sa*tl++";
387 fstringP3+=
"ca*tl++";
389 fstringP3+=
"side*tl++";
390 fstringP3+=
"side*sa++";
391 fstringP3+=
"side*ca++";
392 fstringP3+=
"side*sa*tl++";
393 fstringP3+=
"side*ca*tl++";
398 strP3->Tokenize(
"+")->Print();
399 printf(
"Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
400 tree->SetAlias(
"fitP3",strP3->Data());
401 tree->Draw(
"dtl-fitP3",cut0);
408 fstringP1+=
"dr*(run<40000)++";
409 fstringP1+=
"dr*(abs(run-45600)<200)++";
410 fstringP1+=
"dr*(run>46000)++";
411 fstringP1+=
"side*dr*(run<40000)++";
412 fstringP1+=
"side*dr*(abs(run-45600)<200)++";
413 fstringP1+=
"side*dr*(run>46000)++";
415 fstringP1+=
"tl*(run<40000)++";
416 fstringP1+=
"tl*(abs(run-45600)<200)++";
417 fstringP1+=
"tl*(run>46000)++";
418 fstringP1+=
"side*tl*(run<40000)++";
419 fstringP1+=
"side*tl*(abs(run-45600)<200)++";
420 fstringP1+=
"side*tl*(run>46000)++";
424 fstringP1+=
"sa*tl++";
425 fstringP1+=
"ca*tl++";
427 fstringP1+=
"side*sa++";
428 fstringP1+=
"side*ca++";
429 fstringP1+=
"side*sa*tl++";
430 fstringP1+=
"side*ca*tl++";
435 strP1->Tokenize(
"+")->Print();
436 printf(
"Chi2/npoints = %f\n",TMath::Sqrt(chi2/npoints));
437 tree->SetAlias(
"fitP1",strP1->Data());
438 tree->Draw(
"dz-fitP1",cuttl+cut0);
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile f("CalibObjects.root")