1 #include <sPhenixStyle.h>
2 #include <sPhenixStyle.C>
19 TFile *fin =
new TFile(Form(
"../macro/condor/aggregation/gammaJet_pass%d.root",pass));
21 TTree *
T = (TTree*)fin ->
Get(
"T");
27 vector<float> *clusterEtIso = 0;
28 vector<float> *clusterchisq = 0;
29 vector<float> *photonPhi = 0;
30 vector<float> *photonEta = 0;
31 vector<float> *photonE = 0;
32 vector<float> *photonPt = 0;
44 int nEvents = T -> GetEntries();
46 std::cout <<
"Analyzing " << nEvents <<
" entries" << std::endl;
48 TH2F *isoEtE =
new TH2F(
"isoEtE",
"isoEtE",500,20,100,500,-10,10);
49 isoEtE ->
SetTitle(
";E [GeV]; E_T [GeV]");
50 TH2F *isoEtMatchFrac =
new TH2F(
"isoEtMatchFrac",
"isoEtMatchFrac",500,-50,50,100,0,1);
51 isoEtMatchFrac ->
SetTitle(
"E_T [GeV]; Purity");
54 float eBins[] = {25,30,35,40,45,50,55,60};
55 int nBins =
sizeof(
eBins)/
sizeof(eBins[0]);
56 float fitStart = -60;
float fitEnd = 60;
62 for(
int j = 0;
j < clusterEtIso ->
size();
j++)
64 isoEtE ->
Fill(clusterE ->
at(
j), clusterEtIso ->
at(
j));
69 TCanvas *c1 =
new TCanvas();
70 isoEtE ->
Draw(
"colz");
72 TGraphErrors *
sigma =
new TGraphErrors();
73 TGraphErrors *
mu =
new TGraphErrors();
75 for(
int i = 0;
i < nBins-1;
i++)
77 TH1F *isoEtEProj = (TH1F*)isoEtE ->
ProjectionY(
"projection",isoEtE ->
GetXaxis() -> FindBin(eBins[
i] + 0.001), isoEtE ->
GetXaxis() -> FindBin(eBins[
i+1] - 0.001));
79 TF1 *func =
new TF1(
"func",
"gaus",fitStart, fitEnd);
81 isoEtEProj -> Fit(func,
"Q0",
"",fitStart,fitEnd);
82 TCanvas *cTemp =
new TCanvas();
92 TCanvas *
c2 =
new TCanvas();
93 sigma ->
SetTitle(
";Cluster E [GeV]; Iso E_{T} #sigma [GeV]");
95 TF1 *sigmaFit =
new TF1(
"sigmaFit",
"pol1",eBins[0],eBins[nBins-1]);
97 sigma -> Fit(sigmaFit,
"RQ",
"");
99 TCanvas *c3 =
new TCanvas();
100 mu ->
SetTitle(
";Cluster E [GeV];Iso E_{T} #mu [GeV]");
103 TF1 *muFit =
new TF1(
"muFit",
"[0]*exp([1]*pow(x,[2]) + [3]) + [4]",(eBins[0] + eBins[1])/2,(eBins[nBins-2]+eBins[nBins-1])/2);
108 mu -> Fit(muFit,
"RQ",
"");
111 float sigmas[] = {0.5, 1 , 1.5, 2, 2.5, 3};
112 const int nSigmas =
sizeof(sigmas)/
sizeof(sigmas[0]);
113 int colors[] = {1,2,4,kGreen+2, kViolet,kCyan,kOrange+2,kMagenta+2,kAzure-2};
115 TGraphErrors *gPurity[nSigmas];
116 TGraphErrors *gEfficiency[nSigmas];
118 TCanvas *c4 =
new TCanvas();
119 TCanvas *c5 =
new TCanvas();
120 TH1F *hdrMin =
new TH1F(
"drMin",
"drMin",100,0,0.6);
123 TH1F *hEResp =
new TH1F(
"eResp",
"eResp",200,0,2);
125 TLegend *
leg =
new TLegend(0.5,0.5,0.9,0.9);
129 for(
int s = 0;
s < nSigmas;
s++)
131 gPurity[
s] =
new TGraphErrors();
134 gEfficiency[
s] =
new TGraphErrors();
136 for(
int e = 0;
e < nBins;
e++)
146 if(photonE ->
size() == 0)
continue;
147 nDirPhotons += photonE ->
size();
148 int matchIDCluster = -1;
149 int matchIDPhoton = -1;
151 for(
int k = 0;
k < clusterE ->
size();
k++)
153 if(clusterE ->
at(
k) < eBins[
e] || clusterE ->
at(
k) > eBins[
e+1])
continue;
154 if(abs(clusterEtIso ->
at(
k)) > muFit -> Eval(clusterE ->
at(
k)) + sigmas[
s]*sigmaFit -> Eval(clusterE ->
at(
k)))
continue;
158 for(
int l = 0; l < photonE ->
size(); l++)
160 if((photonE ->
at(l) < eBins[
e] || photonE->
at(l) > eBins[
e+1]) && !checkOnce)
165 float dPhi = clusterPhi ->
at(
k) - photonPhi ->
at(l);
166 float dEta = clusterEta ->
at(
k) - photonEta ->
at(l);
168 while(dPhi > M_PI) dPhi -= 2*M_PI;
169 while(dPhi < -M_PI) dPhi += 2*M_PI;
171 float dr = sqrt(pow(dPhi,2) + pow(dEta,2));
181 hdrMin ->
Fill(drMin);
183 if(!matchIDCluster || !matchIDPhoton)
continue;
185 float response = clusterE ->
at(matchIDCluster)/photonE ->
at(matchIDPhoton);
186 hEResp ->
Fill(response);
188 if(drMin < dRMax && abs(1 - response) < respMin) nMatch++;
196 if(nIsoCluster != 0) purity = (float)nMatch/(
float)nIsoCluster;
197 float efficiency = (float)nMatch/(
float)nDirPhotons;
202 gPurity[
s] ->
SetPoint(
e, (eBins[
e] + eBins[
e+1])/2, purity);
203 gEfficiency[
s] ->
SetPoint(
e, (eBins[
e] + eBins[
e+1])/2, efficiency);
207 leg ->
AddEntry(gPurity[s], Form(
"E_{T} Iso #sigma < %g",sigmas[s]),
"p");
211 gPurity[
s] ->
Draw(
"ap");
212 gPurity[
s] ->
SetTitle(
";Cluster E [GeV]; Purity");
213 gPurity[
s] ->
GetYaxis() -> SetRangeUser(0,0.02);
216 gEfficiency[
s] ->
Draw(
"ap");
217 gEfficiency[
s] ->
SetTitle(
";Cluster E [GeV]; Efficiency");
218 gEfficiency[
s] ->
GetYaxis() -> SetRangeUser(0,0.02);
223 gPurity[
s] ->
Draw(
"samep");
225 gEfficiency[
s] ->
Draw(
"samep");
230 TCanvas *cDrMin =
new TCanvas();
231 hdrMin ->
Draw(
"epx0");
232 hdrMin ->
GetYaxis() -> SetRangeUser(1
e-1, 10*hdrMin -> GetMaximum());
233 TLine *ldrMax =
new TLine(dRMax, 1
e-1, dRMax, hdrMin -> GetMaximum());
236 ldrMax ->
Draw(
"same");
239 TCanvas *cResp =
new TCanvas();
240 hEResp ->
Draw(
"epx0");
241 TLine *lRespMin1 =
new TLine(1-respMin, 0, 1-respMin, hEResp -> GetMaximum());
244 lRespMin1 ->
Draw(
"same");
246 TLine *lRespMin2 =
new TLine(1+respMin, 0, 1+respMin, hEResp -> GetMaximum());
249 lRespMin2 ->
Draw(
"same");