.so cleanup: removed from gSystem->Load()
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / ProduceFastQA.C
1 /****************************************************************************************************************************
2  ******     provided by Gamma Conversion Group, PWG4,                                                                   *****
3  ******     Kathrin Koch, kkoch@physi.uni-heidelberg.de                                                                 *****
4  ******     Friederike Bock, friederike.bock@cern.ch                                                                    *****
5  *****************************************************************************************************************************
6  *** This macro can be used to display the Photon Characteristics of the conversion method in ALICE, it can be operated  *****
7  *** on the output of the GammaConversionTask. It can take 2 input files, the second one should be MC, if this is not    *****
8  *** the case all histograms including MC need to be commented out otherwise the running will crash.                     *****
9  ****************************************************************************************************************************/
10
11 #include <Riostream.h>
12 #include <fstream>
13 #include "TMath.h"
14 #include <stdlib.h>
15 #include <fstream>
16 #include <math.h>
17 #include <TROOT.h>
18 #include <TApplication.h>
19 #include <TPaveLabel.h>
20 #include <TSystem.h>
21 #include <TFrame.h>
22 #include <TStyle.h>
23 #include <TString.h>
24 #include "TGaxis.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH1D.h"
28 #include "TH2F.h"
29 #include "TH3F.h"
30 #include "TF1.h"
31 #include "TVirtualFitter.h"
32 #include "TObject.h"
33 #include "TCanvas.h"
34 #include "TMultiGraph.h"
35 #include "TLegend.h"
36 #include "TDatabasePDG.h"
37 #include "TMinuit.h"
38 #include "TLatex.h"
39 #include "TASImage.h"
40 #include "TPostScript.h"
41 #include "TGraphErrors.h"
42 #include "TArrow.h"
43 #include "TMarker.h"
44 #include "TGraphAsymmErrors.h" 
45
46 TString textGenerator;
47 TString collisionSystem;
48 TString textPeriod;
49 TString textDate;
50
51 void SetStyleTLatex( TLatex* text, Size_t textSize, Width_t lineWidth, Color_t textColor = 1, Bool_t kNDC = kTRUE){
52    if (kNDC) {text->SetNDC();}
53    text->SetTextColor(textColor);
54    text->SetTextSize(textSize);
55    text->SetLineWidth(lineWidth);
56 }
57
58
59 /* DrawAutoGammaHisto is function used for styling a histograma of the gamma conversion group with standart settings
60 * histo1 - first histogram (Data)
61 * Title - histogram title
62 * XTitle - X-axis title
63 * YTitle - Y-axis title
64 * YRangeMax    = kTRUE will scale by Maximum and Minimum Range in Y
65 *YMaxFactor - will MaximumY by this factor if YRangeMay = kTRUE 
66 *YMinimum - this will be used if YRangeMax is set
67 *YRange     = kTRUE will Cut y-axis by YMin and YMax 
68 - will be set to kFAlSE if YRangeMax is set
69 *YMin - minimum Y
70 *YMax - maximum Y
71 *XRange  = kTRUE will Cut x-axis by XMin and XMax
72 *XMin - minimum Y
73 *XMax - maximum Y
74 */ 
75 void DrawAutoGammaHisto( TH1* histo1, 
76                TString Title, TString XTitle, TString YTitle,
77                Bool_t YRangeMax, Float_t YMaxFactor, Float_t YMinimum,
78                Bool_t YRange, Float_t YMin ,Float_t YMax,  
79                Bool_t XRange, Float_t XMin, Float_t XMax) {
80    if (YRangeMax && !XRange){
81       YRange = kFALSE;
82       Double_t maxRangeR = histo1->GetMaximum();
83       Double_t minRangeR = histo1->GetMinimum();      
84       if(YMinimum > minRangeR){minRangeR = YMinimum;}
85       histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);   
86    }
87    if (YRangeMax && XRange){
88       YRange = kFALSE;
89       Double_t maxRangeR = histo1->GetMaximum();
90       Double_t minRangeR = histo1->GetMinimum();      
91       if(YMinimum > minRangeR){minRangeR = YMinimum;}
92       histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);   
93       histo1->GetXaxis()->SetRangeUser(XMin, XMax);   
94    }
95    if (YRange && XRange){
96       histo1->GetYaxis()->SetRangeUser(YMin, YMax);   
97       histo1->GetXaxis()->SetRangeUser(XMin, XMax);   
98    }
99    if (!YRangeMax && !YRange && XRange){
100       histo1->GetXaxis()->SetRangeUser(XMin, XMax);   
101    }
102    
103    if (YRange && !XRange){
104       histo1->GetYaxis()->SetRangeUser(YMin, YMax);
105    }
106    
107    histo1->SetTitle(Title.Data());
108    
109    if(XTitle.CompareTo("") != 0){
110       histo1->SetXTitle(XTitle.Data());
111    }
112    if(YTitle.CompareTo("") != 0){
113       histo1->SetYTitle(YTitle.Data());
114    }
115    histo1->GetYaxis()->SetLabelSize(0.03);
116    histo1->GetYaxis()->SetTitleSize(0.035);  
117    histo1->GetYaxis()->SetDecimals();
118    histo1->GetYaxis()->SetTitleOffset(1.8);
119    histo1->GetXaxis()->SetTitleSize(0.035);
120    histo1->GetXaxis()->SetLabelSize(0.03);   
121    histo1->SetLineColor(kBlue+2);
122    histo1->SetMarkerColor(kBlue+2);
123    histo1->SetMarkerStyle(kFullCircle);
124    histo1->SetMarkerSize(1.5);
125    histo1->DrawCopy("e,p");
126 }
127
128
129 void DrawLabelsEvents(Float_t startX, Float_t startY, Float_t textHeight, Float_t decrease,  TString collisionSystemDummy, TString textGeneratorDummy, TString textPeriodDummy){
130    
131    Float_t aliceStartY = startY - textHeight * 1.15;  
132    TLatex *pp7 = NULL;
133    if( collisionSystemDummy.CompareTo("PbPb @ #sqrt{s_{NN}} = 2.76 TeV") == 0){
134       pp7 = new TLatex((startX-2*decrease),(aliceStartY),collisionSystemDummy.Data()); // Bo: this was modified
135    } else {
136       pp7 = new TLatex((startX+2*decrease),(aliceStartY),collisionSystemDummy.Data()); // Bo: this was modified
137    }
138    pp7->SetNDC();
139    pp7->SetTextColor(1);
140    pp7->SetTextFont(62);   
141    pp7->SetTextSize(textHeight);
142    pp7->SetLineWidth(2);
143    pp7->Draw("same");
144    if (textGeneratorDummy.CompareTo("")!=0 && textPeriodDummy.CompareTo("")!=0){
145       TLatex *generator = new TLatex((startX+decrease),(aliceStartY-1*textHeight*1.15),Form("%s   %s",textGeneratorDummy.Data(),textPeriodDummy.Data())); // Bo: this was modified
146       generator->SetNDC();
147       generator->SetTextColor(1);
148       generator->SetTextFont(62);
149       generator->SetTextSize(textHeight);
150       generator->SetLineWidth(2);
151       generator->Draw("same");   
152    } else if (textGeneratorDummy.CompareTo("")!=0) {
153       TLatex *generator = new TLatex((startX+decrease),(aliceStartY-1*textHeight*1.15),Form("%s",textGeneratorDummy.Data())); // Bo: this was modified
154       generator->SetNDC();
155       generator->SetTextColor(1);
156       generator->SetTextFont(62);
157       generator->SetTextSize(textHeight);
158       generator->SetLineWidth(2);
159       generator->Draw("same");   
160    }
161 }
162
163 /*DrawAutoGammaHisto2D is a function for drawing a 2D-histogram of the gamma conversion group
164 * histo - histogramm which need to be drawn
165 * Title - histogram title
166 * XTitle - X- axis-title
167 * YTitle - Y-axis-title
168 * Input - Legend 
169 * YRange - if kTRUE will scale by YMin and YMay
170 * YMin  - Y minimum
171 * YMax - Y maximum
172 * XRange - if kTRUE will scale by XMin and XMax
173 * XMin - X minimum
174 * XMax - X maximum
175 */
176 void DrawAutoGammaHisto2D( TH2 *histo,  
177                   TString Title, TString XTitle, TString YTitle, TString Input,
178                   Bool_t YRange, Float_t YMin ,Float_t YMax, 
179                   Bool_t XRange, Float_t XMin, Float_t XMax,Float_t titleOffsetX=1.4, Float_t titleOffsetY=1.2) {
180    
181    
182    if (YRange && XRange){
183       histo->GetYaxis()->SetRangeUser(YMin, YMax); 
184       histo->GetXaxis()->SetRangeUser(XMin, XMax); 
185    }
186    if ( !YRange && XRange){
187       histo->GetXaxis()->SetRangeUser(XMin, XMax); 
188    }
189    
190    if (YRange && !XRange){
191       histo->GetYaxis()->SetRangeUser(YMin, YMax);
192    }
193    
194 //    if(Title.CompareTo("") != 0){
195       histo->SetTitle(Title.Data());
196 //    }
197    if(XTitle.CompareTo("") != 0){
198       histo->SetXTitle(XTitle.Data());
199    }
200    if(YTitle.CompareTo("") != 0){
201       histo->SetYTitle(YTitle.Data());
202    }
203    histo->GetYaxis()->SetTitleSize(0.043);   
204    histo->GetYaxis()->SetLabelSize(0.035);
205    histo->GetXaxis()->SetLabelSize(0.035);
206    histo->GetYaxis()->SetDecimals();
207    histo->GetYaxis()->SetTitleOffset(titleOffsetY);
208    histo->GetXaxis()->SetTitleOffset(titleOffsetX);
209    histo->GetXaxis()->SetTitleSize(0.043);   
210    histo->DrawCopy("colz");
211    if(Input.CompareTo("") != 0){
212       TLegend* leg2 = new TLegend(0.6,0.82,0.83,0.9);
213       leg2->SetTextSize(0.04);         
214       leg2->SetFillColor(0);
215       leg2->AddEntry(histo,(Input.Data()));
216       leg2->Draw("same");
217    }
218 }
219
220 void PlotStandard2D( TH2* histo2D, TString nameOutput, TString title, TString xTitle, TString yTitle, Bool_t kRangeY, Double_t startY, Double_t endY, Bool_t kRangeX, Double_t startX, Double_t endX, Int_t logX, Int_t logY, Int_t logZ, Float_t* floatLogo, Int_t canvasSizeX = 500, Int_t canvasSizeY = 500, TString generator ="" , TString period =""){
221    TCanvas * canvasStandard = new TCanvas("canvasStandard","",10,10,canvasSizeX,canvasSizeY);  // gives the page size      
222    canvasStandard->SetLogx(logX);
223    canvasStandard->SetLogy(logY);
224    canvasStandard->SetLogz(logZ);
225    canvasStandard->SetRightMargin(0.12);     
226    canvasStandard->SetLeftMargin(0.12);      
227    canvasStandard->SetBottomMargin(0.1);     
228    canvasStandard->SetTopMargin(0.04);       
229    canvasStandard->cd();
230    histo2D->SetTitle("");
231    DrawAutoGammaHisto2D(   histo2D,
232                            title.Data(), xTitle.Data(), yTitle.Data(),"",kRangeY, startY, endY, kRangeX, startX, endX);
233    histo2D->GetXaxis()->SetTitleOffset(1.05);
234 //    cout << histo2D->GetYaxis()->GetTitleOffset() << endl;
235    histo2D->GetYaxis()->SetTitleOffset(1.35);
236    if (logX==1){
237 //       cout << histo2D->GetXaxis()->GetLabelOffset() << endl;
238       histo2D->GetXaxis()->SetLabelOffset(0.);
239    }   
240       
241    histo2D->Draw("colz");
242    DrawLabelsEvents(floatLogo[0],floatLogo[1],floatLogo[2], 0.00, collisionSystem, generator, period);
243    
244    canvasStandard->Update();
245    canvasStandard->SaveAs(nameOutput.Data());
246    delete canvasStandard;
247 }
248
249 TString GetCentralityString(TString cutNumber){
250    TString centralityCutNumberStart = cutNumber(1,1);
251    TString centralityCutNumberEnd = cutNumber(2,1);
252    TString ppCutNumber = cutNumber(0,1);
253    if (ppCutNumber.CompareTo("0") ==0){
254            return "pp"; 
255    } else if ( ppCutNumber.CompareTo("1") ==0 || ppCutNumber.CompareTo("2") ==0 || ppCutNumber.CompareTo("5") ==0 || ppCutNumber.CompareTo("8") ==0 || ppCutNumber.CompareTo("9") ==0){       
256       if (centralityCutNumberStart.CompareTo("0") == 0 && centralityCutNumberEnd.CompareTo("0") == 0  ){
257           return "0-100%"; 
258       } else {
259           return Form("%i-%i%s", centralityCutNumberStart.Atoi()*10,centralityCutNumberEnd.Atoi()*10,"%");
260       }
261    } else if (ppCutNumber.CompareTo("3") ==0 || ppCutNumber.CompareTo("6") ==0){
262       if (centralityCutNumberStart.CompareTo("0") == 0 && centralityCutNumberEnd.CompareTo("0") == 0  ){
263           return "0-45%"; 
264       } else {
265           return Form("%i-%i%s", centralityCutNumberStart.Atoi()*5,centralityCutNumberEnd.Atoi()*5,"%");
266       }
267    } else if (ppCutNumber.CompareTo("4") ==0 || ppCutNumber.CompareTo("7") ==0){
268       if (centralityCutNumberStart.CompareTo("0") == 0 && centralityCutNumberEnd.CompareTo("0") == 0  ){
269           return "45-95%"; 
270       } else {
271           return Form("%i-%i%s",45+centralityCutNumberStart.Atoi()*5,45+centralityCutNumberEnd.Atoi()*5,"%");
272       }
273    } else return ""; 
274 }  
275
276 TString ReturnFullCollisionsSystem(TString fEnergyFlagOpt){ 
277    if(fEnergyFlagOpt.CompareTo("7TeV") == 0){
278       return  "pp, #sqrt{s} = 7 TeV";
279    } else if( fEnergyFlagOpt.CompareTo("900GeV") == 0) {
280       return  "pp, #sqrt{s} = 900 GeV";
281    } else if( fEnergyFlagOpt.CompareTo("2.76TeV") == 0) {
282       return  "pp, #sqrt{s} = 2.76 TeV";
283    } else if( (fEnergyFlagOpt.CompareTo("PbPb_2.76TeV") == 0) || (fEnergyFlagOpt.CompareTo("HI") == 0) ) {
284       return "Pb-Pb, #sqrt{s_{NN}} = 2.76 TeV";
285    } else if( fEnergyFlagOpt.CompareTo("pPb_5.023TeV") == 0) {
286       return "p-Pb, #sqrt{s_{NN}} = 5.023 TeV";
287    } else {
288       cout << "No correct collision system specification, has been given" << endl;
289       return "";
290    }
291 }
292
293 /* StyleSettingsThesis will make some standard settings for gStyle 
294 */
295 void StyleSettingsThesis(){
296    gStyle->SetOptDate(0);   //show day and time
297    gStyle->SetOptStat(0);  //show statistic
298    gStyle->SetPalette(1,0);
299    gStyle->SetFrameBorderMode(0);
300    gStyle->SetFrameFillColor(0);
301    gStyle->SetTitleFillColor(0);
302    gStyle->SetTextSize(0.5);
303    gStyle->SetLabelSize(0.03,"xyz");
304    gStyle->SetLabelOffset(0.002,"xyz");
305    gStyle->SetTitleFontSize(0.04);
306    gStyle->SetTitleOffset(1,"y");
307    gStyle->SetTitleOffset(0.7,"x");    
308    gStyle->SetCanvasColor(0);
309    gStyle->SetPadTickX(1);
310    gStyle->SetPadTickY(1);
311    gStyle->SetLineWidth(0.01);
312    
313    gStyle->SetPadTopMargin(0.03);
314    gStyle->SetPadBottomMargin(0.09);
315    gStyle->SetPadRightMargin(0.03);
316    gStyle->SetPadLeftMargin(0.13);
317    
318    
319    TGaxis::SetMaxDigits(5);
320    gErrorIgnoreLevel=kError;
321 }
322
323
324 void SetPlotStyle() {
325    const Int_t nRGBs = 5;
326    const Int_t nCont = 255;
327    
328    Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
329    Double_t red[nRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
330    Double_t green[nRGBs] = { 0.31, 0.81, 1.00, 0.20, 0.00 };
331    Double_t blue[nRGBs]  = { 0.51, 1., 0.12, 0.00, 0.00};
332
333    TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
334    gStyle->SetNumberContours(nCont);
335 }
336
337                
338 void ProduceFastQA(TString fileNameInput = "myOutput", TString cutSelection = "5080001022092970023220000000", TString suffix = "eps", TString optEnergy="", TString optMCGenerator="", TString optPeriod=""){   
339    
340    gROOT->Reset();   
341    gSystem->Load("libCore");
342    gSystem->Load("libTree");
343    gSystem->Load("libGeom");
344    gSystem->Load("libVMC");
345    gSystem->Load("libPhysics");
346    gSystem->Load("libSTEERBase");
347    gSystem->Load("libESD");
348    gSystem->Load("libAOD");
349    gSystem->Load("libANALYSIS");
350    gSystem->Load("libANALYSISalice");
351    gSystem->Load("libCORRFW");
352    gROOT->SetStyle("Plain");
353    
354    StyleSettingsThesis();   
355    SetPlotStyle();
356    
357    collisionSystem = ReturnFullCollisionsSystem(optEnergy);
358    if (collisionSystem.CompareTo("") == 0){
359       cout << "No correct collision system specification, has been given" << endl;
360       return;
361    }
362    TString centralityCutNumber = cutSelection(0,3);
363    TString centralityString = GetCentralityString(centralityCutNumber);
364    cout<< centralityCutNumber.Data() << "\t" << centralityString.Data() << endl;
365    if (centralityString.CompareTo("pp") !=0){
366       collisionSystem = Form("%s %s", centralityString.Data(), collisionSystem.Data());
367    }
368
369    if(optMCGenerator.CompareTo("") ==0){
370       textGenerator = "";
371    } else {
372       textGenerator = optMCGenerator;
373    }
374    
375    TFile*  fileInput = new TFile(fileNameInput.Data());
376    TDirectory* directoryQA = (TDirectory*)fileInput->Get(Form("GammaConvV1_QA_%s",cutSelection.Data())); 
377    TList* listQA = (TList*)directoryQA->Get(Form("GammaConv_V1QA_%s",cutSelection.Data()));
378    TList* listQAESD = (TList*)listQA->FindObject("ESD QA");
379    TH1F* histoVertexZ =             (TH1F*)listQAESD->FindObject("Vertex_Z");
380    histoVertexZ->Sumw2();
381    Double_t nEvt = histoVertexZ->GetEntries();
382    histoVertexZ->Scale(1./nEvt);
383    
384    TH1I* histoContrVertexZ =         (TH1I*)listQAESD->FindObject("ContrVertex_Z");
385    TH1D* histoDContrVertexZ = new TH1D("ContrVertex_Z","ContrVertex_Z",3000,0,3000);
386    histoDContrVertexZ->Sumw2();
387    for (Int_t i = 1; i < histoContrVertexZ->GetNbinsX(); i++){
388       histoDContrVertexZ->SetBinContent(i, histoContrVertexZ->GetBinContent(i)/nEvt);
389       histoDContrVertexZ->SetBinError(i, histoContrVertexZ->GetBinError(i)/nEvt);
390    }   
391    histoDContrVertexZ->Rebin(8);
392    
393    TH1I* histoGoodESDTracks = (TH1I*)listQAESD->FindObject("GoodESDTracks");
394    TH1D* histoDGoodESDTracks = new TH1D("GoodESDTracks","GoodESDTracks",3000,0,3000);
395    histoDGoodESDTracks->Sumw2();
396    for (Int_t i = 1; i < histoGoodESDTracks->GetNbinsX(); i++){
397       histoDGoodESDTracks->SetBinContent(i, histoGoodESDTracks->GetBinContent(i)/nEvt);
398       histoDGoodESDTracks->SetBinError(i, histoGoodESDTracks->GetBinError(i)/nEvt);
399    }   
400    histoDGoodESDTracks->Rebin(8);
401    
402    TH1I* histoV0Mult = (TH1I*)listQAESD->FindObject("V0 Multiplicity");
403    TH1D* histoDV0Mult = new TH1D("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
404    histoDV0Mult->Sumw2();
405    for (Int_t i = 1; i < histoV0Mult->GetNbinsX(); i++){
406       histoDV0Mult->SetBinContent(i, histoV0Mult->GetBinContent(i)/nEvt);
407       histoDV0Mult->SetBinError(i, histoV0Mult->GetBinError(i)/nEvt);
408    }   
409    histoDV0Mult->Rebin(10);
410    
411    
412    TH2F* histoITSClusterPhi = (TH2F*)listQAESD->FindObject("ITSClusterPhi");
413    histoITSClusterPhi->Sumw2();
414    histoITSClusterPhi->Scale(1./nEvt);
415    
416    TH1F* histoGammaPt = (TH1F*)listQAESD->FindObject("Gamma_Pt");
417    Double_t nGamma = histoGammaPt->GetEntries();
418    histoGammaPt->Sumw2();
419    histoGammaPt->Scale(1./nEvt);
420    
421    
422    TH1F* histoGammaPhi = (TH1F*)listQAESD->FindObject("Gamma_Phi");
423    histoGammaPhi->Sumw2();
424    histoGammaPhi->Scale(1./nEvt);
425    histoGammaPhi->Rebin(2);
426    
427    TH1F* histoGammaEta = (TH1F*)listQAESD->FindObject("Gamma_Eta");
428    histoGammaEta->Sumw2();
429    histoGammaEta->Scale(1./nEvt);
430    histoGammaEta->Rebin(2);
431    
432    TH1F* histoGammaChi2 = (TH1F*)listQAESD->FindObject("Gamma_Chi2perNDF");
433    histoGammaChi2->Sumw2();
434    histoGammaChi2->Scale(1./nEvt);
435    
436    TH1F* histoGammaPsiPair = (TH1F*)listQAESD->FindObject("Gamma_PsiPair");
437    histoGammaPsiPair->Sumw2();
438    histoGammaPsiPair->Scale(1./nEvt);
439    
440    TH1F* histoGammaCosPoint = (TH1F*)listQAESD->FindObject("Gamma_CosinePointingAngle");
441    histoGammaCosPoint->Sumw2();
442    histoGammaCosPoint->Scale(1./nEvt);
443    
444    TH1F* histoGammaInvMass = (TH1F*)listQAESD->FindObject("Gamma_InvMass");
445    histoGammaInvMass->Sumw2();
446    histoGammaInvMass->Scale(1./nEvt);
447    
448    TH2F* histoGammaArmenteros = (TH2F*)listQAESD->FindObject("Gamma_Armenteros");
449    histoGammaArmenteros->Sumw2();
450    histoGammaArmenteros->Scale(1./nEvt);
451    
452    TH2F* histoEPPt = (TH2F*)listQAESD->FindObject("Electron_Positron_Pt");
453    histoEPPt->Sumw2();
454    histoEPPt->Scale(1./nEvt);
455    
456    TH2F* histoEPEta = (TH2F*)listQAESD->FindObject("Electron_Positron_Eta");
457    histoEPEta->Sumw2();
458    histoEPEta->Scale(1./nEvt);
459    
460    TH2F* histoEPPhi = (TH2F*)listQAESD->FindObject("Electron_Positron_Phi");
461    histoEPPhi->Sumw2();
462    histoEPPhi->Scale(1./nEvt);
463    
464    TH1F* histoEFindableClusterTPC = (TH1F*)listQAESD->FindObject("Electron_findableClusterTPC");
465    histoEFindableClusterTPC->Sumw2();
466    histoEFindableClusterTPC->Scale(1./nEvt);
467    
468    TH1F* histoPFindableClusterTPC = (TH1F*)listQAESD->FindObject("Positron_findableClusterTPC");
469    histoPFindableClusterTPC->Sumw2();
470    histoPFindableClusterTPC->Scale(1./nEvt);
471    
472    TH2F* histoEdEdxPTPC = (TH2F*)listQAESD->FindObject("Electron_dEdx_P");
473    Double_t nElectronTPC = histoEdEdxPTPC->GetEntries();
474    histoEdEdxPTPC->Sumw2();
475    histoEdEdxPTPC->Scale(1./nEvt);
476    TH2F* histoPdEdxPTPC = (TH2F*)listQAESD->FindObject("Positron_dEdx_P");
477    Double_t nPositronTPC = histoPdEdxPTPC->GetEntries();
478    histoPdEdxPTPC->Sumw2();
479    histoPdEdxPTPC->Scale(1./nEvt);
480    TH2F* histoENSigmadEdxPTPC = (TH2F*)listQAESD->FindObject("Electron_NSigmadEdx_P");
481    histoENSigmadEdxPTPC->Sumw2();
482    histoENSigmadEdxPTPC->Scale(1./nEvt);
483    TH2F* histoPNSigmadEdxPTPC = (TH2F*)listQAESD->FindObject("Positron_NSigmadEdx_P");
484    histoPNSigmadEdxPTPC->Sumw2();
485    histoPNSigmadEdxPTPC->Scale(1./nEvt);
486    TH2F* histoENSigmaPiondEdxPTPC = (TH2F*)listQAESD->FindObject("Electron_NSigmaPiondEdx_P");
487    histoENSigmaPiondEdxPTPC->Sumw2();
488    histoENSigmaPiondEdxPTPC->Scale(1./nEvt);
489    TH2F* histoPNSigmaPiondEdxPTPC = (TH2F*)listQAESD->FindObject("Positron_NSigmaPiondEdx_P");
490    histoPNSigmaPiondEdxPTPC->Sumw2();
491    histoPNSigmaPiondEdxPTPC->Scale(1./nEvt);
492    
493    TH2F* histoETOFP = (TH2F*)listQAESD->FindObject("Electron_TOF_P");
494    Double_t nElectronTOF = histoETOFP->GetEntries();
495    histoETOFP->Sumw2();
496    histoETOFP->Scale(1./nEvt);
497    TH2F* histoPTOFP = (TH2F*)listQAESD->FindObject("Positron_TOF_P");
498    Double_t nPositronTOF = histoPTOFP->GetEntries();
499    histoPTOFP->Sumw2();
500    histoPTOFP->Scale(1./nEvt);
501    TH2F* histoENSigmaTOFP = (TH2F*)listQAESD->FindObject("Electron_NSigmaTOF_P");
502    histoENSigmaTOFP->Sumw2();
503    histoENSigmaTOFP->Scale(1./nEvt);
504    TH2F* histoPNSigmaTOFP = (TH2F*)listQAESD->FindObject("Positron_NSigmaTOF_P");
505    histoPNSigmaTOFP->Sumw2();
506    histoPNSigmaTOFP->Scale(1./nEvt);
507    
508    TH2F* histoEdEdxPITS = (TH2F*)listQAESD->FindObject("Electron_ITSdEdx_P");
509    Double_t nElectronITS = histoEdEdxPITS->GetEntries();
510    histoEdEdxPITS->Sumw2();
511    histoEdEdxPITS->Scale(1./nEvt);
512    TH2F* histoPdEdxPITS = (TH2F*)listQAESD->FindObject("Positron_ITSdEdx_P");
513    Double_t nPositronITS = histoPdEdxPITS->GetEntries();
514    histoPdEdxPITS->Sumw2();
515    histoPdEdxPITS->Scale(1./nEvt);
516    TH2F* histoENSigmadEdxPITS = (TH2F*)listQAESD->FindObject("Electron_NSigmaITS_P");
517    histoENSigmadEdxPITS->Sumw2();
518    histoENSigmadEdxPITS->Scale(1./nEvt);
519    TH2F* histoPNSigmadEdxPITS = (TH2F*)listQAESD->FindObject("Positron_NSigmaITS_P");
520    histoPNSigmadEdxPITS->Sumw2();
521    histoPNSigmadEdxPITS->Scale(1./nEvt);
522    
523    
524    TCanvas * canvasEventProp = new TCanvas("canvasEventProp","",0,0,1000,1000);  // gives the page size
525    TPad* padEventProp = new TPad("padEventProp","",0.0,0.0,1,1,0);   // gives the size of the histo areas 
526    padEventProp->SetFillColor(0);
527    padEventProp->GetFrame()->SetFillColor(0);
528    padEventProp->SetBorderMode(0);
529    
530    padEventProp->Divide(2,2);
531    padEventProp->Draw();
532    padEventProp->cd(1);
533    
534    DrawAutoGammaHisto( histoVertexZ,
535                        "", "Z_{vtx} (cm)","dZ/dN_{evt}",
536                        kTRUE, 1.2, 0.,
537                        kFALSE, -10,10,
538                        kFALSE, -10,10);
539    
540    
541    TLatex *labelDataSet = NULL;
542    if (optPeriod.CompareTo("") ){
543       labelDataSet = new TLatex(0.18,0.9,Form("%s",optPeriod.Data()));
544       SetStyleTLatex( labelDataSet, 0.05,4);
545       labelDataSet->Draw();
546    }
547    padEventProp->cd(2);
548    padEventProp->cd(2)->SetLogy(1);
549    
550    DrawAutoGammaHisto( histoDContrVertexZ,
551                        "", "# Contr to prim Vtx","norm counts",
552                        kTRUE, 2., 0.5/nEvt,
553                        kFALSE, -10,10,
554                        kFALSE, -10,10);
555     
556    padEventProp->cd(3);
557    padEventProp->cd(3)->SetLogy(1);
558    
559    DrawAutoGammaHisto( histoDGoodESDTracks,
560                        "", "# Good ESD tracks","norm counts",
561                        kTRUE, 2., 0.5/nEvt,
562                        kFALSE, -10,10,
563                        kFALSE, -10,10);
564    
565    padEventProp->cd(4);
566    padEventProp->cd(4)->SetLogy(1);
567    
568    DrawAutoGammaHisto( histoDV0Mult,
569                        "", "V0 signal","norm counts",
570                        kTRUE, 2., 0.5/nEvt,
571                        kFALSE, -10,10,
572                        kFALSE, -10,10);
573    
574    canvasEventProp->Update();
575    canvasEventProp->SaveAs(Form("EventCharacteristics.%s",suffix.Data()));
576
577    TCanvas * canvasdEdxTPC = new TCanvas("canvasdEdxTPC","",0,0,1000,1500);  // gives the page size
578    TPad* paddEdxTPC = new TPad("paddEdxTPC","",0.0,0.0,1,1,0);   // gives the size of the histo areas 
579    paddEdxTPC->SetFillColor(0);
580    paddEdxTPC->GetFrame()->SetFillColor(0);
581    paddEdxTPC->SetBorderMode(0);
582    
583    paddEdxTPC->Divide(2,3);
584    paddEdxTPC->Draw();
585    paddEdxTPC->cd(1);
586    paddEdxTPC->cd(1)->SetLogx(1);
587    paddEdxTPC->cd(1)->SetLogz(1);
588    paddEdxTPC->cd(1)->SetTopMargin(0.01);
589    paddEdxTPC->cd(1)->SetRightMargin(0.12);
590    Double_t maximumEPTPC = 1.2*histoEdEdxPTPC->GetMaximum();
591    histoEdEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
592    histoEdEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
593    DrawAutoGammaHisto2D( histoEdEdxPTPC,  
594                   "", "#it{p}_{e^{-}} (GeV/c)", "dE_{e^{-}-cand} /dx",  "",
595                   kTRUE, 30., 180., 
596                   kTRUE, 0.01, 20.,0.95);
597    
598    TLatex *labelElectronTPC = new TLatex(0.5,0.9,"Electrons TPC");
599    SetStyleTLatex( labelElectronTPC, 0.05,4);
600    labelElectronTPC->Draw();
601
602    if (labelDataSet) labelDataSet->Draw();
603    
604    
605    paddEdxTPC->cd(2);
606    paddEdxTPC->cd(2)->SetLogx(1);
607    paddEdxTPC->cd(2)->SetLogz(1);
608    paddEdxTPC->cd(2)->SetTopMargin(0.01);
609    paddEdxTPC->cd(2)->SetRightMargin(0.12);
610    histoPdEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
611    histoPdEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
612    DrawAutoGammaHisto2D( histoPdEdxPTPC,  
613                   "", "#it{p}_{e^{+}} (GeV/c)", "dE_{e^{+}-cand} /dx",  "",
614                   kTRUE, 30., 180., 
615                   kTRUE, 0.01, 20.,0.95);
616    
617    TLatex *labelPositronTPC = new TLatex(0.5,0.9,"Positrons TPC");
618    SetStyleTLatex( labelPositronTPC, 0.05,4);
619    labelPositronTPC->Draw();
620
621    paddEdxTPC->cd(3);
622    paddEdxTPC->cd(3)->SetLogx(1);
623    paddEdxTPC->cd(3)->SetLogz(1);
624    paddEdxTPC->cd(3)->SetTopMargin(0.01);
625    paddEdxTPC->cd(3)->SetRightMargin(0.12);
626    histoENSigmadEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
627    histoENSigmadEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
628    DrawAutoGammaHisto2D( histoENSigmadEdxPTPC,  
629                   "", "#it{p}_{e^{-}} (GeV/c)", "n #sigma_{e^{-}} dE/dx",  "",
630                   kTRUE, -10., 10., 
631                   kTRUE, 0.01, 20.,0.95);
632  
633    paddEdxTPC->cd(4);
634    paddEdxTPC->cd(4)->SetLogx(1);
635    paddEdxTPC->cd(4)->SetLogz(1);
636    paddEdxTPC->cd(4)->SetTopMargin(0.01);
637    paddEdxTPC->cd(4)->SetRightMargin(0.12);
638    histoPNSigmadEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
639    histoPNSigmadEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
640    DrawAutoGammaHisto2D( histoPNSigmadEdxPTPC,  
641                   "", "#it{p}_{e^{+}} (GeV/c)", "n #sigma_{e^{+}} dE/dx",  "",
642                   kTRUE, -10., 10., 
643                   kTRUE, 0.01, 20.,0.95);
644  
645    paddEdxTPC->cd(5);
646    paddEdxTPC->cd(5)->SetLogx(1);
647    paddEdxTPC->cd(5)->SetLogz(1);
648    paddEdxTPC->cd(5)->SetTopMargin(0.01);
649    paddEdxTPC->cd(5)->SetRightMargin(0.12);
650    histoENSigmaPiondEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
651    histoENSigmaPiondEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
652    DrawAutoGammaHisto2D( histoENSigmaPiondEdxPTPC,  
653                   "", "#it{p}_{e^{-}} (GeV/c)", "n #sigma_{#pi^{-}} dE/dx",  "",
654                   kTRUE, -10., 10., 
655                   kTRUE, 0.01, 20.,0.95);
656  
657    paddEdxTPC->cd(6);
658    paddEdxTPC->cd(6)->SetLogx(1);
659    paddEdxTPC->cd(6)->SetLogz(1);
660    paddEdxTPC->cd(6)->SetTopMargin(0.01);
661    paddEdxTPC->cd(6)->SetRightMargin(0.12);
662    histoPNSigmaPiondEdxPTPC->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTPC);
663    histoPNSigmaPiondEdxPTPC->GetXaxis()->SetLabelOffset(-0.009);
664    DrawAutoGammaHisto2D( histoPNSigmaPiondEdxPTPC,  
665                   "", "#it{p}_{e^{+}} (GeV/c)", "n #sigma_{#pi^{+}} dE/dx",  "",
666                   kTRUE, -10., 10., 
667                   kTRUE, 0.01, 20.,0.95);
668    
669    canvasdEdxTPC->Update();
670    canvasdEdxTPC->SaveAs(Form("Electrons_dEdx_TPC.%s",suffix.Data()));
671
672    TCanvas * canvasTOF = new TCanvas("canvasTOF","",0,0,1000,1000);  // gives the page size
673    TPad* padTOF = new TPad("padTOF","",0.0,0.0,1,1,0);   // gives the size of the histo areas 
674    padTOF->SetFillColor(0);
675    padTOF->GetFrame()->SetFillColor(0);
676    padTOF->SetBorderMode(0);
677    
678    padTOF->Divide(2,2);
679    padTOF->Draw();
680    padTOF->cd(1);
681    padTOF->cd(1)->SetLogx(1);
682    padTOF->cd(1)->SetLogz(1);
683    padTOF->cd(1)->SetTopMargin(0.01);
684    padTOF->cd(1)->SetRightMargin(0.12);
685    Double_t maximumEPTOF = 1.2*histoETOFP->GetMaximum();
686    histoETOFP->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTOF);
687    histoETOFP->GetXaxis()->SetLabelOffset(-0.009);
688    DrawAutoGammaHisto2D( histoETOFP,  
689                   "", "#it{p}_{e^{-}} (GeV/c)", "t_{measured}-t_{expected} e^{-}",  "",
690                   kTRUE, -1000, 2000., 
691                   kTRUE, 0.01, 20.,0.95);
692    
693    TLatex *labelElectronTOF = new TLatex(0.5,0.9,"Electrons TOF");
694    SetStyleTLatex( labelElectronTOF, 0.05,4);
695    labelElectronTOF->Draw();
696    Double_t fracElecTOF = nElectronTOF/nElectronTPC*100;
697    TLatex *labelFracElectronTOF = new TLatex(0.5,0.845,Form("%4.2f %",fracElecTOF ));
698    SetStyleTLatex( labelFracElectronTOF, 0.05,4);
699    labelFracElectronTOF->Draw();
700    
701
702    if (labelDataSet) labelDataSet->Draw();
703    
704    
705    padTOF->cd(2);
706    padTOF->cd(2)->SetLogx(1);
707    padTOF->cd(2)->SetLogz(1);
708    padTOF->cd(2)->SetTopMargin(0.01);
709    padTOF->cd(2)->SetRightMargin(0.12);
710    histoPTOFP->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTOF);
711    histoPTOFP->GetXaxis()->SetLabelOffset(-0.009);
712    DrawAutoGammaHisto2D( histoPTOFP,  
713                   "", "#it{p}_{e^{+}} (GeV/c)", "t_{measured}-t_{expected} e^{+}",  "",
714                   kTRUE, -1000, 2000., 
715                   kTRUE, 0.01, 20.,0.95);
716    
717    TLatex *labelPositronTOF = new TLatex(0.5,0.9,"Positrons TOF");
718    SetStyleTLatex( labelPositronTOF, 0.05,4);
719    labelPositronTOF->Draw();
720    Double_t fracPosiTOF = nPositronTOF/nPositronTPC*100;
721    TLatex *labelFracPositronTOF = new TLatex(0.5,0.845,Form("%4.2f %",fracPosiTOF ));
722    SetStyleTLatex( labelFracPositronTOF, 0.05,4);
723    labelFracPositronTOF->Draw();
724    
725    padTOF->cd(3);
726    padTOF->cd(3)->SetLogx(1);
727    padTOF->cd(3)->SetLogz(1);
728    padTOF->cd(3)->SetTopMargin(0.01);
729    padTOF->cd(3)->SetRightMargin(0.12);
730    histoENSigmaTOFP->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTOF);
731    histoENSigmaTOFP->GetXaxis()->SetLabelOffset(-0.009);
732    DrawAutoGammaHisto2D( histoENSigmaTOFP,  
733                   "", "#it{p}_{e^{-}} (GeV/c)", "n #sigma_{e^{-}} TOF",  "",
734                   kTRUE, -10., 10., 
735                   kTRUE, 0.01, 20.,0.95);
736  
737    padTOF->cd(4);
738    padTOF->cd(4)->SetLogx(1);
739    padTOF->cd(4)->SetLogz(1);
740    padTOF->cd(4)->SetTopMargin(0.01);
741    padTOF->cd(4)->SetRightMargin(0.12);
742    histoPNSigmaTOFP->GetZaxis()->SetRangeUser(1/nEvt,maximumEPTOF);
743    histoPNSigmaTOFP->GetXaxis()->SetLabelOffset(-0.009);
744    DrawAutoGammaHisto2D( histoPNSigmaTOFP,  
745                   "", "#it{p}_{e^{+}} (GeV/c)", "n #sigma_{e^{+}} TOF",  "",
746                   kTRUE, -10., 10., 
747                   kTRUE, 0.01, 20.,0.95);
748  
749    canvasTOF->Update();
750    canvasTOF->SaveAs(Form("Electrons_TOF.%s",suffix.Data()));
751    
752    
753    TCanvas * canvasITS = new TCanvas("canvasITS","",0,0,1000,1000);  // gives the page size
754    TPad* padITS = new TPad("padITS","",0.0,0.0,1,1,0);   // gives the size of the histo areas 
755    padITS->SetFillColor(0);
756    padITS->GetFrame()->SetFillColor(0);
757    padITS->SetBorderMode(0);
758    
759    padITS->Divide(2,2);
760    padITS->Draw();
761    padITS->cd(1);
762    padITS->cd(1)->SetLogx(1);
763    padITS->cd(1)->SetLogz(1);
764    padITS->cd(1)->SetTopMargin(0.01);
765    padITS->cd(1)->SetRightMargin(0.12);
766    Double_t maximumEPITS = 1.2*histoEdEdxPITS->GetMaximum();
767    histoEdEdxPITS->GetZaxis()->SetRangeUser(1/nEvt,maximumEPITS);
768    histoEdEdxPITS->GetXaxis()->SetLabelOffset(-0.009);
769    DrawAutoGammaHisto2D( histoEdEdxPITS,  
770                   "", "#it{p}_{e^{-}} (GeV/c)", "dE_{e^{-}-cand} /dx ITS",  "",
771                   kTRUE, 0, 180., 
772                   kTRUE, 0.01, 20.,0.95);
773    
774    TLatex *labelElectronITS = new TLatex(0.5,0.9,"Electrons ITS");
775    SetStyleTLatex( labelElectronITS, 0.05,4);
776    labelElectronITS->Draw();
777    Double_t fracElecITS = nElectronITS/nElectronTPC*100;
778    TLatex *labelFracElectronITS = new TLatex(0.5,0.845,Form("%4.2f %",fracElecITS ));
779    SetStyleTLatex( labelFracElectronITS, 0.05,4);
780    labelFracElectronITS->Draw();
781    
782
783    if (labelDataSet) labelDataSet->Draw();
784    
785    
786    padITS->cd(2);
787    padITS->cd(2)->SetLogx(1);
788    padITS->cd(2)->SetLogz(1);
789    padITS->cd(2)->SetTopMargin(0.01);
790    padITS->cd(2)->SetRightMargin(0.12);
791    
792    histoPdEdxPITS->GetZaxis()->SetRangeUser(1/nEvt,maximumEPITS);
793    histoPdEdxPITS->GetXaxis()->SetLabelOffset(-0.009);
794    DrawAutoGammaHisto2D( histoPdEdxPITS,  
795                   "", "#it{p}_{e^{+}} (GeV/c)","dE_{e^{+}-cand} /dx ITS",  "",
796                   kTRUE, 0, 180., 
797                   kTRUE, 0.01, 20.,0.95);
798    
799    TLatex *labelPositronITS = new TLatex(0.5,0.9,"Positrons ITS");
800    SetStyleTLatex( labelPositronITS, 0.05,4);
801    labelPositronITS->Draw();
802    Double_t fracPosiITS = nPositronITS/nPositronTPC*100;
803    TLatex *labelFracPositronITS = new TLatex(0.5,0.845,Form("%4.2f %",fracPosiITS ));
804    SetStyleTLatex( labelFracPositronITS, 0.05,4);
805    labelFracPositronITS->Draw();
806    
807    padITS->cd(3);
808    padITS->cd(3)->SetLogx(1);
809    padITS->cd(3)->SetLogz(1);
810    padITS->cd(3)->SetTopMargin(0.01);
811    padITS->cd(3)->SetRightMargin(0.12);
812    histoENSigmadEdxPITS->GetZaxis()->SetRangeUser(1/nEvt,maximumEPITS);
813    histoENSigmadEdxPITS->GetXaxis()->SetLabelOffset(-0.009);
814    DrawAutoGammaHisto2D( histoENSigmadEdxPITS,  
815                   "", "#it{p}_{e^{-}} (GeV/c)", "n #sigma_{e^{-}} ITS",  "",
816                   kTRUE, -10., 10., 
817                   kTRUE, 0.01, 20.,0.95);
818  
819    padITS->cd(4);
820    padITS->cd(4)->SetLogx(1);
821    padITS->cd(4)->SetLogz(1);
822    padITS->cd(4)->SetTopMargin(0.01);
823    padITS->cd(4)->SetRightMargin(0.12);
824    histoPNSigmadEdxPITS->GetZaxis()->SetRangeUser(1/nEvt,maximumEPITS);
825    histoPNSigmadEdxPITS->GetXaxis()->SetLabelOffset(-0.009);
826    DrawAutoGammaHisto2D( histoPNSigmadEdxPITS,  
827                   "", "#it{p}_{e^{+}} (GeV/c)", "n #sigma_{e^{+}} ITS",  "",
828                   kTRUE, -10., 10., 
829                   kTRUE, 0.01, 20.,0.95);
830  
831    canvasITS->Update();
832    canvasITS->SaveAs(Form("Electrons_ITS.%s",suffix.Data()));
833    
834    
835    
836    TCanvas * canvasPhoton = new TCanvas("canvasPhoton","",0,0,1000,1000);  // gives the page size
837    TPad* padPhoton = new TPad("padPhoton","",0.0,0.0,1,1,0);   // gives the size of the histo areas 
838    padPhoton->SetFillColor(0);
839    padPhoton->GetFrame()->SetFillColor(0);
840    padPhoton->SetBorderMode(0);
841    
842    padPhoton->Divide(3,3);
843    padPhoton->Draw();
844    padPhoton->cd(1);
845    padPhoton->cd(1)->SetLogy(1);
846    padPhoton->cd(1)->SetLogx(1);
847    padPhoton->cd(1)->SetTopMargin(0.01);
848    DrawAutoGammaHisto( histoGammaPt,
849                        "", "#it{p}_{#gamma,T} (GeV/c)","d#it{N}_{#gamma}/d#it{N}_{evt}",
850                        kTRUE, 4., 0.5/nEvt,
851                        kFALSE, -10,10,
852                        kTRUE, 0.1,30);
853    histoGammaPt->SetMarkerSize(0.5);
854    histoGammaPt->Draw("ep1");
855
856    TLatex *labelPhotons = new TLatex(0.75,0.9,"Photon");
857    SetStyleTLatex( labelPhotons, 0.05,4);
858    labelPhotons->Draw();
859    Double_t nGammaPerEvt = nGamma/nEvt;
860    TLatex *labelPhotonsPerEvent = new TLatex(0.18,0.18,Form("N_{#gamma}/N_{Evt} = %4.4f",nGammaPerEvt));
861    SetStyleTLatex( labelPhotonsPerEvent, 0.05,4);
862    labelPhotonsPerEvent->Draw();
863    
864    
865    if (labelDataSet) labelDataSet->Draw();
866    
867    padPhoton->cd(2);
868    padPhoton->cd(2)->SetLogy(1);
869    padPhoton->cd(2)->SetTopMargin(0.01);
870    
871    DrawAutoGammaHisto( histoGammaEta,
872                        "", "#eta_{#gamma}","d#it{N}_{#gamma}/d#it{N}_{evt}",
873                        kTRUE, 2., 0.5/nEvt,
874                        kFALSE, -10,10,
875                        kFALSE, 0.1,30);
876    histoGammaEta->SetMarkerSize(0.5);
877    histoGammaEta->Draw("ep1");
878
879    padPhoton->cd(3);
880    padPhoton->cd(3)->SetLogy(1);
881    padPhoton->cd(3)->SetTopMargin(0.01);
882
883    DrawAutoGammaHisto( histoGammaPhi,
884                        "", "#phi_{#gamma}","d#it{N}_{#gamma}/d#it{N}_{evt}",
885                        kTRUE, 2., 0.5/nEvt,
886                        kFALSE, -10,10,
887                        kFALSE, 0.1,30);
888    histoGammaPhi->SetMarkerSize(0.5);
889    histoGammaPhi->Draw("ep1");
890
891    padPhoton->cd(4);
892    padPhoton->cd(4)->SetLogy(1);
893    padPhoton->cd(4)->SetTopMargin(0.01);
894
895    DrawAutoGammaHisto( histoGammaInvMass,
896                        "", "M_{#gamma#gamma} (GeV/c^{2})","d#it{N}_{#gamma}/d#it{N}_{evt}",
897                        kTRUE, 2., 0.5/nEvt,
898                        kFALSE, -10,10,
899                        kTRUE, 0.,0.1);
900    histoGammaInvMass->SetMarkerSize(0.5);
901    histoGammaInvMass->Draw("ep1");
902    
903    padPhoton->cd(5);
904    padPhoton->cd(5)->SetLogy(1);
905    padPhoton->cd(5)->SetTopMargin(0.01);
906
907    DrawAutoGammaHisto( histoGammaChi2,
908                        "", "#chi^{2}/NDF","d#it{N}_{#gamma}/d#it{N}_{evt}",
909                        kTRUE, 2., 0.5/nEvt*1e1,
910                        kFALSE, -10,10,
911                        kFALSE, 0.,0.1);
912    histoGammaChi2->SetMarkerSize(0.5);
913    histoGammaChi2->Draw("ep1");
914    
915    padPhoton->cd(6);
916    padPhoton->cd(6)->SetLogy(1);
917    padPhoton->cd(6)->SetTopMargin(0.01);
918
919    DrawAutoGammaHisto( histoGammaPsiPair,
920                        "", "#psi_{Pair}","d#it{N}_{#gamma}/d#it{N}_{evt}",
921                        kTRUE, 2., 0.5/nEvt*1e2,
922                        kFALSE, -10,10,
923                        kTRUE, 0.,0.5);
924    histoGammaPsiPair->SetMarkerSize(0.5);
925    histoGammaPsiPair->Draw("ep1");
926    
927    padPhoton->cd(7);
928    padPhoton->cd(7)->SetLogy(1);
929    padPhoton->cd(7)->SetTopMargin(0.01);
930
931    DrawAutoGammaHisto( histoGammaCosPoint,
932                        "", "cos(#theta_{Point})","d#it{N}_{#gamma}/d#it{N}_{evt}",
933                        kTRUE, 2., 0.5/nEvt,
934                        kFALSE, -10,10,
935                        kFALSE, 0.,0.5);
936    histoGammaCosPoint->SetMarkerSize(0.5);
937    histoGammaCosPoint->Draw("ep1");
938  
939    padPhoton->cd(8);
940    padPhoton->cd(8)->SetLogz(1);
941    padPhoton->cd(8)->SetTopMargin(0.01);
942    padPhoton->cd(8)->SetRightMargin(0.12);
943    Double_t maximumPhotons = 1.2*histoGammaArmenteros->GetMaximum();
944    histoGammaArmenteros->GetZaxis()->SetRangeUser(1/nEvt,maximumPhotons);
945    DrawAutoGammaHisto2D( histoGammaArmenteros,  
946                   "", "#alpha = (p^{+}_{L}-p^{-}_{L})/(p^{+}_{L}+p^{-}_{L})", "q_{T} (GeV/c)",  "",
947                   kFALSE, -10., 10., 
948                   kTRUE, -1., 1.,0.95);
949  
950    canvasPhoton->Update();
951    canvasPhoton->SaveAs(Form("Photons.%s",suffix.Data()));
952    
953 }
954