-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTreeAnalysisTop.h
164 lines (138 loc) · 3.44 KB
/
TreeAnalysisTop.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
#ifndef TREEANALYSIS_TOP_H
#define TREEANALYSIS_TOP_H 1
#include "PAFAnalysis.h"
#include "TCounterUI.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TEfficiency.h"
#include "TLorentzVector.h"
#include "TVector3.h"
#include "TTree.h"
#include "TString.h"
#include "TRandom3.h"
#include <fstream>
#include <iostream>
#include <vector>
enum eChannel{
ElEl,
ElMu,
MuMu,
gNCHAN
};
const TString sChannel[gNCHAN] = {
"ElEl",
"ElMu",
"MuMu"
};
enum eElectron{
All,
Barrel,
Endcap,
gNEL
};
const TString sElectron[gNEL] = {
"All",
"Barrel",
"Endcap"
};
class lepton {
public:
lepton(){};
lepton(TLorentzVector vec, int ch, int ty, int ind){
p = vec;
charge = ch;
type = ty;
index = ind;
};
TLorentzVector p;
int charge;
int type; // -1(unknown), 0(mu), 1(ele)
int index;
int MCindex; // index in the collection T_Gen_FinalElec_*
bool ChargeMiss; // false: no charge miss
//Get methods
TLorentzVector Get4Momentum(){ return p;}
Int_t GetCharge(){return charge;}
Double_t GetPt() { return p.Pt();}
Double_t GetEta() { return p.Eta();}
Int_t GetIndex() {return index;}
bool GetChargeMiss(){ return ChargeMiss;}
Int_t GetMCIndex(){ return MCindex;}
//Set methods
void SetMCindex(int i) { MCindex = i; return;}
void SetChargeMiss(bool miss){ ChargeMiss = miss; return;}
};
class TreeAnalysisTop: public PAFAnalysis {
public:
TreeAnalysisTop(TTree *tree=0);
virtual ~TreeAnalysisTop() {};
virtual void Initialise();
virtual void InsideLoop();
virtual void GetParameters();
virtual void SetDataMembersAtTermination();
virtual void Summary();
//Analysis functions
virtual void SetLeptons();
virtual Double_t fGetInvMass();
virtual void CleanDataMembers();
virtual bool MatchLeptonsWithMCTruth();
virtual void CompareCharges();
private:
////////////////
// Histograms //
////////////////
TH1F* fHDummy;
TH1F* hDeltaPtGood;
TH1F* hDeltaPtBad;
TEfficiency* hPt[gNEL];
TEfficiency* hEta;
TEfficiency* hEtaPt;
Int_t counter;
eChannel Channel;
eElectron Electrons;
/////////////////////////////////////
// Datamembers that must be cleaned//
/////////////////////////////////////
std::vector<int> TightElectrons;
std::vector<int> TightMuons;
std::vector<lepton> SelectedLeptons;
std::vector<int> MisMeasuredEl;
////////////////////////
/// Input parameters ///
////////////////////////
TString gSampleName;
TString gfileSuffix;
Float_t gWeight;
Float_t gLumiForPU;
Float_t gTotalLumi;
Int_t gSysSource;
Int_t gSysDirection;
Bool_t gDoSystStudies;
Bool_t gDoTLRatios;
Bool_t gIsData;
Bool_t gUseCSVM;
//////////////////////
// Counting methods //
//////////////////////
Int_t getNTightElectrons();
Int_t getNTightMuons();
//////////////////////////////
// Lepton selection methods //
//////////////////////////////
bool IsGoodMuon(unsigned int,float ptcut= 10.);
bool IsVetoMuon(unsigned int);
bool IsLooseMuon(unsigned int);
bool IsTightMuon(unsigned int);
float getMuonIso(int);
bool IsGoodElectron(unsigned int);
bool IsLooseElectron(unsigned int);
bool IsTightElectron(Int_t);
bool ElPassesTrigger(Int_t);
float getElecIso(int);
float getEACorrection(float);
bool IsBarrelElectron(Int_t);
Int_t GetNBarrelElectrons();
std::vector<lepton> SortLeptonsByPt(std::vector<lepton>&);
ClassDef(TreeAnalysisTop,0);
};
#endif