added eta range
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / drawSystematicsNew.C
1 void DrawpiKpAndCombinedZOnly(Float_t upperPtLimit=0.99)
2 {
3   //gROOT->ProcessLine(".L drawPlots.C");
4   gSystem->Load("libPWG0base");
5
6   const char* fileNames[] = { "systematics.root", "systematics.root", "systematics.root", "correction_map.root" };
7   const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "dndeta_correction" };
8   const char* legendNames[] = { "#pi", "K", "p", "standard" };
9   Int_t folderCount = 3;
10
11
12
13   TH2F* h2DCorrections[4];
14   TH1F* h1DCorrections[4];
15   for (Int_t i=0; i<4; i++) {
16     TFile::Open(fileNames[i]);
17     AlidNdEtaCorrection* correctionTmp = new AlidNdEtaCorrection(folderNames[i],folderNames[i]);
18     correctionTmp->LoadHistograms();
19     
20     //    h2DCorrections[i] = correctionTmp->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get2DCorrectionHistogram("yz",-1,1);
21
22     h1DCorrections[i] = correctionTmp->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get1DCorrectionHistogram("z",-10,10,0.8,0.8);
23   }
24
25   TH2F* null = new TH2F("","",100,0.1,10,100,0.5,9.99);
26   null->SetXTitle("p_{T} (GeV/c)");
27   null->SetXTitle("Correction");
28
29   null->Draw();
30
31   //h1DCorrections[0]->SetMaximum(5);
32   //h1DCorrections[0]->Draw();
33   //  h2DCorrections[0]->Draw("colz");
34   for (Int_t i=1; i<4; i++) {
35     h1DCorrections[i]->Draw("same");
36   }
37   
38 }
39
40
41 void DrawEffectOfChangeInCrossSection() {
42   
43   //get the data
44   TFile* fin = TFile::Open("systematics_xsections.root");
45
46   const Char_t* changes[]  = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless"};
47   Int_t colors[] = {1,2,103,102,4,6,1};
48
49   TH1F* hRatios[7];
50   for(Int_t i=0; i<7; i++) {
51     hRatios[i] = (TH1F*)fin->Get(Form("ratio_vertexReco_triggerBias_%s",changes[i]));
52     hRatios[i]->SetLineWidth(2);
53     hRatios[i]->SetLineColor(colors[i]);                                 
54     hRatios[i]->SetMarkerStyle(22);
55     hRatios[i]->SetMarkerSize(0.8);
56   }
57
58   TPad* p = DrawCanvasAndPad("syst_changeInXsection",700,400);
59   p->SetRightMargin(0.2);
60   p->SetLeftMargin(0.13);
61
62   TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.93,1.06);
63   null->GetXaxis()->SetTitle("#eta");
64   null->GetYaxis()->SetTitle("Ratio pythia/modified cross-sections");
65   null->Draw();
66
67   TLatex* text[7];
68
69   for(Int_t i=1; i<7; i++) {
70     hRatios[i]->Draw("same");
71     
72     TString str(hRatios[i]->GetTitle());
73     str.Remove(0,str.First("DD"));
74     str.Remove(str.First(")"),1);
75     text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0.))-0.002,str.Data());
76     text[i]->SetTextColor(colors[i]);
77     text[i]->Draw();
78   }
79 }
80
81
82 void DrawEffectOfChangeInComposition() {
83   
84   //get the data
85   TFile* fin = TFile::Open("systematics_composition.root");
86
87   Int_t colors[] = {1,2,103,102,4,6,1};
88
89   TH1F* hRatios[6];
90
91   Float_t etaRange = 0.899;
92
93   for (Int_t i=0; i<6; i++) {
94     hRatios[i] = (TH1F*)fin->Get(Form("ratio_%d",i));
95
96     hRatios[i]->SetLineWidth(2);
97     hRatios[i]->SetLineColor(colors[i]);
98     hRatios[i]->SetMarkerStyle(22);
99     hRatios[i]->SetMarkerSize(0.8);
100
101     hRatios[i]->GetXaxis()->SetRangeUser(-etaRange, etaRange);
102   }
103
104   TPad* p = DrawCanvasAndPad("syst_changeOfComposition",700,400);
105   p->SetRightMargin(0.2);
106   p->SetLeftMargin(0.13);
107
108   TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.97,1.03);
109   null->GetXaxis()->SetTitle("#eta");
110   null->GetYaxis()->SetTitle("Ratio pythia/modified composition");
111   null->Draw();
112
113   TLatex* text[6];
114
115   for(Int_t i=0; i<6; i++) {
116     hRatios[i]->Draw("same");
117     
118     TString str(hRatios[i]->GetTitle());
119     str.Remove(0,16);
120     text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0))-0.002,str.Data());
121     text[i]->SetTextColor(colors[i]);
122     text[i]->SetTextSize(0.053);
123     
124     text[i]->Draw();
125   }
126
127
128 }
129
130 TPad* DrawCanvasAndPad(const Char_t* name, Int_t sizeX=600, Int_t sizeY=500) {
131
132   gStyle->SetOptStat(0);
133   gStyle->SetOptTitle(0);
134   gStyle->SetOptFit(0);
135
136   gStyle->SetTextSize(0.04);
137   gStyle->SetTitleSize(0.05,"xyz");
138   //gStyle->SetTitleFont(133, "xyz");
139   //gStyle->SetLabelFont(133, "xyz");
140   //gStyle->SetLabelSize(17, "xyz");
141   gStyle->SetLabelOffset(0.01, "xyz");
142
143   gStyle->SetTitleOffset(1.1, "y");
144   gStyle->SetTitleOffset(1.1, "x");
145   gStyle->SetEndErrorSize(0.0);
146
147   //##############################################
148
149   //making canvas and pads
150   TCanvas *c = new TCanvas(name,name,sizeX,sizeY);
151
152   TPad* p1 = new TPad("pad1","", 0, 0.0, 1.0, 1.0, 0, 0, 0);
153
154   p1->SetBottomMargin(0.15);
155   p1->SetTopMargin(0.03);
156   p1->SetLeftMargin(0.15);
157   p1->SetRightMargin(0.03);
158   
159   p1->SetGridx();
160   p1->SetGridy();
161
162   p1->Draw();
163   p1->cd();
164
165   return p1;
166 }