-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathHistosMC.C
78 lines (64 loc) · 2.72 KB
/
HistosMC.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
// Purpose: Create eta-dependent histograms for inclusive jets analysis
// Author: [email protected]
// Created: April 3, 2017
#include "HistosMC.h"
HistosMC::HistosMC(TDirectory *dir, string trigname) {
TDirectory *curdir = gDirectory;
bool enter = dir->cd();
assert(enter);
this->dir = dir;
// phase space
this->trigname = trigname;
// Once and for all (even if few too many with Sumw2)
TH1::SetDefaultSumw2(kTRUE);
const int na = 200;
vector<double> va(na+1);
for (unsigned int i = 0; i != na+1; ++i)
va[i] = -1. + 2.*i/na;
const int nb = 200;
vector<double> vb(nb+1);
for (unsigned int i = 0; i != nb+1; ++i)
vb[i] = 0+2.*i/nb;
// Loop over alpha entries of interest
for (auto alpha : alpharange) {
int major_alpha = 100*alpha;
// Start by coming up with a nice number identifier
int padding = TMath::Log10(major_alpha);
padding = 2-padding;
while (major_alpha%10==0)
major_alpha /= 10;
string number = std::to_string(major_alpha);
for (int i = 0; i < padding; ++i)
number = string("0")+number;
// Fill all histo types with a corresponding histogram
hdjasymm.push_back( new TH3D((string("hdjasymm_a")+number).c_str(),";p_{T,ave};#eta;Asymmetry",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],na,&va[0]) );
hdjasymmtp.push_back(new TH3D((string("hdjasymmtp_a")+number).c_str(),";p_{T,tag};#eta;Asymmetry",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],na,&va[0]) );
hdjresp_tag.push_back(new TH3D((string("hdjresp_tag_a")+number).c_str(),";p_{T,ave};#eta;R_{tag}",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],nb,&vb[0]) );
hdjresptp_tag.push_back(new TH3D((string("hdjresptp_tag_a")+number).c_str(),";p_{T,ave};#eta;R_{tag}",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],nb,&vb[0]) );
hdjresp_probe.push_back(new TH3D((string("hdjresp_probe_a")+number).c_str(),";p_{T,ave};#eta;R_{probe}",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],nb,&vb[0]) );
hdjresptp_probe.push_back(new TH3D((string("hdjresptp_probe_a")+number).c_str(),";p_{T,ave};#eta;R_{probe}",
jp::npts,&jp::ptrange[0],jp::nwetas,&jp::wetarange[0],nb,&vb[0]) );
}
// Weights:
for (unsigned i = 0; i < alpharange.size(); ++i) {
hdjasymm[i]->Sumw2();
hdjasymmtp[i]->Sumw2();
hdjresp_tag[i]->Sumw2();
hdjresptp_tag[i]->Sumw2();
hdjresp_probe[i]->Sumw2();
hdjresptp_probe[i]->Sumw2();
}
curdir->cd();
}
void HistosMC::Write() {
dir->cd();
dir->Write();
}
HistosMC::~HistosMC() {
Write();
};