-
Notifications
You must be signed in to change notification settings - Fork 1
/
gammaJetDifferentialxjg.C
171 lines (142 loc) · 4.8 KB
/
gammaJetDifferentialxjg.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#include "TFile.h"
#include "TTree.h"
#include "TNtuple.h"
#include "TH1D.h"
#include "TProfile.h"
#include "TGraphAsymmErrors.h"
#include "TGraphErrors.h"
#include "TCanvas.h"
#include "TLegend.h"
#include "TString.h"
#include "TLatex.h"
#include "stdio.h"
#include "TCut.h"
//#include "../HiForest_V3/hiForest.h"
//last forward run is 211256
const Double_t hfBins[] = {0, 20, 30, 1000}; //last entry is upper bound on last bin
const Int_t nhfBins = 3;
//int returnHFBin(double hf);
void gammaJetDifferentialxjg()
{
TH1::SetDefaultSumw2();
TFile *inFile = TFile::Open("gammaJets_inclusive_dphi7pi8_pPbData_v2.root");
TNtuple *inTuple = (TNtuple*)inFile->Get("gammaJets");
//book histos
TH1D *gammaJetEta[nhfBins];
TH1D *x_jg[nhfBins];
TH1D *hfEnergy[nhfBins];
Int_t numEvts[nhfBins];
Int_t numEvtsEtaPlus[nhfBins];
TCanvas *c[4];
c[0] = new TCanvas();
c[1] = new TCanvas();
TLegend *leg = new TLegend(0.65,0.65,0.9,0.9);
leg->SetFillColor(0);
for(Int_t i = 0; i < nhfBins; ++i)
{
TString s_gammaJetEta = "gammaJetEta";
s_gammaJetEta += i;
gammaJetEta[i] = new TH1D(s_gammaJetEta,";Avg #eta_{#gamma jet};Event Fraction",14,-3,3);
TString s_hfEnergy = "hfEnergy";
s_hfEnergy += i;
hfEnergy[i] = new TH1D(s_hfEnergy,"",1000,0,1000);
TString s_x_jg = "x_jg";
s_x_jg += i;
x_jg[i] = new TH1D(s_x_jg,";p_{T}^{jet}/p_{T}^{#gamma};Event Fraction",20,0,1.5);
TCut isolationCut = "(cc4 + cr4 + ct4PtCut20 < 1.0)";
//TCut etaCut = "(abs(gEta) > 1.479)";
//TCut showerShapeCut = "(sigmaIetaIeta < 0.035)";
TCut etaShowerCut = "((abs(gEta) < 1.479) && (sigmaIetaIeta < 0.01) || (abs(gEta) > 1.479) && (sigmaIetaIeta < 0.035))";
TCut ptCut = "(jPt > 30) && (gPt > 50)";
TString hfCut = Form("((HFplusEta4+HFminusEta4) > %f) && ((HFplusEta4+HFminusEta4) > %f)", hfBins[i], hfBins[i+1]);
//TCut cut = isolationCut && etaCut && showerShapeCut && ptCut && hfCut;
TCut cut = isolationCut && etaShowerCut && ptCut && hfCut;
//printf("cut: %s\n",(const char*)cut);
TString runFlip = "((run > 211257)*(-1) + (run < 211257))";
numEvts[i] = inTuple->Project(s_gammaJetEta,"avgEta*"+runFlip,cut);
numEvtsEtaPlus[i] = inTuple->GetEntries(
cut &&
"( avgEta*(run < 211257) >0 ) || ( avgEta*(run > 211257) <0 )"
);
inTuple->Project(s_hfEnergy,"(HFplusEta4+HFminusEta4)",cut);
inTuple->Project(s_x_jg,"jPt/gPt",cut);
gammaJetEta[i]->Scale(1./numEvts[i]);
gammaJetEta[i]->SetMarkerColor(i+1);
gammaJetEta[i]->SetLineColor(i+1);
x_jg[i]->Scale(1./numEvts[i]);
x_jg[i]->SetMarkerColor(i+1);
x_jg[i]->SetLineColor(i+1);
TString label;
label += hfBins[i];
label += " < E_{T}^{HF[|#eta|>4]} < ";
label += hfBins[i+1];
leg->AddEntry(gammaJetEta[i], label, "lp");
if(i==0)
{
//TLatex *lnorm = new TLatex(0.2,0.85, "Monte Carlo");
//lnorm->SetNDC(1);
//lnorm->SetTextSize(0.05);
gammaJetEta[i]->GetXaxis()->CenterTitle();
gammaJetEta[i]->GetYaxis()->CenterTitle();
gammaJetEta[i]->SetMaximum(gammaJetEta[i]->GetMaximum()*1.7);
x_jg[i]->GetXaxis()->CenterTitle();
x_jg[i]->GetYaxis()->CenterTitle();
x_jg[i]->SetMaximum(x_jg[i]->GetMaximum()*1.7);
c[0]->cd();
gammaJetEta[i]->Draw("");
//lnorm->Draw("same");
c[1]->cd();
x_jg[i]->Draw("");
//lnorm->Draw("same");
}
else
{
c[0]->cd();
gammaJetEta[i]->Draw("same");
c[1]->cd();
x_jg[i]->Draw("same");
}
c[0]->cd();
gammaJetEta[i]->Draw("same Lhist");
leg->Draw();
c[1]->cd();
x_jg[i]->Draw("same Lhist");
leg->Draw();
}
//c[0]->SaveAs("avgeta_gammajet_sumiso1_numevts_v2.gif");
//";E_{T}^{HF[|#eta|>4]};<#eta_{#gamma jet}>");
Double_t x[nhfBins];// = {10, 25, 40};
Double_t y[nhfBins];
Double_t ye[nhfBins];
Double_t y2[nhfBins];
Double_t y2e[nhfBins];
for(Int_t i = 0; i < nhfBins; i++)
{
x[i] = hfEnergy[i]->GetMean();
y[i] = gammaJetEta[i]->GetMean();
ye[i]= gammaJetEta[i]->GetMeanError();
y2[i] = x_jg[i]->GetMean();
y2e[i] = x_jg[i]->GetMeanError();
}
c[2] = new TCanvas();
TGraphErrors *means = new TGraphErrors(nhfBins,x,y,0,ye);
means->GetXaxis()->SetTitle("E_{T}^{HF[|#eta|>4]}");
means->GetXaxis()->CenterTitle();
means->GetYaxis()->SetTitle("<#eta_{#gamma jet}>");
means->GetYaxis()->CenterTitle();
//means->SetMinimum(-0.7);
means->SetMaximum(0);
means->Draw("AP");
c[3] = new TCanvas();
TGraphErrors *x_jg_means = new TGraphErrors(nhfBins,x,y2,0,y2e);
x_jg_means->GetXaxis()->SetTitle("E_{T}^{HF[|#eta|>4]}");
x_jg_means->GetXaxis()->CenterTitle();
x_jg_means->GetYaxis()->SetTitle("<x_{J #gamma}>");
x_jg_means->GetYaxis()->CenterTitle();
x_jg_means->Draw("AP");
}
int main()
{
gammaJetDifferentialxjg();
return 0;
}