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