forked from ltikvica/WZanalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WZEvent.h
243 lines (170 loc) · 4.16 KB
/
WZEvent.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#ifndef WZEvent_h
#define WZEvent_h
//Lucija added this to test working with data
#ifdef DATA
#define WZBASECLASS WZ2012Data
#include "WZ2012Data.h"
#endif
#ifdef OLDMC
#define WZBASECLASS WZ
#include "WZ.h"
#endif
#ifdef NEWMC
#define WZBASECLASS WZGenEvent
#include "WZGenEvent.h"
#endif
#ifdef NEWMCPUFIX
#define WZBASECLASS WZGenEvent_v140710
#include "WZGenEvent_v140710.h"
#endif
#ifdef TZMC
#define WZBASECLASS TZJets
#include "TZJets.h"
#endif
#define _ISWZMC_
//Lucija commented it
//#define WZBASECLASS WZGenEvent
#include "TLorentzVector.h"
#include "TH2F.h"
#include "TRandom3.h"
#include <vector>
// #include "WZGenNew.h"
//Lucija commented it
//#include "WZGenEvent.h"
enum FinalState { undefined,
eee,
eem,
mme,
mmm};
enum PassedSelectionStep { selectionNotRun,
failsSelection,
passesZSelection,
passesWSelection,
passesFullSelection};
class RecoLepton : public TLorentzVector {
public:
RecoLepton(double pt, double eta, double phi,
float ch, float id ) {
SetPtEtaPhiM(pt, eta, phi, 0.);
charge = ch;
pdgid = id;
};
float GetScaleFactor();
float LeadTriggerEff();
float TrailTriggerEff();
float PdgId() { return pdgid;};
protected:
float pdgid;
float charge;
static TH2F * MuonSF;
static TH2F * ElecSF;
// Trigger efficiencies
static TH2F * DoubleMuLeadEff;
static TH2F * DoubleMuTrailEff;
static TH2F * DoubleEleLeadEff;
static TH2F * DoubleEleTrailEff;
};
class GenS1Lepton : public TLorentzVector {
public:
GenS1Lepton(double pt, double eta, double phi,
float id=0, float oVpid=-9999.,
float imTau = -9999. ) {
mass = 0;
pdgid = id;
if (abs(id)==11) {
mass = 0.000511;
} else if (abs(id) == 13) {
mass = 0.1057;
}
SetPtEtaPhiM(pt, eta, phi, mass);
motherBoson = oVpid;
isTauDescendent = imTau;
};
int Id() { return pdgid; };
int MotherBoson() { return motherBoson; };
int ComesFromTau() { return isTauDescendent; };
protected:
int pdgid;
int motherBoson;
int isTauDescendent;
float mass;
};
class WZEvent : public WZBASECLASS
{
public:
WZEvent(TTree *tree);
bool passesSelection();
bool passesNewSelection();
void ReadEvent();
void DumpEvent(std::ostream & out, int verboseLevel = 0);
void PrintSummary();
bool PassesGenCuts();
void SmearJets();
float GetShiftedMET(int met_syst);
void ApplyJESCorrection(double strength = 0.);
void PrintNjetsLeadingJetPt();
float LeptonPt(int i);
float LeptonBDT(int i);
float LeptonCharge(int i);
float LeptonEta(int i);
float LeptonPhi(int i);
int LeptonPass2012ICHEP(int i);
float LeptonIso(int i);
float LeptonIsomva(int i);
float GetPileupWeight();
float GetMCWeight();
float GetTriggerEfficiency();
float GetBrWeight();
FinalState GetFinalState(){return final_state;}
PassedSelectionStep GetSelectionLevel() { return selection_level;}
static TH1F* hScaleInEB;
static TH1F* hScaleOutEB;
static TH1F* hScaleEE;
#ifdef _ISWZMC_
std::vector<GenS1Lepton> genLeptons;
std::vector<int> genLeptonsIds;
std::vector<TLorentzVector> genJets;
#endif
std::vector<TLorentzVector> recoJets;
std::vector<RecoLepton> leptons;
float NumZ() { return numZ;}
float NumW() { return numW;}
double SelectedZPt() {
return selectedZPt;
}
TLorentzVector SelectedZP4() {
return selectedZP4;
}
TLorentzVector * ZLepton (unsigned int index);
TLorentzVector * WLepton();
protected:
std::vector<float*> pt;
std::vector<float*> bdt;
std::vector<float*> pdgid;
std::vector<float*> ch;
std::vector<float*> eta;
std::vector<float*> phi;
std::vector<int*> pass2012ICHEP;
std::vector<float*> iso;
std::vector<float*> isomva;
FinalState final_state;
PassedSelectionStep selection_level;
double selectedZPt;
TLorentzVector selectedZP4;
int wLeptonIndex;
int zLeptonsIndex[2];
float numZ;
float numW;
float numMET;
float num3e;
float num2e1mu;
float num1e2mu;
float num3mu;
float numMET3e;
float numMET2e1mu;
float numMET1e2mu;
float numMET3mu;
// For various smearing functions
TRandom3 *random;
};
#endif // #ifdef WZ_cxx