ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/various_assignments/SimPa/AdditionalTools/BuildJZB.C
Revision: 1.1
Committed: Tue Apr 10 14:38:44 2012 UTC (13 years ago) by pablom
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
SimPa implemented

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