1 |
#include <iostream>
|
2 |
#include <vector>
|
3 |
#include "TFile.h"
|
4 |
#include "TTree.h"
|
5 |
#include "TChain.h"
|
6 |
|
7 |
#include "TH1D.h"
|
8 |
#include "TH2D.h"
|
9 |
#include "TCanvas.h"
|
10 |
#include "TProfile.h"
|
11 |
#include "TNtuple.h"
|
12 |
#include "TLegend.h"
|
13 |
#include "TF1.h"
|
14 |
|
15 |
#include "TGraphAsymmErrors.h"
|
16 |
using namespace std;
|
17 |
|
18 |
void PartonBiasedCentrality(double pttrig = 100, int etabin = 2, int nBins = 40){
|
19 |
|
20 |
TFile* inf = new TFile("hydjet_b.root");
|
21 |
|
22 |
TNtuple * nt = dynamic_cast<TNtuple*>(inf->Get("ana/nt"));
|
23 |
|
24 |
TH1D* hB = new TH1D("hB",";b[fm];events",nBins,0,20);
|
25 |
|
26 |
TH1D* hJet = new TH1D(Form("hJet%d",(int)pttrig),";b[fm];events",nBins,0,20);
|
27 |
|
28 |
TH1D* hJetWeight = new TH1D(Form("hJetWeight%d",(int)pttrig),";b[fm];events",nBins,0,20);
|
29 |
TH1D* hJetTrigger = new TH1D(Form("hJetTrigger%d",(int)pttrig),";b[fm];events",nBins,0,20);
|
30 |
|
31 |
TH1D* hNhard = new TProfile("hNhard",";b[fm];N_{hard}",nBins,0,20);
|
32 |
|
33 |
TF1 *fJetWeight = new TF1(Form("fJetWeight%d",(int)pttrig),"gaus",0,20);
|
34 |
TF1 *fJetTrigger = new TF1(Form("fJetTrigger%d",(int)pttrig),"gaus",0,20);
|
35 |
|
36 |
hJet->SetLineColor(4);
|
37 |
hJetWeight->SetLineColor(4);
|
38 |
hJetTrigger->SetLineColor(4);
|
39 |
fJetWeight->SetLineColor(4);
|
40 |
fJetTrigger->SetLineColor(4);
|
41 |
|
42 |
nt->Draw("b>>hB","");
|
43 |
nt->Draw("nhard:b>>hNhard","","prof");
|
44 |
nt->Draw(Form("b>>%s",hJet->GetName()),Form("parton%d > %f",etabin,pttrig));
|
45 |
|
46 |
hJetWeight->Add(hJet);
|
47 |
hJetWeight->Divide(hB);
|
48 |
hJetTrigger->Add(hJetWeight);
|
49 |
|
50 |
int binmax = hJet->GetMaximumBin();
|
51 |
int binmax2 = hJetWeight->GetMaximumBin();
|
52 |
double jetWeightMax = hJetWeight->GetMaximum();
|
53 |
|
54 |
hJet->Scale(hB->GetBinContent(binmax)/hJet->GetBinContent(binmax));
|
55 |
hJetTrigger->Scale(hNhard->GetBinContent(binmax)/hJetTrigger->GetBinContent(binmax));
|
56 |
hJetWeight->Scale(1./jetWeightMax);
|
57 |
|
58 |
hJetWeight->Fit(fJetWeight);
|
59 |
hJetTrigger->Fit(fJetTrigger);
|
60 |
|
61 |
jetWeightMax = fJetWeight->GetMaximum();
|
62 |
hJetWeight->Scale(1./jetWeightMax);
|
63 |
hJetWeight->Fit(fJetWeight);
|
64 |
|
65 |
// cout<<"Max 1 : "<<binmax<<" Max 2 : "<<binmax2<<endl;
|
66 |
|
67 |
TLegend* leg1 = new TLegend(0.13,0.68,0.44,0.88,NULL,"brNDC");
|
68 |
leg1->SetFillColor(0);
|
69 |
leg1->SetTextSize(0.028);
|
70 |
leg1->SetBorderSize(0);
|
71 |
leg1->AddEntry(hB,Form("Min Bias b distribution"),"l");
|
72 |
leg1->AddEntry(hJet,Form("Jet Biased b distribution"),"l");
|
73 |
leg1->AddEntry(hB,Form("(Arbitrary Normalization)"),"");
|
74 |
|
75 |
TLegend* leg2 = new TLegend(0.46,0.68,0.77,0.88,NULL,"brNDC");
|
76 |
leg2->SetFillColor(0);
|
77 |
leg2->SetTextSize(0.028);
|
78 |
leg2->SetBorderSize(0);
|
79 |
leg2->AddEntry(hNhard,Form("N_{hard} vs b"),"l");
|
80 |
leg2->AddEntry(hJetTrigger,Form("p(b)^{Jet Bias} / p(b)^{Min Bias}"),"l");
|
81 |
leg2->AddEntry(hNhard,Form("(Arbitrary Normalization)"),"");
|
82 |
|
83 |
|
84 |
TCanvas* c1 = new TCanvas("c1","c1",400,400);
|
85 |
hB->Draw();
|
86 |
hJet->Draw("same");
|
87 |
leg1->Draw();
|
88 |
c1->Print(Form("impact_parameter_pt%d_nbins%d.gif",(int)pttrig,nBins));
|
89 |
|
90 |
TCanvas* c2 = new TCanvas("c2","c2",400,400);
|
91 |
hNhard->Draw("hist");
|
92 |
hJetTrigger->Draw("same");
|
93 |
leg2->Draw();
|
94 |
c2->Print(Form("jet_bias_nhard_pt%d_nbins%d.gif",(int)pttrig,nBins));
|
95 |
|
96 |
|
97 |
TCanvas* c3 = new TCanvas("c3","c3",400,400);
|
98 |
hJetWeight->Draw("");
|
99 |
c3->Print(Form("jet_bias_pt%d_nbins%d.gif",(int)pttrig,nBins));
|
100 |
|
101 |
|
102 |
// Wrong, it also scales with f(b)
|
103 |
// double eff = hJetWeight->Integral()/hJetWeight->GetNbinsX();
|
104 |
|
105 |
double eff = hJet->Integral()/hB->Integral();
|
106 |
|
107 |
// Report parameters
|
108 |
|
109 |
cout<<"__________________________________"<<endl;
|
110 |
|
111 |
cout<<"Using the Fit Function : "<<endl;
|
112 |
cout<<fJetWeight->GetExpFormula()<<endl;
|
113 |
cout<<"__________________________________"<<endl;
|
114 |
|
115 |
cout<<"The parameters of the fit are : "<<endl;
|
116 |
|
117 |
for(int ip = 0; ip < fJetWeight->GetNpar(); ++ip){
|
118 |
cout<<fJetWeight->GetParameter(ip)<<",";
|
119 |
}
|
120 |
|
121 |
cout<<endl;
|
122 |
cout<<"__________________________________"<<endl;
|
123 |
|
124 |
cout<<"Expected Filter Efficiency : "<<endl;
|
125 |
cout<<" "<<eff<<endl;
|
126 |
cout<<endl;
|
127 |
cout<<"__________________________________"<<endl;
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
}
|
133 |
|