-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.h
180 lines (173 loc) · 4.19 KB
/
event.h
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
172
173
174
175
176
177
178
179
180
#include "utilities.h"
enum Choice_jetpt_var{ GEN=0, RECO, FRAG, FRAG_RES, REF};
class Jet{
private:
double pt;
double eta;
double phi;
double corr_pt;
double rescorr_pt;
double ref_pt;
public:
Jet(double pt, double eta, double phi, double corr_pt=0, double rescorr_pt=0, double ref_pt=0){
this->pt=pt;
this->eta=eta;
this->phi=phi;
this->corr_pt=corr_pt;
this->rescorr_pt=rescorr_pt;
this->ref_pt=ref_pt;
}
void set_corr_pt(double corr_pt){
this->corr_pt=corr_pt;
}
void set_rescorr_pt(double rescorr_pt){
this->rescorr_pt=rescorr_pt;
}
void set_ref_pt(double ref_pt){
this->ref_pt=ref_pt;
}
double get_pt(Choice_jetpt_var choice_pt) const{
switch(choice_pt){
case RECO: case GEN:
return pt;
case FRAG:
return corr_pt;
case FRAG_RES:
return rescorr_pt;
case REF:
return ref_pt;
default:
cout<<"Invalid choice of jet pt for sorting"<<endl;
break;
}
}
double get_eta(){
return eta;
}
double get_phi(){
return phi;
}
};
struct Jetpt_greater_than{
private:
Choice_jetpt_var choice_pt;
public:
Jetpt_greater_than(Choice_jetpt_var choice_pt){
this->choice_pt=choice_pt;
}
bool operator()( const Jet& jet1, const Jet& jet2) const {
return (jet1.get_pt(choice_pt) > jet2.get_pt(choice_pt));
}
};
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
class Event{
private:
bool good_event;
double mpt[11];
bool gen_part;
Choice_jetpt_var choice_pt;
vector<Jet> jets;
Jet *lead;
Jet *sublead;
Jet *third;
public:
void reset(){
good_event = false;
gen_part = false;
for(int i=0; i<11; i++){
mpt[i]=0;
}
lead = NULL;
sublead = NULL;
third = NULL;
}
Event(){
reset();
}
//event selection related functions
void set_event_sel(bool good_event){
this->good_event = good_event;
}
bool is_good_event(){
return good_event;
}
//jet related functions
void set_choice_pt(Choice_jetpt_var choice_pt){
this->choice_pt=choice_pt;
}
int get_njet(){
return jets.size();
}
void add_jet(Jet jet){
if(fabs(jet.get_eta()) < ETA_CUT){
jets.push_back(jet);
}
}
Jet get_ieth_jet(int i){
return jets[i];
}
void sort_jets(){
sort( jets.begin(), jets.end(), Jetpt_greater_than(choice_pt));
lead = new Jet(jets[0].get_pt(RECO), jets[0].get_eta(), jets[0].get_phi(),jets[0].get_pt(FRAG),jets[0].get_pt(FRAG_RES),jets[0].get_pt(REF));
sublead = new Jet(jets[1].get_pt(RECO), jets[1].get_eta(), jets[1].get_phi(),jets[0].get_pt(FRAG),jets[0].get_pt(FRAG_RES),jets[0].get_pt(REF));
if(jets.size()>2) third = new Jet(jets[2].get_pt(RECO), jets[2].get_eta(), jets[2].get_phi(),jets[0].get_pt(FRAG),jets[0].get_pt(FRAG_RES),jets[0].get_pt(REF));
}
Jet *get_lead(){
if(get_njet()>0) return lead;
else{
cout<<"no leading reco jet"<<endl;
exit(EXIT_FAILURE);
}
}
Jet *get_sublead(){
if(get_njet()>1) return sublead;
else{
cout<<"no subleading reco jet"<<endl;
exit(EXIT_FAILURE);
}
}
Jet *get_third(){
if(get_njet()>2) return third;
else{
cout<<"no third reco jet"<<endl;
exit(EXIT_FAILURE);
}
}
double get_Aj(){
double pt1, pt2;
pt1=lead->get_pt(choice_pt);
pt2=sublead->get_pt(choice_pt);
return (pt1-pt2)/(pt1+pt2);
}
double get_Aj23(){
double pt2, pt3;
pt2=sublead->get_pt(choice_pt);
pt3=third->get_pt(choice_pt);
return (pt2-pt3)/(pt2+pt3);
}
double get_dphi12(){
double phi1, phi2;
phi1=lead->get_phi();
phi2=sublead->get_phi();
return utilities::get_dphi(phi1,phi2);
}
double get_dphi13(){
double phi1, phi3;
phi1=lead->get_phi();
phi3=sublead->get_phi();
return utilities::get_dphi(phi1,phi3);
}
//MPT related functions
void set_gen_part(bool gen_part){
this->gen_part=gen_part;
}
void set_mpt(double *mpt){
for(int i=0;i<11;i++){
this->mpt[i]=mpt[i];
}
}
bool is_gen_part(){
return gen_part;
}
};