]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFPID.cxx
Compilation error is corrected
[u/mrichter/AliRoot.git] / TOF / AliTOFPID.cxx
CommitLineData
190c1f49 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//_________________________________________________________________________
17// TTask class for TOF PID.
18// Use case: start root and execute the following macro
19/*
20{
21 // Dynamically link some shared libs
22 if (gClassTable->GetID("AliRun") < 0) {
23 gROOT->LoadMacro("loadlibs.C");
24 loadlibs();
25 }
26 // create an instance of the AliTOFPID class
27 // You have to pass the ntuple and cuts filenames
28 AliTOFPID* tofpid=new AliTOFPID("ntuple.root","cuts.root");
29
30 // option "pp" for pp events (it includes also electron in the analysis)
31 // option "visual" to shows interactively histos
32 // option "asC" or "asEPS" to save canvas in the current dir in .C or .eps format
33
34 // make a choice: uncomment one of these lines
35 // tofpid->Exec("pp","visual","asC");
36 // tofpid->Exec("pp","novisual","asC");
37 // tofpid->Exec("Pb-Pb","visual","asC");
38 // tofpid->Exec("pp","visual","asC");
39 // tofpid->Exec("pp","novisual","asEPS");
40}
41*/
42//
43//
44//
45//
46//
47//
48//
49//
50//-- Authors: B. Zagreev , F. Pierella
51//////////////////////////////////////////////////////////////////////////////
52
190c1f49 53#include "TStyle.h"
54#include "TTask.h"
55#include "TTree.h"
56#include "TSystem.h"
57#include "TFile.h"
58#include "TCanvas.h"
59#include "TPad.h"
60#include "TText.h"
61#include "TLine.h"
62#include "TPaveLabel.h"
63#include "TPaveText.h"
190c1f49 64#include "TFile.h"
65#include <TF1.h>
66#include <TF2.h>
67#include "TTask.h"
68#include "TTree.h"
69#include "TSystem.h"
70#include "TROOT.h"
71#include "TFolder.h"
72#include "TNtuple.h"
73#include "TLeaf.h"
919162e6 74
75#include "AliConst.h"
0f4a7374 76#include "AliTOFGeometry.h"
919162e6 77#include "AliTOFPID.h"
78
190c1f49 79#include <stdlib.h>
f8014e68 80#include <Riostream.h>
81#include <Riostream.h>
190c1f49 82
83ClassImp(AliTOFPID)
84
85//____________________________________________________________________________
86 AliTOFPID::AliTOFPID():TTask("AliTOFPID","")
87{
88 // default ctor - set the pointer member vars to zero
89 felectron = 0;
90 fpion = 0;
91 fkaon = 0;
92 fproton = 0;
93 fcut = 0;
94 fhfile = 0;
95 fNtuple = 0;
96 fgen = 0;
97 foutfileName = 0;
0f4a7374 98
190c1f49 99}
100
101//____________________________________________________________________________
792995c1 102 AliTOFPID::AliTOFPID(char* headerFile, char *cutsFile, const Option_t* opt):TTask("AliTOFPID","")
190c1f49 103{
5fff655e 104 felectron = 0;
105 fpion = 0;
106 fkaon = 0;
107 fproton = 0;
190c1f49 108 fhfile = TFile::Open(headerFile); // connect file with ntuple
109 fcut = TFile::Open(cutsFile); // connect file for cuts
110 foutfileName=headerFile;
5fff655e 111 fNtuple = 0;
112 fgen = 0;
190c1f49 113
114 Init(opt);
115 // add Task to //root/Tasks folder
116 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
117 roottasks->Add(this) ;
0f4a7374 118
190c1f49 119}
120//____________________________________________________________________________
121void AliTOFPID::Init(const Option_t* opt)
122{
123 if(strstr(opt,"pp")){
124 if(fcut->GetKey("electron")) felectron = (TCutG*)fcut->Get("electron");
125 fcut->Print();
126 if(fcut->GetKey("pion")) fpion = (TCutG*)fcut->Get("pion");
127 fcut->Print();
128 }
129 if(fcut->GetKey("kaon")) fkaon = (TCutG*)fcut->Get("kaon");
130 fcut->Print();
131 if(fcut->GetKey("proton")) fproton = (TCutG*)fcut->Get("proton");
132
133 gFile->ls();
134 fNtuple= (TNtuple*)fhfile->Get("Ntuple"); // get ntuple from file
135 Int_t nvar = fNtuple->GetNvar(); cout <<"N of var.="<< nvar << endl;
136 fNtuple->GetEvent(0);
137
138}
139
140//____________________________________________________________________________
141 AliTOFPID::~AliTOFPID()
142{
143 //
144 // dtor (free used memory)
145 //
146
147 if (felectron)
148 {
149 delete felectron;
150 felectron = 0;
151 }
152
153 if (fpion)
154 {
155 delete fpion;
156 fpion = 0;
157 }
158
159 if (fkaon)
160 {
161 delete fkaon;
162 fkaon = 0;
163 }
164
165 if (fproton)
166 {
167 delete fproton;
168 fproton = 0;
169 }
170
171 if (fcut)
172 {
173 delete fcut;
174 fcut = 0;
175 }
176
177
178 if (fhfile)
179 {
180 delete fhfile;
181 fhfile = 0;
182 }
183
184
185 if (fNtuple)
186 {
187 delete fNtuple;
188 fNtuple = 0;
189 }
190
191 if (fgen)
192 {
193 delete fgen;
194 fgen = 0;
195 }
196
197 if (foutfileName)
198 {
199 delete foutfileName;
200 foutfileName = 0;
201 }
202}
203
204
205//____________________________________________________________________________
206void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, const Option_t *outputsavemode)
207{
208 //
209 // Performs PID for TOF detector
210 //
211
212 fTask=1;
213 TAxis *xaxis;
214 ////////// Create histograms /////////////////
215 // for electron only in pp case
216 TH1F* eleff=0;
919162e6 217 TH1F* eleffls=0;
190c1f49 218 TH1F *elcon=0;
219 TH1F *elid=0;
8488c769 220 TH1F *elmatch=0;
190c1f49 221 TH1F *elall=0;
222
223 if(strstr(eventType,"pp")){
224 eleff = new TH1F("eleff","",10,0,0.6);
225 xaxis=eleff->GetYaxis();
226 xaxis->SetLabelSize(.08);
919162e6 227 eleffls = new TH1F("eleffls","",10,0,0.6);
228 xaxis=eleffls->GetYaxis();
229 xaxis->SetLabelSize(.08);
190c1f49 230 elcon = new TH1F("elcon","",10,0,0.6);
231 xaxis=elcon->GetXaxis();
232 xaxis->SetLabelSize(.09);
233 xaxis=elcon->GetYaxis();
234 xaxis->SetLabelSize(.08);
235 elid = new TH1F("elid","Identified electrons",10,0,0.6);
8488c769 236 elmatch = new TH1F("elmatch","N(e)",10,0,0.6);
190c1f49 237 elall = new TH1F("elall","Electrons",10,0,0.6);
238 }
239
240 // pions
241 TH1F *pit = new TH1F("pit","",15,0,2.5); //part. with tracks
242 TH1F *pig = new TH1F("pig","",15,0,2.5); //part. in geometry acceptance
243 TH1F *pieff = new TH1F("pieff","",15,0,2.5); //efficiency
919162e6 244 TH1F *pieffls = new TH1F("pieffls","",15,0,2.5); //efficiency (last step)
190c1f49 245 xaxis=pieff->GetYaxis();
246 xaxis->SetLabelSize(.08);
919162e6 247 xaxis=pieffls->GetYaxis();
248 xaxis->SetLabelSize(.08);
190c1f49 249 TH1F *picon = new TH1F("picon","",15,0,2.5); //contamination
250 xaxis=picon->GetXaxis();
251 xaxis->SetLabelSize(.09);
252 xaxis=picon->GetYaxis();
253 xaxis->SetLabelSize(.08);
254 TH1F *piid = new TH1F("piid","Identified pions",15,0,2.5);
255 TH1F *piall = new TH1F("piall","Pions",15,0,2.5);
8488c769 256 TH1F *pimatch = new TH1F("pimatch","N(Pions)",15,0,2.5);
190c1f49 257 TH1F *pigen = new TH1F("pigen","Pions",15,0,2.5);
258 xaxis=pigen->GetXaxis();
259 xaxis->SetLabelSize(.09);
260 pigen->SetXTitle("P?t! (GeV/c)");
261 xaxis->SetTitleSize(.09);
262 xaxis=pigen->GetYaxis();
263 xaxis->SetLabelSize(.08);
264 //pigen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
265 xaxis->SetTitleSize(.09);
266
267 // kaons
268 TH1F *kat = new TH1F("kat","",15,0,2.5);
269 TH1F *kag = new TH1F("kag","",15,0,2.5);
270 TH1F *kaeff = new TH1F("kaeff","",15,0,2.5);
271 xaxis=kaeff->GetYaxis();
272 xaxis->SetLabelSize(.08);
919162e6 273 TH1F *kaeffls = new TH1F("kaeffls","",15,0,2.5);
274 xaxis=kaeffls->GetYaxis();
275 xaxis->SetLabelSize(.08);
190c1f49 276 TH1F *kacon = new TH1F("kacon","",15,0,2.5);
277 xaxis=kacon->GetXaxis();
278 xaxis->SetLabelSize(.09);
279 xaxis=kacon->GetYaxis();
280 xaxis->SetLabelSize(.08);
281 TH1F *kaid = new TH1F("kaid","Identified kaons",15,0,2.5);
8488c769 282 TH1F *kamatch = new TH1F("kamatch","N(K)",15,0,2.5);
190c1f49 283 TH1F *kaall = new TH1F("kaall","Kaons",15,0,2.5);
284 TH1F *kagen = new TH1F("kagen","Kaons",15,0,2.5);
285 xaxis=kagen->GetXaxis();
286 xaxis->SetLabelSize(.09);
287 kagen->SetXTitle("P?t! (GeV/c)");
288 xaxis->SetTitleSize(.09);
289 xaxis=kagen->GetYaxis();
290 xaxis->SetLabelSize(.08);
291 //kagen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
292 xaxis->SetTitleSize(.09);
293
294 // protons
295 TH1F *prt = new TH1F("prt","",15,0,4.4);
296 TH1F *prg = new TH1F("prg","",15,0,4.4);
297 TH1F *preff = new TH1F("preff","",15,0,4.4);
298 xaxis=preff->GetYaxis();
299 xaxis->SetLabelSize(.08);
919162e6 300 TH1F *preffls = new TH1F("preffls","",15,0,4.4);
301 xaxis=preffls->GetYaxis();
302 xaxis->SetLabelSize(.08);
190c1f49 303 TH1F *prcon = new TH1F("prcon","",15,0,4.4);
304 xaxis=prcon->GetXaxis();
305 xaxis->SetLabelSize(.09);
306 xaxis=prcon->GetYaxis();
307 xaxis->SetLabelSize(.08);
308 TH1F *prid = new TH1F("prid","Identified protons",15,0,4.4);
8488c769 309 TH1F *prmatch = new TH1F("prmatch","N(p)",15,0,4.4);
190c1f49 310 TH1F *prall = new TH1F("prall","Protons",15,0,4.4);
311 TH1F *prgen = new TH1F("prgen","Protons",15,0,4.4);
312 xaxis=prgen->GetXaxis();
313 xaxis->SetLabelSize(.09);
314 prgen->SetXTitle("P?t! (GeV/c)");
315 xaxis->SetTitleSize(.09);
316 xaxis=prgen->GetYaxis();
317 xaxis->SetLabelSize(.08);
318 //prgen->SetYTitle("1/P?t!dN/dP?t! (GeV/c)^-2!");
319 xaxis->SetTitleSize(.09);
320
321 // 2-D histos (extrapolated mass vs momentum)
322 TH2F* hel=0;
323 if(strstr(eventType,"pp")){
324 hel = new TH2F("hel","",1000,-.2,1.2,1000,-4.2,0.);
325 hel->SetXTitle("Mass (GeV/c^{2})");
326 hel->SetYTitle("Momentum (GeV/c)");
327 }
328 TH2F *hpi = new TH2F("hpi","",1000,-.2,1.2,1000,-4.2,0.);
329 hpi->SetXTitle("Mass (GeV/c^{2})");
330 hpi->SetYTitle("Momentum (GeV/c)");
331 TH2F *hka = new TH2F("hka","",1000,-.2,1.2,1000,-4.2,0.);
332 hka->SetXTitle("Mass (GeV/c^{2})");
333 hka->SetYTitle("Momentum (GeV/c)");
334 TH2F *hpr = new TH2F("hpr","",1000,-.2,1.2,1000,-4.2,0.);
335 hpr->SetXTitle("Mass (GeV/c^{2})");
336 hpr->SetYTitle("Momentum (GeV/c)");
337
338
339 fhfile->cd();
340 Int_t nparticles = (Int_t)fNtuple->GetEntries();
341 cout << " Number of nparticles =" << nparticles << endl;
342 if (nparticles <= 0) return;
343
344 Float_t ka=0, pi=0, pr=0, kaal=0, pial=0, pral=0;
345 Float_t pitrack=0, pimag=0, pigeom=0;
346 Float_t katrack=0, kamag=0, kageom=0;
347 Float_t prtrack=0, prmag=0, prgeom=0;
348 Float_t pif=0, kaf=0, prf=0, pin=0, kan=0, prn=0;
b213b8bd 349 Float_t px, py, pz, x, y, z, mass;
350 Int_t event, matc, imam, pdgcode;
190c1f49 351 Int_t indexOfFile=0, numfile=0;
352 //////// Loop over tracks (particles)///////////////////////
353
354 for (Int_t i=0; i < nparticles; i++) {
355 fNtuple->GetEvent(i);
b213b8bd 356 event=(Int_t)(fNtuple->GetLeaf("event")->GetValue());
357 pdgcode=(Int_t)(fNtuple->GetLeaf("ipart")->GetValue());
190c1f49 358 mass=fNtuple->GetLeaf("mext")->GetValue(0);
b213b8bd 359 matc=(Int_t)(fNtuple->GetLeaf("matc")->GetValue(0));
360 imam=(Int_t)(fNtuple->GetLeaf("imam")->GetValue(0));
190c1f49 361 px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
362 py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
363 pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
364 x=fNtuple->GetLeaf("xvtx")->GetValue(0);
365 y=fNtuple->GetLeaf("yvtx")->GetValue(0);
366 z=fNtuple->GetLeaf("zvtx")->GetValue(0);
367 Float_t pvtx=TMath::Sqrt(px*px+py*py+pz*pz);
368 Float_t ptvtx=TMath::Sqrt(px*px+py*py);
369 Float_t mt=0.;
8488c769 370 Bool_t isSelected=(imam == 0 && pz !=0 && TMath::ATan(TMath::Abs(ptvtx/pz))>TMath::Pi()*45./180.);
190c1f49 371 Int_t abspdgcode=TMath::Abs(pdgcode);
372 switch(abspdgcode){
373 case 321:
8488c769 374 if(isSelected && (matc==3 || matc==4)) kamatch->Fill(pvtx);
0f4a7374 375 mt=TMath::Sqrt(AliTOFGeometry::KaonMass()*AliTOFGeometry::KaonMass()+px*px+py*py);
190c1f49 376 break;
377 case 2212:
8488c769 378 if(isSelected && (matc==2 || matc==3 || matc==4)) prmatch->Fill(pvtx);
0f4a7374 379 mt=TMath::Sqrt(AliTOFGeometry::ProtonMass()*AliTOFGeometry::ProtonMass()+px*px+py*py);
190c1f49 380 break;
381 case 11:
8488c769 382 if(strstr(eventType,"pp") && (matc==3 || matc==4)) elmatch->Fill(pvtx); // as in kaon case
0f4a7374 383 mt=TMath::Sqrt(AliTOFGeometry::ElectronMass()*AliTOFGeometry::ElectronMass()+px*px+py*py);
190c1f49 384 break;
385 default:
8488c769 386 if(isSelected && matc>0) pimatch->Fill(pvtx);
0f4a7374 387 mt=TMath::Sqrt(AliTOFGeometry::PionMass()*AliTOFGeometry::PionMass()+px*px+py*py);
190c1f49 388 break;
389 }
390
8488c769 391 if (isSelected)
190c1f49 392 {//only primary +/-45
393 if (fkaon->IsInside(mass,-pvtx) && matc>2) {
394 ka++;
395 if (fTask!=2) kaid->Fill(pvtx); else {kaid->Fill(ptvtx);}
919162e6 396 if (TMath::Abs(pdgcode)==321) {kaf++; kaeff->Fill(pvtx); kaeffls->Fill(pvtx);} else {kan++; kacon->Fill(pvtx);}
190c1f49 397 } else if (fproton->IsInside(mass,-pvtx) && matc>1) {
398 pr++;
399 if (fTask!=2) prid->Fill(pvtx); else
400 {prid->Fill(ptvtx);}
919162e6 401 if (TMath::Abs(pdgcode)==2212) {prf++; preff->Fill(pvtx); preffls->Fill(pvtx);} else {prn++; prcon->Fill(pvtx);}
190c1f49 402 } else if (strstr(eventType,"pp") && felectron->IsInside(mass,-pvtx) && matc>2) {elid->Fill(pvtx);
919162e6 403 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) {eleff->Fill(pvtx); eleffls->Fill(pvtx);} else {elcon->Fill(pvtx);}
190c1f49 404 } else if (matc>0) {
405 //||matc==-4&&fpion->IsInside(mass,-pvtx)
406 pi++;
407 if (fTask!=2) piid->Fill(pvtx); else {piid->Fill(ptvtx);}
919162e6 408 if (TMath::Abs(pdgcode)==211) {pif++; pieff->Fill(pvtx); pieffls->Fill(pvtx);} else {pin++; picon->Fill(pvtx);}
190c1f49 409 }
410
411 //////////////// Normalization histograms ////////////////////
412 if (strstr(eventType,"pp") && TMath::Abs(pdgcode)==11) {
413 if (fTask!=2) elall->Fill(pvtx); else elall->Fill(ptvtx);
414 if (fTask==1) hel->Fill(mass,-pvtx);
415
416 } else if (TMath::Abs(pdgcode)==211) {
417 pial++;
418 if (matc!=0) {
419 pitrack++;
420 pit->Fill(pvtx);
421 if (matc!=-1) {
422 pimag++;
423 if (matc>-2 || matc==-4) {
424 pigeom++;
425 pig->Fill(pvtx);
426 }
427 }
428 }
429 if (fTask!=2) piall->Fill(pvtx);
430 else {
431 piall->Fill(ptvtx,1/ptvtx);
432 }
433 if (fTask==1) hpi->Fill(mass,-pvtx);
434
435 } else if (TMath::Abs(pdgcode)==321) {
436 kaal++;
437 if (matc!=0) {
438 katrack++;
439 kat->Fill(pvtx);
440 if (matc!=-1) {
441 kamag++;
442 if (matc>-2 || matc==-4) {
443 kageom++;
444 kag->Fill(pvtx);
445 }
446 }
447 }
448 if (fTask!=2) kaall->Fill(pvtx);
449 else {
450 kaall->Fill(ptvtx,1/ptvtx);
451 }
452 if (fTask==1) hka->Fill(mass,-pvtx);
453
454 } else if (TMath::Abs(pdgcode)==2212) {
455 pral++;
456 if (matc!=0) {
457 prtrack++;
458 prt->Fill(pvtx);
459 if (matc!=-1) {
460 prmag++;
461 if (matc>-2 || matc==-4) {
462 prgeom++;
463 prg->Fill(pvtx);
464 }
465 }
466 }
467 if (fTask!=2) prall->Fill(pvtx);
468 else {
469 prall->Fill(ptvtx,1/ptvtx);
470 }
471 if (fTask==1) hpr->Fill(mass,-pvtx);}
472
473 }// End of cuts appling
474 }// End of loop over particles
475
476 // display results
477 cout<< "Pions in 45-135 deg. "<< pial <<" (100%)"<< endl;
478 cout<< "Pions that have track "<< pitrack/pial*100 <<" %"<<endl;
479 cout<< "Magnetic field "<< pimag/pial*100 <<" %"<<endl;
480 cout<< "Geometry efficiency "<< pigeom/pial*100 <<" %"<<endl;
481 cout<< "PID procedure "<< pif/pial*100 <<" %"<<endl;
482 cout<< "Contamination "<< pin/pi*100 <<" %"<<endl;
483 cout<<endl;
484 cout<< "Kaons in 45-135 deg. "<< kaal <<" (100%)"<< endl;
485 cout<< "Kaons that have track "<< katrack/kaal*100 <<" %"<<endl;
486 cout<< "Magnetic field "<< kamag/kaal*100 <<" %"<<endl;
487 cout<< "Geometry efficiency "<< kageom/kaal*100 <<" %"<<endl;
488 cout<< "PID procedure(+decays) "<< kaf/kaal*100 <<" %"<<endl;
489 cout<< "Contamination "<< kan/ka*100 <<" %"<<endl;
490 cout<<endl;
491 cout<< "Protons in 45-135 deg. "<< pral <<" (100%)"<< endl;
492 cout<< "Protons that have track "<< prtrack/pral*100 <<" %"<<endl;
493 cout<< "Magnetic field "<< prmag/pral*100 <<" %"<<endl;
494 cout<< "Geometry efficiency "<< prgeom/pral*100 <<" %"<<endl;
495 cout<< "PID procedure "<< prf/pral*100 <<" %"<<endl;
496 cout<< "Contamination "<< prn/pr*100 <<" %"<<endl;
497 cout<<endl;
498 cout<< "All part. in 45-135 deg. "<< pial+kaal+pral <<" (100%)"<< endl;
499 cout<< "All part. that have track "<< (pitrack+katrack+prtrack)/(pial+kaal+pral)*100 <<" %"<<endl;
500 cout<< "Magnetic field "<< (pimag+kamag+prmag)/(pial+kaal+pral)*100 <<" %"<<endl;
501 cout<< "Geometry efficiency "<< (pigeom+kageom+prgeom)/(pial+kaal+pral)*100 <<" %"<<endl;
502 cout<< "PID procedure "<< (pif+kaf+prf)/(pial+kaal+pral)*100 <<" %"<<endl;
503 cout<< "Contamination "<< (pin+kan+prn)/(pi+ka+pr)*100 <<" %"<<endl;
504 cout<<endl;
505
919162e6 506 TCanvas *pidCanvas=0; // overall
507 TCanvas *pidCanvasls=0; // last step of PID
190c1f49 508 TCanvas *momvsmassCanvas=0;
919162e6 509 // overall Efficiency
190c1f49 510 TPad *tp=0;
511 TPad *pad1=0;
512 TPad *pad2=0;
513 TPad *pad3=0;
514 TPad *pad4=0;
515 TPad *pad5=0;
516 TPad *pad6=0;
517 TPad *pad7=0;
518 TPad *pad8=0;
519
919162e6 520 // last step Efficiency
521 TPad *tpls=0;
522 TPad *pad1ls=0;
523 TPad *pad2ls=0;
524 TPad *pad3ls=0;
525 TPad *pad4ls=0;
526 TPad *pad5ls=0;
527 TPad *pad6ls=0;
528 TPad *pad7ls=0;
529 TPad *pad8ls=0;
530
190c1f49 531 //////////////////////// For fTask 1 ///////////////////////////
532 if (fTask==1) {
533 if (strstr(eventType,"pp")){
534 eleff->Divide(elall);
8488c769 535 eleffls->Divide(elmatch);
190c1f49 536 }
919162e6 537 // overall efficiency
190c1f49 538 pieff->Divide(piall);
539 kaeff->Divide(kaall);
540 preff->Divide(prall);
919162e6 541
542 // last step efficiency
8488c769 543 pieffls->Divide(pimatch);
544 kaeffls->Divide(kamatch);
545 preffls->Divide(prmatch);
919162e6 546
190c1f49 547 pit->Divide(piall);
548 kat->Divide(kaall);
549 prt->Divide(prall);
550 pig->Divide(piall);
551 kag->Divide(kaall);
552 prg->Divide(prall);
553 if (strstr(eventType,"pp")){
554 elcon->Divide(elid);
555 }
919162e6 556 // contamination
190c1f49 557 picon->Divide(piid);
558 kacon->Divide(kaid);
559 prcon->Divide(prid);
919162e6 560
190c1f49 561 //Create a canvas, set the view range, show histograms
919162e6 562 // for overall PID
190c1f49 563 if (indexOfFile==0) {
919162e6 564 // overall Efficiency canvas
565 pidCanvas = new TCanvas("pidCanvas","PID (Overall)",10,100,800,500);
190c1f49 566 pidCanvas->SetBorderMode(0);
567 pidCanvas->SetBorderSize(0);
568 pidCanvas->SetFillColor(0);
569 pidCanvas->SetFillStyle(0);
919162e6 570
571 // last step Efficiency canvas
572 pidCanvasls = new TCanvas("pidCanvasls","PID (Last Step)",10,100,800,500);
573 pidCanvasls->SetBorderMode(0);
574 pidCanvasls->SetBorderSize(0);
575 pidCanvasls->SetFillColor(0);
576 pidCanvasls->SetFillStyle(0);
577
578 if (strstr(outputmode,"visual")) {
579 pidCanvas->Draw();
580 pidCanvasls->Draw();
581 }
582
190c1f49 583 Float_t pxs=0.25+0.125; //X size of pad
919162e6 584 Float_t pys=0.5+0.055; //y size of pad
585 // overall
586 tp = new TPad("histo","Histograms",.1,.1,.9,.9);
587 // last step
588 tpls = new TPad("histo","Histograms",.1,.1,.9,.9);
589
190c1f49 590 if (strstr(eventType,"Pb-Pb")){
919162e6 591 // overall efficiency
190c1f49 592 //pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
593 pad2 = new TPad("pad2","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
594 pad3 = new TPad("pad3","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
595 pad4 = new TPad("pad4","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
919162e6 596
597 // contamination
190c1f49 598 //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
599 pad6 = new TPad("pad6","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
600 pad7 = new TPad("pad7","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
601 pad8 = new TPad("pad8","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
919162e6 602
603 // we repeat the same for the last step of PID
604 //pad1ls = new TPad("pad1ls","electron efficiency",0.,.5-.055,0.+pxs,.5-.055+pys-.00001,0,0,0);
605 pad2ls = new TPad("pad2ls","pion efficiency",0.,0.5-.055,0.+pxs,0.5-.055+pys-.00001,0,0,0);
606 pad3ls = new TPad("pad3ls","kaon efficiency",0.3,0.5-.055,0.3+pxs,0.5-.055+pys-.00001,0,0,0);
607 pad4ls = new TPad("pad4ls","proton efficiency",0.6,0.5-.055,0.6+pxs,0.5-.055+pys-.00001,0,0,0);
608
609 // contamination
610 //pad5 = new TPad("pad5","electron contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
611 pad6ls = new TPad("pad6ls","pion contamination",0.,0.,0.+pxs,0.+pys,0,0,0);
612 pad7ls = new TPad("pad7ls","kaon contamination",.3,0.,0.3+pxs,0.+pys,0,0,0);
613 pad8ls = new TPad("pad8ls","proton contamination",.6,0.,0.6+pxs,0.+pys,0,0,0);
614
190c1f49 615 }
616
617 if (strstr(eventType,"pp")){
919162e6 618 // overall Efficiency
190c1f49 619 pad1 = new TPad("pad1","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
620 pad2 = new TPad("pad2","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
621 pad3 = new TPad("pad3","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
622 pad4 = new TPad("pad4","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
919162e6 623
624 // contamination
190c1f49 625 pad5 = new TPad("pad5","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
626 pad6 = new TPad("pad6","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
627 pad7 = new TPad("pad7","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
628 pad8 = new TPad("pad8","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
919162e6 629
630
631 // we repeat the same for the last step of PID
632 pad1ls = new TPad("pad1ls","electron efficiency",0.,.5-.055,0.25+0.045,1.,0,0,0);
633 pad2ls = new TPad("pad2ls","pion efficiency",0.25-0.015,0.5-.055,0.5+0.03,1.,0,0,0);
634 pad3ls = new TPad("pad3ls","kaon efficiency",0.5-0.03,0.5-.055,0.75+0.015,1.,0,0,0);
635 pad4ls = new TPad("pad4ls","proton efficiency",0.75-0.045,0.5-.055,1.,1.,0,0,0);
636
637 // contamination
638 pad5ls = new TPad("pad5ls","electron contamination",0.,0.,.25+.045,.5+.055,0,0,0);
639 pad6ls = new TPad("pad6ls","pion contamination",.25-.015,0.,.5+.03,.5+.055,0,0,0);
640 pad7ls = new TPad("pad7ls","kaon contamination",.5-.03,0.,.75+.015,.5+.055,0,0,0);
641 pad8ls = new TPad("pad8ls","proton contamination",.75-.045,0.,1.,.5+.055,0,0,0);
642
643
190c1f49 644 }
645
919162e6 646 // last step of PID
647 gStyle->SetOptStat(0);
648 tpls->SetFillStyle(0);
649 tpls->SetFillColor(0);
650 tpls->SetBorderSize(0);
651 pidCanvasls->cd();
652 TText *text1ls= new TText(.1,.2,"Contamination Efficiency");
653 text1ls->SetTextAngle(90);
654 if (strstr(outputmode,"visual")) text1ls->Draw();
655 //tp->DrawText(.3,.0,"p (GeV/c");
656 pidCanvasls->cd();
657 TText *text2ls= new TText(.8,.0,"p (GeV/c)");
658 if (strstr(outputmode,"visual")) {
659 text2ls->Draw();
660 tpls->Draw();
661 }
662
663 // overall
190c1f49 664 gStyle->SetOptStat(0);
665 tp->SetFillStyle(0);
666 tp->SetFillColor(0);
667 tp->SetBorderSize(0);
668 pidCanvas->cd();
669 TText *text1= new TText(.1,.2,"Contamination Efficiency");
670 text1->SetTextAngle(90);
671 if (strstr(outputmode,"visual")) text1->Draw();
672 //tp->DrawText(.3,.0,"p (GeV/c");
673 pidCanvas->cd();
674 TText *text2= new TText(.8,.0,"p (GeV/c)");
675 if (strstr(outputmode,"visual")) {
676 text2->Draw();
677 tp->Draw();
678 }
919162e6 679
190c1f49 680 }
681
682
919162e6 683 // drawing histos for overall case
190c1f49 684 if (strstr(eventType,"pp")){
685 pad1->SetFillStyle(0);
686 pad1->SetFillColor(10);
687 tp->cd();
688 if (strstr(outputmode,"visual")) pad1->Draw();
689 pad1->cd();
690 //eleff->SetLineWidth(15);
691 eleff->SetLineWidth(3);
692 eleff->SetMaximum(1.);
693 if (indexOfFile==0) {
694 //eleff->SetFillColor(33);
695 //eleff->SetFillColor(30);
696 //eleff->SetFillColor(0);
697 //eleff->SetLineColor(4);
698 eleff->SetLineColor(1);
919162e6 699 if (strstr(outputmode,"visual")) eleff->Draw();
700 } else {
190c1f49 701 eleff->SetFillStyle(0);
702 eleff->SetFillColor(30);
703 if (indexOfFile==2) {
704 eleff->SetLineColor(3);
705 eleff->SetLineWidth(3);
706 } else {
707 //eleff->SetLineColor(2);
708 eleff->SetLineColor(1);
709 eleff->SetLineStyle(2);}
919162e6 710 if (strstr(outputmode,"visual")) eleff->Draw("same");
711 }
190c1f49 712 // eleff->Fit("pol1");
713 TPaveLabel *ellab = new TPaveLabel(.42,.85,.52,1.05,"e");
714 if (strstr(outputmode,"visual")) ellab->Draw();
715 }
716
717 pad2->SetFillStyle(0);
718 pad2->SetFillColor(10);
719 tp->cd();
720 if (strstr(outputmode,"visual")) pad2->Draw();
721 pad2->cd();
722 pieff->SetLineWidth(3);
723 pieff->SetMaximum(1.);
724 if (indexOfFile==0) {
725 pieff->SetLineColor(1);
726 if (strstr(outputmode,"visual")) pieff->Draw();
727 } else {
728 pieff->SetFillStyle(0);
729 pieff->SetFillColor(30);
730 if (indexOfFile==1) {
731 pieff->SetLineStyle(2);
732 } else if (indexOfFile==2) {
733 pieff->SetLineStyle(3);
734 } else {
735 pieff->SetLineStyle(4);}
919162e6 736 if (strstr(outputmode,"visual")) pieff->Draw("same");
737 }
190c1f49 738 TPaveLabel *pilab = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
739 if (strstr(outputmode,"visual")) pilab->Draw();
740
741 pad3->SetFillStyle(0);
742 pad3->SetFillColor(10);
743 tp->cd();
744 if (strstr(outputmode,"visual")) pad3->Draw();
745 pad3->cd();
746 kaeff->SetLineWidth(3);
747 kaeff->SetMaximum(1.);
748 if (indexOfFile==0) {
749 kaeff->SetLineColor(1);
750 if (strstr(outputmode,"visual")) kaeff->Draw();
751 } else {
752 kaeff->SetFillStyle(0);
753 kaeff->SetFillColor(30);
754 if (indexOfFile==1) {
755 kaeff->SetLineStyle(2);
756 } else if (indexOfFile==2) {
757 kaeff->SetLineStyle(3);
758 } else {
759 kaeff->SetLineStyle(4);}
919162e6 760 if (strstr(outputmode,"visual")) kaeff->Draw("same");
761 }
190c1f49 762 TPaveLabel *kalab = new TPaveLabel(1.7,.85,2.2,1.05,"K");
763 if (strstr(outputmode,"visual")) kalab->Draw();
764
765 pad4->SetFillStyle(0);
766 pad4->SetFillColor(10);
767 tp->cd();
768 if (strstr(outputmode,"visual")) pad4->Draw();
769 pad4->cd();
770 preff->SetLineWidth(3);
771 preff->SetMaximum(1.);
772 if (indexOfFile==0) {
773 preff->SetLineColor(1);
774 if (strstr(outputmode,"visual")) preff->Draw();
775 } else {
776 preff->SetFillStyle(0);
777 preff->SetFillColor(30);
778 if (indexOfFile==1) {
779 preff->SetLineStyle(2);
780 } else if (indexOfFile==2) {
781 preff->SetLineStyle(3);
782 } else {
783 preff->SetLineStyle(4);}
919162e6 784 if (strstr(outputmode,"visual")) preff->Draw("same");
785 }
190c1f49 786 TPaveLabel *prlab = new TPaveLabel(3.2,.85,4.1,1.05,"p");
787 if (strstr(outputmode,"visual")) prlab->Draw();
788
789 if (strstr(eventType,"pp")){
790 pad5->SetFillStyle(0);
791 pad5->SetFillColor(10);
792 tp->cd();
793 if (strstr(outputmode,"visual")) pad5->Draw();
794 pad5->cd();
795 //elcon->SetLineWidth(5);
796 elcon->SetLineWidth(3);
797 elcon->SetMaximum(1.);
798 if (indexOfFile==0) {
799 //elcon->SetFillColor(33);
800 //elcon->SetFillColor(30);
801 //elcon->SetLineColor(4);
802 elcon->SetLineColor(1);
919162e6 803 if (strstr(outputmode,"visual")) elcon->Draw();
804 } else {
190c1f49 805 elcon->SetFillStyle(4000);
806 elcon->SetFillColor(30);
807 if (indexOfFile==2) {
808 elcon->SetLineColor(3);
809 elcon->SetLineWidth(3);
810 } else {
811 elcon->SetLineColor(2);
812 elcon->SetLineStyle(2);}
919162e6 813 if (strstr(outputmode,"visual")) elcon->Draw("same");
814 }
190c1f49 815 }
816
817
818 pad6->SetFillStyle(0);
819 pad6->SetFillColor(10);
820 tp->cd();
821 if (strstr(outputmode,"visual")) pad6->Draw();
822 pad6->cd();
823 picon->SetLineWidth(3);
824 picon->SetMaximum(1.);
825 if (indexOfFile==0) {
826 picon->SetLineColor(1);
919162e6 827 if (strstr(outputmode,"visual")) picon->Draw();
828 } else {
190c1f49 829 picon->SetFillStyle(0);
830 picon->SetFillColor(30);
831 if (indexOfFile==1) {
832 picon->SetLineStyle(2);
833 } else if (indexOfFile==2) {
834 picon->SetLineStyle(3);
835 } else {
836 picon->SetLineStyle(4);
837 TLine* line;
838 line = new TLine(0.2,0.85,0.9,0.85);
839 line->SetLineStyle(2);
840 line->SetLineWidth(1);
841 if (strstr(outputmode,"visual")) line->Draw();
842 line = new TLine(0.2,0.65,0.9,0.65);
843 line->SetLineWidth(2);
844 if (strstr(outputmode,"visual")) line->Draw();
845 line = new TLine(0.2,0.45,0.9,0.45);
846 line->SetLineStyle(3);
847 line->SetLineWidth(1);
848 if (strstr(outputmode,"visual")) line->Draw();
849 line = new TLine(0.2,0.25,0.9,0.25);
850 line->SetLineStyle(4);
851 line->SetLineWidth(1);
852 if (strstr(outputmode,"visual")) line->Draw();
853 TPaveLabel *pl = new TPaveLabel(1.1,0.8,1.9,0.9,"100 ps","br");
854 pl->SetFillColor(18);
855 pl->SetTextSize(0.99);
856 if (strstr(outputmode,"visual")) pl->Draw();
857 pl = new TPaveLabel(1.1,0.6,1.9,0.7,"150 ps","br");
858 pl->SetFillColor(18);
859 pl->SetTextSize(0.99);
860 if (strstr(outputmode,"visual")) pl->Draw();
861 pl = new TPaveLabel(1.1,0.4,1.9,0.5,"200 ps","br");
862 pl->SetFillColor(18);
863 pl->SetTextSize(0.99);
864 if (strstr(outputmode,"visual")) pl->Draw();
865 pl = new TPaveLabel(1.1,0.2,1.9,0.3,"300 ps","br");
866 pl->SetFillColor(18);
867 pl->SetTextSize(0.99);
868 if (strstr(outputmode,"visual")) pl->Draw();
869 }
919162e6 870 if (strstr(outputmode,"visual")) picon->Draw("same");
871 }
190c1f49 872
873 pad7->SetFillStyle(0);
874 pad7->SetFillColor(10);
875 tp->cd();
876 if (strstr(outputmode,"visual")) pad7->Draw();
877 pad7->cd();
878 kacon->SetLineWidth(3);
879 kacon->SetMaximum(1.);
880 if (indexOfFile==0) {
881 kacon->SetLineColor(1);
919162e6 882 if (strstr(outputmode,"visual")) kacon->Draw();
883 } else {
190c1f49 884 kacon->SetFillStyle(0);
885 kacon->SetFillColor(30);
886 if (indexOfFile==1) {
887 kacon->SetLineStyle(2);
888 } else if (indexOfFile==2) {
889 kacon->SetLineStyle(3);
890 } else {
891 kacon->SetLineStyle(4);}
919162e6 892 if (strstr(outputmode,"visual")) kacon->Draw("same");
893 }
190c1f49 894
895 pad8->SetFillStyle(0);
896 pad8->SetFillColor(10);
897 tp->cd();
898 if (strstr(outputmode,"visual")) pad8->Draw();
899 pad8->cd();
900 prcon->SetLineWidth(3);
901 prcon->SetMaximum(1.);
902 if (indexOfFile==0) {
903 prcon->SetLineColor(1);
919162e6 904 if (strstr(outputmode,"visual")) prcon->Draw();
905 } else {
190c1f49 906 prcon->SetFillStyle(0);
907 prcon->SetFillColor(30);
908 if (indexOfFile==1) {
909 prcon->SetLineStyle(2);
910 } else if (indexOfFile==2) {
911 prcon->SetLineStyle(3);
912 } else {
913 prcon->SetLineStyle(4);}
919162e6 914 if (strstr(outputmode,"visual")) prcon->Draw("same");
915 }
916
917
918
919 // last step case (it is just a copy of the previous lines)
920 // moving to pidCanvasls canvas
921 pidCanvasls->cd();
922 // drawing histos for overall case
923 if (strstr(eventType,"pp")){
924 pad1ls->SetFillStyle(0);
925 pad1ls->SetFillColor(10);
926 tpls->cd();
927 if (strstr(outputmode,"visual")) pad1ls->Draw();
928 pad1ls->cd();
929 //eleff->SetLineWidth(15);
930 eleffls->SetLineWidth(3);
931 eleffls->SetMaximum(1.);
932 if (indexOfFile==0) {
933 //eleff->SetFillColor(33);
934 //eleff->SetFillColor(30);
935 //eleff->SetFillColor(0);
936 //eleff->SetLineColor(4);
937 eleffls->SetLineColor(1);
938 if (strstr(outputmode,"visual")) eleffls->Draw();
939 } else {
940 eleffls->SetFillStyle(0);
941 eleffls->SetFillColor(30);
942 if (indexOfFile==2) {
943 eleffls->SetLineColor(3);
944 eleffls->SetLineWidth(3);
945 } else {
946 //eleff->SetLineColor(2);
947 eleffls->SetLineColor(1);
948 eleffls->SetLineStyle(2);}
949 if (strstr(outputmode,"visual")) eleffls->Draw("same");
950 }
951 // eleff->Fit("pol1");
952 TPaveLabel *ellabls = new TPaveLabel(.42,.85,.52,1.05,"e");
953 if (strstr(outputmode,"visual")) ellabls->Draw();
954 }
955
956 pad2ls->SetFillStyle(0);
957 pad2ls->SetFillColor(10);
958 tpls->cd();
959 if (strstr(outputmode,"visual")) pad2ls->Draw();
960 pad2ls->cd();
961 pieffls->SetLineWidth(3);
962 pieffls->SetMaximum(1.);
963 if (indexOfFile==0) {
964 pieffls->SetLineColor(1);
965 if (strstr(outputmode,"visual")) pieffls->Draw();
966 } else {
967 pieffls->SetFillStyle(0);
968 pieffls->SetFillColor(30);
969 if (indexOfFile==1) {
970 pieffls->SetLineStyle(2);
971 } else if (indexOfFile==2) {
972 pieffls->SetLineStyle(3);
973 } else {
974 pieffls->SetLineStyle(4);}
975 if (strstr(outputmode,"visual")) pieffls->Draw("same");
976 }
977 TPaveLabel *pilabls = new TPaveLabel(1.7,.85,2.2,1.05,"#pi");
978 if (strstr(outputmode,"visual")) pilabls->Draw();
979
980 pad3ls->SetFillStyle(0);
981 pad3ls->SetFillColor(10);
982 tpls->cd();
983 if (strstr(outputmode,"visual")) pad3ls->Draw();
984 pad3ls->cd();
985 kaeffls->SetLineWidth(3);
986 kaeffls->SetMaximum(1.);
987 if (indexOfFile==0) {
988 kaeffls->SetLineColor(1);
989 if (strstr(outputmode,"visual")) kaeffls->Draw();
990 } else {
991 kaeffls->SetFillStyle(0);
992 kaeffls->SetFillColor(30);
993 if (indexOfFile==1) {
994 kaeffls->SetLineStyle(2);
995 } else if (indexOfFile==2) {
996 kaeffls->SetLineStyle(3);
997 } else {
998 kaeffls->SetLineStyle(4);}
999 if (strstr(outputmode,"visual")) kaeffls->Draw("same");
1000 }
1001 TPaveLabel *kalabls = new TPaveLabel(1.7,.85,2.2,1.05,"K");
1002 if (strstr(outputmode,"visual")) kalabls->Draw();
1003
1004 pad4ls->SetFillStyle(0);
1005 pad4ls->SetFillColor(10);
1006 tpls->cd();
1007 if (strstr(outputmode,"visual")) pad4ls->Draw();
1008 pad4ls->cd();
1009 preffls->SetLineWidth(3);
1010 preffls->SetMaximum(1.);
1011 if (indexOfFile==0) {
1012 preffls->SetLineColor(1);
1013 if (strstr(outputmode,"visual")) preffls->Draw();
1014 } else {
1015 preffls->SetFillStyle(0);
1016 preffls->SetFillColor(30);
1017 if (indexOfFile==1) {
1018 preffls->SetLineStyle(2);
1019 } else if (indexOfFile==2) {
1020 preffls->SetLineStyle(3);
1021 } else {
1022 preffls->SetLineStyle(4);}
1023 if (strstr(outputmode,"visual")) preffls->Draw("same");
1024 }
1025 TPaveLabel *prlabls = new TPaveLabel(3.2,.85,4.1,1.05,"p");
1026 if (strstr(outputmode,"visual")) prlabls->Draw();
1027
1028 if (strstr(eventType,"pp")){
1029 pad5ls->SetFillStyle(0);
1030 pad5ls->SetFillColor(10);
1031 tpls->cd();
1032 if (strstr(outputmode,"visual")) pad5ls->Draw();
1033 pad5ls->cd();
1034 //elcon->SetLineWidth(5);
1035 elcon->SetLineWidth(3);
1036 elcon->SetMaximum(1.);
1037 if (indexOfFile==0) {
1038 //elcon->SetFillColor(33);
1039 //elcon->SetFillColor(30);
1040 //elcon->SetLineColor(4);
1041 elcon->SetLineColor(1);
1042 if (strstr(outputmode,"visual")) elcon->Draw();
1043 } else {
1044 elcon->SetFillStyle(4000);
1045 elcon->SetFillColor(30);
1046 if (indexOfFile==2) {
1047 elcon->SetLineColor(3);
1048 elcon->SetLineWidth(3);
1049 } else {
1050 elcon->SetLineColor(2);
1051 elcon->SetLineStyle(2);}
1052 if (strstr(outputmode,"visual")) elcon->Draw("same");
1053 }
1054 }
1055
1056
1057 pad6ls->SetFillStyle(0);
1058 pad6ls->SetFillColor(10);
1059 tpls->cd();
1060 if (strstr(outputmode,"visual")) pad6ls->Draw();
1061 pad6ls->cd();
1062 picon->SetLineWidth(3);
1063 picon->SetMaximum(1.);
1064 if (indexOfFile==0) {
1065 picon->SetLineColor(1);
1066 if (strstr(outputmode,"visual")) picon->Draw();
1067 } else {
1068 picon->SetFillStyle(0);
1069 picon->SetFillColor(30);
1070 if (indexOfFile==1) {
1071 picon->SetLineStyle(2);
1072 } else if (indexOfFile==2) {
1073 picon->SetLineStyle(3);
1074 } else {
1075 picon->SetLineStyle(4);
1076 TLine* line;
1077 line = new TLine(0.2,0.85,0.9,0.85);
1078 line->SetLineStyle(2);
1079 line->SetLineWidth(1);
1080 if (strstr(outputmode,"visual")) line->Draw();
1081 line = new TLine(0.2,0.65,0.9,0.65);
1082 line->SetLineWidth(2);
1083 if (strstr(outputmode,"visual")) line->Draw();
1084 line = new TLine(0.2,0.45,0.9,0.45);
1085 line->SetLineStyle(3);
1086 line->SetLineWidth(1);
1087 if (strstr(outputmode,"visual")) line->Draw();
1088 line = new TLine(0.2,0.25,0.9,0.25);
1089 line->SetLineStyle(4);
1090 line->SetLineWidth(1);
1091 if (strstr(outputmode,"visual")) line->Draw();
1092 TPaveLabel *pl = new TPaveLabel(1.1,0.8,1.9,0.9,"100 ps","br");
1093 pl->SetFillColor(18);
1094 pl->SetTextSize(0.99);
1095 if (strstr(outputmode,"visual")) pl->Draw();
1096 pl = new TPaveLabel(1.1,0.6,1.9,0.7,"150 ps","br");
1097 pl->SetFillColor(18);
1098 pl->SetTextSize(0.99);
1099 if (strstr(outputmode,"visual")) pl->Draw();
1100 pl = new TPaveLabel(1.1,0.4,1.9,0.5,"200 ps","br");
1101 pl->SetFillColor(18);
1102 pl->SetTextSize(0.99);
1103 if (strstr(outputmode,"visual")) pl->Draw();
1104 pl = new TPaveLabel(1.1,0.2,1.9,0.3,"300 ps","br");
1105 pl->SetFillColor(18);
1106 pl->SetTextSize(0.99);
1107 if (strstr(outputmode,"visual")) pl->Draw();
1108 }
1109 if (strstr(outputmode,"visual")) picon->Draw("same");
1110 }
1111
1112 pad7ls->SetFillStyle(0);
1113 pad7ls->SetFillColor(10);
1114 tpls->cd();
1115 if (strstr(outputmode,"visual")) pad7ls->Draw();
1116 pad7ls->cd();
1117 kacon->SetLineWidth(3);
1118 kacon->SetMaximum(1.);
1119 if (indexOfFile==0) {
1120 kacon->SetLineColor(1);
1121 if (strstr(outputmode,"visual")) kacon->Draw();
1122 } else {
1123 kacon->SetFillStyle(0);
1124 kacon->SetFillColor(30);
1125 if (indexOfFile==1) {
1126 kacon->SetLineStyle(2);
1127 } else if (indexOfFile==2) {
1128 kacon->SetLineStyle(3);
1129 } else {
1130 kacon->SetLineStyle(4);}
1131 if (strstr(outputmode,"visual")) kacon->Draw("same");
1132 }
190c1f49 1133
919162e6 1134 pad8ls->SetFillStyle(0);
1135 pad8ls->SetFillColor(10);
1136 tpls->cd();
1137 if (strstr(outputmode,"visual")) pad8ls->Draw();
1138 pad8ls->cd();
1139 prcon->SetLineWidth(3);
1140 prcon->SetMaximum(1.);
1141 if (indexOfFile==0) {
1142 prcon->SetLineColor(1);
1143 if (strstr(outputmode,"visual")) prcon->Draw();
1144 } else {
1145 prcon->SetFillStyle(0);
1146 prcon->SetFillColor(30);
1147 if (indexOfFile==1) {
1148 prcon->SetLineStyle(2);
1149 } else if (indexOfFile==2) {
1150 prcon->SetLineStyle(3);
1151 } else {
1152 prcon->SetLineStyle(4);}
1153 if (strstr(outputmode,"visual")) prcon->Draw("same");
1154 }
1155
1156
1157
1158
1159
1160
1161
1162 // momentum vs mass 2-D histos
1163
190c1f49 1164 if (indexOfFile==0) {
1165 momvsmassCanvas = new TCanvas("momvsmassCanvas","Momentum vs mass disribution",500,10,700,700);
1166 momvsmassCanvas->SetFillColor(0);
1167 momvsmassCanvas->SetBorderMode(0);
1168 gPad->SetFillStyle(0);
1169 gPad->SetBorderMode(0);
1170 gPad->SetFillColor(0);
1171 // gStyle->SetOptStat(11);
1172 if (numfile==4) momvsmassCanvas->Divide(1,2,0,0);
1173 } else if (indexOfFile==1 && numfile == 4) {
1174 momvsmassCanvas->cd(1);
1175 TPaveLabel *pl = new TPaveLabel(-0.0376218,-3.03586,0.0979277,-2.70158,"100 ps","br");
1176 pl->SetFillColor(18);
1177 pl->SetTextSize(0.99);
1178 if (strstr(outputmode,"visual")) pl->Draw();
1179 } else if (indexOfFile==3 && numfile == 4) {
1180 momvsmassCanvas->cd(2);
1181 TPaveLabel *pl = new TPaveLabel(-0.0591866,-3.17077,0.076363,-2.86857,"300 ps","br");
1182 pl->SetFillColor(18);
1183 pl->SetTextSize(0.99);
1184 if (strstr(outputmode,"visual")) pl->Draw();
1185 }
1186 if (numfile !=4) momvsmassCanvas->cd();
1187 if (numfile !=4 || indexOfFile==1 || indexOfFile==3) {
1188 // hpi->PaintStat2(01);
1189 hpi->SetMarkerColor(5);
1190 if (strstr(outputmode,"visual")) hpi->Draw();
1191 if(strstr(eventType,"pp")){
1192 hel->SetMarkerColor(2);
1193 if (strstr(outputmode,"visual")) hel->Draw("same");
1194 }
1195 hka->SetMarkerColor(4);
1196 if (strstr(outputmode,"visual")) hka->Draw("same");
1197 hpr->SetMarkerColor(3);
1198 if (strstr(outputmode,"visual")) hpr->Draw("same");
1199 if (strstr(outputmode,"visual")) {
1200 fkaon->Draw();
1201 fproton->Draw();
1202 if(strstr(eventType,"pp")){
1203 felectron->Draw();
1204 fpion->Draw();
1205 }
1206 }
1207 if(strstr(eventType,"pp")){
1208 //TPaveText *ep = new TPaveText(-0.05,-0.5,0.05,-0.3);
1209 //ep->AddText("e");
1210 TPaveLabel *ep = new TPaveLabel(.42,.85,.52,1.05,"e");
1211 if (strstr(outputmode,"visual")) ep->Draw();
1212 }
1213
1214 TPaveText *pip = new TPaveText(0.15,-1.0,0.25,-0.8);
1215 pip->AddText("#pi");
1216 if (strstr(outputmode,"visual")) pip->Draw();
1217 TPaveText *kp = new TPaveText(0.5,-2.0,0.6,-1.8);
1218 kp->AddText("K");
1219 if (strstr(outputmode,"visual")) kp->Draw();
1220 TPaveText *prp = new TPaveText(0.9,-2.7,1.0,-2.5);
1221 prp->AddText("p");
1222 if (strstr(outputmode,"visual")) prp->Draw();
1223 // TText *text2= new TText(.59,.06,"Momentum");
1224 // text1->SetTextAngle(90);
1225 // text1->Draw();
1226 //pidCanvas->DrawText(.1,.2,"Contamination Efficiency");
1227 momvsmassCanvas->Update();
1228 if(strstr(outputsavemode,"asC")) momvsmassCanvas->Print("momvsmassCanvas.C");
1229 if(strstr(outputsavemode,"asEPS")) momvsmassCanvas->Print("momvsmassCanvas.eps");
1230 pidCanvas->cd();
1231 pidCanvas->Update();
1232 if(strstr(outputsavemode,"asC")) pidCanvas->Print("pidCanvas.C");
1233 if(strstr(outputsavemode,"asEPS")) pidCanvas->Print("pidCanvas.eps");
1234 char outFileName[100];
1235 strcpy(outFileName,"histos");
1236 strcat(outFileName,foutfileName);
1237 TFile *houtfile = new TFile(outFileName,"recreate");
1238 houtfile->cd();
1239 // saving canvas
1240 pidCanvas->Write(0,TObject::kOverwrite);
1241 momvsmassCanvas->Write(0,TObject::kOverwrite);
919162e6 1242 // saving 1-D histos
190c1f49 1243 pit->Write(0,TObject::kOverwrite);
1244 pig->Write(0,TObject::kOverwrite);
1245 pieff->Write(0,TObject::kOverwrite);
919162e6 1246 pieffls->Write(0,TObject::kOverwrite);
190c1f49 1247 picon->Write(0,TObject::kOverwrite);
1248 piid->Write(0,TObject::kOverwrite);
8488c769 1249 pimatch->Write(0,TObject::kOverwrite);
190c1f49 1250 piall->Write(0,TObject::kOverwrite);
1251 pigen->Write(0,TObject::kOverwrite);
1252 kat->Write(0,TObject::kOverwrite);
1253 kag->Write(0,TObject::kOverwrite);
1254 kaeff->Write(0,TObject::kOverwrite);
919162e6 1255 kaeffls->Write(0,TObject::kOverwrite);
190c1f49 1256 kaid->Write(0,TObject::kOverwrite);
8488c769 1257 kamatch->Write(0,TObject::kOverwrite);
190c1f49 1258 kaall->Write(0,TObject::kOverwrite);
1259 kagen->Write(0,TObject::kOverwrite);
1260 kacon->Write(0,TObject::kOverwrite);
1261 prt->Write(0,TObject::kOverwrite);
1262 prg->Write(0,TObject::kOverwrite);
1263 preff->Write(0,TObject::kOverwrite);
919162e6 1264 preffls->Write(0,TObject::kOverwrite);
190c1f49 1265 prcon->Write(0,TObject::kOverwrite);
1266 prid->Write(0,TObject::kOverwrite);
8488c769 1267 prmatch->Write(0,TObject::kOverwrite);
190c1f49 1268 prall->Write(0,TObject::kOverwrite);
1269 prgen->Write(0,TObject::kOverwrite);
919162e6 1270 // saving 2-D histos
190c1f49 1271 hpi->Write(0,TObject::kOverwrite);
1272 hka->Write(0,TObject::kOverwrite);
1273 hpr->Write(0,TObject::kOverwrite);
1274 // electron histos
1275 if (hel && eleff && elcon && elid && elall){
1276 hel->Write(0,TObject::kOverwrite);
1277 eleff->Write(0,TObject::kOverwrite);
1278 elcon->Write(0,TObject::kOverwrite);
1279 elid->Write(0,TObject::kOverwrite);
8488c769 1280 elmatch->Write(0,TObject::kOverwrite);
190c1f49 1281 elall->Write(0,TObject::kOverwrite);
1282 }
1283 cout << "file " << houtfile << " has been created" << endl;
1284 cout << "it contains PID histos and canvas" << endl;
1285 houtfile->Close();
1286 houtfile->Write(0,TObject::kOverwrite);
1287 }
1288 }
1289
1290 if (strstr(outputmode,"novisual")){
1291 // free used memory
1292 delete pit ; pit=0;
1293 delete pig ; pig=0;
1294 delete pieff; pieff=0;
919162e6 1295 delete pieffls; pieffls=0;
190c1f49 1296 delete picon; picon=0;
1297 delete piid ; piid=0;
8488c769 1298 delete pimatch; pimatch=0;
190c1f49 1299 delete piall; piall=0;
1300 delete pigen; pigen=0;
1301 delete kat ; kat=0;
1302 delete kag ; kag=0;
1303 delete kaeff; kaeff=0;
919162e6 1304 delete kaeffls; kaeffls=0;
190c1f49 1305 delete kaid; kaid=0;
8488c769 1306 delete kamatch; kamatch=0;
190c1f49 1307 delete kaall; kaall=0;
1308 delete kagen; kagen=0;
1309 delete kacon; kacon=0;
1310 delete prt; prt=0;
1311 delete prg; prg=0;
1312 delete preff; preff=0;
919162e6 1313 delete preffls; preffls=0;
190c1f49 1314 delete prcon; prcon=0;
1315 delete prid; prid=0;
8488c769 1316 delete prmatch; prmatch=0;
190c1f49 1317 delete prall; prall=0;
1318 delete prgen; prgen=0;
1319 // 2-D
1320 delete hpi; hpi=0;
1321 delete hka; hka=0;
1322 delete hpr; hpr=0;
1323 if (hel){
1324 delete hel;
1325 hel=0;
1326 }
1327 if (eleff){
1328 delete eleff;
1329 eleff=0;
1330 }
919162e6 1331 if (eleffls){
1332 delete eleffls;
1333 eleffls=0;
1334 }
190c1f49 1335 if (elcon){
1336 delete elcon;
1337 elcon=0;
1338 }
1339 if (elid){
1340 delete elid;
1341 elid=0;
1342 }
8488c769 1343 if (elmatch){
1344 delete elmatch;
1345 elmatch=0;
1346 }
190c1f49 1347 if (elall){
1348 delete elall;
1349 elall=0;
1350 }
1351 }
1352}
1353
1354
1355//__________________________________________________________________
5c016a7b 1356Bool_t AliTOFPID::operator==( AliTOFPID const & /*tofrec*/)const
190c1f49 1357{
1358 // dummy version of Equal operator.
1359 // requested by coding conventions
1360 return kTRUE;
1361
1362}