1 |
#include "../interface/Selection.h"
|
2 |
|
3 |
|
4 |
Selection::Selection(){
|
5 |
jets.clear();
|
6 |
electrons.clear();
|
7 |
muons.clear();
|
8 |
mets.clear();
|
9 |
Njets_ = 4;
|
10 |
JetPtThreshold_ = 30.;
|
11 |
JetEtaThreshold_ = 2.4;
|
12 |
JetEHThreashold_ = 0.1;
|
13 |
MuonPtThreshold_ = 10.;
|
14 |
MuonEtaThreshold_ = 2.1;
|
15 |
MuonRelIso_ = 0.1;
|
16 |
MuonVetoEM_ = 4;
|
17 |
MuonVetoHad_ = 6;
|
18 |
MuonNofValidHits_ = 11;
|
19 |
Muond0Cut_ = 0.2;
|
20 |
MuonNormChi2_ = 10;
|
21 |
ElectronPtThreshold_ = 10.;
|
22 |
ElectronEtaThreshold_ = 2.5;
|
23 |
ElectronRelIso_ = 0.1;
|
24 |
Electrond0Cut_ = 0.2;
|
25 |
METThreashold_ = 0;
|
26 |
}
|
27 |
|
28 |
Selection::Selection(const std::vector<TRootJet>& jets_, const std::vector<TRootMuon>& muons_, const std::vector<TRootMET>& mets_){
|
29 |
jets.clear();
|
30 |
electrons.clear();
|
31 |
muons.clear();
|
32 |
mets.clear();
|
33 |
Njets_ = 4;
|
34 |
JetPtThreshold_ = 30.;
|
35 |
JetEtaThreshold_ = 2.4;
|
36 |
JetEHThreashold_ = 0.1;
|
37 |
MuonPtThreshold_ = 10.;
|
38 |
MuonEtaThreshold_ = 2.1;
|
39 |
MuonRelIso_ = 0.1;
|
40 |
MuonVetoEM_ = 4;
|
41 |
MuonVetoHad_ = 6;
|
42 |
MuonNofValidHits_ = 11;
|
43 |
Muond0Cut_ = 0.2;
|
44 |
MuonNormChi2_ = 10;
|
45 |
ElectronPtThreshold_ = 10.;
|
46 |
ElectronEtaThreshold_ = 2.5;
|
47 |
ElectronRelIso_ = 0.1;
|
48 |
Electrond0Cut_ = 0.2;
|
49 |
METThreashold_ = 0;
|
50 |
for(unsigned int i=0;i<jets_.size();i++) jets.push_back(jets_[i]);
|
51 |
for(unsigned int i=0;i<muons_.size();i++) muons.push_back(muons_[i]);
|
52 |
for(unsigned int i=0;i<mets_.size();i++) mets.push_back(mets_[i]);
|
53 |
}
|
54 |
|
55 |
Selection::Selection(const std::vector<TRootJet>& jets_, const std::vector<TRootMuon>& muons_, const std::vector<TRootElectron>& electrons_, const std::vector<TRootMET>& mets_){
|
56 |
jets.clear();
|
57 |
electrons.clear();
|
58 |
muons.clear();
|
59 |
mets.clear();
|
60 |
Njets_ = 4;
|
61 |
JetPtThreshold_ = 30.;
|
62 |
JetEtaThreshold_ = 2.4;
|
63 |
JetEHThreashold_ = 0.1;
|
64 |
MuonPtThreshold_ = 10.;
|
65 |
MuonEtaThreshold_ = 2.1;
|
66 |
MuonRelIso_ = 0.1;
|
67 |
MuonVetoEM_ = 4;
|
68 |
MuonVetoHad_ = 6;
|
69 |
MuonNofValidHits_ = 11;
|
70 |
Muond0Cut_ = 0.2;
|
71 |
MuonNormChi2_ = 10;
|
72 |
ElectronPtThreshold_ = 20.;
|
73 |
ElectronEtaThreshold_ = 2.5;
|
74 |
ElectronRelIso_ = 0.1;
|
75 |
Electrond0Cut_ = 0.2;
|
76 |
METThreashold_ = 0;
|
77 |
for(unsigned int i=0;i<jets_.size();i++) jets.push_back(jets_[i]);
|
78 |
for(unsigned int i=0;i<muons_.size();i++) muons.push_back(muons_[i]);
|
79 |
for(unsigned int i=0;i<mets_.size();i++) mets.push_back(mets_[i]);
|
80 |
for(unsigned int i=0;i<electrons_.size();i++) electrons.push_back(electrons_[i]);
|
81 |
}
|
82 |
|
83 |
Selection::Selection(const Selection & s){
|
84 |
jets = s.jets;
|
85 |
electrons = s.electrons;
|
86 |
muons = s.muons;
|
87 |
mets = s.mets;
|
88 |
JetPtThreshold_ = s.JetPtThreshold_;
|
89 |
JetEtaThreshold_ = s.JetEtaThreshold_;
|
90 |
JetEHThreashold_ = s.JetEHThreashold_;
|
91 |
MuonPtThreshold_ = s.MuonPtThreshold_;
|
92 |
MuonEtaThreshold_ = s.MuonEtaThreshold_;
|
93 |
MuonRelIso_ = s.MuonRelIso_;
|
94 |
MuonVetoEM_ = s.MuonVetoEM_;
|
95 |
MuonVetoHad_ = s.MuonVetoHad_;
|
96 |
MuonNofValidHits_ = s.MuonNofValidHits_;
|
97 |
Muond0Cut_ = s.Muond0Cut_;
|
98 |
MuonNormChi2_ = s.MuonNormChi2_;
|
99 |
ElectronPtThreshold_ = s.ElectronPtThreshold_;
|
100 |
ElectronEtaThreshold_ = s.ElectronEtaThreshold_;
|
101 |
ElectronRelIso_ = s.ElectronRelIso_;
|
102 |
Electrond0Cut_ = s.Electrond0Cut_;
|
103 |
METThreashold_ = s.METThreashold_;
|
104 |
}
|
105 |
|
106 |
Selection::~Selection(){}
|
107 |
|
108 |
void Selection::SetConfiguration(float PtThrJets, float EtaThrJets, float EHThrJets, float PtThrMuons, float EtaThrMuons, float MuonRelIso, float MuonVetoEM, float MuonVetoHad){
|
109 |
JetPtThreshold_ = PtThrJets;
|
110 |
JetEtaThreshold_ = EtaThrJets;
|
111 |
JetEHThreashold_ = EHThrJets;
|
112 |
MuonPtThreshold_ = PtThrMuons;
|
113 |
MuonEtaThreshold_ = EtaThrMuons;
|
114 |
MuonRelIso_ = MuonRelIso;
|
115 |
MuonVetoEM_ = MuonVetoEM;
|
116 |
MuonVetoHad_ = MuonVetoHad;
|
117 |
}
|
118 |
|
119 |
std::vector<TRootJet> Selection::GetSelectedJets() const{
|
120 |
std::vector<TRootJet> selectedJets;
|
121 |
for(unsigned int i=0;i<jets.size();i++){
|
122 |
if(fabs(jets[i].Eta())<JetEtaThreshold_ && jets[i].Pt()>JetPtThreshold_ && jets[i].hcalEnergyFraction()>=JetEHThreashold_)
|
123 |
selectedJets.push_back(jets[i]);
|
124 |
}
|
125 |
std::sort(selectedJets.begin(),selectedJets.end(),HighestPt());
|
126 |
return selectedJets;
|
127 |
}
|
128 |
|
129 |
std::vector<TRootJet> Selection::GetSelectedJets(float PtThr, float EtaThr, float EHThr) const{
|
130 |
std::vector<TRootJet> selectedJets;
|
131 |
for(unsigned int i=0;i<jets.size();i++){
|
132 |
if(fabs(jets[i].Eta())<EtaThr && jets[i].Pt()>PtThr && jets[i].hcalEnergyFraction()>=EHThr)
|
133 |
selectedJets.push_back(jets[i]);
|
134 |
}
|
135 |
std::sort(selectedJets.begin(),selectedJets.end(),HighestPt());
|
136 |
return selectedJets;
|
137 |
}
|
138 |
|
139 |
std::vector<TRootMuon> Selection::GetSelectedMuons() const{
|
140 |
std::vector<TRootMuon> selectedMuons;
|
141 |
for(unsigned int i=0;i<muons.size();i++){
|
142 |
//Compute isolation
|
143 |
bool isIsolated = false;
|
144 |
if(1./muons[i].isoR03_emEt() < MuonRelIso_) isIsolated = true;
|
145 |
if(muons[i].idGlobalMuonPromptTight() && muons[i].normalizedChi2()<MuonNormChi2_ && fabs(muons[i].d0())<Muond0Cut_ && muons[i].numberOfValidTrackerHits()>=MuonNofValidHits_ && fabs(muons[i].Eta())<MuonEtaThreshold_ && muons[i].Pt()>MuonPtThreshold_ ){
|
146 |
selectedMuons.push_back(muons[i]);
|
147 |
}
|
148 |
}
|
149 |
std::sort(selectedMuons.begin(),selectedMuons.end(),HighestPt());
|
150 |
return selectedMuons;
|
151 |
}
|
152 |
|
153 |
std::vector<TRootElectron> Selection::GetSelectedElectrons() const{
|
154 |
std::vector<TRootElectron> selectedElectrons;
|
155 |
for(unsigned int i=0;i<electrons.size();i++){
|
156 |
//Compute isolation
|
157 |
bool isIsolated = false;
|
158 |
float RelIso = (electrons[i].isoR03_emEt() + electrons[i].isoR03_hadEt()+electrons[i].isoR03_sumPt()) / electrons[i].Et();
|
159 |
if(RelIso < ElectronRelIso_) isIsolated = true;
|
160 |
|
161 |
if(electrons[i].idCutBasedFixedThresholdTight() && fabs(electrons[i].d0())<Electrond0Cut_ && fabs(electrons[i].Eta())<ElectronEtaThreshold_ && electrons[i].Pt()>ElectronPtThreshold_ && isIsolated){
|
162 |
selectedElectrons.push_back(electrons[i]);
|
163 |
}
|
164 |
}
|
165 |
std::sort(selectedElectrons.begin(),selectedElectrons.end(),HighestPt());
|
166 |
return selectedElectrons;
|
167 |
}
|
168 |
|
169 |
std::vector<TRootElectron> Selection::GetSelectedElectrons(float PtThr, float EtaThr,float ElectronRelIso) const{
|
170 |
std::vector<TRootElectron> selectedElectrons;
|
171 |
for(unsigned int i=0;i<electrons.size();i++){
|
172 |
//Compute isolation
|
173 |
bool isIsolated = false;
|
174 |
float RelIso = (electrons[i].isoR03_emEt() + electrons[i].isoR03_hadEt()+electrons[i].isoR03_sumPt()) / electrons[i].Et();
|
175 |
if(RelIso < ElectronRelIso) isIsolated = true;
|
176 |
|
177 |
if(electrons[i].idCutBasedFixedThresholdTight() && fabs(electrons[i].d0())<Electrond0Cut_ && fabs(electrons[i].Eta())<EtaThr && electrons[i].Pt()>PtThr && isIsolated){
|
178 |
selectedElectrons.push_back(electrons[i]);
|
179 |
}
|
180 |
}
|
181 |
std::sort(selectedElectrons.begin(),selectedElectrons.end(),HighestPt());
|
182 |
return selectedElectrons;
|
183 |
}
|
184 |
|
185 |
//std::vector<TRootMuon> Selection::GetSelectedMuons(float PtThr, float EtaThr,float MuonRelIso, float MuonVetoEM, float MuonVetoHad) const{
|
186 |
std::vector<TRootMuon> Selection::GetSelectedMuons(float PtThr, float EtaThr,float MuonRelIso) const{
|
187 |
std::vector<TRootMuon> selectedMuons;
|
188 |
for(unsigned int i=0;i<muons.size();i++){
|
189 |
//Compute isolation
|
190 |
bool isIsolated = false;
|
191 |
if(1./muons[i].isoR03_emEt() < MuonRelIso ) isIsolated = true;
|
192 |
if(muons[i].idGlobalMuonPromptTight() && muons[i].normalizedChi2()<MuonNormChi2_ && fabs(muons[i].d0())<Muond0Cut_ && muons[i].numberOfValidTrackerHits()>=MuonNofValidHits_ && fabs(muons[i].Eta())<EtaThr && muons[i].Pt()>PtThr && isIsolated){
|
193 |
selectedMuons.push_back(muons[i]);
|
194 |
}
|
195 |
}
|
196 |
std::sort(selectedMuons.begin(),selectedMuons.end(),HighestPt());
|
197 |
return selectedMuons;
|
198 |
}
|
199 |
|
200 |
std::vector<TRootMuon> Selection::GetSelectedMuonsInvIso(float PtThr, float EtaThr,float MuonRelIso) const{
|
201 |
std::vector<TRootMuon> selectedMuons;
|
202 |
for(unsigned int i=0;i<muons.size();i++){
|
203 |
//Compute isolation
|
204 |
bool isNonIsolated = false;
|
205 |
if(1./muons[i].isoR03_emEt() > MuonRelIso ) isNonIsolated = true;
|
206 |
if(muons[i].idGlobalMuonPromptTight() && muons[i].normalizedChi2()<MuonNormChi2_ && fabs(muons[i].d0())<Muond0Cut_ && muons[i].numberOfValidTrackerHits()>=MuonNofValidHits_ && fabs(muons[i].Eta())<EtaThr && muons[i].Pt()>PtThr && isNonIsolated){
|
207 |
selectedMuons.push_back(muons[i]);
|
208 |
}
|
209 |
}
|
210 |
std::sort(selectedMuons.begin(),selectedMuons.end(),HighestPt());
|
211 |
return selectedMuons;
|
212 |
}
|
213 |
|
214 |
std::vector<TRootMuon> Selection::GetSelectedMuonsNonIso() const{
|
215 |
std::vector<TRootMuon> selectedMuons;
|
216 |
for(unsigned int i=0;i<muons.size();i++){
|
217 |
//if(muons[i].idGlobalMuonPromptTight() && muons[i].chi2()<10 && fabs(muons[i].d0())<0.02 && muons[i].nofValidHits()>=11 && fabs(muons[i].Eta())< MuonEtaThreshold_ && muons[i].Pt()> MuonPtThreshold_){
|
218 |
if( muons[i].idGlobalMuonPromptTight() && muons[i].normalizedChi2()<MuonNormChi2_ && fabs(muons[i].d0())<Muond0Cut_ && muons[i].numberOfValidTrackerHits()>=MuonNofValidHits_ && fabs(muons[i].Eta())< MuonEtaThreshold_ && muons[i].Pt()> MuonPtThreshold_){
|
219 |
selectedMuons.push_back(muons[i]);
|
220 |
}
|
221 |
}
|
222 |
std::sort(selectedMuons.begin(),selectedMuons.end(),HighestPt());
|
223 |
return selectedMuons;
|
224 |
}
|
225 |
|
226 |
std::vector<TRootMuon> Selection::GetSelectedMuonsNonIso(float PtThr, float EtaThr) const{
|
227 |
std::vector<TRootMuon> selectedMuons;
|
228 |
for(unsigned int i=0;i<muons.size();i++){
|
229 |
if(fabs(muons[i].Eta())< EtaThr && muons[i].Pt()> PtThr){
|
230 |
selectedMuons.push_back(muons[i]);
|
231 |
}
|
232 |
}
|
233 |
std::sort(selectedMuons.begin(),selectedMuons.end(),HighestPt());
|
234 |
return selectedMuons;
|
235 |
}
|
236 |
bool Selection::isSelected(unsigned int Njets, bool Veto2ndLepton) const{
|
237 |
if(Veto2ndLepton){
|
238 |
if(GetSelectedMuons().size()==1 && GetSelectedElectrons().size()==0 && GetSelectedJets().size()>= Njets) return true;
|
239 |
}
|
240 |
else{
|
241 |
if(GetSelectedMuons().size()>0 && GetSelectedJets().size()>= Njets) return true;
|
242 |
}
|
243 |
return false;
|
244 |
}
|
245 |
|
246 |
bool Selection::isSelected(float JetPtThr, unsigned int Njets, bool Veto2ndLepton) const{
|
247 |
if(Veto2ndLepton){
|
248 |
if(GetSelectedMuons().size()==1 && GetSelectedElectrons().size()==0 && GetSelectedJets(JetPtThr, JetEtaThreshold_, JetEHThreashold_).size()>= Njets) return true;
|
249 |
}
|
250 |
else{
|
251 |
if(GetSelectedMuons().size()>0 && GetSelectedJets(JetPtThr, JetEtaThreshold_, JetEHThreashold_).size()>= Njets) return true;
|
252 |
}
|
253 |
return false;
|
254 |
}
|
255 |
|
256 |
bool Selection::isSelected(float PtThrJets, float EtaThrJets, float PtThrMuons, float EtaThrMuons, float MuonRelIso, float PtThrElectrons, float EtaThrElectrons, float ElectronRelIso, unsigned int Njets, bool Veto2ndLepton) const{
|
257 |
if(Veto2ndLepton){
|
258 |
if(GetSelectedMuons(PtThrMuons, EtaThrMuons, MuonRelIso).size()==1 && GetSelectedElectrons(PtThrElectrons, EtaThrElectrons, ElectronRelIso).size()==0 && GetSelectedJets(PtThrJets, EtaThrJets, Njets).size()>=Njets) return true;
|
259 |
}
|
260 |
else{
|
261 |
if(GetSelectedMuons(PtThrMuons, EtaThrMuons, MuonRelIso).size()>0 && GetSelectedJets(PtThrJets, EtaThrJets, Njets).size()>=Njets) return true;
|
262 |
}
|
263 |
return false;
|
264 |
}
|
265 |
|