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