]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/TestAnalisys.C
Function parameter reordering (Marian)
[u/mrichter/AliRoot.git] / TPC / TestAnalisys.C
CommitLineData
5f9ad509 1/*
2 .L AliGenInfo.C+
72008ac9 3 .L TestAnalisys.C+
4 AddChains(868); // AddChains(runNumber);
5f9ad509 5 Select(); // make default selection of data
6*/
7
72008ac9 8#include "TFile.h"
9#include "TTree.h"
10#include "TChain.h"
11#include "TString.h"
12#include "TLegend.h"
13#include "TCut.h"
14#include "TF1.h"
15#include "TProfile.h"
16#include "TProfile2D.h"
17#include "TH1F.h"
18#include "TH2F.h"
19#include "TPad.h"
20#include "TCanvas.h"
21#include "TSystem.h"
22#include "TParticle.h"
23#include "TRandom.h"
24#include "TEventList.h"
25
26#include "AliTrackReference.h"
27#include "AliTPCParam.h"
28#include "AliDetector.h"
29#include "AliStack.h"
30#include "AliGenInfo.h"
31
32
33
5f9ad509 34
5f9ad509 35
36
72008ac9 37void Select(); // make default selection
38void AddChains(Int_t run); // add all the trees with selected run number to the chain
39void MakePictures(char *dirname); // make default pictures
5f9ad509 40
72008ac9 41void PRFYZ(TCut cut0, TCut cut1, char * description);
42void PRFZZ(TCut cut0, TCut cut1, char * description);
43void P5Z(TCut cut0, TCut cut1, char * description);
44void P3Z(TCut cut0, TCut cut1, char * description);
45void ResYZ(TCut cut0, TCut cut1, char * description);
46void SysYX(TCut cut0, char * description);
47void SysZX(TCut cut0, char * description);
48//
49TProfile * ProfileMaxRow(TCut cut0, char *name, Int_t max);
50TProfile * ProfileMaxPhi(TCut cut0, char *name, Int_t max);
b2c02e7d 51TProfile * ProfileMaxZ(TCut cut0, char *name, Int_t max);
52TProfile * ProfileQRow(TCut cut0, char *name, Int_t max);
53TProfile * ProfileQPhi(TCut cut0, char *name, Int_t max);
72008ac9 54TProfile * ProfileQZ(TCut cut0, char *name, Int_t max);
55TCanvas * NoiseSector(TCut cut0, char * description, Int_t maxrow, Int_t maxpad);
5f9ad509 56
57//
58// global variables
59//
60TChain chaincl("Tracks","Tracks"); // tpc tracks and clusters
72008ac9 61TChain chaincl2("Tracks","Tracks"); // tpc tracks and clusters
62TChain chainSignal("SignalB","SignalB"); // signals over threshold 50
63
5f9ad509 64TChain chainFit("Fit","Fit"); // fitted signals with fit parameters
65TChain chainPed("Fit","Fit"); // fitted pedestal with noise
72008ac9 66TString runDesc="Run "; // run descriptor
5f9ad509 67//
68AliComparisonDraw comp;
72008ac9 69AliComparisonDraw compCl;
5f9ad509 70AliComparisonDraw compF;
5f9ad509 71AliComparisonDraw compP;
5f9ad509 72//
73//
74// selection of data for analysis
75//
76TEventList * listTracks = new TEventList("listTracks","listTracks");
77TEventList * listFitS = new TEventList("listFitS","listFitS");
78TEventList * listFitPed = new TEventList("listFitPed","listFitPed");
79
80
72008ac9 81
82
83void MakePictures(char *dirname){
84 //
85 //
86 //
87 const Int_t kMinCl = 200;
88 char chshell[100];
89 sprintf(chshell,"mkdir %s", dirname);
90 gSystem->Exec(chshell);
91 sprintf(chshell,"cd %s", dirname);
92 gSystem->Exec(chshell);
93 //
94 //
95 //
96 TCanvas c(dirname,dirname);
97 for (Int_t isector=0; isector<36; isector++){
98 char chcut1[100];
99 char chcut2[100];
100 char chdesc[100];
101 TProfile * prof;
102 sprintf(chshell,"Cl.fX>0&&Cl.fDetector==%d",isector);
103 Int_t ncl = comp.fTree->Draw("Cl.fY",chshell);
104 if (ncl<kMinCl) continue;
105 printf("MakePictures sector %d\n",isector);
106 //
107 // charge pictures
108 //
109 //
110 // charge row
111 //
112 c.cd();
113 sprintf(chdesc,"%s Sector %d IROC",runDesc.Data(), isector);
114 sprintf(chcut1,"Cl.fDetector==%d", isector);
b2c02e7d 115 prof = ProfileQRow(chcut1, chdesc, 70);
72008ac9 116 sprintf(chshell,"%s/qrow_sec%dIROC.eps", dirname,isector);
117 prof->Draw();
118 c.Update();
119 c.Print(chshell);
b2c02e7d 120 prof = ProfileMaxRow(chcut1, chdesc, 70);
121 sprintf(chshell,"%s/maxrow_sec%dIROC.eps", dirname,isector);
122 prof->Draw();
123 c.Update();
124 c.Print(chshell);
72008ac9 125 //
126 sprintf(chdesc,"%s Sector %d OROC",runDesc.Data(), isector);
127 sprintf(chcut1,"Cl.fDetector==%d", isector+36);
b2c02e7d 128 prof = ProfileQRow(chcut1, chdesc, 100);
72008ac9 129 sprintf(chshell,"%s/qrow_sec%dOROC.eps", dirname,isector);
130 prof->Draw();
131 c.Update();
132 c.Print(chshell);
b2c02e7d 133 prof = ProfileMaxRow(chcut1, chdesc, 100);
134 sprintf(chshell,"%s/maxrow_sec%dOROC.eps", dirname,isector);
135 prof->Draw();
136 c.Update();
137 c.Print(chshell);
72008ac9 138 //
139 // charge phi
140 //
141 sprintf(chdesc,"%s Sector %d IROC",runDesc.Data(), isector);
142 sprintf(chcut1,"Cl.fDetector==%d", isector);
143 prof = ProfileMaxPhi(chcut1, chdesc,20);
144 sprintf(chshell,"%s/qphi_sec%dIROC.eps", dirname,isector);
145 prof->Draw();
146 c.Update();
147 c.Print(chshell);
148 //
149 sprintf(chdesc,"%s Sector %d OROC",runDesc.Data(), isector);
150 sprintf(chcut1,"Cl.fDetector==%d", isector+36);
151 prof = ProfileMaxPhi(chcut1, chdesc,20);
152 sprintf(chshell,"%s/qphi_sec%dOROC.eps", dirname,isector);
153 prof->Draw();
154 c.Update();
155 c.Print(chshell);
156 //
157 // charge z
158 //
159 sprintf(chdesc,"%s Sector %d IROC",runDesc.Data(), isector);
160 sprintf(chcut1,"Cl.fDetector==%d", isector);
161 prof = ProfileQZ(chcut1, chdesc,20);
162 sprintf(chshell,"%s/qz_sec%dIROC.eps", dirname,isector);
163 prof->Draw();
164 c.Update();
165 c.Print(chshell);
166 //
167 sprintf(chdesc,"%s Sector %d OROC",runDesc.Data(), isector);
168 sprintf(chcut1,"Cl.fDetector==%d", isector+36);
169 prof = ProfileQZ(chcut1, chdesc,20);
170 sprintf(chshell,"%s/qz_sec%dOROC.eps", dirname,isector);
171 prof->Draw();
172 c.Update();
173 c.Print(chshell);
174 //
175 // Picture noise
176 //
177 sprintf(chdesc,"%s Sector %d IROC",runDesc.Data(), isector);
178 sprintf(chcut1,"Sector==%d", isector);
179 TCanvas *cnoise = NoiseSector(chcut1, chdesc,70,70);
180 sprintf(chshell,"%s/noise_sec%dIROC.eps", dirname,isector);
181 cnoise->Print(chshell);
182 sprintf(chdesc,"%s Sector %d OROC",runDesc.Data(), isector);
183 sprintf(chcut1,"Sector==%d", isector+36);
184 cnoise = NoiseSector(chcut1, chdesc,70,70);
185 sprintf(chshell,"%s/noise_sec%dOROC.eps", dirname,isector);
186 cnoise->Print(chshell);
187 //
188 // systematic
189 //
190 c.cd();
191 sprintf(chdesc,"%s Sector %d",runDesc.Data(), isector);
192 sprintf(chcut1,"Cl.fDetector==%d||Cl.fDetector==%d", isector, isector+36);
193 SysYX(chcut1,chdesc);
194 sprintf(chshell,"%s/deltayx_sec%d.eps", dirname,isector);
195 c.Print(chshell);
b2c02e7d 196 c.cd();
72008ac9 197 SysZX(chcut1,chdesc);
198 sprintf(chshell,"%s/deltazx_sec%d.eps", dirname,isector);
199 c.Print(chshell);
200
201 //
202 // picture prf
203 //
204 if (ncl<500) continue; //not enough statistic
205 //
206 sprintf(chdesc,"%s Sector %d",runDesc.Data(), isector);
207 sprintf(chcut1,"Cl.fDetector==%d", isector);
208 sprintf(chcut2,"Cl.fDetector==%d", isector+36);
209 c.cd();
210 PRFYZ(chcut1, chcut2,chdesc);
211 sprintf(chshell,"%s/prfyz_sec%d.eps", dirname,isector);
212 c.Print(chshell);
213 sprintf(chcut1,"Sector==%d", isector);
214 sprintf(chcut2,"Sector==%d", isector+36);
215 PRFZZ(chcut1, chcut2,chdesc);
216 sprintf(chshell,"%s/prfzz_sec%d.eps", dirname,isector);
217 c.Print(chshell);
218 //
219 // y resolution
220 //
221 sprintf(chdesc,"%s Sector %d",runDesc.Data(), isector);
222 sprintf(chcut1,"Cl.fDetector==%d", isector);
223 sprintf(chcut2,"Cl.fDetector==%d", isector+36);
224 c.cd();
225 ResYZ(chcut1, chcut2,chdesc);
226 sprintf(chshell,"%s/resyz_sec%d.eps", dirname,isector);
227 c.Print(chshell);
228 //
229 }
230}
231
232
233
234
235
236
5f9ad509 237void AddChains(Int_t run){
238 //
72008ac9 239 // add files to the chains + check consistency
5f9ad509 240 //
241 ifstream in0;
242 ifstream in1;
243 ifstream in2;
72008ac9 244 ifstream in3;
245 ifstream in4;
5f9ad509 246 TString sfile;
247 char strcl[100];
72008ac9 248 runDesc+=run;
5f9ad509 249 // TPC tracks
250 //
251 sprintf(strcl,"ls run%d*/TPCtracks.root > /tmp/files.txt", run);
252 gSystem->Exec(strcl);
253 in0.open("/tmp/files.txt");
254 for (;in0>>sfile;){
255 if (sfile.Length()==0) break;
256 printf("%s\n",sfile.Data());
72008ac9 257 TFile f(sfile.Data());
258 TTree * tree = (TTree*)f.Get("Tracks");
259 if (tree){
260 f.Close();
261 chaincl.Add(sfile.Data());
262 }
5f9ad509 263 }
264 //
265 // Fitted signals
266 sprintf(strcl,"ls run%d*/FitSignal.root > /tmp/files.txt", run);
267 gSystem->Exec(strcl);
268 in1.open("/tmp/files.txt");
269 for (;in1>>sfile;){
270 if (sfile.Length()==0) break;
72008ac9 271 printf("%s\n",sfile.Data());
272 TFile f(sfile.Data());
273 TTree * tree =(TTree*)f.Get("Fit");
274 if (tree){
275 f.Close();
276 chainFit.Add(sfile.Data());
277 }
5f9ad509 278 }
279 //
280 // Fitted pedestal
281 sprintf(strcl,"ls run%d*/TPCsignal.root > /tmp/files.txt", run);
282 gSystem->Exec(strcl);
283 in2.open("/tmp/files.txt");
284 for (;in2>>sfile;){
285 if (sfile.Length()==0) break;
286 printf("%s\n",sfile.Data());
72008ac9 287 TFile f(sfile.Data());
288 TTree * tree =(TTree*)f.Get("Fit");
289 if (tree){
290 f.Close();
291 chainPed.Add(sfile.Data());
292 }
293 // chainPed.Add(sfile.Data());
294 }
295 //
296 // Fitted pedestal
297 sprintf(strcl,"ls run%d*/TPCsignal.root > /tmp/files.txt", run);
298 gSystem->Exec(strcl);
299 in4.open("/tmp/files.txt");
300 for (;in4>>sfile;){
301 if (sfile.Length()==0) break;
302 printf("%s\n",sfile.Data());
303 TFile f(sfile.Data());
304 TTree * tree =(TTree*)f.Get("SignalB");
305 if (tree){
306 f.Close();
307 chainPed.Add(sfile.Data());
308 }
309 // chainPed.Add(sfile.Data());
310 }
311 //
312 // Rec points trees
313 //
314 printf("\n IMPORT REC points");
315 sprintf(strcl,"ls run%d*/*RecPoints* > /tmp/files.txt", run);
316 gSystem->Exec(strcl);
317 in3.open("/tmp/files.txt");
318 for (;in3>>sfile;){
319 if (sfile.Length()==0) break;
320 printf("%s\n",sfile.Data());
321 TFile fcl(sfile.Data());
322 char tname[100];
323 sprintf(tname,"%s/%s/TreeR",sfile.Data(),fcl.GetListOfKeys()->At(0)->GetName());
324 chaincl2.Add(tname);
325 // chainPed.Add(sfile.Data());
5f9ad509 326 }
72008ac9 327
328 comp.fTree = &chaincl;
329 compF.fTree = &chainFit;
330 compP.fTree = &chainPed;
5f9ad509 331}
332
333void Select(){
334 //
335 // base cut on the tracks
336 //
337 comp.fTree->Draw(">>listTracks","Track.fN>50&&abs(Track.fP4)<0.001");
338 comp.fTree->SetEventList(listTracks);
339 //
72008ac9 340 compF.fTree->Draw(">>listFitS","p2>0&&p2<5&&p1<900&&p0<10000&&p4<1&&p4>0&&p5<p3&&chi2<150");
341 compF.fTree->SetEventList(listFitS);
5f9ad509 342}
343
344
345
346void PRFYZ(TCut cut0, TCut cut1, char * description){
347 //
348 // plot Pad response function as funtion of drift z
349 //
350 //
351 TF1 * f1 = new TF1("fdiff","sqrt([0]*[0]+(250-x)*[1]*[1])");
352 f1->SetParameter(1,0.2);
353 f1->SetParameter(0,0.2);
354 comp.DrawXY("Cl.fZ","sqrt(Cl.fSigmaY2)","Track.fTrackPoints.GetAngleY()<0.05","Track.fTrackPoints.fTX>0"+cut0,5,10,240,-0,1);
355 TH1F * prfInnerY = (TH1F*)comp.fMean->Clone();
356
357 comp.DrawXY("Cl.fZ","sqrt(Cl.fSigmaY2)","Track.fTrackPoints.GetAngleY()<0.05","Track.fTrackPoints.fTX>0"+cut1,5,10,240,-0,1);
358 TH1F * prfOuterY = (TH1F*)comp.fMean->Clone();
359 //
360 //
361 prfOuterY->SetMinimum(0);
362 prfOuterY->SetMarkerStyle(23);
363 prfInnerY->SetMarkerStyle(24);
364 prfOuterY->SetXTitle("Z position (cm)");
365 prfOuterY->SetYTitle("PRF width (cm)");
366 char chouter[100];
367 char chinner[100];
368 prfOuterY->Fit(f1);
369 sprintf(chouter,"Outer sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
370 prfInnerY->Fit(f1);
371 sprintf(chinner,"Inner sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
372 prfOuterY->Draw();
373 prfInnerY->Draw("same");
374 TString desc = description;
375 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, desc+"\nTPC cluster shape Fit: #sigma = #sqrt{p_{0}^{2}+(z_{d}-z)p_{1}^{2}}");
376 legend->SetBorderSize(1);
377 legend->AddEntry(prfOuterY,chouter);
378 legend->AddEntry(prfInnerY,chinner);
379 legend->Draw();
380}
381
382
72008ac9 383
384void PRFZZ(TCut cut0, TCut cut1, char * description){
385 TF1 * f1 = new TF1("fdiff","sqrt([0]*[0]+x*[1]*[1])");
386 f1->SetParameter(1,0.2);
387 f1->SetParameter(0,0.2);
388 compF.DrawXY("p1*0.285","p2*0.285","p2>0",cut0,8,20,250,-0,2);
389 TH1F * prfInnerY = (TH1F*)compF.fMean->Clone();
390 compF.DrawXY("p1*0.285","p2*0.285","p2>0",cut1,8,20,250,-0,2);
391 TH1F * prfOuterY = (TH1F*)compF.fMean->Clone();
392 //
393 //
394 prfOuterY->SetMinimum(0);
395 prfOuterY->SetMarkerStyle(23);
396 prfInnerY->SetMarkerStyle(24);
397 prfOuterY->SetXTitle("Drift length(cm)");
398 prfOuterY->SetYTitle("Z Sigma (cm)");
399 char chouter[100];
400 char chinner[100];
401 prfOuterY->Fit(f1);
402 sprintf(chouter,"Outer sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
403 prfInnerY->Fit(f1);
404 sprintf(chinner,"Inner sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
405 prfOuterY->Draw();
406 prfInnerY->Draw("same");
407 TString desc = description;
408 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, desc+"TPC signal shape Fit: #sigma = #sqrt{p_{0}^{2}+(z)p_{1}^{2}}");
409 legend->SetBorderSize(1);
410 legend->AddEntry(prfOuterY,chouter);
411 legend->AddEntry(prfInnerY,chinner);
412 legend->Draw();
413}
414
415
5f9ad509 416void ResYZ(TCut cut0, TCut cut1, char * description){
417 //
418 // resolution in y coordinate as function of z
419 //
420 TF1 * f1 = new TF1("fdiff","sqrt([0]*[0]+(250-x)*[1]*[1])");
421 f1->SetParameter(1,0.2);
422 f1->SetParameter(0,0.2);
423 comp.DrawXY("Cl.fZ","Track.fTrackPoints.GetY()-Cl.GetY()","Track.fTrackPoints.GetAngleY()<0.05","Track.fTrackPoints.fTX>0"+cut0,5,10,240,-0.5,0.5);
424 TH1F * prfInnerY = (TH1F*)comp.fRes->Clone();
425
426 comp.DrawXY("Cl.fZ","Track.fTrackPoints.GetY()-Cl.GetY()","Track.fTrackPoints.GetAngleY()<0.05","Track.fTrackPoints.fTX>0"+cut1,5,10,240,-0.5,0.5);
427 TH1F * prfOuterY = (TH1F*)comp.fRes->Clone();
428 //
429 //
430 prfOuterY->SetMinimum(0);
431 prfOuterY->SetMaximum(0.15);
432 prfOuterY->SetMarkerStyle(23);
433 prfInnerY->SetMarkerStyle(24);
434 prfOuterY->SetXTitle("Z position (cm)");
435 prfOuterY->SetYTitle("Y resolution (cm)");
436 char chouter[100];
437 char chinner[100];
438 prfOuterY->Fit(f1);
439 sprintf(chouter,"Outer sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
440 prfInnerY->Fit(f1);
441 sprintf(chinner,"Inner sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
442 prfOuterY->Draw();
443 prfInnerY->Draw("same");
444 TString desc = description;
445 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, desc+"TPC cluster resolution: #sigma = #sqrt{p_{0}^{2}+(z_{d}-z)p_{1}^{2}}");
446 legend->SetBorderSize(1);
447 legend->AddEntry(prfOuterY,chouter);
448 legend->AddEntry(prfInnerY,chinner);
449 legend->Draw();
450}
451
72008ac9 452void SysYX(TCut cut0, char * description){
453 //
454 //
455 //
456 TProfile * profA = new TProfile("profY","profY",70,89,250);
457 comp.fTree->Draw("Cl.fY-Track.fTrackPoints.GetY():Track.fTrackPoints.GetX()>>profY","abs(Cl.fY-Track.fTrackPoints.GetY())<1&&Track.fTrackPoints.fTX>10"+cut0,"prof");
458 profA->SetXTitle("Local X (cm)");
459 profA->SetYTitle("Mean #Delta Y (cm)");
460 TLegend *legend = new TLegend(0.55,0.25,0.85,0.30, description);
461 legend->Draw();
462}
463
464void SysZX(TCut cut0, char * description){
465 //
466 //
467 //
468 TProfile * profA = new TProfile("profZ","profZ",70,89,250);
469 comp.fTree->Draw("Cl.fZ-Track.fTrackPoints.GetZ():Track.fTrackPoints.GetX()>>profZ","abs(Cl.fZ-Track.fTrackPoints.GetZ())<1&&Track.fTrackPoints.fTX>10"+cut0,"prof");
470 profA->SetXTitle("Local X (cm)");
471 profA->SetYTitle("Mean #Delta Z (cm)");
472 TLegend *legend = new TLegend(0.55,0.25,0.85,0.30, description);
473 legend->Draw();
474}
5f9ad509 475
72008ac9 476TProfile * ProfileMaxRow(TCut cut0, char *name, Int_t max){
5f9ad509 477 //
478 // make profile histrogram of amplitudes
479 //
480 TProfile *profA = new TProfile(name,name,max,0,max-1);
481 char expr[100];
482 sprintf(expr,"Cl.fMax:Cl.fRow>>%s",name);
483 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
484 profA->SetXTitle("Pad Row");
b2c02e7d 485 profA->SetYTitle("Amplitude at maxima (ADC)");
5f9ad509 486 return profA;
487}
72008ac9 488
489TProfile * ProfileMaxPhi(TCut cut0, char *name, Int_t max){
490 //
491 // make profile histrogram of amplitudes
492 //
493 TProfile *profA = new TProfile(name,name,max,-0.14,0.14);
494 char expr[100];
495 sprintf(expr,"Cl.fMax:Cl.fY/Cl.fX>>%s",name);
496 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
497 profA->SetXTitle("Local #phi(rad)");
b2c02e7d 498 profA->SetYTitle("Amplitude at maxima (ADC)");
499 return profA;
500}
501
502TProfile * ProfileQRow(TCut cut0, char *name, Int_t max){
503 //
504 // make profile histrogram of amplitudes
505 //
506 TProfile *profA = new TProfile(name,name,max,0,max-1);
507 char expr[100];
508 sprintf(expr,"Cl.fQ:Cl.fRow>>%s",name);
509 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
510 profA->SetXTitle("Pad Row");
511 profA->SetYTitle("Total charge(ADC)");
512 return profA;
513}
514
515TProfile * ProfileQPhi(TCut cut0, char *name, Int_t max){
516 //
517 // make profile histrogram of amplitudes
518 //
519 TProfile *profA = new TProfile(name,name,max,-0.14,0.14);
520 char expr[100];
521 sprintf(expr,"Cl.fQ:Cl.fY/Cl.fX>>%s",name);
522 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
523 profA->SetXTitle("Local #phi(rad)");
524 profA->SetYTitle("Total charge (ADC)");
72008ac9 525 return profA;
526}
527
528TProfile * ProfileQZ(TCut cut0, char *name, Int_t max){
529 //
530 // make profile histrogram of amplitudes
531 //
532 TF1 * f1 = new TF1("f1","[0]+[1]*[0]*(250-x)");
533 TProfile *profA = new TProfile(name,name,max,0,250);
534 char expr[100];
535 sprintf(expr,"Cl.fQ:Cl.fZ>>%s",name);
536 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
537 profA->SetXTitle("Z position (cm)");
538 profA->SetYTitle("Amplitude (ADC)");
539 char chc[100];
540 profA->Fit(f1);
541 sprintf(chc,"p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
542 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, chc);
543 legend->Draw();
544 return profA;
545}
546
b2c02e7d 547TProfile * ProfileMaxZ(TCut cut0, char *name, Int_t max){
548 //
549 // make profile histrogram of amplitudes
550 //
551 TF1 * f1 = new TF1("f1","[0]+[1]*[0]*(250-x)");
552 TProfile *profA = new TProfile(name,name,max,0,250);
553 char expr[100];
554 sprintf(expr,"Cl.fMax:Cl.fZ>>%s",name);
555 comp.fTree->Draw(expr,"Cl.fZ>0&&Cl.fMax<500"+cut0,"prof");
556 profA->SetXTitle("Z position (cm)");
557 profA->SetYTitle("Amplitude at maxima (ADC)");
558 char chc[100];
559 profA->Fit(f1);
560 sprintf(chc,"p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
561 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, chc);
562 legend->Draw();
563 return profA;
564}
565
72008ac9 566
567void P3Z(TCut cut0, TCut cut1, char * description){
568 //
569 // first exponenent as function of z drift
570 //
571 TF1 * f1 = new TF1("fdiff","[0]+[1]/[0]*x");
572 f1->SetParameter(1,0.2);
573 f1->SetParameter(0,0.2);
574 compF.DrawXY("p1*0.285","p3","Max>250",cut0,5,20,250,-0,2);
575 TH1F * prfInnerY = (TH1F*)compF.fMean->Clone();
576 compF.DrawXY("p1*0.285","p3","Max>250",cut1,5,20,250,-0,2);
577 TH1F * prfOuterY = (TH1F*)compF.fMean->Clone();
578 //
579 //
580 prfOuterY->SetMinimum(0);
581 prfOuterY->SetMaximum(1);
582 prfOuterY->SetMarkerStyle(23);
583 prfInnerY->SetMarkerStyle(24);
584 prfOuterY->SetXTitle("Drift length (cm)");
585 prfOuterY->SetYTitle("Lambda 0 (Time Bin)");
586 char chouter[100];
587 char chinner[100];
588 prfOuterY->Fit(f1);
589 sprintf(chouter,"Outer sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
590 prfInnerY->Fit(f1);
591 sprintf(chinner,"Inner sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
592 prfOuterY->Draw();
593 prfInnerY->Draw("same");
594 TString desc = description;
595 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, desc+"TPC cluster shape fit Parameter Lambda0 - P3:");
596 legend->SetBorderSize(1);
597 legend->AddEntry(prfOuterY,chouter);
598 legend->AddEntry(prfInnerY,chinner);
599 legend->Draw();
600}
601
602
603void P5Z(TCut cut0, TCut cut1, char * description){
604 //
605 // second exponenent as function of z drift
606 //
607 TF1 * f1 = new TF1("fdiff","[0]+[1]/[0]*x");
608 f1->SetParameter(1,0.2);
609 f1->SetParameter(0,0.2);
610 compF.DrawXY("p1*0.285","p5","Max>250",cut0,5,20,250,-0,0.2);
611 TH1F * prfInnerY = (TH1F*)compF.fMean->Clone();
612 compF.DrawXY("p1*0.285","p5","Max>250",cut1,5,20,250,-0,0.2);
613 TH1F * prfOuterY = (TH1F*)compF.fMean->Clone();
614 //
615 //
616 prfOuterY->SetMinimum(0);
617 prfOuterY->SetMaximum(0.15);
618 prfOuterY->SetMarkerStyle(23);
619 prfInnerY->SetMarkerStyle(24);
620 prfOuterY->SetXTitle("Drift length (Time Bin)");
621 prfOuterY->SetYTitle("Lambda1 (Time bin)");
622 char chouter[100];
623 char chinner[100];
624 prfOuterY->Fit(f1);
625 sprintf(chouter,"Outer sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
626 prfInnerY->Fit(f1);
627 sprintf(chinner,"Inner sector : p_{0} = %f p_{1} = %f",f1->GetParameter(0),f1->GetParameter(1));
628 prfOuterY->Draw();
629 prfInnerY->Draw("same");
630 TString desc = description;
631 TLegend *legend = new TLegend(0.25,0.12,0.85,0.35, desc+"TPC cluster shape fit Parameter Lambda1 - P5");
632 legend->SetBorderSize(1);
633 legend->AddEntry(prfOuterY,chouter);
634 legend->AddEntry(prfInnerY,chinner);
635 legend->Draw();
636}
637
638TCanvas * NoiseSector(TCut cut0, char * description, Int_t maxrow, Int_t maxpad){
639 //
640 // draw plots of the noise
641 //
642 TCanvas * c = new TCanvas;
643 c->Divide(2,1);
644 c->Draw();
645 c->cd(1);
646 compP.fTree->Draw("GSigma","GSigma<5"+cut0);
647 c->cd(2);
648 Float_t rand = gRandom->Rndm();
649 char name[100];
650 sprintf(name,"prof%f",rand);
651 TProfile2D * prof= new TProfile2D(name,name,maxrow, 0, maxrow-1, 2*maxpad,-maxpad,maxpad);
652 char expr[100];
653 sprintf(expr,"GSigma:RPad:Row>>%s",name);
654 prof->SetXTitle("Pad row");
655 prof->SetYTitle("Pad number");
656 compP.fTree->Draw(expr,cut0,"profcolz");
657 c->cd(1);
658 TString desc = description;
659 TLegend *legend = new TLegend(0.25,0.30,0.85,0.85, desc+"Noise map");
660 legend->Draw();
661
662 return c;
663}