-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcutClass.h
165 lines (144 loc) · 5.63 KB
/
cutClass.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
#include "AnalysisEvent.h"
#include <vector>
#include <map>
#include "plots.h"
#include "TH2.h"
#include <fstream>
#include "TLorentzVector.h"
class Cuts{
bool makeLeptonCuts(AnalysisEvent*,float*,std::map<std::string,Plots*>, TH1F*);
bool invertIsoCut(AnalysisEvent*,float*,std::map<std::string,Plots*>, TH1F*);
std::vector<int> makeJetCuts(AnalysisEvent*,int,float*);
std::vector<int> makeMetCuts(AnalysisEvent*);
std::vector<int> makeBCuts(AnalysisEvent*, std::vector<int>);
std::vector<int> getTightEles(AnalysisEvent* event);
std::vector<int> getInvIsoEles(AnalysisEvent* event);
std::vector<int> getLooseEles(AnalysisEvent* event);
std::vector<int> getTightMuons(AnalysisEvent* event);
std::vector<int> synchTightMuons(AnalysisEvent* event);
std::vector<int> getInvIsoMuons(AnalysisEvent* event);
std::vector<int> getLooseMuons(AnalysisEvent* event);
float getZCand(AnalysisEvent*, std::vector<int>, std::vector<int>);
bool triggerCuts(AnalysisEvent*);
//Method for running the synchronisation with Jeremy.
bool synchCuts(AnalysisEvent * event);
int getLooseLepsNum(AnalysisEvent * event); //Mimic preselection skims
int getLooseElecs(AnalysisEvent* event);
int getLooseMus(AnalysisEvent* event);
//Simple deltaR function, because the reco namespace doesn't work or something
double deltaR(float,float,float,float);
void dumpToFile(AnalysisEvent * event, int);
//Function to get lepton SF
float getLeptonWeight(AnalysisEvent*);
float eleSF(float, float);
float muonSF(float, float);
// Tight electron cuts
unsigned int numTightEle_;
float tightElePt_;
float tightEleEta_;
float tightEled0_;
int tightEleMissLayers_;
bool tightEleCheckPhotonVeto_;
float tightEleMVA_;
float tightEleRelIso_;
//Loose electron cuts
unsigned int numLooseEle_;
float looseElePt_;
float looseEleEta_;
float looseEleMVA_;
float looseEleRelIso_;
//Tight muon cuts
unsigned int numTightMu_;
float tightMuonPt_;
float tightMuonEta_;
float tightMuonRelIso_;
//Loose muon cuts
unsigned int numLooseMu_;
float looseMuonPt_;
float looseMuonEta_;
float looseMuonRelIso_;
//z cuts
float invZMassCut_;
//Tight jet cuts
unsigned int numJets_;
unsigned int maxJets_;
float jetPt_;
float jetEta_;
int jetNConsts_;
bool jetIDDo_;
//B-Disc cut
unsigned int numbJets_;
unsigned int maxbJets_;
float bDiscCut_;
//set to true to fill in histograms.
bool doPlots_;
bool fillCutFlow_; // Fill cut flows
bool invertIsoCut_; // For background estimation
bool synchCutFlow_; //For synch
bool singleEventInfoDump_; //For dropping info on event for synching.
//Some things that will be used for JEC uncertainties.
std::vector<float> ptMinJEC_;
std::vector<float> ptMaxJEC_;
std::vector<float> etaMinJEC_;
std::vector<float> etaMaxJEC_;
std::vector<std::vector <float> > jecSFUp_;
std::vector<std::vector <float> > jecSFDown_;
void initialiseJECCors();
float getJECUncertainty(float,float,int);
TLorentzVector getJetLVec(AnalysisEvent*,int,int);
int getptbin_for_btag(float);
std::vector<float> SFb_error;
//Histogram to be used in synchronisation.
TH1F* synchCutFlowHist_;
TH1I* synchNumEles_;
TH1I* synchNumMus_;
TH1I* synchMuonCutFlow_;
bool makeEventDump_;
ofstream step0EventDump_;
ofstream step2EventDump_;
ofstream step4EventDump_;
ofstream step6EventDump_;
//Sets whether to do MC or data cuts. Set every time a new dataset is processed in the main loop.
bool isMC_;
std::string triggerFlag_;
std::string postfixName_;
//For producing post-lepsel skims
TTree* postLepSelTree_;
TTree* postLepSelTree2_;
TTree* postLepSelTree3_;
//For removing trigger cuts. Will be set to false by default
bool skipTrigger_;
//For making b-tagging efficiencies. Needed for reweighting and systematics.
bool makeBTagEffPlots_;
//And the efficiency plots.
std::vector<TH2D*> bTagEffPlots_;
bool getBTagWeight_;
void getBWeight(AnalysisEvent *, TLorentzVector, int, float*, float*, float*, float*, float*, float*, float*, float*, float*, float*);
//met and mtw cut values
float metCut_;
float mTWCut_;
//Sets trigger from config file
std::string cutConfTrigLabel_;
public:
Cuts(bool,bool,bool,bool,bool);
~Cuts();
bool makeCuts(AnalysisEvent*,float*,std::map<std::string,Plots*>, TH1F*,int);
void setTightEle(float pt = 20, float eta = 2.5, float d0 = 0.04);
void setMC(bool isMC) {isMC_ = isMC;};
void setCloneTree(TTree* tree, TTree* tree2, TTree* tree3) {postLepSelTree_ = tree; postLepSelTree2_ = tree2; postLepSelTree3_ = tree3;};
void setNumLeps(int tightMu, int looseMu, int tightEle, int looseEle){numTightEle_ = tightEle; numLooseEle_ = looseEle; numTightMu_ = tightMu; numLooseMu_ = looseMu;};
void setCutConfTrigLabel(std::string newLabel){cutConfTrigLabel_ = newLabel;};
void setInvIsoCut(bool invIso){invertIsoCut_ = invIso;};
void setTriggerFlag(std::string triggerFlag) {triggerFlag_ = triggerFlag;};
void setBTagPlots(std::vector<TH2D*> vec, bool makePlotsOrRead) {makeBTagEffPlots_ = makePlotsOrRead; bTagEffPlots_ = vec;getBTagWeight_ = !makePlotsOrRead;};
void setSkipTrig(bool skip){skipTrigger_ = skip;};
void setMetCut(float cut){metCut_ = cut;};
void setMTWCut(float cut){mTWCut_ = cut;};
void setJetRegion(int nJets, int nBets, int maxJets, int maxBJets){numJets_ = nJets; numbJets_ = nBets; maxJets_ = maxJets; maxbJets_ = maxBJets;};
bool parse_config(std::string);
void dumpLeptonInfo(AnalysisEvent*);
void dumpLooseLepInfo(AnalysisEvent*);
TH1F* getSynchCutFlow();
int numFound(){return synchCutFlowHist_->GetBinContent(4);};
void setEventInfoFlag(bool flag){singleEventInfoDump_ = flag;};
};