-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowPpGroom.cxx
143 lines (106 loc) · 4.16 KB
/
ShowPpGroom.cxx
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
{
gStyle->SetOptStat(0);
gStyle->SetHistLineWidth(2);
int MinRefmult = 269;
bool UseEmb = true;
TFile* f = new TFile("Results/Groom_pp.root","READ");
TTree* ResultTree = (TTree*) f->Get("ResultTree");
TString outname = f->GetName();
outname->ReplaceAll( ".root", ".Zg.root");
TFile * out= new TFile ( outname, "RECREATE");
TH1::SetDefaultSumw2(true);
TH2::SetDefaultSumw2(true);
TH1D* LeadPt = new TH1D("LeadPt","Leading jet p_{T}", 60, 0, 60);
TH1D* GroomLeadPt = new TH1D("GroomLeadPt","Groomed Leading jet p_{T}", 60, 0, 60);
int nzgBins=40;
TH1D* zgLead2030 = new TH1D("zgLead2030","Leading jet with 20<p_{T}<30", nzgBins, 0.05, 0.55);
TH1D* zgLead3040 = new TH1D("zgLead3040","Leading jet with 30<p_{T}<40", nzgBins, 0.05, 0.55);
TH1D* zgLead4060 = new TH1D("zgLead4060","Leading jet with 40<p_{T}<60", nzgBins, 0.05, 0.55);
TClonesArray* pJets = new TClonesArray( "TStarJetVectorJet" );
TClonesArray* pGroomedJets = new TClonesArray( "TStarJetVectorJet" );
double weight=1;
int njets=0;
double zg[1000];
double Embrefmult;
ResultTree->SetBranchAddress("Embrefmult", &Embrefmult );
if ( UseEmb ) {
ResultTree->SetBranchAddress("Embnjets", &njets);
ResultTree->SetBranchAddress("Embzg", zg);
ResultTree->SetBranchAddress("EmbJets", &pJets );
ResultTree->SetBranchAddress("EmbGroomedJets", &pGroomedJets );
} else {
ResultTree->SetBranchAddress("Jets", &pJets );
ResultTree->SetBranchAddress("njets", &njets);
ResultTree->SetBranchAddress("zg", zg);
ResultTree->SetBranchAddress("GroomedJets", &pGroomedJets );
}
Long64_t NEvents = ResultTree->GetEntries();
// NEvents = 10000;
TStarJetVectorJet* Jet;
TStarJetVectorJet* GroomedJet;
for ( int evi=0; evi<NEvents; ++evi){
if ( !(evi%10000) ) cout << "Working on " << evi << " / " << NEvents << endl;
ResultTree->GetEntry(evi);
//if ( UseEmb && Embrefmult<MinRefmult ) continue;
if ( pJets->GetEntries()<1 ) continue;
Jet = (TStarJetVectorJet*) pJets->At(0);
float pt = Jet->Pt();
GroomedJet = (TStarJetVectorJet*) pGroomedJets->At(0);
float gpt = GroomedJet->Pt();
LeadPt->Fill ( pt, weight );
GroomLeadPt->Fill ( gpt, weight );
if ( pt >= 20 && pt < 30 ){
zgLead2030->Fill ( zg[0], weight );
}
if ( pt >= 30 && pt < 40 ){
zgLead3040->Fill ( zg[0], weight );
}
if ( pt >= 40 && pt < 60 ){
zgLead4060->Fill ( zg[0], weight );
}
}
TLegend* leg;
// =========================== Draw spectra ===============================
new TCanvas;
leg = new TLegend( 0.55, 0.75, 0.89, 0.9, "pp HT" );
leg->SetBorderSize(0);
leg->SetLineWidth(10);
leg->SetFillStyle(0);
leg->SetMargin(0.1);
gPad->SetGridx(0); gPad->SetGridy(0);
gPad->SetLogy();
LeadPt->SetTitle(";p_{T} [GeV];arb.");
LeadPt->SetLineColor(kBlack);
LeadPt->Draw();
GroomLeadPt->SetLineColor(kGray+1);
GroomLeadPt->Draw("same");
leg->AddEntry( LeadPt->GetName(), "Leading Jet");
leg->AddEntry( GroomLeadPt->GetName(), "Groomed Leading Jet");
leg->Draw("same");
gPad->SaveAs("Plots/PpGroomSpectra.png");
// =========================== Draw original ===============================
new TCanvas;
gPad->SetGridx(0); gPad->SetGridy(0);
TLegend* leg = new TLegend( 0.6, 0.65, 0.89, 0.9, "pp HT, Leading jet" );
leg->SetBorderSize(0);
leg->SetLineWidth(10);
leg->SetFillStyle(0);
leg->SetMargin(0.1);
zgLead2030->Scale ( 1./ zgLead2030->Integral() / zgLead2030->GetXaxis()->GetBinWidth(1));
zgLead3040->Scale ( 1./ zgLead3040->Integral() / zgLead3040->GetXaxis()->GetBinWidth(1));
zgLead4060->Scale ( 1./ zgLead4060->Integral() / zgLead4060->GetXaxis()->GetBinWidth(1));
zgLead2030->SetTitle(";z_{g};arb.");
zgLead2030->SetAxisRange(0,10,"y");
zgLead2030->SetLineColor(kBlack);
zgLead2030->Draw();
leg->AddEntry( zgLead2030, "20<p_{T}<30");
zgLead3040->SetLineColor(kMagenta);
zgLead3040->Draw("same");
leg->AddEntry( zgLead3040, "30<p_{T}<40");
// zgLead4060->SetLineColor(kRed);
// zgLead4060->Draw("same");
// leg->AddEntry( zgLead4060, "40<p_{T}<60");
leg->Draw();
gPad->SaveAs("Plots/PpZg.png");
out->Write();
}