17 |
|
// |
18 |
|
// |
19 |
|
|
20 |
+ |
#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" |
21 |
+ |
#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" |
22 |
+ |
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
23 |
+ |
#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h" |
24 |
+ |
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
25 |
+ |
|
26 |
|
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbAnalyzerNew.h" |
27 |
< |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEvent.h" |
28 |
< |
#include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEventAuxInfo.h" |
27 |
> |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" |
28 |
> |
|
29 |
> |
#define GENPTOLOR(a) TLorentzVector((a).px(), (a).py(), (a).pz(), (a).energy()) |
30 |
> |
#define GENPTOLORP(a) TLorentzVector((a)->px(), (a)->py(), (a)->pz(), (a)->energy()) |
31 |
|
|
24 |
– |
#include "FWCore/Framework/interface/ESHandle.h" |
25 |
– |
#include "DataFormats/PatCandidates/interface/PATObject.h" |
26 |
– |
#include "DataFormats/PatCandidates/interface/TriggerObject.h" |
27 |
– |
#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" |
28 |
– |
#include "RecoBTag/Records/interface/BTagPerformanceRecord.h" |
29 |
– |
#include "CondFormats/PhysicsToolsObjects/interface/BinningPointByMap.h" |
30 |
– |
#include "RecoBTag/PerformanceDB/interface/BtagPerformance.h" |
32 |
|
|
33 |
< |
#include "DataFormats/GeometryVector/interface/VectorUtil.h" |
33 |
> |
struct CompareJetPtMuons { |
34 |
> |
bool operator()( const VHbbEvent::MuonInfo& j1, const VHbbEvent::MuonInfo& j2 ) const { |
35 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
36 |
> |
} |
37 |
> |
}; |
38 |
> |
struct CompareJetPtElectrons { |
39 |
> |
bool operator()( const VHbbEvent::ElectronInfo& j1, const VHbbEvent::ElectronInfo& j2 ) const { |
40 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
41 |
> |
} |
42 |
> |
}; |
43 |
> |
struct CompareJetPtTaus { |
44 |
> |
bool operator()( const VHbbEvent::TauInfo& j1, const VHbbEvent::TauInfo& j2 ) const { |
45 |
> |
return j1.p4.Pt() > j2.p4.Pt(); |
46 |
> |
} |
47 |
> |
}; |
48 |
|
|
49 |
|
|
35 |
– |
#define GENPTOLOR(a) TLorentzVector((a).px(), (a).py(), (a).pz(), (a).energy()) |
36 |
– |
#define GENPTOLORP(a) TLorentzVector((a)->px(), (a)->py(), (a)->pz(), (a)->energy()) |
50 |
|
|
51 |
|
HbbAnalyzerNew::HbbAnalyzerNew(const edm::ParameterSet& iConfig): |
52 |
|
eleLabel_(iConfig.getParameter<edm::InputTag>("electronTag")), |
93 |
|
using namespace edm; |
94 |
|
using namespace reco; |
95 |
|
|
96 |
+ |
// JEC Uncertainty |
97 |
+ |
|
98 |
+ |
// JetCorrectionUncertainty *jecUnc=0; |
99 |
+ |
edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl; |
100 |
+ |
iSetup.get<JetCorrectionsRecord>().get("AK5PF",JetCorParColl); |
101 |
+ |
JetCorrectionUncertainty *jecUnc=0; |
102 |
+ |
// if (!runOnMC_){ |
103 |
+ |
JetCorrectorParameters const & JetCorPar = (*JetCorParColl)["Uncertainty"]; |
104 |
+ |
jecUnc = new JetCorrectionUncertainty(JetCorPar); |
105 |
+ |
// } |
106 |
|
|
107 |
|
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() ); |
108 |
|
std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() ); |
111 |
|
// ?? |
112 |
|
|
113 |
|
// trigger |
114 |
+ |
|
115 |
+ |
// trigger |
116 |
|
edm::Handle<edm::TriggerResults> hltresults; |
117 |
|
//iEvent.getByLabel("TriggerResults", hltresults); |
118 |
|
|
121 |
|
iEvent.getByLabel(hltResults_, hltresults); |
122 |
|
|
123 |
|
const edm::TriggerNames & triggerNames_ = iEvent.triggerNames(*hltresults); |
99 |
– |
|
100 |
– |
int ntrigs = hltresults->size(); |
101 |
– |
if (ntrigs==0){std::cout << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;} |
102 |
– |
|
103 |
– |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
104 |
– |
|
105 |
– |
TString trigName=triggerNames_.triggerName(itrig); |
106 |
– |
bool accept = hltresults->accept(itrig); |
107 |
– |
|
108 |
– |
if (accept){(auxInfo->triggerInfo.flag)[itrig] = 1;} |
109 |
– |
else { (auxInfo->triggerInfo.flag)[itrig] = 0;} |
110 |
– |
|
111 |
– |
// std::cout << "%HLTInfo -- Number of HLT Triggers: " << ntrigs << std::endl; |
112 |
– |
// std::cout << "%HLTInfo -- HLTTrigger(" << itrig << "): " << trigName << " = " << accept << std::endl; |
113 |
– |
} |
114 |
– |
|
115 |
– |
// |
116 |
– |
// big bloat |
117 |
– |
// |
118 |
– |
|
119 |
– |
|
120 |
– |
int goodDoubleMu3=0,goodDoubleMu3_2=0, |
121 |
– |
goodMu9=0, goodIsoMu9=0, goodMu11=0, goodIsoMu13_3=0, goodMu15=0, goodMu15_1=0; |
122 |
– |
int goodDoubleElec10=0,goodDoubleElec15_1=0,goodDoubleElec17_1=0; |
123 |
– |
int goodMet100=0; |
124 |
– |
int goodSingleEle1=0,goodSingleEle2=0,goodSingleEle3=0,goodSingleEle4=0; |
125 |
– |
int goodBtagMu1=0,goodBtagMu2=0,goodBtagMu0=0,goodBtagMu11=0; |
126 |
– |
int goodBtagMuJet1=0, goodBtagMuJet2=0, goodBtagMuJet3=0, goodBtagMuJet4=0; |
127 |
– |
int goodIsoMu15=0,goodIsoMu17v5=0,goodIsoMu17v6=0; |
128 |
– |
|
129 |
– |
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
130 |
– |
TString trigName=triggerNames_.triggerName(itrig); |
131 |
– |
if(strcmp(trigName,"HLT_Mu9")==0) goodMu9++; |
132 |
– |
if(strcmp(trigName,"HLT_IsoMu9")==0) goodIsoMu9++; |
133 |
– |
if(strcmp(trigName,"HLT_IsoMu13_v3")==0) goodIsoMu13_3++; |
134 |
– |
if(strcmp(trigName,"HLT_Mu11")==0) goodMu11++; |
135 |
– |
if(strcmp(trigName,"HLT_DoubleMu3")==0) goodDoubleMu3++; |
136 |
– |
if(strcmp(trigName,"HLT_DoubleMu3_v2")==0) goodDoubleMu3_2++; |
137 |
– |
if(strcmp(trigName,"HLT_Mu15")==0) goodMu15++; |
138 |
– |
if(strcmp(trigName,"HLT_Mu15_v1")==0) goodMu15_1++; |
139 |
– |
|
140 |
– |
if(strcmp(trigName,"HLT_DoubleEle10_SW_L1R")==0) goodDoubleElec10++; |
141 |
– |
if(strcmp(trigName,"HLT_DoubleEle15_SW_L1R_v1")==0) goodDoubleElec15_1++; |
142 |
– |
if(strcmp(trigName,"HLT_DoubleEle17_SW_L1R_v1")==0) goodDoubleElec17_1++; |
143 |
– |
if(strcmp(trigName,"HLT_MET100_v1")==0) goodMet100++; |
144 |
– |
if(strcmp(trigName,"HLT_Ele15_SW_L1R")==0) goodSingleEle1++; |
145 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TightEleId_L1R")==0) goodSingleEle2++; |
146 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TighterEleIdIsol_L1R_v2")==0) goodSingleEle3++; |
147 |
– |
if(strcmp(trigName,"HLT_Ele17_SW_TighterEleIdIsol_L1R_v3")==0) goodSingleEle4++; |
148 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet20U_v1")==0) goodBtagMu1++; |
149 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet30U_Mu5_v3")==0) goodBtagMu2++; |
150 |
– |
if(strcmp(trigName,"HLT_BTagMu_Jet20U")==0) goodBtagMu0++; |
151 |
– |
if(strcmp(trigName,"HLT_BTagMu_DiJet20U_Mu5_v1")==0) goodBtagMu11++; |
152 |
– |
if(strcmp(trigName,"HLT_Mu17_CentralJet30_BTagIP_v2")==0) goodBtagMuJet1++; |
153 |
– |
if(strcmp(trigName,"HLT_Mu17_CentralJet30_v2")==0) goodBtagMuJet2++; |
154 |
– |
if(strcmp(trigName,"HLT_HT200_Mu5_PFMHT35_v2")==0) goodBtagMuJet3++; |
155 |
– |
if(strcmp(trigName,"HLT_Mu12_CentralJet30_BTagIP_v2")==0) goodBtagMuJet4++; |
156 |
– |
|
157 |
– |
if(strcmp(trigName,"HLT_IsoMu15_v5")==0) goodIsoMu15++; |
158 |
– |
if(strcmp(trigName,"HLT_IsoMu17_v5")==0) goodIsoMu17v5++; |
159 |
– |
if(strcmp(trigName,"HLT_IsoMu17_v6")==0) goodIsoMu17v6++; |
160 |
– |
} |
161 |
– |
int itrig1=-99; |
162 |
– |
if(goodMu9!=0) itrig1 = triggerNames_.triggerIndex("HLT_Mu9"); |
163 |
– |
int itrig2=-99; |
164 |
– |
if(goodIsoMu9!=0) itrig2 = triggerNames_.triggerIndex("HLT_IsoMu9"); |
165 |
– |
int itrig3=-99; |
166 |
– |
if(goodIsoMu13_3!=0) itrig3 = triggerNames_.triggerIndex("HLT_IsoMu13_v3"); |
167 |
– |
int itrig4=-99; |
168 |
– |
if(goodMu11!=0) itrig4 = triggerNames_.triggerIndex("HLT_Mu11"); |
169 |
– |
int itrig5=-99; |
170 |
– |
if(goodDoubleMu3!=0) itrig5 = triggerNames_.triggerIndex("HLT_DoubleMu3"); |
171 |
– |
int itrig6=-99; |
172 |
– |
if(goodDoubleMu3_2!=0) itrig6 = triggerNames_.triggerIndex("HLT_DoubleMu3_v2"); |
173 |
– |
int itrig7=-99; |
174 |
– |
if(goodMu15!=0) itrig7 = triggerNames_.triggerIndex("HLT_Mu15"); |
175 |
– |
int itrig8=-99; |
176 |
– |
if(goodMu15_1!=0) itrig8 = triggerNames_.triggerIndex("HLT_Mu15_v1"); |
177 |
– |
|
178 |
– |
int itrig9=-99; |
179 |
– |
if(goodDoubleElec10!=0) itrig9 = triggerNames_.triggerIndex("HLT_DoubleEle10_SW_L1R"); |
180 |
– |
int itrig10=-99; |
181 |
– |
if(goodDoubleElec15_1!=0) itrig10 = triggerNames_.triggerIndex("HLT_DoubleEle15_SW_L1R_v1"); |
182 |
– |
int itrig11=-99; |
183 |
– |
if(goodDoubleElec17_1!=0) itrig11 = triggerNames_.triggerIndex("HLT_DoubleEle17_SW_L1R_v1"); |
184 |
– |
int itrig12=-99; |
185 |
– |
if(goodMet100!=0) itrig12 = triggerNames_.triggerIndex("HLT_MET100_v1"); |
186 |
– |
|
187 |
– |
int itrig13=-99; |
188 |
– |
if(goodSingleEle1!=0) itrig13 = triggerNames_.triggerIndex("HLT_Ele15_SW_L1R"); |
189 |
– |
int itrig14=-99; |
190 |
– |
if(goodSingleEle2!=0) itrig14 = triggerNames_.triggerIndex("HLT_Ele17_SW_TightEleId_L1R"); |
191 |
– |
int itrig15=-99; |
192 |
– |
if(goodSingleEle3!=0) itrig15 = triggerNames_.triggerIndex("HLT_Ele17_SW_TighterEleIdIsol_L1R_v2"); |
193 |
– |
int itrig16=-99; |
194 |
– |
if(goodSingleEle4!=0) itrig16 = triggerNames_.triggerIndex("HLT_Ele17_SW_TighterEleIdIsol_L1R_v3"); |
195 |
– |
|
196 |
– |
int itrig17=-99; |
197 |
– |
if(goodBtagMu1!=0) itrig17 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet20U_v1"); |
198 |
– |
int itrig18=-99; |
199 |
– |
if(goodBtagMu2!=0) itrig18 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet30U_Mu5_v3"); |
200 |
– |
int itrig19=-99; |
201 |
– |
if(goodBtagMu0!=0) itrig19 = triggerNames_.triggerIndex("HLT_BTagMu_Jet20U"); |
202 |
– |
int itrig20=-99; |
203 |
– |
if(goodBtagMu11!=0) itrig20 = triggerNames_.triggerIndex("HLT_BTagMu_DiJet20U_Mu5_v1"); |
204 |
– |
int itrig21=-99; |
205 |
– |
if(goodBtagMuJet1!=0) itrig21 = triggerNames_.triggerIndex("HLT_Mu17_CentralJet30_BTagIP_v2"); |
206 |
– |
int itrig22=-99; |
207 |
– |
if(goodBtagMuJet2!=0) itrig22 = triggerNames_.triggerIndex("HLT_Mu17_CentralJet30_v2"); |
208 |
– |
int itrig23=-99; |
209 |
– |
if(goodBtagMuJet3!=0) itrig23 = triggerNames_.triggerIndex("HLT_HT200_Mu5_PFMHT35_v2"); |
210 |
– |
int itrig231=-99; |
211 |
– |
if(goodBtagMuJet4!=0) itrig231 = triggerNames_.triggerIndex("HLT_Mu12_CentralJet30_BTagIP_v2"); |
212 |
– |
|
213 |
– |
int itrig24=-99; |
214 |
– |
if(goodIsoMu15!=0) itrig24 = triggerNames_.triggerIndex("HLT_IsoMu15_v5"); |
215 |
– |
int itrig25=-99; |
216 |
– |
if(goodIsoMu17v5!=0) itrig25 = triggerNames_.triggerIndex("HLT_IsoMu17_v5"); |
217 |
– |
int itrig26=-99; |
218 |
– |
if(goodIsoMu17v6!=0) itrig26 = triggerNames_.triggerIndex("HLT_IsoMu17_v6"); |
219 |
– |
|
220 |
– |
if (itrig1!=-99 && hltresults->accept(itrig1)) auxInfo->triggerInfo.triggerMu9=1; else auxInfo->triggerInfo.triggerMu9=0; |
221 |
– |
if (itrig2!=-99 && hltresults->accept(itrig2)) auxInfo->triggerInfo.triggerIsoMu9=1; else auxInfo->triggerInfo.triggerIsoMu9=0; |
222 |
– |
if (itrig3!=-99 && hltresults->accept(itrig3)) auxInfo->triggerInfo.triggerIsoMu13_3=1; else auxInfo->triggerInfo.triggerIsoMu13_3=0; |
223 |
– |
if (itrig4!=-99 && hltresults->accept(itrig4)) auxInfo->triggerInfo.triggerMu11=1; else auxInfo->triggerInfo.triggerMu11=0; |
224 |
– |
if (itrig5!=-99 && hltresults->accept(itrig5)) auxInfo->triggerInfo.triggerDoubleMu3=1; else auxInfo->triggerInfo.triggerDoubleMu3=0; |
225 |
– |
if (itrig6!=-99 && hltresults->accept(itrig6)) auxInfo->triggerInfo.triggerDoubleMu3_2=1; else auxInfo->triggerInfo.triggerDoubleMu3_2=0; |
226 |
– |
if (itrig7!=-99 && hltresults->accept(itrig7)) auxInfo->triggerInfo.triggerMu15=1; else auxInfo->triggerInfo.triggerMu15=0; |
227 |
– |
if (itrig8!=-99 && hltresults->accept(itrig8)) auxInfo->triggerInfo.triggerMu15_1=1; else auxInfo->triggerInfo.triggerMu15_1=0; |
228 |
– |
|
229 |
– |
if (itrig9!=-99 && hltresults->accept(itrig9)) auxInfo->triggerInfo.triggerDoubleElec10=1; else auxInfo->triggerInfo.triggerDoubleElec10=0; |
230 |
– |
if (itrig10!=-99 && hltresults->accept(itrig10)) auxInfo->triggerInfo.triggerDoubleElec15_1=1; else auxInfo->triggerInfo.triggerDoubleElec15_1=0; |
231 |
– |
if (itrig11!=-99 && hltresults->accept(itrig11)) auxInfo->triggerInfo.triggerDoubleElec17_1=1; else auxInfo->triggerInfo.triggerDoubleElec17_1=0; |
232 |
– |
if (itrig12!=-99 && hltresults->accept(itrig12)) auxInfo->triggerInfo.triggerMet100_1=1; else auxInfo->triggerInfo.triggerMet100_1=0; |
233 |
– |
|
234 |
– |
if (itrig13!=-99 && hltresults->accept(itrig13)) auxInfo->triggerInfo.triggerSingleEle1=1; else auxInfo->triggerInfo.triggerSingleEle1=0; |
235 |
– |
if (itrig14!=-99 && hltresults->accept(itrig14)) auxInfo->triggerInfo.triggerSingleEle2=1; else auxInfo->triggerInfo.triggerSingleEle2=0; |
236 |
– |
if (itrig15!=-99 && hltresults->accept(itrig15)) auxInfo->triggerInfo.triggerSingleEle3=1; else auxInfo->triggerInfo.triggerSingleEle3=0; |
237 |
– |
if (itrig16!=-99 && hltresults->accept(itrig16)) auxInfo->triggerInfo.triggerSingleEle4=1; else auxInfo->triggerInfo.triggerSingleEle4=0; |
238 |
– |
|
239 |
– |
if (itrig17!=-99 && hltresults->accept(itrig17)) auxInfo->triggerInfo.triggerBtagMu1=1; else auxInfo->triggerInfo.triggerBtagMu1=0; |
240 |
– |
if (itrig18!=-99 && hltresults->accept(itrig18)) auxInfo->triggerInfo.triggerBtagMu2=1; else auxInfo->triggerInfo.triggerBtagMu2=0; |
241 |
– |
if (itrig19!=-99 && hltresults->accept(itrig19)) auxInfo->triggerInfo.triggerBtagMu0=1; else auxInfo->triggerInfo.triggerBtagMu0=0; |
242 |
– |
if (itrig20!=-99 && hltresults->accept(itrig20)) auxInfo->triggerInfo.triggerBtagMu11=1; else auxInfo->triggerInfo.triggerBtagMu11=0; |
243 |
– |
if (itrig21!=-99 && hltresults->accept(itrig21)) auxInfo->triggerInfo.triggerBtagMuJet1=1; else auxInfo->triggerInfo.triggerBtagMuJet1=0; |
244 |
– |
if (itrig22!=-99 && hltresults->accept(itrig22)) auxInfo->triggerInfo.triggerBtagMuJet2=1; else auxInfo->triggerInfo.triggerBtagMuJet2=0; |
245 |
– |
if (itrig23!=-99 && hltresults->accept(itrig23)) auxInfo->triggerInfo.triggerBtagMuJet3=1; else auxInfo->triggerInfo.triggerBtagMuJet3=0; |
246 |
– |
if (itrig231!=-99 && hltresults->accept(itrig231)) auxInfo->triggerInfo.triggerBtagMuJet4=1; else auxInfo->triggerInfo.triggerBtagMuJet4=0; |
247 |
– |
|
248 |
– |
if (itrig24!=-99 && hltresults->accept(itrig24)) auxInfo->triggerInfo.triggerIsoMu15=1; else auxInfo->triggerInfo.triggerIsoMu15=0; |
249 |
– |
if (itrig25!=-99 && hltresults->accept(itrig25)) auxInfo->triggerInfo.triggerIsoMu17v5=1; else auxInfo->triggerInfo.triggerIsoMu17v5=0; |
250 |
– |
if (itrig26!=-99 && hltresults->accept(itrig26)) auxInfo->triggerInfo.triggerIsoMu17v6=1; else auxInfo->triggerInfo.triggerIsoMu17v6=0; |
251 |
– |
|
252 |
– |
if (itrig1==-99) auxInfo->triggerInfo.triggerMu9=-99; |
253 |
– |
if (itrig2==-99) auxInfo->triggerInfo.triggerIsoMu9=-99; |
254 |
– |
if (itrig3==-99) auxInfo->triggerInfo.triggerIsoMu13_3=-99; |
255 |
– |
if (itrig4==-99) auxInfo->triggerInfo.triggerMu11=-99; |
256 |
– |
if (itrig5==-99) auxInfo->triggerInfo.triggerDoubleMu3=-99; |
257 |
– |
if (itrig6==-99) auxInfo->triggerInfo.triggerDoubleMu3_2=-99; |
258 |
– |
if (itrig7==-99) auxInfo->triggerInfo.triggerMu15=-99; |
259 |
– |
if (itrig8==-99) auxInfo->triggerInfo.triggerMu15_1=-99; |
260 |
– |
|
261 |
– |
if (itrig9==-99) auxInfo->triggerInfo.triggerDoubleElec10=-99; |
262 |
– |
if (itrig10==-99) auxInfo->triggerInfo.triggerDoubleElec15_1=-99; |
263 |
– |
if (itrig11==-99) auxInfo->triggerInfo.triggerDoubleElec17_1=-99; |
264 |
– |
if (itrig12==-99) auxInfo->triggerInfo.triggerMet100_1=-99; |
265 |
– |
|
266 |
– |
if (itrig13==-99) auxInfo->triggerInfo.triggerSingleEle1=-99; |
267 |
– |
if (itrig14==-99) auxInfo->triggerInfo.triggerSingleEle2=-99; |
268 |
– |
if (itrig15==-99) auxInfo->triggerInfo.triggerSingleEle3=-99; |
269 |
– |
if (itrig16==-99) auxInfo->triggerInfo.triggerSingleEle4=-99; |
270 |
– |
|
271 |
– |
if(itrig17==-99) auxInfo->triggerInfo.triggerBtagMu1=-99; |
272 |
– |
if(itrig18==-99) auxInfo->triggerInfo.triggerBtagMu2=-99; |
273 |
– |
if(itrig19==-99) auxInfo->triggerInfo.triggerBtagMu0=-99; |
274 |
– |
if(itrig20==-99) auxInfo->triggerInfo.triggerBtagMu11=-99; |
275 |
– |
if(itrig21==-99) auxInfo->triggerInfo.triggerBtagMuJet1=-99; |
276 |
– |
if(itrig22==-99) auxInfo->triggerInfo.triggerBtagMuJet2=-99; |
277 |
– |
if(itrig23==-99) auxInfo->triggerInfo.triggerBtagMuJet3=-99; |
278 |
– |
if(itrig231==-99) auxInfo->triggerInfo.triggerBtagMuJet4=-99; |
279 |
– |
|
280 |
– |
if(itrig24==-99) auxInfo->triggerInfo.triggerIsoMu15=-99; |
281 |
– |
if(itrig25==-99) auxInfo->triggerInfo.triggerIsoMu17v5=-99; |
282 |
– |
if(itrig26==-99) auxInfo->triggerInfo.triggerIsoMu17v6=-99; |
283 |
– |
|
284 |
– |
// MinDRMu=-99.,MCBestMuId=-99,MCBestMuMomId=-99,MCBestMuGMomId=-99; |
285 |
– |
// for(int i=0;i<50;i++) {DeltaRMu[i]=-99;} |
286 |
– |
|
124 |
|
|
125 |
+ |
int ntrigs = hltresults->size(); |
126 |
+ |
if (ntrigs==0){std::cerr << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;} |
127 |
|
|
128 |
|
BeamSpot vertexBeamSpot; |
129 |
|
edm::Handle<reco::BeamSpot> recoBeamSpotHandle; |
160 |
|
|
161 |
|
|
162 |
|
edm::Handle<double> rhoHandle; |
163 |
< |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); auxInfo->puInfo.rho = *rhoHandle; |
163 |
> |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); |
164 |
> |
auxInfo->puInfo.rho = *rhoHandle; |
165 |
|
|
166 |
+ |
edm::Handle<std::vector< PileupSummaryInfo> > puHandle; |
167 |
+ |
|
168 |
+ |
if (runOnMC_){ |
169 |
+ |
iEvent.getByType(puHandle); |
170 |
+ |
if (puHandle.isValid()){ |
171 |
+ |
|
172 |
+ |
std::vector< PileupSummaryInfo> pu = (*puHandle); |
173 |
+ |
for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){ |
174 |
+ |
int bx = (*it).getBunchCrossing(); |
175 |
+ |
unsigned int num = (*it).getPU_NumInteractions(); |
176 |
+ |
// std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl; |
177 |
+ |
auxInfo->puInfo.pus[bx] =num; |
178 |
+ |
} |
179 |
+ |
} |
180 |
+ |
} |
181 |
+ |
|
182 |
|
//// real start |
183 |
|
|
184 |
|
|
189 |
|
|
190 |
|
if(runOnMC_){ |
191 |
|
|
192 |
< |
int Hin=-99,Win=-99,Zin=-99,bin=-99,bbarin=-99; |
337 |
< |
iEvent.getByLabel("genParticles", genParticles); |
192 |
> |
iEvent.getByLabel("genParticles", genParticles); |
193 |
|
|
194 |
|
for(size_t i = 0; i < genParticles->size(); ++ i) { |
195 |
< |
int Hin=-99,Win=-99,Zin=-99,bin=-99,bbarin=-99; |
341 |
< |
|
195 |
> |
|
196 |
|
const GenParticle & p = (*genParticles)[i]; |
197 |
|
int id = p.pdgId(); |
198 |
|
int st = p.status(); |
199 |
|
|
200 |
|
if(id==25){ |
201 |
|
|
348 |
– |
/* int wh=0; |
349 |
– |
int nMoth = p.numberOfMothers(); |
350 |
– |
for(size_t jj = 0; jj < nMoth; ++ jj) { |
351 |
– |
const Candidate * mom = p.mother( jj ); |
352 |
– |
int nmomdau= mom->numberOfDaughters(); |
353 |
– |
for(size_t j = 0; j < nmomdau; ++ j) { |
354 |
– |
const Candidate * Wmomdau = mom->daughter( j ); |
355 |
– |
if(abs(Wmomdau->pdgId())==24) wh++; |
356 |
– |
} |
357 |
– |
} |
358 |
– |
|
359 |
– |
if(wh==0) continue; |
360 |
– |
*/ |
202 |
|
VHbbEventAuxInfo::ParticleMCInfo htemp; |
362 |
– |
Hin=i; |
203 |
|
htemp.status=st; |
204 |
|
htemp.charge=p.charge(); |
205 |
|
if(p.mother(0)!=0) htemp.momid=p.mother(0)->pdgId(); |
206 |
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) htemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
207 |
|
htemp.p4 = GENPTOLOR(p); |
208 |
< |
|
208 |
> |
|
209 |
|
int ndau = p.numberOfDaughters(); |
210 |
|
for(int j = 0; j < ndau; ++ j) { |
211 |
|
const Candidate * Hdau = p.daughter( j ); |
214 |
|
} |
215 |
|
(auxInfo->mcH).push_back(htemp); |
216 |
|
} |
217 |
< |
|
218 |
< |
|
217 |
> |
|
218 |
> |
|
219 |
|
if(abs(id)==24){ |
220 |
< |
|
381 |
< |
Win=i; |
220 |
> |
|
221 |
|
VHbbEventAuxInfo::ParticleMCInfo wtemp; |
222 |
|
wtemp.status=st; |
223 |
|
wtemp.charge=p.charge(); |
224 |
|
if(p.mother(0)!=0) wtemp.momid=p.mother(0)->pdgId(); |
225 |
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) wtemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
226 |
|
wtemp.p4=GENPTOLOR(p); |
227 |
< |
|
227 |
> |
|
228 |
|
int ndau = p.numberOfDaughters(); |
229 |
|
for(int j = 0; j < ndau; ++ j) { |
230 |
|
const Candidate * Wdau = p.daughter( j ); |
236 |
|
|
237 |
|
if(abs(id)==23){ |
238 |
|
|
239 |
< |
Zin=i; |
239 |
> |
|
240 |
|
VHbbEventAuxInfo::ParticleMCInfo ztemp; |
241 |
|
ztemp.status=st; |
242 |
|
ztemp.charge=p.charge(); |
258 |
|
|
259 |
|
|
260 |
|
if(id==5){ |
261 |
< |
bin=i; |
261 |
> |
|
262 |
|
VHbbEventAuxInfo::ParticleMCInfo btemp; |
263 |
|
btemp.status=st; |
264 |
|
btemp.charge=p.charge(); |
265 |
|
if(p.mother(0)!=0) btemp.momid=p.mother(0)->pdgId(); |
266 |
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) btemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
267 |
+ |
|
268 |
+ |
btemp.p4=GENPTOLOR(p); |
269 |
+ |
|
270 |
+ |
int nHDaubdau = p.numberOfDaughters(); |
271 |
+ |
for(int j = 0; j < nHDaubdau; ++ j) { |
272 |
+ |
const Candidate * Bdau = p.daughter( j ); |
273 |
+ |
btemp.dauid.push_back(Bdau->pdgId()); |
274 |
+ |
} |
275 |
|
auxInfo->mcB.push_back(btemp); |
276 |
|
} |
277 |
|
|
278 |
|
if(id==-5){ |
279 |
< |
bbarin=i; |
279 |
> |
|
280 |
|
VHbbEventAuxInfo::ParticleMCInfo bbtemp; |
281 |
|
|
282 |
|
bbtemp.status=st; |
283 |
|
bbtemp.charge=p.charge(); |
284 |
|
if(p.mother(0)!=0) bbtemp.momid=p.mother(0)->pdgId(); |
285 |
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) bbtemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
286 |
+ |
|
287 |
+ |
bbtemp.p4=GENPTOLOR(p); |
288 |
+ |
|
289 |
+ |
int nHDaubdau = p.numberOfDaughters(); |
290 |
+ |
for(int j = 0; j < nHDaubdau; ++ j) { |
291 |
+ |
const Candidate * Bdau = p.daughter( j ); |
292 |
+ |
bbtemp.dauid.push_back(Bdau->pdgId()); |
293 |
+ |
} |
294 |
+ |
|
295 |
+ |
|
296 |
|
auxInfo->mcBbar.push_back(bbtemp); |
297 |
|
} |
298 |
|
|
302 |
|
ctemp.charge=p.charge(); |
303 |
|
if(p.mother(0)!=0) ctemp.momid=p.mother(0)->pdgId(); |
304 |
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) ctemp.gmomid=p.mother(0)->mother(0)->pdgId(); |
305 |
+ |
|
306 |
+ |
ctemp.p4=GENPTOLOR(p); |
307 |
+ |
|
308 |
+ |
int nHDaubdau = p.numberOfDaughters(); |
309 |
+ |
for(int j = 0; j < nHDaubdau; ++ j) { |
310 |
+ |
const Candidate * Bdau = p.daughter( j ); |
311 |
+ |
ctemp.dauid.push_back(Bdau->pdgId()); |
312 |
+ |
} |
313 |
+ |
|
314 |
|
auxInfo->mcC.push_back(ctemp); |
315 |
+ |
|
316 |
|
} |
450 |
– |
|
451 |
– |
if(bin!=-99 && bbarin!=-99){ |
452 |
– |
const Candidate & bGen = (*genParticles)[bin]; |
453 |
– |
const Candidate & bbarGen = (*genParticles)[bbarin]; |
454 |
– |
((auxInfo->mcB).back()).p4=GENPTOLOR(bGen); |
455 |
– |
((auxInfo->mcBbar).back()).p4=GENPTOLOR(bbarGen); |
456 |
– |
|
457 |
– |
int nHDaubdau = bGen.numberOfDaughters(); |
458 |
– |
for(int j = 0; j < nHDaubdau; ++ j) { |
459 |
– |
const Candidate * Bdau = bGen.daughter( j ); |
460 |
– |
((auxInfo->mcB).back()).dauid.push_back(Bdau->pdgId()); |
461 |
– |
((auxInfo->mcB).back()).dauFourMomentum.push_back(GENPTOLORP(Bdau)); |
462 |
– |
} |
463 |
– |
int nHDaubbardau = bbarGen.numberOfDaughters(); |
464 |
– |
for(int j = 0; j < nHDaubbardau; ++ j) { |
465 |
– |
const Candidate * Bbardau = bbarGen.daughter( j ); |
466 |
– |
((auxInfo->mcBbar).back()).dauid.push_back(Bbardau->pdgId()); |
467 |
– |
((auxInfo->mcBbar).back()).dauFourMomentum.push_back(GENPTOLORP(Bbardau)); |
468 |
– |
} |
469 |
– |
|
470 |
– |
} |
317 |
|
|
318 |
|
} |
319 |
|
|
474 |
– |
|
320 |
|
} // isMC |
321 |
|
|
322 |
|
/////// end generator block |
359 |
|
iEvent.getByLabel(eleLabel_,electronHandle); |
360 |
|
edm::View<pat::Electron> electrons = *electronHandle; |
361 |
|
|
517 |
– |
edm::Handle<edm::View<pat::MET> > metHandle; |
518 |
– |
iEvent.getByLabel(metLabel_,metHandle); |
519 |
– |
edm::View<pat::MET> mets = *metHandle; |
362 |
|
|
363 |
|
// edm::Handle<edm::View<pat::Photon> > phoHandle; |
364 |
|
// iEvent.getByLabel(phoLabel_,phoHandle); |
400 |
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVT",mistagSF_CSVT_); |
401 |
|
const BtagPerformance & mistagSF_CSVT = *(mistagSF_CSVT_.product()); |
402 |
|
|
403 |
+ |
BTagSFContainer btagSFs; |
404 |
+ |
btagSFs.BTAGSF_CSVL = (bTagSF_CSVL_.product()); |
405 |
+ |
btagSFs.BTAGSF_CSVM = (bTagSF_CSVM_.product()); |
406 |
+ |
btagSFs.BTAGSF_CSVT = (bTagSF_CSVT_.product()); |
407 |
+ |
btagSFs.MISTAGSF_CSVL = (mistagSF_CSVL_.product()); |
408 |
+ |
btagSFs.MISTAGSF_CSVM = (mistagSF_CSVM_.product()); |
409 |
+ |
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product()); |
410 |
|
|
411 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){ |
412 |
|
// if(jet_iter->pt()>50) |
413 |
|
// njetscounter++; |
414 |
|
VHbbEvent::SimpleJet sj; |
415 |
< |
sj.flavour = jet_iter->partonFlavour(); |
415 |
> |
fillSimpleJet(sj,jet_iter); |
416 |
> |
// if(!runOnMC_) |
417 |
|
|
418 |
< |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
569 |
< |
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
570 |
< |
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags"); |
571 |
< |
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags"); |
572 |
< |
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); |
573 |
< |
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags"); |
574 |
< |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
575 |
< |
sj.charge=jet_iter->jetCharge(); |
576 |
< |
sj.ntracks=jet_iter->associatedTracks().size(); |
577 |
< |
sj.p4=GENPTOLORP(jet_iter); |
578 |
< |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
579 |
< |
sj.SF_CSVL=1; |
580 |
< |
sj.SF_CSVM=1; |
581 |
< |
sj.SF_CSVT=1; |
582 |
< |
sj.SF_CSVLerr=0; |
583 |
< |
sj.SF_CSVMerr=0; |
584 |
< |
sj.SF_CSVTerr=0; |
585 |
< |
// |
586 |
< |
// add tVector |
587 |
< |
// |
588 |
< |
sj.tVector = getTvect(&(*jet_iter)); |
418 |
> |
setJecUnc(sj,jecUnc); |
419 |
|
|
420 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
421 |
|
|
422 |
|
if(runOnMC_){ |
423 |
< |
double minb1DR=9999.; |
424 |
< |
//scale factor |
425 |
< |
BinningPointByMap measurePoint; |
426 |
< |
//for a USDG |
427 |
< |
//for CB jets |
428 |
< |
//scale factor 1 for CB jets over 240GeV/c |
429 |
< |
if( TMath::Abs(sj.flavour) == 4 or TMath::Abs(sj.flavour) == 5 ){ |
430 |
< |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
431 |
< |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
432 |
< |
if( bTagSF_CSVL.isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
433 |
< |
sj.SF_CSVL = bTagSF_CSVL.getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
434 |
< |
sj.SF_CSVLerr = bTagSF_CSVL.getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
435 |
< |
if(verbose_){ |
436 |
< |
std::clog << "C/B Jet flavour = " << sj.flavour << std::endl; |
437 |
< |
std::clog << "C/B Jet Et = " << sj.p4.Et() << std::endl; |
438 |
< |
std::clog << "C/B Jet eta = " << sj.p4.Eta() << std::endl; |
439 |
< |
std::clog << "C/B Scale Factor = " << sj.SF_CSVL << std::endl; |
440 |
< |
std::clog << "C/B Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
441 |
< |
} |
612 |
< |
} |
613 |
< |
if( bTagSF_CSVM.isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
614 |
< |
sj.SF_CSVM = bTagSF_CSVM.getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
615 |
< |
sj.SF_CSVMerr = bTagSF_CSVM.getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
616 |
< |
} |
617 |
< |
if( bTagSF_CSVT.isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
618 |
< |
sj.SF_CSVT = bTagSF_CSVT.getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
619 |
< |
sj.SF_CSVTerr = bTagSF_CSVT.getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
620 |
< |
} |
621 |
< |
else{ |
622 |
< |
std::cerr << "No SF found in the database for this jet" << std::endl; |
623 |
< |
if(verbose_){ |
624 |
< |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
625 |
< |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
626 |
< |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
627 |
< |
} |
423 |
> |
|
424 |
> |
fillScaleFactors(sj, btagSFs); |
425 |
> |
|
426 |
> |
//PAT genJet matching |
427 |
> |
//genJet |
428 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
429 |
> |
//physical parton for mother info ONLY |
430 |
> |
if( (jet_iter->genParton()) |
431 |
> |
and (jet_iter->genParton()->mother()) ) |
432 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
433 |
> |
TLorentzVector gJp4; |
434 |
> |
if(gJ){ |
435 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
436 |
> |
sj. bestMCp4mom = gJp4; |
437 |
> |
if(verbose_){ |
438 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
439 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
440 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
441 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
442 |
|
} |
443 |
|
} |
444 |
< |
else { |
445 |
< |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
446 |
< |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
447 |
< |
if( mistagSF_CSVL.isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
448 |
< |
sj.SF_CSVL = mistagSF_CSVL.getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
449 |
< |
sj.SF_CSVLerr = mistagSF_CSVL.getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
450 |
< |
if(verbose_){ |
451 |
< |
std::clog << "Light Jet flavour = " << sj.flavour << std::endl; |
452 |
< |
std::clog << "Light Jet Et = " << sj.p4.Et() << std::endl; |
453 |
< |
std::clog << "Light Jet eta = " << sj.p4.Eta() << std::endl; |
454 |
< |
std::clog << "Light Scale Factor = " << sj.SF_CSVL << std::endl; |
455 |
< |
std::clog << "Light Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
456 |
< |
} |
457 |
< |
} |
458 |
< |
if( mistagSF_CSVM.isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
459 |
< |
sj.SF_CSVM = mistagSF_CSVM.getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
460 |
< |
sj.SF_CSVMerr = mistagSF_CSVM.getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
461 |
< |
} |
462 |
< |
if( mistagSF_CSVT.isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
463 |
< |
sj.SF_CSVT = mistagSF_CSVT.getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
464 |
< |
sj.SF_CSVTerr = mistagSF_CSVT.getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
465 |
< |
} |
466 |
< |
else{ |
467 |
< |
std::cerr << "No SF found in the database for this jet" << std::endl; |
468 |
< |
if(verbose_){ |
469 |
< |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
470 |
< |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
471 |
< |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
472 |
< |
} |
444 |
> |
|
445 |
> |
} //isMC |
446 |
> |
hbbInfo->simpleJets.push_back(sj); |
447 |
> |
|
448 |
> |
} |
449 |
> |
|
450 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){ |
451 |
> |
// if(jet_iter->pt()>50) |
452 |
> |
// njetscounter++; |
453 |
> |
VHbbEvent::SimpleJet sj; |
454 |
> |
fillSimpleJet(sj,jet_iter); |
455 |
> |
// if(!runOnMC_) |
456 |
> |
setJecUnc(sj,jecUnc); |
457 |
> |
|
458 |
> |
|
459 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
460 |
> |
|
461 |
> |
if(runOnMC_){ |
462 |
> |
|
463 |
> |
fillScaleFactors(sj, btagSFs); |
464 |
> |
|
465 |
> |
//PAT genJet matching |
466 |
> |
//genJet |
467 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
468 |
> |
//physical parton for mother info ONLY |
469 |
> |
if( (jet_iter->genParton()) |
470 |
> |
and (jet_iter->genParton()->mother()) ) |
471 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
472 |
> |
TLorentzVector gJp4; |
473 |
> |
if(gJ){ |
474 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
475 |
> |
sj. bestMCp4mom = gJp4; |
476 |
> |
if(verbose_){ |
477 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
478 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
479 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
480 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
481 |
|
} |
482 |
|
} |
483 |
+ |
|
484 |
+ |
} //isMC |
485 |
+ |
hbbInfo->simpleJets3.push_back(sj); |
486 |
+ |
|
487 |
+ |
} |
488 |
|
|
489 |
< |
for(size_t i = 0; i < genParticles->size(); ++ i) { |
490 |
< |
const GenParticle & p = (*genParticles)[i]; |
491 |
< |
int id = p.pdgId(); |
492 |
< |
if(abs(id)<=6 || id==21 || id==23 || abs(id)==24){ |
493 |
< |
TLorentzVector bestMCp4_,bestMCp4mom_; |
494 |
< |
double bb1DR=TMath::Sqrt((p.eta()-p4Jet.eta())*(p.eta()-p4Jet.eta())+ |
495 |
< |
(p.phi()-p4Jet.phi())*(p.phi()-p4Jet.phi())); |
496 |
< |
if(bb1DR<minb1DR){ |
497 |
< |
minb1DR=bb1DR; |
498 |
< |
sj.bestMCid=id; |
499 |
< |
bestMCp4_.SetPtEtaPhiE(p.pt(),p.eta(),p.phi(),p.energy()); |
500 |
< |
sj.bestMCp4= bestMCp4_; |
501 |
< |
if(p.mother()!=0){ |
502 |
< |
sj.bestMCmomid=p.mother()->pdgId(); |
503 |
< |
bestMCp4mom_.SetPtEtaPhiE(p.mother()->pt(),p.mother()->eta(),p.mother()->phi(),p.mother()->energy()); |
504 |
< |
sj.bestMCp4mom=bestMCp4mom_; |
505 |
< |
} |
506 |
< |
} |
489 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){ |
490 |
> |
// if(jet_iter->pt()>50) |
491 |
> |
// njetscounter++; |
492 |
> |
VHbbEvent::SimpleJet sj; |
493 |
> |
fillSimpleJet(sj,jet_iter); |
494 |
> |
// if(!runOnMC_) |
495 |
> |
setJecUnc(sj,jecUnc); |
496 |
> |
|
497 |
> |
|
498 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
499 |
> |
|
500 |
> |
if(runOnMC_){ |
501 |
> |
|
502 |
> |
fillScaleFactors(sj, btagSFs); |
503 |
> |
|
504 |
> |
//PAT genJet matching |
505 |
> |
//genJet |
506 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
507 |
> |
//physical parton for mother info ONLY |
508 |
> |
if( (jet_iter->genParton()) |
509 |
> |
and (jet_iter->genParton()->mother()) ) |
510 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
511 |
> |
TLorentzVector gJp4; |
512 |
> |
if(gJ){ |
513 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
514 |
> |
sj. bestMCp4mom = gJp4; |
515 |
> |
if(verbose_){ |
516 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
517 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
518 |
> |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
519 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
520 |
|
} |
521 |
|
} |
522 |
+ |
|
523 |
|
} //isMC |
524 |
< |
hbbInfo->simpleJets.push_back(sj); |
524 |
> |
hbbInfo->simpleJets4.push_back(sj); |
525 |
|
|
526 |
|
} |
527 |
< |
|
527 |
> |
|
528 |
|
|
529 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){ |
530 |
|
|
531 |
|
VHbbEvent::SimpleJet sj; |
532 |
< |
sj.flavour = jet_iter->partonFlavour(); |
532 |
> |
fillSimpleJet(sj,jet_iter); |
533 |
> |
// if(!runOnMC_) |
534 |
> |
setJecUnc(sj,jecUnc); |
535 |
> |
/* sj.flavour = jet_iter->partonFlavour(); |
536 |
|
|
537 |
|
|
538 |
|
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
546 |
|
sj.ntracks=jet_iter->associatedTracks().size(); |
547 |
|
sj.p4=GENPTOLORP(jet_iter); |
548 |
|
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
549 |
< |
sj.tVector = getTvect(&(*jet_iter)); |
549 |
> |
sj.SF_CSVL=1; |
550 |
> |
sj.SF_CSVM=1; |
551 |
> |
sj.SF_CSVT=1; |
552 |
> |
sj.SF_CSVLerr=0; |
553 |
> |
sj.SF_CSVMerr=0; |
554 |
> |
sj.SF_CSVTerr=0; |
555 |
> |
|
556 |
> |
// |
557 |
> |
// addtaginfo for csv |
558 |
> |
// |
559 |
> |
|
560 |
> |
if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
561 |
|
|
562 |
+ |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
563 |
+ |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
564 |
+ |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
565 |
+ |
Measurement1D m = tf->flightDistance(0); |
566 |
+ |
sj.vtx3dL = m.value(); |
567 |
+ |
sj.vtx3deL = m.error(); |
568 |
+ |
} |
569 |
+ |
|
570 |
+ |
|
571 |
+ |
// |
572 |
+ |
// add tVector |
573 |
+ |
// |
574 |
+ |
sj.tVector = getTvect(&(*jet_iter)); |
575 |
+ |
*/ |
576 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
577 |
|
|
578 |
+ |
|
579 |
|
if(runOnMC_){ |
580 |
< |
double minb2DR=9999.; |
581 |
< |
for(size_t i = 0; i < genParticles->size(); ++ i) { |
582 |
< |
const GenParticle & p = (*genParticles)[i]; |
583 |
< |
int id = p.pdgId(); |
584 |
< |
if(abs(id)<=6 || id==21 || id==23 || abs(id)==24){ |
585 |
< |
double bb2DR=TMath::Sqrt((p.eta()-p4Jet.eta())*(p.eta()-p4Jet.eta())+ |
586 |
< |
(p.phi()-p4Jet.phi())*(p.phi()-p4Jet.phi())); |
587 |
< |
if(bb2DR<minb2DR) {minb2DR=bb2DR; sj.bestMCid=id; if(p.mother()!=0) sj.bestMCmomid=p.mother()->pdgId();} |
580 |
> |
|
581 |
> |
//BTV scale factors |
582 |
> |
fillScaleFactors(sj, btagSFs); |
583 |
> |
|
584 |
> |
//PAT genJet matching |
585 |
> |
//genJet |
586 |
> |
const reco::GenJet *gJ = jet_iter->genJet(); |
587 |
> |
//physical parton for mother info ONLY |
588 |
> |
if( (jet_iter->genParton()) |
589 |
> |
and (jet_iter->genParton()->mother()) ) |
590 |
> |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
591 |
> |
TLorentzVector gJp4; |
592 |
> |
if(gJ){ |
593 |
> |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
594 |
> |
sj. bestMCp4mom = gJp4; |
595 |
> |
if(verbose_){ |
596 |
> |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
597 |
> |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
598 |
> |
std::clog << "genJet matched deltaR = " << gJp4.DeltaR(sj.p4) << std::endl; |
599 |
> |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
600 |
|
} |
601 |
|
} |
602 |
+ |
|
603 |
|
} //isMC |
604 |
|
|
605 |
|
hbbInfo->simpleJets2.push_back(sj); |
638 |
|
VHbbEvent::HardJet hj; |
639 |
|
hj.constituents=constituents.size(); |
640 |
|
hj.p4 =GENPTOLORP(jet_iter); |
641 |
< |
|
641 |
> |
|
642 |
|
for (unsigned int iJC(0); iJC<constituents.size(); ++iJC ){ |
643 |
|
Jet::Constituent icandJet = constituents[iJC]; |
644 |
|
|
671 |
|
<< "," << subjet_iter->bDiscriminator("combinedSecondaryVertexBJetTags") << "\n";} |
672 |
|
|
673 |
|
VHbbEvent::SimpleJet sj; |
674 |
< |
|
675 |
< |
sj.flavour = subjet_iter->partonFlavour(); |
674 |
> |
fillSimpleJet(sj,subjet_iter); |
675 |
> |
// if(!runOnMC_) |
676 |
> |
setJecUnc(sj,jecUnc); |
677 |
> |
/* sj.flavour = subjet_iter->partonFlavour(); |
678 |
|
sj.tVector = getTvect(&(*subjet_iter)); |
679 |
|
sj.tche=subjet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
680 |
|
sj.tchp=subjet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
687 |
|
sj.ntracks=subjet_iter->associatedTracks().size(); |
688 |
|
sj.p4=GENPTOLORP(subjet_iter); |
689 |
|
sj.p4=(getChargedTracksMomentum(&*(subjet_iter))); |
690 |
+ |
|
691 |
+ |
// |
692 |
+ |
// addtaginfo for csv |
693 |
+ |
// |
694 |
+ |
|
695 |
+ |
if (subjet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
696 |
+ |
|
697 |
+ |
const reco::SecondaryVertexTagInfo * tf = subjet_iter->tagInfoSecondaryVertex(); |
698 |
+ |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
699 |
+ |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
700 |
+ |
Measurement1D m = tf->flightDistance(0); |
701 |
+ |
sj.vtx3dL = m.value(); |
702 |
+ |
sj.vtx3deL = m.error(); |
703 |
+ |
} |
704 |
+ |
*/ |
705 |
|
hbbInfo->subJets.push_back(sj); |
706 |
|
|
707 |
|
} |
716 |
|
edm::View<pat::MET> metsTC = *metTCHandle; |
717 |
|
if(metsTC.size()){ |
718 |
|
hbbInfo->tcmet.sumEt=(metsTC[0]).sumEt(); |
719 |
< |
hbbInfo->tcmet.metSig=(metsTC[0]).mEtSig(); |
719 |
> |
hbbInfo->tcmet.metSig=(metsTC[0]).significance(); |
720 |
|
hbbInfo->tcmet.eLong=(metsTC[0]).e_longitudinal(); |
721 |
|
hbbInfo->tcmet.p4=GENPTOLOR((metsTC[0])); |
722 |
|
if (verbose_) std::cout <<" METTC "<< hbbInfo->tcmet.metSig <<" " << hbbInfo->tcmet.sumEt<<std::endl; |
723 |
|
} |
724 |
|
|
725 |
+ |
|
726 |
+ |
edm::Handle<edm::View<reco::MET> > mHTHandle; |
727 |
+ |
iEvent.getByLabel("patMETsHT",mHTHandle); |
728 |
+ |
edm::View<reco::MET> metsHT = *mHTHandle; |
729 |
+ |
if(metsHT.size()){ |
730 |
+ |
hbbInfo->mht.sumEt=(metsHT[0]).sumEt(); |
731 |
+ |
hbbInfo->mht.metSig=(metsHT[0]).significance(); |
732 |
+ |
hbbInfo->mht.eLong=(metsHT[0]).e_longitudinal(); |
733 |
+ |
hbbInfo->mht.p4=GENPTOLOR((metsHT[0])); |
734 |
+ |
if (verbose_) std::cout <<" METHT "<< hbbInfo->mht.metSig <<" " << hbbInfo->mht.sumEt<<std::endl; |
735 |
+ |
} |
736 |
+ |
|
737 |
+ |
edm::Handle<edm::View<pat::MET> > metHandle; |
738 |
+ |
iEvent.getByLabel(metLabel_,metHandle); |
739 |
+ |
edm::View<pat::MET> mets = *metHandle; |
740 |
+ |
|
741 |
|
if(mets.size()){ |
742 |
|
hbbInfo->calomet.sumEt=(mets[0]).sumEt(); |
743 |
< |
hbbInfo->calomet.metSig=(mets[0]).mEtSig(); |
743 |
> |
hbbInfo->calomet.metSig=(mets[0]).significance(); |
744 |
|
hbbInfo->calomet.eLong=(mets[0]).e_longitudinal(); |
745 |
|
hbbInfo->calomet.p4=GENPTOLOR((mets[0])); |
746 |
< |
if (verbose_) std::cout <<" METTC "<< hbbInfo->calomet.metSig <<" " << hbbInfo->calomet.sumEt<<std::endl; |
746 |
> |
if (verbose_) std::cout <<" METCALO "<< hbbInfo->calomet.metSig <<" " << hbbInfo->calomet.sumEt<<std::endl; |
747 |
|
} |
832 |
– |
|
748 |
|
|
749 |
|
edm::Handle<edm::View<pat::MET> > metPFHandle; |
750 |
|
iEvent.getByLabel("patMETsPF",metPFHandle); |
751 |
|
edm::View<pat::MET> metsPF = *metPFHandle; |
752 |
< |
|
752 |
> |
|
753 |
|
if(metsPF.size()){ |
754 |
|
hbbInfo->pfmet.sumEt=(metsPF[0]).sumEt(); |
755 |
< |
hbbInfo->pfmet.metSig=(metsPF[0]).mEtSig(); |
755 |
> |
hbbInfo->pfmet.metSig=(metsPF[0]).significance(); |
756 |
|
hbbInfo->pfmet.eLong=(metsPF[0]).e_longitudinal(); |
757 |
|
hbbInfo->pfmet.p4=GENPTOLOR((metsPF[0])); |
758 |
< |
if (verbose_) std::cout <<" METTC "<< hbbInfo->pfmet.metSig <<" " << hbbInfo->pfmet.sumEt<<std::endl; |
758 |
> |
if (verbose_) std::cout <<" METPF "<< hbbInfo->pfmet.metSig <<" " << hbbInfo->pfmet.sumEt<<std::endl; |
759 |
|
} |
760 |
< |
|
761 |
< |
|
760 |
> |
|
761 |
> |
|
762 |
|
if(verbose_){ |
763 |
< |
std::cout << "METs: calomet "<<mets.size()<<" tcmet "<<metsTC.size()<<" pfmet "<<metsPF.size()<<std::endl; |
763 |
> |
std::cout << "METs: calomet "<<mets.size()<<" tcmet"<<metsTC.size()<<" pfmet "<<metsPF.size()<<" MHT" <<metsHT.size()<<std::endl; |
764 |
|
} |
765 |
|
|
766 |
< |
std::cout << " INPUT MUONS "<<muons.size()<<std::endl; |
766 |
> |
if(verbose_) |
767 |
> |
std::cout << " INPUT MUONS "<<muons.size()<<std::endl; |
768 |
|
|
769 |
|
for(edm::View<pat::Muon>::const_iterator mu = muons.begin(); mu!=muons.end(); ++mu){ |
770 |
|
VHbbEvent::MuonInfo mf; |
782 |
|
|
783 |
|
mf.ipDb=mu->dB(); |
784 |
|
mf.ipErrDb=mu->edB(); |
785 |
< |
if(mu->isGlobalMuon()) mf.cat=1; |
786 |
< |
else if(mu->isTrackerMuon()) mf.cat=2; |
787 |
< |
else mf.cat=3; |
785 |
> |
mf.cat=0; |
786 |
> |
if(mu->isGlobalMuon()) mf.cat|=1; |
787 |
> |
if(mu->isTrackerMuon()) mf.cat|=2; |
788 |
> |
if(mu->isStandAloneMuon()) mf.cat|=4; |
789 |
|
TrackRef trkMu1Ref = mu->get<TrackRef>(); |
790 |
|
if(trkMu1Ref.isNonnull()){ |
791 |
|
const Track* MuTrk1 = mu->get<TrackRef>().get(); |
811 |
|
//Muon trigger matching |
812 |
|
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
813 |
|
std::string trigName=triggerNames_.triggerName(itrig); |
814 |
< |
if( (mu->triggerObjectMatchesByPath(trigName).size() != 0) ){ |
814 |
> |
if( (mu->triggerObjectMatchesByPath(trigName,false,false).size() != 0) ){ |
815 |
|
mf.hltMatchedBits.push_back(itrig); |
816 |
|
if(verbose_){ |
817 |
|
std::clog << "Trigger Matching box" << std::endl; |
819 |
|
std::clog << "Matching parameters are defined in the cfg" << std::endl; |
820 |
|
std::clog << "Trigger bit = " << itrig << std::endl; |
821 |
|
std::clog << "Trigger name = " << trigName << std::endl; |
822 |
< |
std::clog << "Trigger object matched collection size = " << mu->triggerObjectMatchesByPath(trigName).size() << std::endl; |
822 |
> |
std::clog << "Trigger object matched collection size = " << mu->triggerObjectMatchesByPath(trigName,false,false).size() << std::endl; |
823 |
|
std::clog << "Pat Muon pt = " << mf.p4.Pt() << " HLT object matched = " << mu->triggerObjectMatch(0)->p4().Pt() << std::endl; |
824 |
|
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl; |
825 |
|
} |
848 |
|
hbbInfo->muInfo.push_back(mf); |
849 |
|
} |
850 |
|
|
851 |
< |
std::cout << " INPUT electrons "<<electrons.size()<<std::endl; |
851 |
> |
if(verbose_) |
852 |
> |
std::cout << " INPUT electrons "<<electrons.size()<<std::endl; |
853 |
|
for(edm::View<pat::Electron>::const_iterator elec = electrons.begin(); elec!=electrons.end(); ++elec){ |
854 |
|
VHbbEvent::ElectronInfo ef; |
855 |
|
ef.p4=GENPTOLORP(elec); |
885 |
|
ef.id70 =elec->electronID("eidVBTFCom70"); |
886 |
|
ef.id70r=elec->electronID("eidVBTFRel70"); |
887 |
|
|
888 |
< |
//Muon trigger matching |
888 |
> |
//Electron trigger matching |
889 |
|
for (int itrig = 0; itrig != ntrigs; ++itrig){ |
890 |
|
std::string trigName=triggerNames_.triggerName(itrig); |
891 |
|
if( (elec->triggerObjectMatchesByPath(trigName).size() != 0) ){ |
914 |
|
hbbInfo->eleInfo.push_back(ef); |
915 |
|
} |
916 |
|
|
917 |
< |
|
918 |
< |
std::cout << " INPUT taus "<<taus.size()<<std::endl; |
917 |
> |
if(verbose_) |
918 |
> |
std::cout << " INPUT taus "<<taus.size()<<std::endl; |
919 |
|
for(edm::View<pat::Tau>::const_iterator tau = taus.begin(); tau!=taus.end(); ++tau){ |
920 |
|
VHbbEvent::TauInfo tf; |
921 |
|
tf.p4=GENPTOLORP(tau); |
936 |
|
hbbInfo->tauInfo.push_back(tf); |
937 |
|
} |
938 |
|
|
939 |
+ |
CompareJetPtMuons ptComparatorMu; |
940 |
+ |
CompareJetPtElectrons ptComparatorE; |
941 |
+ |
CompareJetPtTaus ptComparatorTau; |
942 |
+ |
|
943 |
+ |
std::sort(hbbInfo->muInfo.begin(), hbbInfo->muInfo.end(), ptComparatorMu); |
944 |
+ |
std::sort(hbbInfo->eleInfo.begin(), hbbInfo->eleInfo.end(), ptComparatorE); |
945 |
+ |
std::sort(hbbInfo->tauInfo.begin(), hbbInfo->tauInfo.end(), ptComparatorTau); |
946 |
+ |
|
947 |
|
|
948 |
|
// dimuons and dielectrons |
949 |
|
|
975 |
|
df.daughter1.ipErrDb=muonDau0.edB(); |
976 |
|
df.daughter2.ipErrDb=muonDau1.edB(); |
977 |
|
|
978 |
< |
|
979 |
< |
if(muonDau0.isGlobalMuon()) df.daughter1.cat =1; |
980 |
< |
else if(muonDau0.isTrackerMuon()) df.daughter1.cat=2; |
981 |
< |
else df.daughter1.cat=3; |
982 |
< |
if(muonDau1.isGlobalMuon()) df.daughter2.cat =1; |
983 |
< |
else if(muonDau1.isTrackerMuon()) df.daughter2.cat=2; |
984 |
< |
else df.daughter2.cat=3; |
978 |
> |
df.daughter1.cat=0; |
979 |
> |
if(muonDau0.isGlobalMuon()) df.daughter1.cat|=1; |
980 |
> |
if(muonDau0.isTrackerMuon()) df.daughter1.cat|=2; |
981 |
> |
if(muonDau0.isStandAloneMuon()) df.daughter1.cat|=4; |
982 |
> |
df.daughter2.cat=0; |
983 |
> |
if(muonDau1.isGlobalMuon()) df.daughter2.cat|=1; |
984 |
> |
if(muonDau1.isTrackerMuon()) df.daughter2.cat|=2; |
985 |
> |
if(muonDau1.isStandAloneMuon()) df.daughter2.cat|=4; |
986 |
|
|
987 |
|
TrackRef trkMu1Ref = muonDau0.get<TrackRef>(); |
988 |
|
TrackRef trkMu2Ref = muonDau1.get<TrackRef>(); |
1200 |
|
//re- |
1201 |
|
} |
1202 |
|
|
1203 |
+ |
|
1204 |
+ |
//Btagging scale factors |
1205 |
+ |
void HbbAnalyzerNew::fillScaleFactors(VHbbEvent::SimpleJet& sj, BTagSFContainer iSF){ |
1206 |
+ |
|
1207 |
+ |
|
1208 |
+ |
BinningPointByMap measurePoint; |
1209 |
+ |
//for a USDG |
1210 |
+ |
//for CB jets |
1211 |
+ |
//scale factor 1 for CB jets over 240GeV/c |
1212 |
+ |
if( TMath::Abs(sj.flavour) == 4 or TMath::Abs(sj.flavour) == 5 ){ |
1213 |
+ |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
1214 |
+ |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
1215 |
+ |
if( iSF.BTAGSF_CSVL->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1216 |
+ |
sj.SF_CSVL = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1217 |
+ |
sj.SF_CSVLerr = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1218 |
+ |
if(verbose_){ |
1219 |
+ |
std::clog << "C/B Jet flavour = " << sj.flavour << std::endl; |
1220 |
+ |
std::clog << "C/B Jet Et = " << sj.p4.Et() << std::endl; |
1221 |
+ |
std::clog << "C/B Jet eta = " << sj.p4.Eta() << std::endl; |
1222 |
+ |
std::clog << "C/B CSVL Scale Factor = " << sj.SF_CSVL << std::endl; |
1223 |
+ |
std::clog << "C/B CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
1224 |
+ |
} |
1225 |
+ |
} |
1226 |
+ |
if( iSF.BTAGSF_CSVM->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1227 |
+ |
sj.SF_CSVM = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1228 |
+ |
sj.SF_CSVMerr = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1229 |
+ |
} |
1230 |
+ |
if( iSF.BTAGSF_CSVT->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){ |
1231 |
+ |
sj.SF_CSVT = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint); |
1232 |
+ |
sj.SF_CSVTerr = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBERRCORR , measurePoint); |
1233 |
+ |
} |
1234 |
+ |
else{ |
1235 |
+ |
if(verbose_){ |
1236 |
+ |
std::cerr << "No SF found in the database for this jet" << std::endl; |
1237 |
+ |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
1238 |
+ |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
1239 |
+ |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
1240 |
+ |
} |
1241 |
+ |
} |
1242 |
+ |
} |
1243 |
+ |
else { |
1244 |
+ |
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() ); |
1245 |
+ |
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) ); |
1246 |
+ |
if( iSF.MISTAGSF_CSVL->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1247 |
+ |
sj.SF_CSVL = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1248 |
+ |
sj.SF_CSVLerr = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1249 |
+ |
if(verbose_){ |
1250 |
+ |
std::clog << "Light Jet flavour = " << sj.flavour << std::endl; |
1251 |
+ |
std::clog << "Light Jet Et = " << sj.p4.Et() << std::endl; |
1252 |
+ |
std::clog << "Light Jet eta = " << sj.p4.Eta() << std::endl; |
1253 |
+ |
std::clog << "Light CSVL Scale Factor = " << sj.SF_CSVL << std::endl; |
1254 |
+ |
std::clog << "Light CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl; |
1255 |
+ |
} |
1256 |
+ |
} |
1257 |
+ |
if( iSF.MISTAGSF_CSVM->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1258 |
+ |
sj.SF_CSVM = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1259 |
+ |
sj.SF_CSVMerr = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1260 |
+ |
} |
1261 |
+ |
if( iSF.MISTAGSF_CSVT->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){ |
1262 |
+ |
sj.SF_CSVT = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint); |
1263 |
+ |
sj.SF_CSVTerr = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLERRCORR , measurePoint); |
1264 |
+ |
} |
1265 |
+ |
else{ |
1266 |
+ |
if(verbose_){ |
1267 |
+ |
std::cerr << "No SF found in the database for this jet" << std::endl; |
1268 |
+ |
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl; |
1269 |
+ |
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl; |
1270 |
+ |
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl; |
1271 |
+ |
} |
1272 |
+ |
} |
1273 |
+ |
} |
1274 |
+ |
|
1275 |
+ |
} |
1276 |
+ |
|
1277 |
+ |
void HbbAnalyzerNew::setJecUnc(VHbbEvent::SimpleJet& sj,JetCorrectionUncertainty* jecunc){ |
1278 |
+ |
// |
1279 |
+ |
// test |
1280 |
+ |
// |
1281 |
+ |
|
1282 |
+ |
return; |
1283 |
+ |
double eta = sj.p4.Eta(); |
1284 |
+ |
double pt = sj.p4.Pt(); |
1285 |
+ |
|
1286 |
+ |
jecunc->setJetEta(eta); |
1287 |
+ |
jecunc->setJetPt(pt); // here you must use the CORRECTED jet pt |
1288 |
+ |
double unc = jecunc->getUncertainty(true); |
1289 |
+ |
sj.jecunc= unc; |
1290 |
+ |
} |
1291 |
+ |
|
1292 |
+ |
|
1293 |
+ |
void HbbAnalyzerNew ::fillSimpleJet (VHbbEvent::SimpleJet& sj, edm::View<pat::Jet>::const_iterator jet_iter){ |
1294 |
+ |
sj.flavour = jet_iter->partonFlavour(); |
1295 |
+ |
|
1296 |
+ |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
1297 |
+ |
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
1298 |
+ |
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags"); |
1299 |
+ |
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags"); |
1300 |
+ |
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); |
1301 |
+ |
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags"); |
1302 |
+ |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
1303 |
+ |
sj.charge=jet_iter->jetCharge(); |
1304 |
+ |
sj.ntracks=jet_iter->associatedTracks().size(); |
1305 |
+ |
sj.p4=GENPTOLORP(jet_iter); |
1306 |
+ |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
1307 |
+ |
sj.SF_CSVL=1; |
1308 |
+ |
sj.SF_CSVM=1; |
1309 |
+ |
sj.SF_CSVT=1; |
1310 |
+ |
sj.SF_CSVLerr=0; |
1311 |
+ |
sj.SF_CSVMerr=0; |
1312 |
+ |
sj.SF_CSVTerr=0; |
1313 |
+ |
|
1314 |
+ |
|
1315 |
+ |
if (jet_iter->isPFJet() == true) { |
1316 |
+ |
|
1317 |
+ |
sj.chargedHadronEFraction = jet_iter-> chargedHadronEnergyFraction(); |
1318 |
+ |
sj.neutralHadronEFraction = jet_iter-> neutralHadronEnergyFraction (); |
1319 |
+ |
sj.chargedEmEFraction = jet_iter-> chargedEmEnergyFraction (); |
1320 |
+ |
sj.neutralEmEFraction = jet_iter-> neutralEmEnergyFraction (); |
1321 |
+ |
sj. nConstituents = jet_iter->getPFConstituents().size(); |
1322 |
+ |
|
1323 |
+ |
} |
1324 |
+ |
// |
1325 |
+ |
// addtaginfo for csv |
1326 |
+ |
// |
1327 |
+ |
|
1328 |
+ |
// if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
1329 |
+ |
|
1330 |
+ |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
1331 |
+ |
if (tf){ |
1332 |
+ |
if (tf->nVertices() >0){ |
1333 |
+ |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
1334 |
+ |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
1335 |
+ |
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin(); |
1336 |
+ |
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){ |
1337 |
+ |
sj.vtxTrackIds.push_back(tit->key()); |
1338 |
+ |
} |
1339 |
+ |
Measurement1D m = tf->flightDistance(0); |
1340 |
+ |
sj.vtx3dL = m.value(); |
1341 |
+ |
sj.vtx3deL = m.error(); |
1342 |
+ |
} |
1343 |
+ |
} |
1344 |
+ |
// |
1345 |
+ |
// add tVector |
1346 |
+ |
// |
1347 |
+ |
sj.tVector = getTvect(&(*jet_iter)); |
1348 |
+ |
} |
1349 |
+ |
|
1350 |
+ |
|
1351 |
|
//define this as a plug-in |
1352 |
|
DEFINE_FWK_MODULE(HbbAnalyzerNew); |