ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/various_assignments/SimPa/AdditionalTools/MarcoAutomatedDrawing.C
Revision: 1.1
Committed: Fri Apr 13 14:05:23 2012 UTC (13 years, 1 month ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Marcos way of drawing the histos

File Contents

# Content
1 #include <iostream>
2 #include <vector>
3 #include <sys/stat.h>
4 #include <getopt.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include "../../../Plotting/Modules//GeneralToolBox.C"
8 #include "../../../Plotting/Modules//SampleClass.C"
9 #include "../../../Plotting/Modules//setTDRStyle.C"
10 //#include "../../../Plotting/Modules//Setup.C"
11 //#include "../../../Plotting/Modules//Poisson_Calculator.C"
12 //#include "../../../Plotting/Modules//ActiveSamples.C"
13 //#include "../../../Plotting/Modules//PeakFinder.C"
14 //#include "../../../Plotting/Modules//UpperLimitsWithShape.C"
15 //#include "../../../Plotting/Modules//Plotting_Functions.C"
16 //#include "../../../Plotting/Modules//LimitCalculation.C"
17 //#include "../../../Plotting/Modules//ResultModule.C"
18 //#include "../../../Plotting/Modules//CrossSectionReader.C"
19 //#include "../../../Plotting/Modules//Systematics.C"
20 //#include "../../../Plotting/Modules//SUSYScan.C"
21
22 #include <TCut.h>
23 #include <TROOT.h>
24 #include <TCanvas.h>
25 #include <TMath.h>
26 #include <TColor.h>
27 #include <TPaveText.h>
28 #include <TRandom.h>
29 #include <TH1.h>
30 #include <TH2.h>
31 #include <TF1.h>
32 #include <TSQLResult.h>
33
34
35 int plots_for_config(string config) {
36
37
38 gROOT->SetStyle("Plain");
39 bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2
40 setTDRStyle(do_fat_line);
41 gStyle->SetTextFont(42);
42
43
44 TFile *fall = new TFile(((string)"AllFixed"+config+".root").c_str());
45 TFile *fallbutz1 = new TFile(((string)"AllFixedButZ1"+config+".root").c_str());
46 TFile *fallbutz1z2 = new TFile(((string)"AllFixedButZ1Z2"+config+".root").c_str());
47 // TFile *fallbutz1z2chi1chi2 = new TFile(("AllFixedButZ1Z2Chi1Chi2"+config+".root").c_str());
48 TFile *fallbutz1z2chi1chi2 = new TFile(("AllFixedButZ1Z2Chi1Chi2.root"));
49 write_warning(__FUNCTION__,"There's no second AllFixedButZ1Z2Chi1Chi2 at the moment!!");
50 TFile *fnothing = new TFile(((string)"NothingFixed.root").c_str());
51
52 TTree *eall = (TTree *) fall->Get("events");
53 TTree *eallbutz1 = (TTree *) fallbutz1->Get("events");
54 TTree *eallbutz1z2 = (TTree *) fallbutz1z2->Get("events");
55 TTree *eallbutz1z2chi1chi2 = (TTree *) fallbutz1z2chi1chi2->Get("events");
56 TTree *enothing = (TTree *) fnothing->Get("events");
57
58
59 TH1F *hall = new TH1F("hall", "", 100, -500, 800);
60 TH1F *hallbutz1 = new TH1F("hallbutz1", "", 100, -500, 800);
61 TH1F *hallbutz1z2 = new TH1F("hallbutz1z2", "", 100, -500, 800);
62 TH1F *hallbutz1z2chi1chi2 = new TH1F("hallbutz1z2chi1chi2", "", 100, -500, 800);
63 TH1F *hnothing = new TH1F("hnothing", "", 100, -500, 800);
64
65 TH2F *hall2d = new TH2F("hall2d", "", 100, -500, 800, 50, 0, 3.2);
66 TH2F *hallbutz12d = new TH2F("hallbutz12d", "", 100, -500, 800, 50, 0, 3.2);
67 TH2F *hallbutz1z22d = new TH2F("hallbutz1z22d", "", 100, -500, 800, 50, 0, 3.2);
68 TH2F *hallbutz1z2chi1chi22d = new TH2F("hallbutz1z2chi1chi22d", "", 100, -500, 800, 50, 0, 3.2);
69 TH2F *hnothing2d = new TH2F("hnothing2d", "", 100, -500, 800, 50, 0, 3.2);
70
71
72 eall->Project("hall", "jzb", "", "GOF");
73 eallbutz1->Project("hallbutz1", "jzb", "", "GOF");
74 eallbutz1z2->Project("hallbutz1z2", "jzb", "", "GOF");
75 eallbutz1z2chi1chi2->Project("hallbutz1z2chi1chi2", "jzb", "", "GOF");
76 enothing->Project("hnothing", "jzb", "", "GOF");
77
78 hall->GetXaxis()->SetTitle("Generator JZB");
79 hallbutz1->GetXaxis()->SetTitle("Generator JZB");
80 hallbutz1z2->GetXaxis()->SetTitle("Generator JZB");
81 hallbutz1z2chi1chi2->GetXaxis()->SetTitle("Generator JZB");
82 hnothing->GetXaxis()->SetTitle("Generator JZB");
83
84 hall->GetYaxis()->SetTitle("events");
85 hallbutz1->GetYaxis()->SetTitle("events");
86 hallbutz1z2->GetYaxis()->SetTitle("events");
87 hallbutz1z2chi1chi2->GetYaxis()->SetTitle("events");
88 hnothing->GetYaxis()->SetTitle("events");
89
90 hall->GetXaxis()->CenterTitle();
91 hallbutz1->GetXaxis()->CenterTitle();
92 hallbutz1z2->GetXaxis()->CenterTitle();
93 hallbutz1z2chi1chi2->GetXaxis()->CenterTitle();
94 hnothing->GetXaxis()->CenterTitle();
95
96 hall->GetYaxis()->CenterTitle();
97 hallbutz1->GetYaxis()->CenterTitle();
98 hallbutz1z2->GetYaxis()->CenterTitle();
99 hallbutz1z2chi1chi2->GetYaxis()->CenterTitle();
100 hnothing->GetYaxis()->CenterTitle();
101
102 hall->GetYaxis()->SetTitleOffset(1.5);
103 hallbutz1->GetYaxis()->SetTitleOffset(1.5);
104 hallbutz1z2->GetYaxis()->SetTitleOffset(1.5);
105 hallbutz1z2chi1chi2->GetYaxis()->SetTitleOffset(1.5);
106 hnothing->GetYaxis()->SetTitleOffset(1.5);
107
108 Color_t color;
109 if(config=="") color=kRed;
110 else color=kBlue;
111
112 hall->SetLineColor(color);
113 hallbutz1->SetLineColor(color);
114 hallbutz1z2->SetLineColor(color);
115 hallbutz1z2chi1chi2->SetLineColor(color);
116 hnothing->SetLineColor(color);
117
118 eall->Project("hall2d", "acos(cos(phiZ1-phiChi1)):jzb", "", "GOF");
119 eallbutz1->Project("hallbutz12d", "acos(cos(phiZ1-phiChi1)):jzb", "", "GOF");
120 eallbutz1z2->Project("hallbutz1z22d", "acos(cos(phiZ2-phiChi2)):jzb", "", "GOF");
121 // eallbutz1z2chi1chi2->Project("hallbutz1z2chi1chi22d", "mercedes:jzb", "", "GOF");
122 // enothing->Project("hnothing2d", "abs(etaJets)-abs(etaZ1):jzb", "", "GOF");
123 eallbutz1z2chi1chi2->Project("hallbutz1z2chi1chi22d", "acos(cos(phiZ2-phiChi2)):jzb", "", "GOF");
124 enothing->Project("hnothing2d", "acos(cos(phiZ2-phiChi2)):jzb", "", "GOF");
125
126 hall2d->GetXaxis()->SetTitle("Generator JZB");
127 hallbutz12d->GetXaxis()->SetTitle("Generator JZB");
128 hallbutz1z22d->GetXaxis()->SetTitle("Generator JZB");
129 hallbutz1z2chi1chi22d->GetXaxis()->SetTitle("Generator JZB");
130 hnothing2d->GetXaxis()->SetTitle("Generator JZB");
131
132 hall2d->GetYaxis()->SetTitle("#Delta #phi(Z, #chi^{2}_{0})");
133 hallbutz12d->GetYaxis()->SetTitle("#Delta #phi(Z, #chi^{2}_{0})");
134 hallbutz1z22d->GetYaxis()->SetTitle("#Delta #phi(Z, #chi^{2}_{0})");
135 hallbutz1z2chi1chi22d->GetYaxis()->SetTitle("#Delta #phi(Z, #chi^{2}_{0})");
136 hnothing2d->GetYaxis()->SetTitle("#Delta #phi(Z, #chi^{2}_{0})");
137
138 hall2d->GetYaxis()->CenterTitle();
139 hallbutz12d->GetYaxis()->CenterTitle();
140 hallbutz1z22d->GetYaxis()->CenterTitle();
141 hallbutz1z2chi1chi22d->GetYaxis()->CenterTitle();
142 hnothing2d->GetYaxis()->CenterTitle();
143
144 hall2d->GetXaxis()->CenterTitle();
145 hallbutz12d->GetXaxis()->CenterTitle();
146 hallbutz1z22d->GetXaxis()->CenterTitle();
147 hallbutz1z2chi1chi22d->GetXaxis()->CenterTitle();
148 hnothing2d->GetXaxis()->CenterTitle();
149
150 string configu="NegativeConfiguration";
151 if(config=="2") configu="PositiveConfiguration";
152
153 TCanvas *mall = new TCanvas("mall","mall",500,1000);
154 mall->Divide(1,2);
155 mall->cd(1);
156 hall->Draw();
157 TText *t = write_title("JZB distribution (all angles fixed)");
158 t->Draw();
159 mall->cd(2);
160 mall->cd(2)->SetRightMargin(0.15);
161 hall2d->Draw("COLZ");
162 TText *t2 = write_title("Angle between Z and neutralino (all angles fixed)");
163 t2->Draw();
164 CompleteSave(mall,"study/AllFixed"+configu);
165 delete mall;
166
167 TCanvas *mallbutz1 = new TCanvas("mallbutz1","c1",500,1000);
168 mallbutz1->Divide(1,2);
169 mallbutz1->cd(1);
170 hallbutz1->Draw();
171 TText *t3 = write_title("JZB distribution (Z free)");
172 t3->Draw();
173 mallbutz1->cd(2);
174 mallbutz1->cd(2)->SetRightMargin(0.15);
175 hallbutz12d->Draw("COLZ");
176 TText *t4 = write_title("Angle between Z and neutralino (Z free)");
177 t4->Draw();
178 CompleteSave(mallbutz1,"study/JZB2DZ1"+configu);
179 delete mallbutz1;
180
181 TCanvas *mallbutz1z2 = new TCanvas("mallbutz1z2","c3",500,1000);
182 mallbutz1z2->Divide(1,2);
183 mallbutz1z2->cd(1);
184 hallbutz1z2->Draw();
185 TText *t5 = write_title("JZB distribution (Z's free)");
186 t5->Draw();
187 mallbutz1z2->cd(2);
188 mallbutz1z2->cd(2)->SetRightMargin(0.15);
189 hallbutz1z22d->Draw("COLZ");
190 TText *t6 = write_title("Angle between Z and neutralino (Z's free)");
191 t6->Draw();
192 CompleteSave(mallbutz1z2,"study/JZB2DZ1Z2"+configu);
193 delete mallbutz1z2;
194
195 TCanvas *mallbutz1z2chi1chi2 = new TCanvas("mallbutz1z2chi1chi2","c4",500,1000);
196 mallbutz1z2chi1chi2->Divide(1,2);
197 mallbutz1z2chi1chi2->cd(1);
198 hallbutz1z2chi1chi2->Draw();
199 TText *t7 = write_title("JZB distribution (free in 2D)");
200 t7->Draw();
201 mallbutz1z2chi1chi2->cd(2);
202 mallbutz1z2chi1chi2->cd(2)->SetRightMargin(0.15);
203 hallbutz1z2chi1chi22d->Draw("COLZ");
204 TText *t8 = write_title("Angle between Z and neutralino (free in 2D)");
205 t8->Draw();
206 CompleteSave(mallbutz1z2chi1chi2,"study/JZB2DComplete"+configu);
207 delete mallbutz1z2chi1chi2;
208
209 TCanvas *mnothing = new TCanvas("mnothing","c5",500,1000);
210 mnothing->Divide(1,2);
211 mnothing->cd(1);
212 hnothing->Draw();
213 TText *t9 = write_title("JZB distribution (no angles fixed)");
214 t9->Draw();
215 mnothing->cd(2);
216 mnothing->cd(2)->SetRightMargin(0.15);
217 hnothing2d->Draw("COLZ");
218 TText *t10 = write_title("Angle between Z and neutralino (no angles fixed)");
219 t10->Draw();
220 CompleteSave(mnothing,"study/JZB3DComplete"+configu);
221 delete mnothing;
222
223 return 0;
224 }
225
226 int main() {
227 do_png(1);
228 do_pdf(1);
229 char currentpath[1024];
230 char *path = getcwd(currentpath,1024);
231 PlottingSetup::basedirectory=string(currentpath)+"/";
232 plots_for_config("");
233 plots_for_config("2");
234 }