Added new scripts to:
[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   for (Int_t i=0; i<6; i++) {
92     hRatios[i] = (TH1F*)fin->Get(Form("ratio_%d",i));
93                 
94     hRatios[i]->SetLineWidth(2);
95     hRatios[i]->SetLineColor(colors[i]);                                 
96     hRatios[i]->SetMarkerStyle(22);
97     hRatios[i]->SetMarkerSize(0.8);
98   }
99
100   TPad* p = DrawCanvasAndPad("syst_changeOfComposition",700,400);
101   p->SetRightMargin(0.2);
102   p->SetLeftMargin(0.13);
103
104   TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.97,1.03);
105   null->GetXaxis()->SetTitle("#eta");
106   null->GetYaxis()->SetTitle("Ratio pythia/modified composition");
107   null->Draw();
108
109   TLatex* text[6];
110
111   for(Int_t i=0; i<6; i++) {
112     hRatios[i]->Draw("same");
113     
114     TString str(hRatios[i]->GetTitle());
115     str.Remove(0,16);
116     text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0.9))-0.002,str.Data());
117     text[i]->SetTextColor(colors[i]);
118     text[i]->SetTextSize(0.053);
119     
120     text[i]->Draw();
121   }
122
123
124 }
125
126 TPad* DrawCanvasAndPad(const Char_t* name, Int_t sizeX=600, Int_t sizeY=500) {
127
128   gStyle->SetOptStat(0);
129   gStyle->SetOptTitle(0);
130   gStyle->SetOptFit(0);
131
132   gStyle->SetTextSize(0.04);
133   gStyle->SetTitleSize(0.05,"xyz");
134   //gStyle->SetTitleFont(133, "xyz");
135   //gStyle->SetLabelFont(133, "xyz");
136   //gStyle->SetLabelSize(17, "xyz");
137   gStyle->SetLabelOffset(0.01, "xyz");
138
139   gStyle->SetTitleOffset(1.1, "y");
140   gStyle->SetTitleOffset(1.1, "x");
141   gStyle->SetEndErrorSize(0.0);
142
143   //##############################################
144
145   //making canvas and pads
146   TCanvas *c = new TCanvas(name,name,sizeX,sizeY);
147
148   TPad* p1 = new TPad("pad1","", 0, 0.0, 1.0, 1.0, 0, 0, 0);
149
150   p1->SetBottomMargin(0.15);
151   p1->SetTopMargin(0.03);
152   p1->SetLeftMargin(0.15);
153   p1->SetRightMargin(0.03);
154   
155   p1->SetGridx();
156   p1->SetGridy();
157
158   p1->Draw();
159   p1->cd();
160
161   return p1;
162 }