]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/macros/DrawReductionFactorpp.C
Updates to run with deltas (L. Cunqueiro)
[u/mrichter/AliRoot.git] / PWG3 / hfe / macros / DrawReductionFactorpp.C
1 TList *GetResults(const Char_t *testfile,const Char_t *plus="");
2 TObject* GetSpectrum(AliCFContainer *c, Int_t step);
3 TObject* GetEfficiency(AliCFContainer *c, Int_t step = 9);
4 TObject* GetEfficiency(AliCFContainer *c, Int_t step, Int_t step0);
5
6
7 void DrawReductionFactorpp(const char *testfile,const char *name) {
8   
9   gStyle->SetPalette(1);
10   gStyle->SetOptStat(1111);
11   gStyle->SetPadBorderMode(0);
12   gStyle->SetCanvasColor(10);
13   gStyle->SetPadLeftMargin(0.13);
14   gStyle->SetPadRightMargin(0.13);
15   
16   ///////////////////////////////////
17   // Take the stuff
18   //////////////////////////////////
19
20   TList *results = GetResults(testfile,name);
21   if(!results){
22     printf("No output objects: Calculation will terminate here\n");
23     return;
24   }
25
26   AliHFEcontainer *containerhfe = (AliHFEcontainer *) results->FindObject("trackContainer");
27   if(!containerhfe) {
28     printf("No hfe container \n");
29     return;
30   }
31
32   AliCFContainer *sumcontainer = containerhfe->GetCFContainer("recTrackContReco");
33   if(!sumcontainer) {
34     printf("No container sum esd\n");
35     return;
36   }
37   
38   Int_t numberOfEvents = (Int_t) containerhfe->GetNumberOfEvents();
39   
40   printf("Number of events for  %d after Event cut\n",numberOfEvents);
41   
42   /////////////////////////////////////
43   // Take efficiencies
44   /////////////////////////////////////
45   
46   // ESD values
47
48   AliCFEffGrid  *efficiencystepkineITSTPC  = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepRecKineITSTPC,AliHFEcuts::kStepRecNoCut);
49   AliCFEffGrid  *efficiencystepPrim        = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepRecPrim,AliHFEcuts::kStepRecKineITSTPC);
50   AliCFEffGrid  *efficiencystepHFEcutsITS  = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsITS,AliHFEcuts::kStepRecPrim);
51   AliCFEffGrid  *efficiencystepHFEcutsTRD  = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsTRD,AliHFEcuts::kStepHFEcutsITS);
52   
53
54   AliCFEffGrid  *efficiencystepPIDTOF      = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsTRD + 1,AliHFEcuts::kStepHFEcutsTRD);
55   AliCFEffGrid  *efficiencystepPIDTPC      = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsTRD + 2,AliHFEcuts::kStepHFEcutsTRD + 1);
56
57   AliCFEffGrid  *efficiencystepPIDall      = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsTRD + 2,AliHFEcuts::kStepHFEcutsTRD);
58
59   AliCFEffGrid  *efficiencystepall      = (AliCFEffGrid*)  GetEfficiency(sumcontainer,AliHFEcuts::kStepHFEcutsTRD + 2,AliHFEcuts::kStepRecNoCut);
60   
61
62   ///////////////////////////////////////
63   // Plot 1D
64   ///////////////////////////////////////
65
66   TCanvas * canvascomparisonbis = new TCanvas("ITSTPCrefitStep","ITSTPCrefitStep",1000,700);
67   canvascomparisonbis->Divide(2,2);
68  
69   canvascomparisonbis->cd(1);
70   TH1D* h_effstepkineITSTPC1Donly = (TH1D *) efficiencystepkineITSTPC->Project(0);
71   h_effstepkineITSTPC1Donly->SetTitle("(ITS & TPC refit) / (No cut)");
72   h_effstepkineITSTPC1Donly->SetStats(0);
73   h_effstepkineITSTPC1Donly->SetLineColor(kBlue);
74   h_effstepkineITSTPC1Donly->SetMarkerColor(kBlue);
75   h_effstepkineITSTPC1Donly->SetMarkerStyle(25);
76   h_effstepkineITSTPC1Donly->GetXaxis()->SetRangeUser(0.3,6.0);
77   h_effstepkineITSTPC1Donly->SetXTitle("p_{T} [GeV/c]");
78   h_effstepkineITSTPC1Donly->SetYTitle("Efficiency");
79   h_effstepkineITSTPC1Donly->Draw();
80
81   canvascomparisonbis->cd(2);
82   TH1D* h_effstepPrim1Donly = (TH1D *) efficiencystepPrim->Project(0);
83   h_effstepPrim1Donly->SetTitle("No Kink");
84   h_effstepPrim1Donly->SetStats(0);
85   h_effstepPrim1Donly->SetLineColor(kBlue);
86   h_effstepPrim1Donly->SetMarkerColor(kBlue);
87   h_effstepPrim1Donly->SetMarkerStyle(25);
88   h_effstepPrim1Donly->GetXaxis()->SetRangeUser(0.3,6.0);
89   h_effstepPrim1Donly->SetXTitle("p_{T} [GeV/c]");
90   h_effstepPrim1Donly->SetYTitle("Efficiency");
91   h_effstepPrim1Donly->Draw();
92
93   canvascomparisonbis->cd(3);
94   TH1D* h_effstepHFEcutsITS1Donlya = (TH1D *) efficiencystepHFEcutsITS->Project(0);
95   h_effstepHFEcutsITS1Donlya->SetTitle("First pixel");
96   h_effstepHFEcutsITS1Donlya->SetStats(0);
97   h_effstepHFEcutsITS1Donlya->SetLineColor(kBlue);
98   h_effstepHFEcutsITS1Donlya->SetMarkerColor(kBlue);
99   h_effstepHFEcutsITS1Donlya->SetMarkerStyle(25);
100   h_effstepHFEcutsITS1Donlya->GetXaxis()->SetRangeUser(0.3,6.0);
101   h_effstepHFEcutsITS1Donlya->GetYaxis()->SetRangeUser(0.0,1.0);
102   h_effstepHFEcutsITS1Donlya->SetXTitle("p_{T} [GeV/c]");
103   h_effstepHFEcutsITS1Donlya->SetYTitle("Efficiency");
104   h_effstepHFEcutsITS1Donlya->Draw();
105  
106   canvascomparisonbis->cd(4);
107   TH1D* h_effstepHFEcutsTRDonly = (TH1D *) efficiencystepHFEcutsTRD->Project(0);
108   h_effstepHFEcutsTRDonly->SetTitle("TOF matching");
109   h_effstepHFEcutsTRDonly->SetStats(0);
110   h_effstepHFEcutsTRDonly->SetLineColor(kBlue);
111   h_effstepHFEcutsTRDonly->SetMarkerColor(kBlue);
112   h_effstepHFEcutsTRDonly->SetMarkerStyle(25);
113   h_effstepHFEcutsTRDonly->GetXaxis()->SetRangeUser(0.3,6.0);
114   h_effstepHFEcutsTRDonly->SetXTitle("p_{T} [GeV/c]");
115   h_effstepHFEcutsTRDonly->SetYTitle("Efficiency");
116   h_effstepHFEcutsTRDonly->Draw();
117   
118   /////////
119   // PID
120   /////////
121
122   TCanvas * canvasc1Don = new TCanvas("PIDstep","PIDstep",1000,700);
123   canvasc1Don->Divide(2,1);
124   
125   canvasc1Don->cd(1);
126   TH1D* h_effstepPID1Donly = (TH1D *) efficiencystepPIDTOF->Project(0);
127   h_effstepPID1Donly->SetTitle("TOF 3 sigma cut");
128   h_effstepPID1Donly->SetStats(0);
129   h_effstepPID1Donly->SetLineColor(kBlue);
130   h_effstepPID1Donly->SetMarkerColor(kBlue);
131   h_effstepPID1Donly->SetMarkerStyle(25);
132   h_effstepPID1Donly->GetXaxis()->SetRangeUser(0.3,6.0);
133   h_effstepPID1Donly->SetXTitle("p_{T} [GeV/c]");
134   h_effstepPID1Donly->SetYTitle("Efficiency");
135   h_effstepPID1Donly->Draw();
136  
137   canvasc1Don->cd(2);
138   gPad->SetLogy();
139   TH1D* h_effstepPID1Donlyy = (TH1D *) efficiencystepPIDTPC->Project(0);
140   h_effstepPID1Donlyy->SetTitle("TPC PID cut");
141   h_effstepPID1Donlyy->SetStats(0);
142   h_effstepPID1Donlyy->SetLineColor(kBlue);
143   h_effstepPID1Donlyy->SetMarkerColor(kBlue);
144   h_effstepPID1Donlyy->SetMarkerStyle(25);
145   h_effstepPID1Donlyy->GetXaxis()->SetRangeUser(0.3,6.0);
146   h_effstepPID1Donlyy->SetXTitle("p_{T} [GeV/c]");
147   h_effstepPID1Donlyy->SetYTitle("Efficiency");
148   h_effstepPID1Donlyy->Draw();
149   
150
151   
152   
153 }
154
155 // ====================================================================
156 TList *GetResults(const Char_t *testfile,const Char_t *plus){
157   //
158   // read output
159   //
160   TFile *f = TFile::Open(testfile);
161   if(!f || f->IsZombie()){
162     printf("File not readable\n");
163     return 0x0;
164   }
165   TString name("HFE_Results");
166   name += plus; 
167   printf("Name of TList %s\n",(const char*)name); 
168   TList *l = dynamic_cast<TList *>(f->Get((const char*)name));
169   if(!l){
170     printf("Output container not found\n");
171     f->Close(); delete f;
172     return 0x0;
173   } 
174   TList *returnlist = dynamic_cast<TList *>(l->Clone());
175   f->Close(); delete f;
176   return returnlist;
177 }
178 //_________________________________________________________________________
179 TObject* GetSpectrum(AliCFContainer *c, Int_t step) {
180   AliCFDataGrid* data = new AliCFDataGrid("data","",*c,step);
181   //data->SetMeasured(step);
182   return data;
183 }
184 //__________________________________________________________________________
185 TObject* GetEfficiency(AliCFContainer *c, Int_t step) {
186   TString name("eff");
187   name += step;
188   AliCFEffGrid* eff = new AliCFEffGrid((const char*)name,"",*c);
189   eff->CalculateEfficiency(step,0);
190   return eff;
191 }
192 //_________________________________________________________________________
193 TObject* GetEfficiency(AliCFContainer *c, Int_t step, Int_t step0) {
194   TString name("eff");
195   name += step;
196   name+= step0;
197   AliCFEffGrid* eff = new AliCFEffGrid((const char*)name,"",*c);
198   eff->CalculateEfficiency(step,step0);
199   return eff;
200 }