30 if (
argc > 1 &&
string(
argv[1]) ==
"--help") {
31 cout <<
"USAGE: JetResolution_t --era <era> --alg <alg> --nevts <n> --gaussian" << endl;
35 string era(
"Spring10");
36 string alg(
"AK5Calo");
37 unsigned nevts(10000);
38 bool doGaussian(
false);
40 for (
int i = 1;
i <
argc;
i++) {
41 if (
string(
argv[
i]) ==
"--era") {
44 }
else if (
string(
argv[
i]) ==
"--alg") {
47 }
else if (
string(
argv[
i]) ==
"--nevts") {
52 }
else if (
string(
argv[
i]) ==
"--gaussian") {
55 cerr <<
"ERROR: unknown option '" <<
argv[
i] <<
"'" << endl;
61 cout <<
"alg: " << alg << endl;
63 cout <<
"gaussian: " << doGaussian << endl << endl;
72 cout << ptFileName << endl;
73 cout << etaFileName << endl;
74 cout << phiFileName << endl;
82 float pt = 200. * gRandom->Exp(0.1);
83 float eta = gRandom->Uniform(-5.0, 5.0);
86 cout <<
"pT=" <<
pt <<
" eta=" <<
eta <<
" phi=" <<
phi << endl;
88 TF1* fPtResol = ptResol.resolutionEtaPt(
eta,
pt);
89 TF1* fEtaResol = etaResol.resolutionEtaPt(
eta,
pt);
90 TF1* fPhiResol = phiResol.resolutionEtaPt(
eta,
pt);
100 TH1F* hRndPt =
new TH1F(
"RndPt",
";random number", 200, 0.0, 5.0);
101 TH1F* hGenPt =
new TH1F(
"GenPt",
";p_{T} [GeV]", 100, 0., 250.);
102 TH1F* hJetPt =
new TH1F(
"JetPt",
";p_{T} [GeV]", 100, 0., 250.);
104 TH1F* hRndEta =
new TH1F(
"RndEta",
";random number", 200, -5.0, 5.0);
105 TH1F* hGenEta =
new TH1F(
"GenEta",
";#eta", 51, -5., 5.);
106 TH1F* hJetEta =
new TH1F(
"JetEta",
";#eta", 51, -5., 5.);
108 TH1F* hRndPhi =
new TH1F(
"RndPhi",
";random number", 200, -3.15, 3.15);
109 TH1F* hGenPhi =
new TH1F(
"GenPhi",
";#varphi", 41, -3.15, 3.15);
110 TH1F* hJetPhi =
new TH1F(
"JetPhi",
";#varphi", 41, -3.15, 3.15);
112 for (
unsigned ievt = 0; ievt <
nevts; ievt++) {
113 if ((ievt + 1) % 1000 == 0)
114 cout << ievt + 1 <<
" events processed." << endl;
116 float genpt = 200. * gRandom->Exp(0.1);
119 float geneta = gRandom->Uniform(-5.0, 5.0);
122 fPtResol = ptResol.resolutionEtaPt(geneta, genpt);
123 fEtaResol = etaResol.resolutionEtaPt(geneta, genpt);
124 fPhiResol = phiResol.resolutionEtaPt(geneta, genpt);
126 float rndpt = fPtResol->GetRandom();
127 float rndeta = fEtaResol->GetRandom();
128 float rndphi = fPhiResol->GetRandom();
130 float jetpt = rndpt * genpt;
131 float jeteta = rndeta + geneta;
132 float jetphi = rndphi + genphi;
138 hRndEta->Fill(rndeta);
139 hGenEta->Fill(geneta);
140 hJetEta->Fill(jeteta);
142 hRndPhi->Fill(rndphi);
143 hGenPhi->Fill(genphi);
144 hJetPhi->Fill(jetphi);
149 TApplication* app =
new TApplication(
"JetResolution_t", &
argc,
argv);
150 gROOT->SetStyle(
"Plain");
153 TCanvas* cResolution =
new TCanvas(
"Resolution",
"Resolution", 0, 0, 1000, 400);
154 cResolution->Divide(3, 1);
159 TF1* fPtEta1 = ptResol.parameterEta(
"sigma", 0.25);
160 TF1* fPtEta2 = ptResol.parameterEta(
"sigma", 1.75);
161 TF1* fPtEta3 = ptResol.parameterEta(
"sigma", 2.75);
163 fPtEta1->SetLineWidth(1);
164 fPtEta2->SetLineWidth(1);
165 fPtEta3->SetLineWidth(1);
166 fPtEta1->SetNpx(500);
167 fPtEta2->SetNpx(500);
168 fPtEta3->SetNpx(500);
169 fPtEta1->SetLineColor(kRed);
170 fPtEta2->SetLineColor(kBlue);
171 fPtEta3->SetLineColor(kGreen);
172 fPtEta1->SetRange(5.0, 500.);
173 fPtEta2->SetRange(5.0, 500.);
174 fPtEta3->SetRange(5.0, 500.);
176 fPtEta2->Draw(
"SAME");
177 fPtEta3->Draw(
"SAME");
179 fPtEta1->SetTitle(
"p_{T} - Resolution");
180 fPtEta1->GetHistogram()->SetXTitle(
"p_{T} [GeV]");
181 fPtEta1->GetHistogram()->SetYTitle(
"#sigma(p_{T})/p_{T}");
182 fPtEta1->GetHistogram()->GetYaxis()->CenterTitle();
183 fPtEta1->GetHistogram()->GetYaxis()->SetTitleOffset(1.33);
185 TLegend* legPtRes =
new TLegend(0.6, 0.85, 0.85, 0.6);
186 legPtRes->SetFillColor(10);
187 legPtRes->AddEntry(fPtEta1,
"#eta=0.25",
"l");
188 legPtRes->AddEntry(fPtEta2,
"#eta=1.75",
"l");
189 legPtRes->AddEntry(fPtEta3,
"#eta=2.75",
"l");
195 TF1* fEtaEta1 = etaResol.parameterEta(
"sigma", 0.25);
196 TF1* fEtaEta2 = etaResol.parameterEta(
"sigma", 1.75);
197 TF1* fEtaEta3 = etaResol.parameterEta(
"sigma", 2.75);
199 fEtaEta1->SetLineWidth(1);
200 fEtaEta2->SetLineWidth(1);
201 fEtaEta3->SetLineWidth(1);
202 fEtaEta1->SetNpx(500);
203 fEtaEta2->SetNpx(500);
204 fEtaEta3->SetNpx(500);
205 fEtaEta1->SetLineColor(kRed);
206 fEtaEta2->SetLineColor(kBlue);
207 fEtaEta3->SetLineColor(kGreen);
208 fEtaEta1->SetRange(5.0, 500.);
209 fEtaEta2->SetRange(5.0, 500.);
210 fEtaEta3->SetRange(5.0, 500.);
212 fEtaEta2->Draw(
"SAME");
213 fEtaEta3->Draw(
"SAME");
215 fEtaEta1->SetTitle(
"#eta - Resolution");
216 fEtaEta1->GetHistogram()->SetXTitle(
"p_{T} [GeV]");
217 fEtaEta1->GetHistogram()->SetYTitle(
"#sigma(#eta)");
218 fEtaEta1->GetHistogram()->GetYaxis()->CenterTitle();
219 fEtaEta1->GetHistogram()->GetYaxis()->SetTitleOffset(1.33);
221 TLegend* legEtaRes =
new TLegend(0.6, 0.85, 0.85, 0.6);
222 legEtaRes->SetFillColor(10);
223 legEtaRes->AddEntry(fEtaEta1,
"#eta=0.25",
"l");
224 legEtaRes->AddEntry(fEtaEta2,
"#eta=1.75",
"l");
225 legEtaRes->AddEntry(fEtaEta3,
"#eta=2.75",
"l");
231 TF1* fPhiEta1 = phiResol.parameterEta(
"sigma", 0.25);
232 TF1* fPhiEta2 = phiResol.parameterEta(
"sigma", 1.75);
233 TF1* fPhiEta3 = phiResol.parameterEta(
"sigma", 2.75);
235 fPhiEta1->SetLineWidth(1);
236 fPhiEta2->SetLineWidth(1);
237 fPhiEta3->SetLineWidth(1);
238 fPhiEta1->SetNpx(500);
239 fPhiEta2->SetNpx(500);
240 fPhiEta3->SetNpx(500);
241 fPhiEta1->SetLineColor(kRed);
242 fPhiEta2->SetLineColor(kBlue);
243 fPhiEta3->SetLineColor(kGreen);
244 fPhiEta1->SetRange(5.0, 500.);
245 fPhiEta2->SetRange(5.0, 500.);
246 fPhiEta3->SetRange(5.0, 500.);
248 fPhiEta2->Draw(
"SAME");
249 fPhiEta3->Draw(
"SAME");
251 fPhiEta1->SetTitle(
"#varphi - Resolution");
252 fPhiEta1->GetHistogram()->SetXTitle(
"p_{T} [GeV]");
253 fPhiEta1->GetHistogram()->SetYTitle(
"#sigma(#varphi)");
254 fPhiEta1->GetHistogram()->GetYaxis()->CenterTitle();
255 fPhiEta1->GetHistogram()->GetYaxis()->SetTitleOffset(1.33);
257 TLegend* legPhiRes =
new TLegend(0.6, 0.85, 0.85, 0.6);
258 legPhiRes->SetFillColor(10);
259 legPhiRes->AddEntry(fPhiEta1,
"#eta=0.25",
"l");
260 legPhiRes->AddEntry(fPhiEta2,
"#eta=1.75",
"l");
261 legPhiRes->AddEntry(fPhiEta3,
"#eta=2.75",
"l");
265 TCanvas* cSmearing =
new TCanvas(
"Smearing",
"Smearing", 100, 100, 1000, 600);
266 cSmearing->Divide(3, 2);
283 hJetPt->Draw(
"SAME");
284 hJetPt->SetLineColor(kRed);
285 if (hGenPt->GetMaximum() < hJetPt->GetMaximum())
286 hGenPt->SetMaximum(1.1 * hJetPt->GetMaximum());
287 TLegend* legPt =
new TLegend(0.6, 0.8, 0.85, 0.65);
288 legPt->SetFillColor(10);
289 legPt->AddEntry(hGenPt,
"generated",
"l");
290 legPt->AddEntry(hJetPt,
"smeared",
"l");
295 hJetEta->Draw(
"SAME");
296 hJetEta->SetLineColor(kRed);
297 if (hGenEta->GetMaximum() < hJetEta->GetMaximum())
298 hGenEta->SetMaximum(1.1 * hJetEta->GetMaximum());
299 hGenEta->SetMinimum(0.0);
300 hGenEta->SetMaximum(1.5 * hGenEta->GetMaximum());
301 TLegend* legEta =
new TLegend(0.6, 0.8, 0.85, 0.65);
302 legEta->SetFillColor(10);
303 legEta->AddEntry(hGenEta,
"generated",
"l");
304 legEta->AddEntry(hJetEta,
"smeared",
"l");
309 hJetPhi->Draw(
"SAME");
310 hJetPhi->SetLineColor(kRed);
311 if (hGenPhi->GetMaximum() < hJetPhi->GetMaximum())
312 hGenPhi->SetMaximum(1.1 * hJetPhi->GetMaximum());
313 hGenPhi->SetMinimum(0.0);
314 hGenPhi->SetMaximum(1.5 * hGenPhi->GetMaximum());
315 TLegend* legPhi =
new TLegend(0.6, 0.8, 0.85, 0.65);
316 legPhi->SetFillColor(10);
317 legPhi->AddEntry(hGenPhi,
"generated",
"l");
318 legPhi->AddEntry(hJetPhi,
"smeared",
"l");
const std::string & fullPath() const