1 |
ntran |
1.77.2.2 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: HbbAnalyzerNew
|
4 |
|
|
// Class: HbbAnalyzerNew
|
5 |
|
|
//
|
6 |
tboccali |
1.1 |
/**\class HbbAnalyzerNew HbbAnalyzerNew.cc Analysis/HbbAnalyzer/src/HbbAnalyzerNew.cc
|
7 |
ntran |
1.77.2.2 |
|
8 |
|
|
Description: <one line class summary>
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
<Notes on implementation>
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: David Lopes Pegna,Address unknown,NONE,
|
15 |
|
|
// Created: Thu Mar 5 13:51:28 EST 2009
|
16 |
ntran |
1.77.2.3 |
// $Id: HbbAnalyzerNew.cc,v 1.77.2.2 2012/11/19 20:53:44 ntran Exp $
|
17 |
ntran |
1.77.2.2 |
//
|
18 |
|
|
//
|
19 |
tboccali |
1.1 |
|
20 |
|
|
|
21 |
ntran |
1.77.2.2 |
//uncomment to save also jet collections 1 and 4
|
22 |
|
|
//#define ENABLE_SIMPLEJETS1
|
23 |
|
|
//#define ENABLE_SIMPLEJETS4
|
24 |
arizzi |
1.34 |
|
25 |
tboccali |
1.28 |
#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h"
|
26 |
|
|
#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h"
|
27 |
|
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h"
|
28 |
|
|
#include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h"
|
29 |
|
|
#include "DataFormats/TrackReco/interface/TrackFwd.h"
|
30 |
|
|
|
31 |
tboccali |
1.2 |
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbAnalyzerNew.h"
|
32 |
tboccali |
1.33 |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
|
33 |
tboccali |
1.5 |
|
34 |
arizzi |
1.34 |
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
|
35 |
degrutto |
1.58 |
#include "DataFormats/Math/interface/deltaR.h"
|
36 |
degrutto |
1.61 |
#include "DataFormats/Math/interface/LorentzVector.h"
|
37 |
|
|
#include "DataFormats/Math/interface/Vector3D.h"
|
38 |
|
|
#include "Math/GenVector/PxPyPzM4D.h"
|
39 |
|
|
|
40 |
arizzi |
1.70 |
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
|
41 |
|
|
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
|
42 |
|
|
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
|
43 |
|
|
#include "TrackingTools/IPTools/interface/IPTools.h"
|
44 |
|
|
|
45 |
degrutto |
1.73 |
#include "CMGTools/External/interface/PileupJetIdentifier.h"
|
46 |
|
|
#include "CMGTools/External/interface/PileupJetIdAlgo.h"
|
47 |
ntran |
1.77.2.2 |
//#include "CMGTools/External/interface/PileupJetIdProducer.h"
|
48 |
degrutto |
1.61 |
|
49 |
|
|
#include <cmath>
|
50 |
|
|
|
51 |
|
|
|
52 |
degrutto |
1.58 |
|
53 |
arizzi |
1.34 |
|
54 |
tboccali |
1.1 |
#define GENPTOLOR(a) TLorentzVector((a).px(), (a).py(), (a).pz(), (a).energy())
|
55 |
|
|
#define GENPTOLORP(a) TLorentzVector((a)->px(), (a)->py(), (a)->pz(), (a)->energy())
|
56 |
|
|
|
57 |
tboccali |
1.28 |
|
58 |
degrutto |
1.58 |
|
59 |
tboccali |
1.28 |
struct CompareJetPtMuons {
|
60 |
ntran |
1.77.2.2 |
bool operator()( const VHbbEvent::MuonInfo& j1, const VHbbEvent::MuonInfo& j2 ) const {
|
61 |
|
|
return j1.p4.Pt() > j2.p4.Pt();
|
62 |
|
|
}
|
63 |
tboccali |
1.28 |
};
|
64 |
|
|
struct CompareJetPtElectrons {
|
65 |
ntran |
1.77.2.2 |
bool operator()( const VHbbEvent::ElectronInfo& j1, const VHbbEvent::ElectronInfo& j2 ) const {
|
66 |
|
|
return j1.p4.Pt() > j2.p4.Pt();
|
67 |
|
|
}
|
68 |
tboccali |
1.28 |
};
|
69 |
|
|
struct CompareJetPtTaus {
|
70 |
ntran |
1.77.2.2 |
bool operator()( const VHbbEvent::TauInfo& j1, const VHbbEvent::TauInfo& j2 ) const {
|
71 |
|
|
return j1.p4.Pt() > j2.p4.Pt();
|
72 |
|
|
}
|
73 |
tboccali |
1.28 |
};
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
tboccali |
1.1 |
HbbAnalyzerNew::HbbAnalyzerNew(const edm::ParameterSet& iConfig):
|
78 |
ntran |
1.77.2.2 |
eleLabel_(iConfig.getParameter<edm::InputTag>("electronTag")),
|
79 |
|
|
muoLabel_(iConfig.getParameter<edm::InputTag>("muonTag")),
|
80 |
|
|
lep_ptCutForBjets_(iConfig.getParameter<double>("lep_ptCutForBjets")),
|
81 |
|
|
elenoCutsLabel_(iConfig.getParameter<edm::InputTag>("electronNoCutsTag")),
|
82 |
|
|
muonoCutsLabel_(iConfig.getParameter<edm::InputTag>("muonNoCutsTag")),
|
83 |
|
|
jetLabel_(iConfig.getParameter<edm::InputTag>("jetTag")),
|
84 |
|
|
subjetLabel_(iConfig.getParameter<edm::InputTag>("subjetTag")),
|
85 |
|
|
filterjetLabel_(iConfig.getParameter<edm::InputTag>("filterjetTag")),
|
86 |
|
|
simplejet1Label_(iConfig.getParameter<edm::InputTag>("simplejet1Tag")),
|
87 |
|
|
simplejet2Label_(iConfig.getParameter<edm::InputTag>("simplejet2Tag")),
|
88 |
|
|
simplejet3Label_(iConfig.getParameter<edm::InputTag>("simplejet3Tag")),
|
89 |
|
|
simplejet4Label_(iConfig.getParameter<edm::InputTag>("simplejet4Tag")),
|
90 |
|
|
tauLabel_(iConfig.getParameter<edm::InputTag>("tauTag")),
|
91 |
|
|
metLabel_(iConfig.getParameter<edm::InputTag>("metTag")),
|
92 |
|
|
phoLabel_(iConfig.getParameter<edm::InputTag>("photonTag")),
|
93 |
|
|
hltResults_(iConfig.getParameter<edm::InputTag>("hltResultsTag")),
|
94 |
|
|
runOnMC_(iConfig.getParameter<bool>("runOnMC")), verbose_(iConfig.getUntrackedParameter<bool>("verbose")) {
|
95 |
|
|
|
96 |
|
|
//
|
97 |
|
|
// put the setwhatproduced etc etc
|
98 |
|
|
|
99 |
|
|
produces<VHbbEvent>();
|
100 |
|
|
produces<VHbbEventAuxInfo>();
|
101 |
|
|
|
102 |
|
|
|
103 |
tboccali |
1.1 |
}
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
HbbAnalyzerNew::~HbbAnalyzerNew(){
|
107 |
ntran |
1.77.2.2 |
|
108 |
|
|
// do anything here that needs to be done at desctruction time
|
109 |
|
|
// (e.g. close files, deallocate resources etc.)
|
110 |
|
|
|
111 |
tboccali |
1.1 |
}
|
112 |
|
|
|
113 |
|
|
|
114 |
ntran |
1.77.2.2 |
//
|
115 |
|
|
// member functions
|
116 |
|
|
//
|
117 |
tboccali |
1.1 |
|
118 |
ntran |
1.77.2.2 |
// ------------ method called to for each event ------------
|
119 |
tboccali |
1.1 |
void
|
120 |
|
|
HbbAnalyzerNew::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){
|
121 |
ntran |
1.77.2.2 |
using namespace edm;
|
122 |
|
|
using namespace reco;
|
123 |
tboccali |
1.1 |
|
124 |
|
|
|
125 |
ntran |
1.77.2.2 |
// JEC Uncertainty
|
126 |
tboccali |
1.1 |
|
127 |
ntran |
1.77.2.2 |
// JetCorrectionUncertainty *jecUnc=0;
|
128 |
|
|
edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl;
|
129 |
|
|
iSetup.get<JetCorrectionsRecord>().get("AK5PFchs",JetCorParColl);
|
130 |
|
|
JetCorrectionUncertainty *jecUnc=0;
|
131 |
|
|
// if (!runOnMC_){
|
132 |
|
|
JetCorrectorParameters const & JetCorPar = (*JetCorParColl)["Uncertainty"];
|
133 |
|
|
jecUnc = new JetCorrectionUncertainty(JetCorPar);
|
134 |
|
|
// }
|
135 |
|
|
|
136 |
|
|
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() );
|
137 |
|
|
std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() );
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
if (runOnMC_){
|
141 |
|
|
Handle<GenEventInfoProduct> evt_info;
|
142 |
|
|
iEvent.getByType(evt_info);
|
143 |
|
|
auxInfo->weightMCProd = evt_info->weight();
|
144 |
|
|
}
|
145 |
|
|
else
|
146 |
|
|
{ auxInfo->weightMCProd =1.;}
|
147 |
|
|
//
|
148 |
|
|
// ??
|
149 |
|
|
|
150 |
ntran |
1.77.2.3 |
//eventNo
|
151 |
|
|
auxInfo->run = iEvent.id().run();
|
152 |
|
|
auxInfo->event = iEvent.id().event();
|
153 |
|
|
auxInfo->lumi = iEvent.luminosityBlock();
|
154 |
|
|
auxInfo->bunch = iEvent.bunchCrossing();
|
155 |
|
|
|
156 |
ntran |
1.77.2.2 |
// trigger
|
157 |
|
|
|
158 |
|
|
// trigger
|
159 |
|
|
edm::Handle<edm::TriggerResults> hltresults;
|
160 |
|
|
//iEvent.getByLabel("TriggerResults", hltresults);
|
161 |
|
|
|
162 |
|
|
//edm::InputTag tag("TriggerResults::HLT");
|
163 |
|
|
// edm::InputTag tag("TriggerResults::HLT0");
|
164 |
|
|
iEvent.getByLabel(hltResults_, hltresults);
|
165 |
|
|
|
166 |
|
|
const edm::TriggerNames & triggerNames_ = iEvent.triggerNames(*hltresults);
|
167 |
|
|
|
168 |
|
|
int ntrigs = hltresults->size();
|
169 |
|
|
if (ntrigs==0){std::cerr << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;}
|
170 |
|
|
|
171 |
|
|
BeamSpot vertexBeamSpot;
|
172 |
|
|
edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
|
173 |
|
|
iEvent.getByLabel("offlineBeamSpot",recoBeamSpotHandle);
|
174 |
|
|
vertexBeamSpot = *recoBeamSpotHandle;
|
175 |
|
|
/*
|
176 |
|
|
double BSx=vertexBeamSpot.x0();
|
177 |
|
|
double BSy=vertexBeamSpot.y0();
|
178 |
|
|
double BSz=vertexBeamSpot.z0();
|
179 |
|
|
*/
|
180 |
|
|
|
181 |
|
|
double MinVtxProb=-999.;
|
182 |
|
|
int VtxIn=-99;
|
183 |
|
|
|
184 |
|
|
Handle<reco::VertexCollection> recVtxs;
|
185 |
|
|
iEvent.getByLabel("offlinePrimaryVertices", recVtxs);
|
186 |
|
|
|
187 |
|
|
auxInfo->pvInfo.nVertices = recVtxs->size();
|
188 |
|
|
|
189 |
|
|
for(size_t i = 0; i < recVtxs->size(); ++ i) {
|
190 |
|
|
const Vertex &vtx = (*recVtxs)[i];
|
191 |
|
|
double RecVtxProb=TMath::Prob(vtx.chi2(),vtx.ndof());
|
192 |
|
|
if(RecVtxProb>MinVtxProb){
|
193 |
|
|
VtxIn=i;
|
194 |
|
|
MinVtxProb=RecVtxProb;
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
tboccali |
1.30 |
|
198 |
ntran |
1.77.2.2 |
const Vertex &RecVtx = (*recVtxs)[VtxIn];
|
199 |
|
|
const Vertex &RecVtxFirst = (*recVtxs)[0];
|
200 |
|
|
const Vertex &vertex = RecVtxFirst; //used in ele id 2012
|
201 |
|
|
|
202 |
|
|
auxInfo->pvInfo.firstPVInPT2 = TVector3(RecVtxFirst.x(), RecVtxFirst.y(), RecVtxFirst.z());
|
203 |
|
|
auxInfo->pvInfo.firstPVInProb = TVector3(RecVtx.x(), RecVtx.y(), RecVtx.z());
|
204 |
|
|
|
205 |
|
|
(auxInfo->pvInfo).efirstPVInPT2 = (RecVtxFirst.error());
|
206 |
|
|
(auxInfo->pvInfo).efirstPVInProb = RecVtx.error();
|
207 |
|
|
|
208 |
|
|
edm::Handle<double> rhoHandle;
|
209 |
|
|
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle);
|
210 |
|
|
auxInfo->puInfo.rho = *rhoHandle;
|
211 |
|
|
|
212 |
|
|
edm::Handle<double> rho25Handle;
|
213 |
|
|
iEvent.getByLabel(edm::InputTag("kt6PFJets25", "rho"),rho25Handle);
|
214 |
|
|
auxInfo->puInfo.rho25 = *rho25Handle;
|
215 |
|
|
edm::Handle<double> rho25HandleIso;
|
216 |
|
|
iEvent.getByLabel(edm::InputTag("kt6PFJetsForIsolation", "rho"),rho25HandleIso);
|
217 |
|
|
auxInfo->puInfo.rho25Iso = *rho25HandleIso;
|
218 |
|
|
|
219 |
|
|
edm::Handle<double> rhoNeutralHandle;
|
220 |
|
|
iEvent.getByLabel(edm::InputTag("kt6PFJetsCentralNeutral", "rho"),rhoNeutralHandle);
|
221 |
|
|
auxInfo->puInfo.rhoNeutral = *rhoNeutralHandle;
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
edm::Handle<std::vector< PileupSummaryInfo> > puHandle;
|
225 |
|
|
|
226 |
|
|
if (runOnMC_){
|
227 |
|
|
iEvent.getByType(puHandle);
|
228 |
|
|
if (puHandle.isValid()){
|
229 |
|
|
|
230 |
|
|
std::vector< PileupSummaryInfo> pu = (*puHandle);
|
231 |
|
|
for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){
|
232 |
|
|
int bx = (*it).getBunchCrossing();
|
233 |
|
|
if(bx == 0) { auxInfo->puInfo.truePU = (*it).getTrueNumInteractions();}
|
234 |
|
|
unsigned int num = (*it).getPU_NumInteractions();
|
235 |
|
|
// std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl;
|
236 |
|
|
auxInfo->puInfo.pus[bx] =num;
|
237 |
|
|
}
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
tboccali |
1.30 |
|
241 |
ntran |
1.77.2.2 |
//// real start
|
242 |
tboccali |
1.1 |
|
243 |
degrutto |
1.73 |
|
244 |
ntran |
1.77.2.2 |
Handle<GenParticleCollection> genParticles;
|
245 |
|
|
|
246 |
|
|
bool printJet=0;
|
247 |
tboccali |
1.1 |
|
248 |
|
|
|
249 |
tboccali |
1.3 |
if(runOnMC_){
|
250 |
ntran |
1.77.2.2 |
|
251 |
|
|
iEvent.getByLabel("genParticles", genParticles);
|
252 |
|
|
|
253 |
|
|
for(size_t i = 0; i < genParticles->size(); ++ i) {
|
254 |
|
|
|
255 |
|
|
const GenParticle & p = (*genParticles)[i];
|
256 |
|
|
int id = p.pdgId();
|
257 |
|
|
int st = p.status();
|
258 |
|
|
|
259 |
|
|
if(id==25){
|
260 |
|
|
|
261 |
|
|
VHbbEventAuxInfo::ParticleMCInfo htemp;
|
262 |
|
|
htemp.status=st;
|
263 |
|
|
htemp.charge=p.charge();
|
264 |
|
|
if(p.mother(0)!=0) htemp.momid=p.mother(0)->pdgId();
|
265 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) htemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
266 |
|
|
htemp.p4 = GENPTOLOR(p);
|
267 |
|
|
|
268 |
|
|
int ndau = p.numberOfDaughters();
|
269 |
|
|
for(int j = 0; j < ndau; ++ j) {
|
270 |
|
|
const Candidate * Hdau = p.daughter( j );
|
271 |
|
|
htemp.dauid.push_back(Hdau->pdgId());
|
272 |
|
|
htemp.dauFourMomentum.push_back(GENPTOLORP(Hdau));
|
273 |
|
|
}
|
274 |
|
|
(auxInfo->mcH).push_back(htemp);
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
if(abs(id)==24){
|
279 |
|
|
|
280 |
|
|
VHbbEventAuxInfo::ParticleMCInfo wtemp;
|
281 |
|
|
wtemp.status=st;
|
282 |
|
|
wtemp.charge=p.charge();
|
283 |
|
|
if(p.mother(0)!=0) wtemp.momid=p.mother(0)->pdgId();
|
284 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) wtemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
285 |
|
|
wtemp.p4=GENPTOLOR(p);
|
286 |
|
|
|
287 |
|
|
int ndau = p.numberOfDaughters();
|
288 |
|
|
for(int j = 0; j < ndau; ++ j) {
|
289 |
|
|
const Candidate * Wdau = p.daughter( j );
|
290 |
|
|
wtemp.dauid.push_back(Wdau->pdgId());
|
291 |
|
|
wtemp.dauFourMomentum.push_back(GENPTOLORP(Wdau));
|
292 |
|
|
}
|
293 |
|
|
auxInfo->mcW.push_back(wtemp);
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
if(abs(id)==15) {
|
297 |
|
|
VHbbEventAuxInfo::ParticleMCInfo tautemp;
|
298 |
|
|
tautemp.status=st;
|
299 |
|
|
tautemp.charge=p.charge();
|
300 |
|
|
if(p.mother(0)!=0) tautemp.momid=p.mother(0)->pdgId();
|
301 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) tautemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
302 |
|
|
tautemp.p4=GENPTOLOR(p);
|
303 |
|
|
|
304 |
|
|
int ndau = p.numberOfDaughters();
|
305 |
|
|
for(int j = 0; j < ndau; ++ j) {
|
306 |
|
|
const Candidate * Taudau = p.daughter( j );
|
307 |
|
|
tautemp.dauid.push_back(Taudau->pdgId());
|
308 |
|
|
tautemp.dauFourMomentum.push_back(GENPTOLORP(Taudau));
|
309 |
|
|
}
|
310 |
|
|
auxInfo->mcTau.push_back(tautemp);
|
311 |
|
|
}
|
312 |
|
|
|
313 |
|
|
if(abs(id)==23){
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
VHbbEventAuxInfo::ParticleMCInfo ztemp;
|
317 |
|
|
ztemp.status=st;
|
318 |
|
|
ztemp.charge=p.charge();
|
319 |
|
|
if(p.mother(0)!=0) ztemp.momid=p.mother(0)->pdgId();
|
320 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) ztemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
321 |
|
|
ztemp.p4=GENPTOLOR(p);
|
322 |
|
|
|
323 |
|
|
int ndau = p.numberOfDaughters();
|
324 |
|
|
for(int j = 0; j < ndau; ++ j) {
|
325 |
|
|
const Candidate * Zdau = p.daughter( j );
|
326 |
|
|
ztemp.dauid.push_back(Zdau->pdgId());
|
327 |
|
|
ztemp.dauFourMomentum.push_back(GENPTOLORP(Zdau));
|
328 |
|
|
}
|
329 |
|
|
auxInfo->mcZ.push_back(ztemp);
|
330 |
|
|
}
|
331 |
|
|
//
|
332 |
|
|
// binfo
|
333 |
|
|
//
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
if(id==5){
|
337 |
|
|
|
338 |
|
|
VHbbEventAuxInfo::ParticleMCInfo btemp;
|
339 |
|
|
btemp.status=st;
|
340 |
|
|
btemp.charge=p.charge();
|
341 |
|
|
if(p.mother(0)!=0) btemp.momid=p.mother(0)->pdgId();
|
342 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) btemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
343 |
|
|
|
344 |
|
|
btemp.p4=GENPTOLOR(p);
|
345 |
|
|
|
346 |
|
|
int nHDaubdau = p.numberOfDaughters();
|
347 |
|
|
for(int j = 0; j < nHDaubdau; ++ j) {
|
348 |
|
|
const Candidate * Bdau = p.daughter( j );
|
349 |
|
|
btemp.dauid.push_back(Bdau->pdgId());
|
350 |
|
|
}
|
351 |
|
|
auxInfo->mcB.push_back(btemp);
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
if(id==-5){
|
355 |
|
|
|
356 |
|
|
VHbbEventAuxInfo::ParticleMCInfo bbtemp;
|
357 |
|
|
|
358 |
|
|
bbtemp.status=st;
|
359 |
|
|
bbtemp.charge=p.charge();
|
360 |
|
|
if(p.mother(0)!=0) bbtemp.momid=p.mother(0)->pdgId();
|
361 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) bbtemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
362 |
|
|
|
363 |
|
|
bbtemp.p4=GENPTOLOR(p);
|
364 |
|
|
|
365 |
|
|
int nHDaubdau = p.numberOfDaughters();
|
366 |
|
|
for(int j = 0; j < nHDaubdau; ++ j) {
|
367 |
|
|
const Candidate * Bdau = p.daughter( j );
|
368 |
|
|
bbtemp.dauid.push_back(Bdau->pdgId());
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
auxInfo->mcBbar.push_back(bbtemp);
|
373 |
|
|
}
|
374 |
|
|
|
375 |
|
|
if(abs(id)==4){
|
376 |
|
|
VHbbEventAuxInfo::ParticleMCInfo ctemp;
|
377 |
|
|
ctemp.status=st;
|
378 |
|
|
ctemp.charge=p.charge();
|
379 |
|
|
if(p.mother(0)!=0) ctemp.momid=p.mother(0)->pdgId();
|
380 |
|
|
if(p.mother(0)!=0 && p.mother(0)->mother(0)!=0) ctemp.gmomid=p.mother(0)->mother(0)->pdgId();
|
381 |
|
|
|
382 |
|
|
ctemp.p4=GENPTOLOR(p);
|
383 |
|
|
|
384 |
|
|
int nHDaubdau = p.numberOfDaughters();
|
385 |
|
|
for(int j = 0; j < nHDaubdau; ++ j) {
|
386 |
|
|
const Candidate * Bdau = p.daughter( j );
|
387 |
|
|
ctemp.dauid.push_back(Bdau->pdgId());
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
auxInfo->mcC.push_back(ctemp);
|
391 |
|
|
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
} // isMC
|
397 |
degrutto |
1.61 |
|
398 |
ntran |
1.77.2.2 |
/////// end generator block
|
399 |
degrutto |
1.58 |
|
400 |
ntran |
1.77.2.2 |
/// photon used in isolation
|
401 |
|
|
edm::Handle<edm::View<reco::PFCandidate> > photonIsoH;
|
402 |
|
|
iEvent.getByLabel("pfAllPhotons",photonIsoH);
|
403 |
|
|
edm::View<reco::PFCandidate> photonsForIso = *photonIsoH;
|
404 |
|
|
|
405 |
|
|
edm::Handle<edm::View<pat::Muon> > muonHandle;
|
406 |
|
|
iEvent.getByLabel(muoLabel_,muonHandle);
|
407 |
|
|
edm::View<pat::Muon> muons = *muonHandle;
|
408 |
|
|
|
409 |
|
|
// hard jet
|
410 |
|
|
edm::Handle<edm::View<pat::Jet> > jetHandle;
|
411 |
|
|
iEvent.getByLabel(jetLabel_,jetHandle);
|
412 |
|
|
edm::View<pat::Jet> jets = *jetHandle;
|
413 |
|
|
|
414 |
|
|
// sub jet
|
415 |
|
|
edm::Handle<edm::View<pat::Jet> > subjetHandle;
|
416 |
|
|
iEvent.getByLabel(subjetLabel_,subjetHandle);
|
417 |
|
|
edm::View<pat::Jet> subjets = *subjetHandle;
|
418 |
|
|
|
419 |
|
|
// filter jet
|
420 |
|
|
edm::Handle<edm::View<pat::Jet> > filterjetHandle;
|
421 |
|
|
iEvent.getByLabel(filterjetLabel_,filterjetHandle);
|
422 |
|
|
edm::View<pat::Jet> filterjets = *filterjetHandle;
|
423 |
|
|
|
424 |
|
|
// standard jets
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
edm::Handle<edm::View<pat::Jet> > simplejet2Handle;
|
428 |
|
|
iEvent.getByLabel(simplejet2Label_,simplejet2Handle);
|
429 |
|
|
edm::View<pat::Jet> simplejets2 = *simplejet2Handle;
|
430 |
|
|
|
431 |
|
|
edm::Handle<edm::View<pat::Jet> > simplejet3Handle;
|
432 |
|
|
iEvent.getByLabel(simplejet3Label_,simplejet3Handle);
|
433 |
|
|
edm::View<pat::Jet> simplejets3 = *simplejet3Handle;
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
edm::Handle<edm::View<pat::Electron> > electronHandle;
|
438 |
|
|
iEvent.getByLabel(eleLabel_,electronHandle);
|
439 |
|
|
edm::View<pat::Electron> electrons = *electronHandle;
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
// edm::Handle<edm::View<pat::Photon> > phoHandle;
|
443 |
|
|
// iEvent.getByLabel(phoLabel_,phoHandle);
|
444 |
|
|
// edm::View<pat::Photon> photons = *phoHandle;
|
445 |
|
|
|
446 |
|
|
edm::Handle<edm::View<pat::Tau> > tauHandle;
|
447 |
|
|
iEvent.getByLabel(tauLabel_,tauHandle);
|
448 |
|
|
edm::View<pat::Tau> taus = *tauHandle;
|
449 |
|
|
|
450 |
|
|
//Get the computer for the CSV
|
451 |
|
|
ESHandle<JetTagComputer> handle;
|
452 |
|
|
iSetup.get<JetTagComputerRecord>().get("combinedSecondaryVertex", handle);
|
453 |
|
|
computer = dynamic_cast<const GenericMVAJetTagComputer*>(handle.product());
|
454 |
|
|
|
455 |
|
|
//BTAGGING SCALE FACTOR FROM DATABASE
|
456 |
|
|
//Combined Secondary Vertex Loose
|
457 |
|
|
edm::ESHandle<BtagPerformance> bTagSF_CSVL_;
|
458 |
|
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVL",bTagSF_CSVL_);
|
459 |
|
|
//Combined Secondary Vertex Medium
|
460 |
|
|
edm::ESHandle<BtagPerformance> bTagSF_CSVM_;
|
461 |
|
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVM",bTagSF_CSVM_);
|
462 |
|
|
//Combined Secondary Vertex Tight
|
463 |
|
|
edm::ESHandle<BtagPerformance> bTagSF_CSVT_;
|
464 |
|
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVT",bTagSF_CSVT_);
|
465 |
|
|
|
466 |
|
|
edm::ESHandle<BtagPerformance> mistagSF_CSVL_;
|
467 |
|
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVL",mistagSF_CSVL_);
|
468 |
|
|
//Combined Secondary Vertex Medium
|
469 |
|
|
edm::ESHandle<BtagPerformance> mistagSF_CSVM_;
|
470 |
|
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVM",mistagSF_CSVM_);
|
471 |
|
|
//Combined Secondary Vertex Tight
|
472 |
|
|
edm::ESHandle<BtagPerformance> mistagSF_CSVT_;
|
473 |
|
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVT",mistagSF_CSVT_);
|
474 |
|
|
|
475 |
|
|
BTagSFContainer btagSFs;
|
476 |
|
|
btagSFs.BTAGSF_CSVL = (bTagSF_CSVL_.product());
|
477 |
|
|
btagSFs.BTAGSF_CSVM = (bTagSF_CSVM_.product());
|
478 |
|
|
btagSFs.BTAGSF_CSVT = (bTagSF_CSVT_.product());
|
479 |
|
|
btagSFs.MISTAGSF_CSVL = (mistagSF_CSVL_.product());
|
480 |
|
|
btagSFs.MISTAGSF_CSVM = (mistagSF_CSVM_.product());
|
481 |
|
|
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product());
|
482 |
|
|
|
483 |
|
|
#ifdef ENABLE_SIMPLEJETS1
|
484 |
|
|
edm::Handle<edm::View<pat::Jet> > simplejet1Handle;
|
485 |
|
|
iEvent.getByLabel(simplejet1Label_,simplejet1Handle);
|
486 |
|
|
edm::View<pat::Jet> simplejets1 = *simplejet1Handle;
|
487 |
|
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){
|
488 |
|
|
// if(jet_iter->pt()>50)
|
489 |
|
|
// njetscounter++;
|
490 |
|
|
VHbbEvent::SimpleJet sj;
|
491 |
|
|
// std::cout <<" sj1"<<std::endl;
|
492 |
|
|
fillSimpleJet(sj,jet_iter);
|
493 |
|
|
// if(!runOnMC_)
|
494 |
|
|
|
495 |
|
|
setJecUnc(sj,jecUnc);
|
496 |
|
|
|
497 |
|
|
Particle::LorentzVector p4Jet = jet_iter->p4();
|
498 |
|
|
|
499 |
|
|
if(runOnMC_){
|
500 |
|
|
|
501 |
|
|
fillScaleFactors(sj, btagSFs);
|
502 |
|
|
|
503 |
|
|
//PAT genJet matching
|
504 |
|
|
//genJet
|
505 |
|
|
const reco::GenJet *gJ = jet_iter->genJet();
|
506 |
|
|
//physical parton for mother info ONLY
|
507 |
|
|
if( (jet_iter->genParton()) ){
|
508 |
|
|
sj.bestMCid = jet_iter->genParton()->pdgId();
|
509 |
|
|
if( (jet_iter->genParton()->mother()) )
|
510 |
|
|
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
|
511 |
|
|
}
|
512 |
|
|
TLorentzVector gJp4;
|
513 |
|
|
if(gJ){
|
514 |
|
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
|
515 |
|
|
sj.bestMCp4 = gJp4;
|
516 |
|
|
if(verbose_){
|
517 |
|
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
|
518 |
|
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
|
519 |
|
|
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl;
|
520 |
|
|
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
|
521 |
|
|
}
|
522 |
|
|
}
|
523 |
|
|
|
524 |
|
|
} //isMC
|
525 |
|
|
hbbInfo->simpleJets.push_back(sj);
|
526 |
|
|
|
527 |
degrutto |
1.58 |
}
|
528 |
ntran |
1.77.2.2 |
#endif //ENABLE_SIMPLEJETS1
|
529 |
degrutto |
1.58 |
|
530 |
ntran |
1.77.2.2 |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){
|
531 |
|
|
// if(jet_iter->pt()>50)
|
532 |
|
|
// njetscounter++;
|
533 |
|
|
VHbbEvent::SimpleJet sj;
|
534 |
|
|
// std::cout <<" sj3"<<std::endl;
|
535 |
|
|
fillSimpleJet(sj,jet_iter);
|
536 |
|
|
// if(!runOnMC_)
|
537 |
|
|
setJecUnc(sj,jecUnc);
|
538 |
|
|
|
539 |
|
|
Particle::LorentzVector p4Jet = jet_iter->p4();
|
540 |
|
|
|
541 |
|
|
if(runOnMC_){
|
542 |
|
|
|
543 |
|
|
fillScaleFactors(sj, btagSFs);
|
544 |
|
|
|
545 |
|
|
//PAT genJet matching
|
546 |
|
|
//genJet
|
547 |
|
|
const reco::GenJet *gJ = jet_iter->genJet();
|
548 |
|
|
//physical parton for mother info ONLY
|
549 |
|
|
if( (jet_iter->genParton()) ){
|
550 |
|
|
sj.bestMCid = jet_iter->genParton()->pdgId();
|
551 |
|
|
if( (jet_iter->genParton()->mother()) )
|
552 |
|
|
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
|
553 |
|
|
}
|
554 |
|
|
TLorentzVector gJp4;
|
555 |
|
|
if(gJ){
|
556 |
|
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
|
557 |
|
|
sj.bestMCp4 = gJp4;
|
558 |
|
|
if(verbose_){
|
559 |
|
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
|
560 |
|
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
|
561 |
|
|
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl;
|
562 |
|
|
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
|
563 |
|
|
}
|
564 |
|
|
}
|
565 |
|
|
|
566 |
|
|
} //isMC
|
567 |
|
|
//
|
568 |
|
|
|
569 |
|
|
|
570 |
|
|
hbbInfo->simpleJets3.push_back(sj);
|
571 |
|
|
|
572 |
|
|
}
|
573 |
degrutto |
1.61 |
|
574 |
ntran |
1.77.2.2 |
#ifdef ENABLE_SIMPLEJETS4
|
575 |
|
|
edm::Handle<edm::View<pat::Jet> > simplejet4Handle;
|
576 |
|
|
iEvent.getByLabel(simplejet4Label_,simplejet4Handle);
|
577 |
|
|
edm::View<pat::Jet> simplejets4 = *simplejet4Handle;
|
578 |
|
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){
|
579 |
|
|
// if(jet_iter->pt()>50)
|
580 |
|
|
// njetscounter++;
|
581 |
|
|
|
582 |
|
|
VHbbEvent::SimpleJet sj;
|
583 |
|
|
// std::cout <<" sj4"<<std::endl;
|
584 |
|
|
fillSimpleJet(sj,jet_iter);
|
585 |
|
|
// if(!runOnMC_)
|
586 |
|
|
setJecUnc(sj,jecUnc);
|
587 |
|
|
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
Particle::LorentzVector p4Jet = jet_iter->p4();
|
591 |
|
|
|
592 |
|
|
if(runOnMC_){
|
593 |
|
|
|
594 |
|
|
fillScaleFactors(sj, btagSFs);
|
595 |
|
|
|
596 |
|
|
//PAT genJet matching
|
597 |
|
|
//genJet
|
598 |
|
|
const reco::GenJet *gJ = jet_iter->genJet();
|
599 |
|
|
//physical parton for mother info ONLY
|
600 |
|
|
if( (jet_iter->genParton()) ){
|
601 |
|
|
sj.bestMCid = jet_iter->genParton()->pdgId();
|
602 |
|
|
if( (jet_iter->genParton()->mother()) )
|
603 |
|
|
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
|
604 |
|
|
}
|
605 |
|
|
TLorentzVector gJp4;
|
606 |
|
|
if(gJ){
|
607 |
|
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
|
608 |
|
|
sj.bestMCp4 = gJp4;
|
609 |
|
|
if(verbose_){
|
610 |
|
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
|
611 |
|
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
|
612 |
|
|
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl;
|
613 |
|
|
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
|
614 |
|
|
}
|
615 |
|
|
}
|
616 |
|
|
|
617 |
|
|
} //isMC
|
618 |
|
|
hbbInfo->simpleJets4.push_back(sj);
|
619 |
|
|
|
620 |
|
|
}
|
621 |
|
|
#endif //ENABLE SIMPLEJETS4
|
622 |
degrutto |
1.61 |
|
623 |
|
|
|
624 |
ntran |
1.77.2.2 |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
VHbbEvent::SimpleJet sj;
|
629 |
|
|
// std::cout <<" sj2"<<std::endl;
|
630 |
|
|
fillSimpleJet(sj,jet_iter);
|
631 |
|
|
|
632 |
|
|
///########### PU JET ID #################
|
633 |
|
|
// add puId...
|
634 |
|
|
edm::Handle<edm::ValueMap<float> > puJetIdMVA;
|
635 |
|
|
iEvent.getByLabel("puJetMva","fullDiscriminant", puJetIdMVA);
|
636 |
|
|
|
637 |
|
|
edm::Handle<edm::ValueMap<int> > puJetIdFlag;
|
638 |
|
|
iEvent.getByLabel("puJetMva", "fullId", puJetIdFlag);
|
639 |
|
|
|
640 |
|
|
// cout << " pt " << jet_iter->pt() << " eta " << jet_iter->eta() << std::endl;
|
641 |
|
|
unsigned int idx = jet_iter - simplejets2.begin();
|
642 |
|
|
|
643 |
|
|
|
644 |
|
|
|
645 |
|
|
sj.puJetIdMva = (*puJetIdMVA)[simplejets2.refAt(idx)];
|
646 |
|
|
int idflag = (*puJetIdFlag)[simplejets2.refAt(idx)];
|
647 |
|
|
|
648 |
|
|
|
649 |
|
|
// cout << " PU JetID MVA " << mva;
|
650 |
|
|
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kLoose )) {
|
651 |
|
|
//cout << " pass loose wp";
|
652 |
|
|
sj.puJetIdL =1;
|
653 |
|
|
}
|
654 |
|
|
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kMedium )) {
|
655 |
|
|
// cout << " pass medium wp";
|
656 |
|
|
sj.puJetIdM =1;
|
657 |
|
|
}
|
658 |
|
|
if( PileupJetIdentifier::passJetId( idflag, PileupJetIdentifier::kTight )) {
|
659 |
|
|
// cout << " pass tight wp";
|
660 |
|
|
sj.puJetIdT =1;
|
661 |
|
|
}
|
662 |
|
|
// cout << endl;
|
663 |
|
|
// ############# END OF PU JET ID ######################
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
// if(!runOnMC_)
|
667 |
|
|
setJecUnc(sj,jecUnc);
|
668 |
|
|
/* sj.flavour = jet_iter->partonFlavour();
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags");
|
672 |
|
|
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags");
|
673 |
|
|
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags");
|
674 |
|
|
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags");
|
675 |
|
|
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags");
|
676 |
|
|
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags");
|
677 |
|
|
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags");
|
678 |
|
|
sj.charge=jet_iter->jetCharge();
|
679 |
|
|
sj.ntracks=jet_iter->associatedTracks().size();
|
680 |
|
|
sj.p4=GENPTOLORP(jet_iter);
|
681 |
|
|
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter)));
|
682 |
|
|
sj.SF_CSVL=1;
|
683 |
|
|
sj.SF_CSVM=1;
|
684 |
|
|
sj.SF_CSVT=1;
|
685 |
|
|
sj.SF_CSVLerr=0;
|
686 |
|
|
sj.SF_CSVMerr=0;
|
687 |
|
|
sj.SF_CSVTerr=0;
|
688 |
|
|
|
689 |
|
|
|
690 |
|
|
//
|
691 |
|
|
// addtaginfo for csv
|
692 |
|
|
//
|
693 |
|
|
|
694 |
|
|
if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) {
|
695 |
|
|
|
696 |
|
|
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex();
|
697 |
|
|
sj.vtxMass = tf->secondaryVertex(0).p4().mass();
|
698 |
|
|
sj.vtxNTracks = tf->secondaryVertex(0).nTracks();
|
699 |
|
|
Measurement1D m = tf->flightDistance(0);
|
700 |
|
|
sj.vtx3dL = m.value();
|
701 |
|
|
sj.vtx3deL = m.error();
|
702 |
|
|
}
|
703 |
|
|
|
704 |
|
|
|
705 |
|
|
//
|
706 |
|
|
// add tVector
|
707 |
|
|
//
|
708 |
|
|
sj.tVector = getTvect(&(*jet_iter));
|
709 |
|
|
*/
|
710 |
|
|
Particle::LorentzVector p4Jet = jet_iter->p4();
|
711 |
|
|
|
712 |
|
|
if(runOnMC_){
|
713 |
|
|
|
714 |
|
|
//BTV scale factors
|
715 |
|
|
fillScaleFactors(sj, btagSFs);
|
716 |
|
|
|
717 |
|
|
//PAT genJet matching
|
718 |
|
|
//genJet
|
719 |
|
|
const reco::GenJet *gJ = jet_iter->genJet();
|
720 |
|
|
//physical parton for mother info ONLY
|
721 |
|
|
if( (jet_iter->genParton()) ){
|
722 |
|
|
sj.bestMCid = jet_iter->genParton()->pdgId();
|
723 |
|
|
if( (jet_iter->genParton()->mother()) )
|
724 |
|
|
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
|
725 |
|
|
}
|
726 |
|
|
TLorentzVector gJp4;
|
727 |
|
|
if(gJ){
|
728 |
|
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
|
729 |
|
|
sj.bestMCp4 = gJp4;
|
730 |
|
|
if(verbose_){
|
731 |
|
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
|
732 |
|
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
|
733 |
|
|
std::clog << "genJet matched deltaR = " << gJp4.DeltaR(sj.p4) << std::endl;
|
734 |
|
|
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
|
735 |
|
|
}
|
736 |
|
|
}
|
737 |
|
|
|
738 |
|
|
// add flag if a mc lepton is find inside a cone around the jets...
|
739 |
|
|
iEvent.getByLabel("genParticles", genParticles);
|
740 |
|
|
|
741 |
|
|
for(size_t i = 0; i < genParticles->size(); ++ i) {
|
742 |
|
|
|
743 |
|
|
const GenParticle & p = (*genParticles)[i];
|
744 |
|
|
int id = 0;
|
745 |
|
|
p.pt()> lep_ptCutForBjets_ ? id= p.pdgId(): 0;
|
746 |
|
|
|
747 |
|
|
// std::cout<< "found a muon with pt " << mu->pt() << std::endl;
|
748 |
|
|
if ((abs(id)==13 || abs(id)==11) && deltaR(p.eta(), p.phi(), sj.p4.Eta(), sj.p4.Phi() ) <0.5) sj.isSemiLeptMCtruth=1;
|
749 |
|
|
}
|
750 |
|
|
|
751 |
|
|
} //isMC
|
752 |
|
|
|
753 |
|
|
// add flag if a reco lepton is find inside a cone around the jets...
|
754 |
|
|
edm::Handle<edm::View<reco::Candidate> > muonNoCutsHandle;
|
755 |
|
|
iEvent.getByLabel(muonoCutsLabel_,muonNoCutsHandle);
|
756 |
|
|
edm::View<reco::Candidate> muonsNoCuts = *muonNoCutsHandle;
|
757 |
|
|
|
758 |
|
|
|
759 |
|
|
|
760 |
|
|
for(edm::View<reco::Candidate>::const_iterator mu = muonsNoCuts.begin(); mu!=muonsNoCuts.end() && sj.isSemiLept!=1; ++mu){
|
761 |
|
|
// std::cout<< "found a muon with pt " << mu->pt() << std::endl;
|
762 |
|
|
const pat::Muon& m = static_cast <const pat::Muon&> (*mu);
|
763 |
|
|
float Smpt = m.pt();
|
764 |
|
|
float Smeta = m.eta();
|
765 |
|
|
float Smphi = m.phi();
|
766 |
|
|
|
767 |
|
|
float SmJdR = deltaR(Smeta, Smphi, sj.p4.Eta(), sj.p4.Phi());
|
768 |
|
|
|
769 |
|
|
if ( Smpt> lep_ptCutForBjets_ && SmJdR <0.5) {
|
770 |
|
|
sj.isSemiLept=1;
|
771 |
|
|
//isSemiLept(-99), isSemiLeptMCtruth(-99), SoftLeptPt(-99), SoftLeptdR(-99), SoftLeptptRel(-99), SoftLeptpdgId(-99), SoftLeptIdlooseMu(-99), SoftLeptId95(-99), SoftLeptRelCombIso(-99),
|
772 |
|
|
sj.SoftLeptpdgId =13;
|
773 |
|
|
sj.SoftLeptdR= SmJdR;
|
774 |
|
|
sj.SoftLeptPt=Smpt;
|
775 |
|
|
TVector3 mvec ( m.p4().Vect().X(), m.p4().Vect().Y(), m.p4().Vect().Z() );
|
776 |
|
|
sj.SoftLeptptRel= sj.p4.Perp( mvec );
|
777 |
|
|
sj.SoftLeptRelCombIso = (m.trackIso() + m.ecalIso() + m.hcalIso() ) / Smpt ;
|
778 |
|
|
sj.SoftLeptIdlooseMu=m.muonID("TMLastStationLoose");
|
779 |
|
|
}
|
780 |
|
|
}
|
781 |
|
|
|
782 |
|
|
|
783 |
|
|
edm::Handle<edm::View<reco::Candidate> > eleNoCutsHandle;
|
784 |
|
|
iEvent.getByLabel(elenoCutsLabel_,eleNoCutsHandle);
|
785 |
|
|
edm::View<reco::Candidate> elesNoCuts = *eleNoCutsHandle;
|
786 |
|
|
|
787 |
|
|
|
788 |
|
|
|
789 |
|
|
for(edm::View<reco::Candidate>::const_iterator ele = elesNoCuts.begin(); ele!=elesNoCuts.end() && sj.isSemiLept!=1; ++ele){
|
790 |
|
|
|
791 |
|
|
const pat::Electron& e = static_cast <const pat::Electron&> (*ele);
|
792 |
|
|
float Smpt = e.pt();
|
793 |
|
|
float Smeta = e.eta();
|
794 |
|
|
float Smphi = e.phi();
|
795 |
|
|
|
796 |
|
|
float SmJdR = deltaR(Smeta, Smphi, sj.p4.Eta(), sj.p4.Phi());
|
797 |
|
|
if ( Smpt> lep_ptCutForBjets_ && SmJdR <0.5) {
|
798 |
|
|
sj.isSemiLept=1;
|
799 |
|
|
sj.SoftLeptpdgId =11;
|
800 |
|
|
sj.SoftLeptdR= SmJdR;
|
801 |
|
|
sj.SoftLeptPt=Smpt;
|
802 |
|
|
TVector3 mvec ( e.p4().Vect().X(), e.p4().Vect().Y(), e.p4().Vect().Z() );
|
803 |
|
|
sj.SoftLeptptRel= sj.p4.Perp( mvec );
|
804 |
|
|
sj.SoftLeptRelCombIso = (e.trackIso() + e.ecalIso() + e.hcalIso() ) / Smpt ;
|
805 |
|
|
// sj.SoftLeptId95=e.electronID("eidVBTFCom95");
|
806 |
|
|
//std::cout << "before ele id " << std::endl;
|
807 |
|
|
// std::cout << " e.e.sigmaIetaIeta " << e.sigmaIetaIeta() << std::endl;
|
808 |
|
|
//std::cout << " e.isEB() " << e.isEB() << std::endl;
|
809 |
|
|
if (
|
810 |
|
|
( fabs(Smeta)<2.5 && !( abs(Smeta)>1.4442 && abs(Smeta)<1.566)) &&
|
811 |
|
|
|
812 |
|
|
(( abs(Smeta)>1.566 && (e.sigmaIetaIeta()<0.01) && ( e.deltaPhiSuperClusterTrackAtVtx()<0.8 && e.deltaPhiSuperClusterTrackAtVtx()>-0.8) && ( e.deltaEtaSuperClusterTrackAtVtx()<0.007 && e.deltaEtaSuperClusterTrackAtVtx()>-0.007 ) )
|
813 |
|
|
|| ( abs(Smeta)<1.4442 && (e.sigmaIetaIeta()<0.03) && ( e.deltaPhiSuperClusterTrackAtVtx()<0.7 && e.deltaPhiSuperClusterTrackAtVtx()>-0.7 ) && ( e.deltaEtaSuperClusterTrackAtVtx()<0.01 && e.deltaEtaSuperClusterTrackAtVtx()>-0.01 ) ))
|
814 |
|
|
)
|
815 |
|
|
sj.SoftLeptId95=1;
|
816 |
|
|
}
|
817 |
|
|
}
|
818 |
|
|
|
819 |
|
|
|
820 |
|
|
|
821 |
|
|
|
822 |
|
|
|
823 |
|
|
hbbInfo->simpleJets2.push_back(sj);
|
824 |
|
|
|
825 |
|
|
}
|
826 |
degrutto |
1.58 |
|
827 |
tboccali |
1.1 |
|
828 |
ntran |
1.77.2.2 |
/* const GenJet* jet1Mc = bjet1.genJet();
|
829 |
|
|
const GenJet* jet2Mc = bjet2.genJet();
|
830 |
|
|
if(jet1Mc!=0){
|
831 |
|
|
MCbJet1MomId=jet1Mc->mother()->pdgId();
|
832 |
|
|
MCbJet1GMomId=jet1Mc->mother()->mother()->pdgId();
|
833 |
|
|
}
|
834 |
|
|
|
835 |
|
|
if(jet2Mc!=0){
|
836 |
|
|
MCbJet2MomId=jet2Mc->mother()->pdgId();
|
837 |
|
|
MCbJet2GMomId=jet2Mc->mother()->mother()->pdgId();
|
838 |
|
|
}
|
839 |
|
|
*/
|
840 |
tboccali |
1.1 |
|
841 |
ntran |
1.77.2.1 |
//////////////////////////////////////////////////////////////
|
842 |
|
|
//////////////////////////////////////////////////////////////
|
843 |
|
|
////// Nhan's Jets
|
844 |
|
|
|
845 |
ntran |
1.77.2.2 |
// C A 1 2 R A W J E T
|
846 |
ntran |
1.77.2.1 |
edm::Handle<edm::View<pat::Jet> > ca12jetHandle;
|
847 |
|
|
iEvent.getByLabel("selectedPatJetsCA12PF",ca12jetHandle);
|
848 |
|
|
edm::View<pat::Jet> ca12jets = *ca12jetHandle;
|
849 |
ntran |
1.77.2.2 |
edm::Handle<edm::View<pat::Jet> > camdft12jetHandle;
|
850 |
|
|
iEvent.getByLabel("selectedPatJetsCA12MassDropFilteredPF",camdft12jetHandle);
|
851 |
|
|
edm::View<pat::Jet> camdft12jets = *camdft12jetHandle;
|
852 |
|
|
|
853 |
|
|
edm::Handle<edm::View<pat::Jet> > camdft12subjetHandle;
|
854 |
|
|
iEvent.getByLabel("selectedPatJetsCA12MassDropFilteredSubjetsPF",camdft12subjetHandle);
|
855 |
|
|
edm::View<pat::Jet> camdft12subjets = *camdft12subjetHandle;
|
856 |
|
|
edm::Handle<edm::View<pat::Jet> > caft12subjetHandle;
|
857 |
|
|
iEvent.getByLabel("selectedPatJetsCA12FilteredSubjetsPF",caft12subjetHandle);
|
858 |
|
|
edm::View<pat::Jet> caft12subjets = *caft12subjetHandle;
|
859 |
|
|
edm::Handle<edm::View<pat::Jet> > capr12subjetHandle;
|
860 |
|
|
iEvent.getByLabel("selectedPatJetsCA12PrunedSubjetsPF",capr12subjetHandle);
|
861 |
|
|
edm::View<pat::Jet> capr12subjets = *capr12subjetHandle;
|
862 |
|
|
|
863 |
ntran |
1.77.2.1 |
int ctr = 0;
|
864 |
ntran |
1.77.2.2 |
// C A 1 2 R A W J E T S
|
865 |
|
|
// std::cout << "Fill CA12 Raw jet!" << std::endl;
|
866 |
ntran |
1.77.2.1 |
for(edm::View<pat::Jet>::const_iterator jet_iter = ca12jets.begin(); jet_iter!=ca12jets.end(); ++jet_iter){
|
867 |
ntran |
1.77.2.2 |
// std::cout << "jet # " << ctr << std::endl;
|
868 |
|
|
// std::cout << "size: " << jet_iter->getPFConstituents().size() << std::endl;
|
869 |
ntran |
1.77.2.1 |
|
870 |
|
|
std::vector<reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents();
|
871 |
|
|
VHbbEvent::RawJet rj;
|
872 |
|
|
rj.p4 = GENPTOLORP(jet_iter);
|
873 |
|
|
rj.Nconstituents = jet_iter->getPFConstituents().size();
|
874 |
|
|
|
875 |
|
|
for (unsigned int iJC = 0; iJC<constituents.size(); ++iJC ){
|
876 |
ntran |
1.77.2.2 |
|
877 |
ntran |
1.77.2.1 |
rj.constituents_px.push_back( jet_iter->getPFConstituents().at(iJC)->px() );
|
878 |
|
|
rj.constituents_py.push_back( jet_iter->getPFConstituents().at(iJC)->py() );
|
879 |
|
|
rj.constituents_pz.push_back( jet_iter->getPFConstituents().at(iJC)->pz() );
|
880 |
|
|
rj.constituents_e.push_back( jet_iter->getPFConstituents().at(iJC)->energy() );
|
881 |
|
|
rj.constituents_pdgId.push_back( jet_iter->getPFConstituents().at(iJC)->pdgId() );
|
882 |
|
|
}
|
883 |
|
|
|
884 |
ntran |
1.77.2.2 |
hbbInfo->CA12wConstits.push_back( rj );
|
885 |
ntran |
1.77.2.1 |
ctr++;
|
886 |
|
|
|
887 |
|
|
}
|
888 |
ntran |
1.77.2.2 |
// C A 1 2 M A S S D R O P / F I L T E R E D J E T S
|
889 |
|
|
// std::cout << "Fill CA12 MDFT jet!" << std::endl;
|
890 |
|
|
|
891 |
|
|
for(edm::View<pat::Jet>::const_iterator jet_iter = camdft12jets.begin(); jet_iter!=camdft12jets.end(); ++jet_iter){
|
892 |
|
|
|
893 |
|
|
if(printJet) {std::cout << "Jet Pt: " << jet_iter->pt() << " E,M: " << jet_iter->p4().E() << " " << jet_iter->p4().M() << "\n";}
|
894 |
|
|
|
895 |
|
|
reco::Jet::Constituents constituents = jet_iter->getJetConstituents();
|
896 |
|
|
// std::cout << "NsubJets: " << constituents.size() << "\n";
|
897 |
|
|
|
898 |
|
|
// if(printJet) {std::cout << "NsubJets: " << constituents.size() << "\n";}
|
899 |
|
|
VHbbEvent::HardJet hj;
|
900 |
|
|
hj.constituents=constituents.size();
|
901 |
|
|
hj.p4 =GENPTOLORP(jet_iter);
|
902 |
|
|
|
903 |
|
|
for (unsigned int iJC(0); iJC<constituents.size(); ++iJC ){
|
904 |
|
|
Jet::Constituent icandJet = constituents[iJC];
|
905 |
|
|
|
906 |
|
|
if(printJet) {std::cout << "subJet Pt: " << icandJet->pt() << " subJet E,M,eta,phi: " << icandJet->p4().E() << ","
|
907 |
|
|
<< icandJet->p4().M() << "," << icandJet->eta() << "," << icandJet->phi() << "\n"; }
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
hj.subFourMomentum.push_back(GENPTOLORP(icandJet));
|
911 |
|
|
hj.etaSub.push_back(icandJet->eta());
|
912 |
|
|
hj.phiSub.push_back(icandJet->phi());
|
913 |
|
|
|
914 |
|
|
// std::cout << "subjet constituents: " << icandJet->getJetConstituents.size() << std::endl;
|
915 |
|
|
|
916 |
|
|
}
|
917 |
|
|
hbbInfo->CAmdft12.push_back(hj);
|
918 |
|
|
}
|
919 |
|
|
|
920 |
|
|
// C A 1 2 M A S S D R O P / F I L T E R E D S U B J E T S
|
921 |
|
|
// std::cout << "Fill CA12 MDFT subjet!" << std::endl;
|
922 |
|
|
for(edm::View<pat::Jet>::const_iterator subjet_iter = camdft12subjets.begin(); subjet_iter!=camdft12subjets.end(); ++subjet_iter){
|
923 |
|
|
VHbbEvent::SimpleJet sj;
|
924 |
|
|
fillSimpleJet(sj,subjet_iter);
|
925 |
|
|
// setJecUnc(sj,jecUnc);
|
926 |
|
|
hbbInfo->CAmdft12_subjets.push_back(sj);
|
927 |
|
|
}
|
928 |
|
|
// C A 1 2 F I L T E R E D S U B J E T S
|
929 |
|
|
// std::cout << "Fill CA12 FT subjet!" << std::endl;
|
930 |
|
|
for(edm::View<pat::Jet>::const_iterator subjet_iter = caft12subjets.begin(); subjet_iter!=caft12subjets.end(); ++subjet_iter){
|
931 |
|
|
VHbbEvent::SimpleJet sj;
|
932 |
|
|
fillSimpleJet(sj,subjet_iter);
|
933 |
|
|
// setJecUnc(sj,jecUnc);
|
934 |
|
|
hbbInfo->CAft12_subjets.push_back(sj);
|
935 |
|
|
}
|
936 |
|
|
// C A 1 2 P R U N E D S U B J E T S
|
937 |
|
|
// std::cout << "Fill CA12 PR subjet!" << std::endl;
|
938 |
|
|
for(edm::View<pat::Jet>::const_iterator subjet_iter = capr12subjets.begin(); subjet_iter!=capr12subjets.end(); ++subjet_iter){
|
939 |
|
|
VHbbEvent::SimpleJet sj;
|
940 |
|
|
fillSimpleJet(sj,subjet_iter);
|
941 |
|
|
// setJecUnc(sj,jecUnc);
|
942 |
|
|
hbbInfo->CApr12_subjets.push_back(sj);
|
943 |
|
|
}
|
944 |
|
|
|
945 |
ntran |
1.77.2.1 |
|
946 |
ntran |
1.77.2.2 |
// C A 1 2 R A W J E T G E N
|
947 |
ntran |
1.77.2.1 |
// fill the GEN jet information too!
|
948 |
|
|
if(runOnMC_){
|
949 |
|
|
|
950 |
|
|
|
951 |
|
|
edm::Handle<reco::GenJetCollection> genJets ;
|
952 |
|
|
iEvent.getByLabel("ca12GenJetsNoNu",genJets);
|
953 |
|
|
|
954 |
|
|
for (reco::GenJetCollection::const_iterator moIter = genJets->begin(); moIter != genJets->end(); ++moIter) {
|
955 |
ntran |
1.77.2.2 |
// std::cout << "jet eta: " << moIter->eta() << std::endl;
|
956 |
ntran |
1.77.2.1 |
if (moIter->pt() > 80.){
|
957 |
|
|
VHbbEvent::RawJet rgj;
|
958 |
|
|
rgj.p4 = TLorentzVector( moIter->px(), moIter->py(), moIter->pz(), moIter->energy() );
|
959 |
|
|
rgj.Nconstituents = moIter->getGenConstituents().size();
|
960 |
ntran |
1.77.2.2 |
|
961 |
ntran |
1.77.2.1 |
for (unsigned int iJC = 0; iJC < moIter->getGenConstituents().size(); iJC++){
|
962 |
|
|
rgj.constituents_px.push_back( moIter->getGenConstituents().at(iJC)->px() );
|
963 |
|
|
rgj.constituents_py.push_back( moIter->getGenConstituents().at(iJC)->py() );
|
964 |
|
|
rgj.constituents_pz.push_back( moIter->getGenConstituents().at(iJC)->pz() );
|
965 |
|
|
rgj.constituents_e.push_back( moIter->getGenConstituents().at(iJC)->energy() );
|
966 |
|
|
rgj.constituents_pdgId.push_back( moIter->getGenConstituents().at(iJC)->pdgId() );
|
967 |
|
|
}
|
968 |
ntran |
1.77.2.2 |
hbbInfo->CA12wConstitsGen.push_back( rgj );
|
969 |
ntran |
1.77.2.1 |
}
|
970 |
|
|
}
|
971 |
ntran |
1.77.2.2 |
// edm::Handle<edm::View<reco::GenJet> > ca12genjetHandle;
|
972 |
|
|
// iEvent.getByLabel("ca12GenJetsNoNu",ca12genjetHandle);
|
973 |
|
|
// edm::View<pat::Jet> ca12genjets = *ca12genjetHandle;
|
974 |
|
|
// ctr = 0;
|
975 |
|
|
// for(edm::View<reco::GenJet>::const_iterator jet_iter = ca12genjets.begin(); jet_iter!=ca12genjets.end(); ++jet_iter){
|
976 |
|
|
// std::cout << "jet # " << ctr << std::endl;
|
977 |
|
|
// std::coit << "jet pt = " << jet_iter->pt() << std::endl;
|
978 |
|
|
|
979 |
|
|
// std::cout << "size: " << jet_iter->getPFConstituents().size() << std::endl;
|
980 |
|
|
//
|
981 |
|
|
// std::vector<reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents();
|
982 |
|
|
// VHbbEvent::RawJet rj;
|
983 |
|
|
// rj.p4 = GENPTOLORP(jet_iter);
|
984 |
|
|
// rj.Nconstituents = jet_iter->getPFConstituents().size();
|
985 |
|
|
//
|
986 |
|
|
// for (unsigned int iJC = 0; iJC<constituents.size(); ++iJC ){
|
987 |
|
|
//
|
988 |
|
|
// rj.constituents_px.push_back( jet_iter->getPFConstituents().at(iJC)->px() );
|
989 |
|
|
// rj.constituents_py.push_back( jet_iter->getPFConstituents().at(iJC)->py() );
|
990 |
|
|
// rj.constituents_pz.push_back( jet_iter->getPFConstituents().at(iJC)->pz() );
|
991 |
|
|
// rj.constituents_e.push_back( jet_iter->getPFConstituents().at(iJC)->energy() );
|
992 |
|
|
// rj.constituents_pdgId.push_back( jet_iter->getPFConstituents().at(iJC)->pdgId() );
|
993 |
|
|
// }
|
994 |
|
|
//
|
995 |
|
|
// hbbInfo->rawJetsGen.push_back( rj );
|
996 |
|
|
|
997 |
|
|
// ctr++;
|
998 |
|
|
//
|
999 |
|
|
// }
|
1000 |
|
|
|
1001 |
ntran |
1.77.2.1 |
}
|
1002 |
|
|
//////////////////////////////////////////////////////////////
|
1003 |
|
|
//////////////////////////////////////////////////////////////
|
1004 |
tboccali |
1.1 |
|
1005 |
ntran |
1.77.2.2 |
/////// hard jet
|
1006 |
tboccali |
1.1 |
|
1007 |
tboccali |
1.28 |
|
1008 |
ntran |
1.77.2.2 |
double matEta[1000*30],matPhi[1000*30];
|
1009 |
|
|
for(int i=0;i<1000;i++){for(int j=0;j<30;j++){matEta[i*j]=-99.;matPhi[i*j]=-99.;}}
|
1010 |
|
|
|
1011 |
|
|
for(edm::View<pat::Jet>::const_iterator jet_iter = jets.begin(); jet_iter!=jets.end(); ++jet_iter){
|
1012 |
ntran |
1.77.2.1 |
|
1013 |
ntran |
1.77.2.2 |
if(printJet) {std::cout << "Jet Pt: " << jet_iter->pt() << " E,M: " << jet_iter->p4().E() << " " << jet_iter->p4().M() << "\n";}
|
1014 |
|
|
|
1015 |
|
|
reco::Jet::Constituents constituents = jet_iter->getJetConstituents();
|
1016 |
|
|
std::cout << "NsubJets: " << constituents.size() << "\n";
|
1017 |
|
|
// std::cout << "Nconstituents: " << jet_iter->getConstituents().size() << "\n";
|
1018 |
|
|
|
1019 |
|
|
// if(printJet) {std::cout << "NsubJets: " << constituents.size() << "\n";}
|
1020 |
|
|
VHbbEvent::HardJet hj;
|
1021 |
|
|
hj.constituents=constituents.size();
|
1022 |
|
|
hj.p4 =GENPTOLORP(jet_iter);
|
1023 |
|
|
|
1024 |
|
|
for (unsigned int iJC(0); iJC<constituents.size(); ++iJC ){
|
1025 |
|
|
Jet::Constituent icandJet = constituents[iJC];
|
1026 |
|
|
|
1027 |
|
|
if(printJet) {std::cout << "subJet Pt: " << icandJet->pt() << " subJet E,M,eta,phi: " << icandJet->p4().E() << ","
|
1028 |
|
|
<< icandJet->p4().M() << "," << icandJet->eta() << "," << icandJet->phi() << "\n"; }
|
1029 |
|
|
|
1030 |
|
|
|
1031 |
|
|
hj.subFourMomentum.push_back(GENPTOLORP(icandJet));
|
1032 |
|
|
hj.etaSub.push_back(icandJet->eta());
|
1033 |
|
|
hj.phiSub.push_back(icandJet->phi());
|
1034 |
|
|
|
1035 |
|
|
// std::cout << "subjet constituents: " << icandJet->getJetConstituents.size() << std::endl;
|
1036 |
|
|
|
1037 |
|
|
}
|
1038 |
|
|
hbbInfo->hardJets.push_back(hj);
|
1039 |
tboccali |
1.1 |
}
|
1040 |
|
|
|
1041 |
ntran |
1.77.2.2 |
// HardJetSubEta2.SetMatrixArray(matEta);
|
1042 |
|
|
// HardJetSubPhi2.SetMatrixArray(matPhi);
|
1043 |
|
|
// TMatrixDRow a1(HardJetSubEta2,0);
|
1044 |
|
|
// for(int i=0;i<30;i++){
|
1045 |
|
|
// std::cout << "test: " << a1[i] << "\n";
|
1046 |
|
|
// }
|
1047 |
|
|
|
1048 |
|
|
// pat subJets with Btag
|
1049 |
|
|
|
1050 |
|
|
|
1051 |
|
|
for(edm::View<pat::Jet>::const_iterator subjet_iter = subjets.begin(); subjet_iter!=subjets.end(); ++subjet_iter){
|
1052 |
|
|
|
1053 |
|
|
if(printJet) {std::cout << "SubJetTagged Pt: " << subjet_iter->pt() << " E,M,eta,phi,Btag: " << subjet_iter->p4().E()
|
1054 |
|
|
<< "," << subjet_iter->p4().M() << "," << subjet_iter->eta() << "," << subjet_iter->phi()
|
1055 |
|
|
<< "," << subjet_iter->bDiscriminator("combinedSecondaryVertexBJetTags") << "\n";}
|
1056 |
|
|
|
1057 |
|
|
VHbbEvent::SimpleJet sj;
|
1058 |
|
|
// std::cout <<" sub jet "<<std::endl;
|
1059 |
|
|
fillSimpleJet(sj,subjet_iter);
|
1060 |
|
|
// if(!runOnMC_)
|
1061 |
|
|
setJecUnc(sj,jecUnc);
|
1062 |
|
|
/* sj.flavour = subjet_iter->partonFlavour();
|
1063 |
|
|
sj.tVector = getTvect(&(*subjet_iter));
|
1064 |
|
|
sj.tche=subjet_iter->bDiscriminator("trackCountingHighEffBJetTags");
|
1065 |
|
|
sj.tchp=subjet_iter->bDiscriminator("trackCountingHighPurBJetTags");
|
1066 |
|
|
sj.jp=subjet_iter->bDiscriminator("jetProbabilityBJetTags");
|
1067 |
|
|
sj.jpb=subjet_iter->bDiscriminator("jetBProbabilityBJetTags");
|
1068 |
|
|
sj.ssvhe=subjet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags");
|
1069 |
|
|
sj.csv=subjet_iter->bDiscriminator("combinedSecondaryVertexBJetTags");
|
1070 |
|
|
sj.csvmva=subjet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags");
|
1071 |
|
|
sj.charge=subjet_iter->jetCharge();
|
1072 |
|
|
sj.ntracks=subjet_iter->associatedTracks().size();
|
1073 |
|
|
sj.p4=GENPTOLORP(subjet_iter);
|
1074 |
|
|
sj.p4=(getChargedTracksMomentum(&*(subjet_iter)));
|
1075 |
|
|
|
1076 |
|
|
//
|
1077 |
|
|
// addtaginfo for csv
|
1078 |
|
|
//
|
1079 |
|
|
|
1080 |
|
|
if (subjet_iter->hasTagInfo("SimpleSecondaryVertex")) {
|
1081 |
|
|
|
1082 |
|
|
const reco::SecondaryVertexTagInfo * tf = subjet_iter->tagInfoSecondaryVertex();
|
1083 |
|
|
sj.vtxMass = tf->secondaryVertex(0).p4().mass();
|
1084 |
|
|
sj.vtxNTracks = tf->secondaryVertex(0).nTracks();
|
1085 |
|
|
Measurement1D m = tf->flightDistance(0);
|
1086 |
|
|
sj.vtx3dL = m.value();
|
1087 |
|
|
sj.vtx3deL = m.error();
|
1088 |
|
|
}
|
1089 |
|
|
*/
|
1090 |
|
|
hbbInfo->subJets.push_back(sj);
|
1091 |
|
|
|
1092 |
bortigno |
1.18 |
}
|
1093 |
ntran |
1.77.2.2 |
|
1094 |
|
|
for(edm::View<pat::Jet>::const_iterator filterjet_iter = filterjets.begin(); filterjet_iter!=filterjets.end(); ++filterjet_iter){
|
1095 |
|
|
|
1096 |
|
|
if(printJet) {std::cout << "FilterjetTagged Pt: " << filterjet_iter->pt() << " E,M,eta,phi,Btag: " << filterjet_iter->p4().E() << "," << filterjet_iter->p4().M() << "," << filterjet_iter->eta() << "," << filterjet_iter->phi() << "," << filterjet_iter->bDiscriminator("combinedSecondaryVertexBJetTags") << "\n";}
|
1097 |
|
|
|
1098 |
|
|
VHbbEvent::SimpleJet fj;
|
1099 |
|
|
// std::cout <<" sub jet "<<std::endl;
|
1100 |
|
|
fillSimpleJet(fj,filterjet_iter);
|
1101 |
|
|
// if(!runOnMC_)
|
1102 |
|
|
setJecUnc(fj,jecUnc);
|
1103 |
|
|
|
1104 |
|
|
if(runOnMC_){
|
1105 |
|
|
|
1106 |
|
|
//BTV scale factors
|
1107 |
|
|
// fillScaleFactors(sj, btagSFs);
|
1108 |
|
|
|
1109 |
|
|
//PAT genJet matching
|
1110 |
|
|
//genJet
|
1111 |
|
|
const reco::GenJet *gJ = filterjet_iter->genJet();
|
1112 |
|
|
//physical parton for mother info ONLY
|
1113 |
|
|
if( (filterjet_iter->genParton()) ){
|
1114 |
|
|
fj.bestMCid = filterjet_iter->genParton()->pdgId();
|
1115 |
|
|
if( (filterjet_iter->genParton()->mother()) )
|
1116 |
|
|
fj.bestMCmomid=filterjet_iter->genParton()->mother()->pdgId();
|
1117 |
|
|
}
|
1118 |
|
|
TLorentzVector gJp4;
|
1119 |
|
|
if(gJ){
|
1120 |
|
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
|
1121 |
|
|
fj.bestMCp4 = gJp4;
|
1122 |
|
|
if(verbose_){
|
1123 |
|
|
std::clog << "filter genJet matched Pt = " << gJp4.Pt() << std::endl;
|
1124 |
|
|
std::clog << "filter genJet matched eta = " << gJp4.Eta() << std::endl;
|
1125 |
|
|
std::clog << "filter genJet matched deltaR = " << gJp4.DeltaR(fj.p4) << std::endl;
|
1126 |
|
|
std::clog << "filter genJet matched mother id = " << fj.bestMCmomid << std::endl;
|
1127 |
|
|
}
|
1128 |
|
|
}
|
1129 |
|
|
}
|
1130 |
|
|
|
1131 |
|
|
hbbInfo->filterJets.push_back(fj);
|
1132 |
|
|
|
1133 |
|
|
|
1134 |
arizzi |
1.74 |
}
|
1135 |
tboccali |
1.50 |
|
1136 |
ntran |
1.77.2.2 |
//
|
1137 |
|
|
// add charged met
|
1138 |
|
|
//
|
1139 |
|
|
|
1140 |
|
|
edm::Handle<edm::View<reco::MET> > metChargedHandle;
|
1141 |
|
|
iEvent.getByLabel("pfMETNoPUCharge",metChargedHandle);
|
1142 |
|
|
edm::View<reco::MET> metsCh = *metChargedHandle;
|
1143 |
|
|
if(metsCh.size()){
|
1144 |
|
|
hbbInfo->metCh.sumEt=(metsCh[0]).sumEt();
|
1145 |
|
|
hbbInfo->metCh.metSig=metSignificance(& (metsCh[0]));
|
1146 |
|
|
hbbInfo->metCh.eLong=(metsCh[0]).e_longitudinal();
|
1147 |
|
|
hbbInfo->metCh.p4=GENPTOLOR((metsCh[0]));
|
1148 |
|
|
if (verbose_) std::cout <<" METCharged "<< hbbInfo->metCh.metSig <<" " << hbbInfo->metCh.sumEt<<std::endl;
|
1149 |
|
|
}
|
1150 |
|
|
|
1151 |
|
|
// type 1 corr met
|
1152 |
|
|
edm::Handle<edm::View<reco::MET> > pfmetType1corrHandle;
|
1153 |
|
|
iEvent.getByLabel("patType1CorrectedPFMet",pfmetType1corrHandle);
|
1154 |
|
|
edm::View<reco::MET> pfmetsType1corr = *pfmetType1corrHandle;
|
1155 |
|
|
if(pfmetsType1corr.size()){
|
1156 |
|
|
hbbInfo->pfmetType1corr.sumEt=(pfmetsType1corr[0]).sumEt();
|
1157 |
|
|
hbbInfo->pfmetType1corr.metSig=metSignificance(& (pfmetsType1corr[0]));
|
1158 |
|
|
hbbInfo->pfmetType1corr.eLong=(pfmetsType1corr[0]).e_longitudinal();
|
1159 |
|
|
hbbInfo->pfmetType1corr.p4=GENPTOLOR((pfmetsType1corr[0]));
|
1160 |
|
|
if (verbose_) std::cout <<" type 1 corrected pfMET "<< hbbInfo->pfmetType1corr.metSig <<" " << hbbInfo->pfmetType1corr.sumEt<<std::endl;
|
1161 |
arizzi |
1.75 |
}
|
1162 |
ntran |
1.77.2.2 |
|
1163 |
|
|
|
1164 |
|
|
// type 1 + 2 corr met
|
1165 |
|
|
edm::Handle<edm::View<reco::MET> > pfmetType1p2corrHandle;
|
1166 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMet",pfmetType1p2corrHandle);
|
1167 |
|
|
edm::View<reco::MET> pfmetsType1p2corr = *pfmetType1p2corrHandle;
|
1168 |
|
|
if(pfmetsType1p2corr.size()){
|
1169 |
|
|
hbbInfo->pfmetType1p2corr.sumEt=(pfmetsType1p2corr[0]).sumEt();
|
1170 |
|
|
hbbInfo->pfmetType1p2corr.metSig=metSignificance(& (pfmetsType1p2corr[0]));
|
1171 |
|
|
hbbInfo->pfmetType1p2corr.eLong=(pfmetsType1p2corr[0]).e_longitudinal();
|
1172 |
|
|
hbbInfo->pfmetType1p2corr.p4=GENPTOLOR((pfmetsType1p2corr[0]));
|
1173 |
|
|
if (verbose_) std::cout <<" type 1 +2 corrected pfMET "<< hbbInfo->pfmetType1p2corr.metSig <<" " << hbbInfo->pfmetType1p2corr.sumEt<<std::endl;
|
1174 |
|
|
}
|
1175 |
|
|
|
1176 |
|
|
// type 1 corr met NoPU
|
1177 |
|
|
/* edm::Handle<edm::View<reco::MET> > pfmetNoPUType1corrHandle;
|
1178 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetNoPU",pfmetNoPUType1corrHandle);
|
1179 |
|
|
edm::View<reco::MET> pfmetsNoPUType1corr = *pfmetNoPUType1corrHandle;
|
1180 |
|
|
if(pfmetsNoPUType1corr.size()){
|
1181 |
|
|
hbbInfo->pfmetNoPUType1corr.sumEt=(pfmetsNoPUType1corr[0]).sumEt();
|
1182 |
|
|
hbbInfo->pfmetNoPUType1corr.metSig=metSignificance(& (pfmetsNoPUType1corr[0]));
|
1183 |
|
|
hbbInfo->pfmetNoPUType1corr.eLong=(pfmetsNoPUType1corr[0]).e_longitudinal();
|
1184 |
|
|
hbbInfo->pfmetNoPUType1corr.p4=GENPTOLOR((pfmetsNoPUType1corr[0]));
|
1185 |
|
|
if (verbose_) std::cout <<" type 1 corrected pfMET NoPU"<< hbbInfo->pfmetNoPUType1corr.metSig <<" " << hbbInfo->pfmetNoPUType1corr.sumEt<<std::endl;
|
1186 |
|
|
}
|
1187 |
|
|
|
1188 |
|
|
|
1189 |
|
|
// type 1 + 2 corr met
|
1190 |
|
|
edm::Handle<edm::View<reco::MET> > pfmetNoPUType1p2corrHandle;
|
1191 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetNoPU",pfmetNoPUType1p2corrHandle);
|
1192 |
|
|
edm::View<reco::MET> pfmetsNoPUType1p2corr = *pfmetNoPUType1p2corrHandle;
|
1193 |
|
|
if(pfmetsNoPUType1p2corr.size()){
|
1194 |
|
|
hbbInfo->pfmetNoPUType1p2corr.sumEt=(pfmetsNoPUType1p2corr[0]).sumEt();
|
1195 |
|
|
hbbInfo->pfmetNoPUType1p2corr.metSig=metSignificance(& (pfmetsNoPUType1p2corr[0]));
|
1196 |
|
|
hbbInfo->pfmetNoPUType1p2corr.eLong=(pfmetsNoPUType1p2corr[0]).e_longitudinal();
|
1197 |
|
|
hbbInfo->pfmetNoPUType1p2corr.p4=GENPTOLOR((pfmetsNoPUType1p2corr[0]));
|
1198 |
|
|
if (verbose_) std::cout <<" type 1 +2 corrected pfMET "<< hbbInfo->pfmetNoPUType1p2corr.metSig <<" " << hbbInfo->pfmetNoPUType1p2corr.sumEt<<std::endl;
|
1199 |
|
|
}
|
1200 |
|
|
|
1201 |
|
|
*/
|
1202 |
|
|
|
1203 |
|
|
/*
|
1204 |
|
|
// MET uncertainty vector
|
1205 |
|
|
vector<pat::MET> "patType1CorrectedPFMet" "" "VH"
|
1206 |
|
|
vector<pat::MET> "patType1CorrectedPFMetElectronEnDown" "" "VH"
|
1207 |
|
|
vector<pat::MET> "patType1CorrectedPFMetElectronEnUp" "" "VH"
|
1208 |
|
|
vector<pat::MET> "patType1CorrectedPFMetJetEnDown" "" "VH"
|
1209 |
|
|
vector<pat::MET> "patType1CorrectedPFMetJetEnUp" "" "VH"
|
1210 |
|
|
vector<pat::MET> "patType1CorrectedPFMetJetResDown" "" "VH"
|
1211 |
|
|
vector<pat::MET> "patType1CorrectedPFMetJetResUp" "" "VH"
|
1212 |
|
|
vector<pat::MET> "patType1CorrectedPFMetMuonEnDown" "" "VH"
|
1213 |
|
|
vector<pat::MET> "patType1CorrectedPFMetMuonEnUp" "" "VH"
|
1214 |
|
|
vector<pat::MET> "patType1CorrectedPFMetNoPU" "" "VH"
|
1215 |
|
|
vector<pat::MET> "patType1CorrectedPFMetTauEnDown" "" "VH"
|
1216 |
|
|
vector<pat::MET> "patType1CorrectedPFMetTauEnUp" "" "VH"
|
1217 |
|
|
vector<pat::MET> "patType1CorrectedPFMetUnclusteredEnDown" "" "VH"
|
1218 |
|
|
vector<pat::MET> "patType1CorrectedPFMetUnclusteredEnUp" "" "VH"
|
1219 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMet" "" "VH"
|
1220 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetElectronEnDown" "" "VH"
|
1221 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetElectronEnUp" "" "VH"
|
1222 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetJetEnDown" "" "VH"
|
1223 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetJetEnUp" "" "VH"
|
1224 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetJetResDown" "" "VH"
|
1225 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetJetResUp" "" "VH"
|
1226 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetMuonEnDown" "" "VH"
|
1227 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetMuonEnUp" "" "VH"
|
1228 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetNoPU" "" "VH"
|
1229 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetTauEnDown" "" "VH"
|
1230 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetTauEnUp" "" "VH"
|
1231 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetUnclusteredEnDown" "" "VH"
|
1232 |
|
|
vector<pat::MET> "patType1p2CorrectedPFMetUnclusteredEnUp" "" "VH"
|
1233 |
|
|
*/
|
1234 |
|
|
|
1235 |
|
|
VHbbEvent::METInfo metunc;
|
1236 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetElectronEnDownHandle;
|
1237 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetElectronEnDown",patType1CorrectedPFMetElectronEnDownHandle);
|
1238 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsElectronEnDown = *patType1CorrectedPFMetElectronEnDownHandle;
|
1239 |
|
|
if(patType1CorrectedPFMetsElectronEnDown.size()){
|
1240 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsElectronEnDown[0]).sumEt();
|
1241 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsElectronEnDown[0]));
|
1242 |
|
|
metunc.eLong=(patType1CorrectedPFMetsElectronEnDown[0]).e_longitudinal();
|
1243 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsElectronEnDown[0]));
|
1244 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1245 |
|
|
}
|
1246 |
|
|
|
1247 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetElectronEnUpHandle;
|
1248 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetElectronEnUp",patType1CorrectedPFMetElectronEnUpHandle);
|
1249 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsElectronEnUp = *patType1CorrectedPFMetElectronEnUpHandle;
|
1250 |
|
|
if(patType1CorrectedPFMetsElectronEnUp.size()){
|
1251 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsElectronEnUp[0]).sumEt();
|
1252 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsElectronEnUp[0]));
|
1253 |
|
|
metunc.eLong=(patType1CorrectedPFMetsElectronEnUp[0]).e_longitudinal();
|
1254 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsElectronEnUp[0]));
|
1255 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1256 |
|
|
}
|
1257 |
|
|
|
1258 |
|
|
|
1259 |
|
|
|
1260 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetMuonEnDownHandle;
|
1261 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetMuonEnDown",patType1CorrectedPFMetMuonEnDownHandle);
|
1262 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsMuonEnDown = *patType1CorrectedPFMetMuonEnDownHandle;
|
1263 |
|
|
if(patType1CorrectedPFMetsMuonEnDown.size()){
|
1264 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsMuonEnDown[0]).sumEt();
|
1265 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsMuonEnDown[0]));
|
1266 |
|
|
metunc.eLong=(patType1CorrectedPFMetsMuonEnDown[0]).e_longitudinal();
|
1267 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsMuonEnDown[0]));
|
1268 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1269 |
|
|
}
|
1270 |
|
|
|
1271 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetMuonEnUpHandle;
|
1272 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetMuonEnUp",patType1CorrectedPFMetMuonEnUpHandle);
|
1273 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsMuonEnUp = *patType1CorrectedPFMetMuonEnUpHandle;
|
1274 |
|
|
if(patType1CorrectedPFMetsMuonEnUp.size()){
|
1275 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsMuonEnUp[0]).sumEt();
|
1276 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsMuonEnUp[0]));
|
1277 |
|
|
metunc.eLong=(patType1CorrectedPFMetsMuonEnUp[0]).e_longitudinal();
|
1278 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsMuonEnUp[0]));
|
1279 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1280 |
|
|
}
|
1281 |
|
|
|
1282 |
|
|
|
1283 |
|
|
|
1284 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetTauEnDownHandle;
|
1285 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetTauEnDown",patType1CorrectedPFMetTauEnDownHandle);
|
1286 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsTauEnDown = *patType1CorrectedPFMetTauEnDownHandle;
|
1287 |
|
|
if(patType1CorrectedPFMetsTauEnDown.size()){
|
1288 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsTauEnDown[0]).sumEt();
|
1289 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsTauEnDown[0]));
|
1290 |
|
|
metunc.eLong=(patType1CorrectedPFMetsTauEnDown[0]).e_longitudinal();
|
1291 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsTauEnDown[0]));
|
1292 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1293 |
|
|
}
|
1294 |
|
|
|
1295 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetTauEnUpHandle;
|
1296 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetTauEnUp",patType1CorrectedPFMetTauEnUpHandle);
|
1297 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsTauEnUp = *patType1CorrectedPFMetTauEnUpHandle;
|
1298 |
|
|
if(patType1CorrectedPFMetsTauEnUp.size()){
|
1299 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsTauEnUp[0]).sumEt();
|
1300 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsTauEnUp[0]));
|
1301 |
|
|
metunc.eLong=(patType1CorrectedPFMetsTauEnUp[0]).e_longitudinal();
|
1302 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsTauEnUp[0]));
|
1303 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1304 |
|
|
}
|
1305 |
|
|
|
1306 |
|
|
|
1307 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetJetEnDownHandle;
|
1308 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetJetEnDown",patType1CorrectedPFMetJetEnDownHandle);
|
1309 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsJetEnDown = *patType1CorrectedPFMetJetEnDownHandle;
|
1310 |
|
|
if(patType1CorrectedPFMetsJetEnDown.size()){
|
1311 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsJetEnDown[0]).sumEt();
|
1312 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsJetEnDown[0]));
|
1313 |
|
|
metunc.eLong=(patType1CorrectedPFMetsJetEnDown[0]).e_longitudinal();
|
1314 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsJetEnDown[0]));
|
1315 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1316 |
|
|
}
|
1317 |
|
|
|
1318 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetJetEnUpHandle;
|
1319 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetJetEnUp",patType1CorrectedPFMetJetEnUpHandle);
|
1320 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsJetEnUp = *patType1CorrectedPFMetJetEnUpHandle;
|
1321 |
|
|
if(patType1CorrectedPFMetsJetEnUp.size()){
|
1322 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsJetEnUp[0]).sumEt();
|
1323 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsJetEnUp[0]));
|
1324 |
|
|
metunc.eLong=(patType1CorrectedPFMetsJetEnUp[0]).e_longitudinal();
|
1325 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsJetEnUp[0]));
|
1326 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1327 |
|
|
}
|
1328 |
|
|
|
1329 |
|
|
|
1330 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetJetResDownHandle;
|
1331 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetJetResDown",patType1CorrectedPFMetJetResDownHandle);
|
1332 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsJetResDown = *patType1CorrectedPFMetJetResDownHandle;
|
1333 |
|
|
if(patType1CorrectedPFMetsJetResDown.size()){
|
1334 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsJetResDown[0]).sumEt();
|
1335 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsJetResDown[0]));
|
1336 |
|
|
metunc.eLong=(patType1CorrectedPFMetsJetResDown[0]).e_longitudinal();
|
1337 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsJetResDown[0]));
|
1338 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1339 |
|
|
}
|
1340 |
|
|
|
1341 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetJetResUpHandle;
|
1342 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetJetResUp",patType1CorrectedPFMetJetResUpHandle);
|
1343 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsJetResUp = *patType1CorrectedPFMetJetResUpHandle;
|
1344 |
|
|
if(patType1CorrectedPFMetsJetResUp.size()){
|
1345 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsJetResUp[0]).sumEt();
|
1346 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsJetResUp[0]));
|
1347 |
|
|
metunc.eLong=(patType1CorrectedPFMetsJetResUp[0]).e_longitudinal();
|
1348 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsJetResUp[0]));
|
1349 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1350 |
|
|
}
|
1351 |
|
|
|
1352 |
|
|
|
1353 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetUnclusteredEnDownHandle;
|
1354 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetUnclusteredEnDown",patType1CorrectedPFMetUnclusteredEnDownHandle);
|
1355 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsUnclusteredEnDown = *patType1CorrectedPFMetUnclusteredEnDownHandle;
|
1356 |
|
|
if(patType1CorrectedPFMetsUnclusteredEnDown.size()){
|
1357 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsUnclusteredEnDown[0]).sumEt();
|
1358 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsUnclusteredEnDown[0]));
|
1359 |
|
|
metunc.eLong=(patType1CorrectedPFMetsUnclusteredEnDown[0]).e_longitudinal();
|
1360 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsUnclusteredEnDown[0]));
|
1361 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1362 |
|
|
}
|
1363 |
|
|
|
1364 |
|
|
edm::Handle<edm::View<reco::MET> > patType1CorrectedPFMetUnclusteredEnUpHandle;
|
1365 |
|
|
iEvent.getByLabel("patType1CorrectedPFMetUnclusteredEnUp",patType1CorrectedPFMetUnclusteredEnUpHandle);
|
1366 |
|
|
edm::View<reco::MET> patType1CorrectedPFMetsUnclusteredEnUp = *patType1CorrectedPFMetUnclusteredEnUpHandle;
|
1367 |
|
|
if(patType1CorrectedPFMetsUnclusteredEnUp.size()){
|
1368 |
|
|
metunc.sumEt =(patType1CorrectedPFMetsUnclusteredEnUp[0]).sumEt();
|
1369 |
|
|
metunc.metSig=metSignificance(& (patType1CorrectedPFMetsUnclusteredEnUp[0]));
|
1370 |
|
|
metunc.eLong=(patType1CorrectedPFMetsUnclusteredEnUp[0]).e_longitudinal();
|
1371 |
|
|
metunc.p4=GENPTOLOR((patType1CorrectedPFMetsUnclusteredEnUp[0]));
|
1372 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1373 |
|
|
}
|
1374 |
|
|
|
1375 |
|
|
|
1376 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetElectronEnDownHandle;
|
1377 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetElectronEnDown",patType1p2CorrectedPFMetElectronEnDownHandle);
|
1378 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsElectronEnDown = *patType1p2CorrectedPFMetElectronEnDownHandle;
|
1379 |
|
|
if(patType1p2CorrectedPFMetsElectronEnDown.size()){
|
1380 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsElectronEnDown[0]).sumEt();
|
1381 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsElectronEnDown[0]));
|
1382 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsElectronEnDown[0]).e_longitudinal();
|
1383 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsElectronEnDown[0]));
|
1384 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1385 |
|
|
}
|
1386 |
|
|
|
1387 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetElectronEnUpHandle;
|
1388 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetElectronEnUp",patType1p2CorrectedPFMetElectronEnUpHandle);
|
1389 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsElectronEnUp = *patType1p2CorrectedPFMetElectronEnUpHandle;
|
1390 |
|
|
if(patType1p2CorrectedPFMetsElectronEnUp.size()){
|
1391 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsElectronEnUp[0]).sumEt();
|
1392 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsElectronEnUp[0]));
|
1393 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsElectronEnUp[0]).e_longitudinal();
|
1394 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsElectronEnUp[0]));
|
1395 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1396 |
|
|
}
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
|
1400 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetMuonEnDownHandle;
|
1401 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetMuonEnDown",patType1p2CorrectedPFMetMuonEnDownHandle);
|
1402 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsMuonEnDown = *patType1p2CorrectedPFMetMuonEnDownHandle;
|
1403 |
|
|
if(patType1p2CorrectedPFMetsMuonEnDown.size()){
|
1404 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsMuonEnDown[0]).sumEt();
|
1405 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsMuonEnDown[0]));
|
1406 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsMuonEnDown[0]).e_longitudinal();
|
1407 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsMuonEnDown[0]));
|
1408 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1409 |
|
|
}
|
1410 |
|
|
|
1411 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetMuonEnUpHandle;
|
1412 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetMuonEnUp",patType1p2CorrectedPFMetMuonEnUpHandle);
|
1413 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsMuonEnUp = *patType1p2CorrectedPFMetMuonEnUpHandle;
|
1414 |
|
|
if(patType1p2CorrectedPFMetsMuonEnUp.size()){
|
1415 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsMuonEnUp[0]).sumEt();
|
1416 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsMuonEnUp[0]));
|
1417 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsMuonEnUp[0]).e_longitudinal();
|
1418 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsMuonEnUp[0]));
|
1419 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1420 |
|
|
}
|
1421 |
|
|
|
1422 |
|
|
|
1423 |
|
|
|
1424 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetTauEnDownHandle;
|
1425 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetTauEnDown",patType1p2CorrectedPFMetTauEnDownHandle);
|
1426 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsTauEnDown = *patType1p2CorrectedPFMetTauEnDownHandle;
|
1427 |
|
|
if(patType1p2CorrectedPFMetsTauEnDown.size()){
|
1428 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsTauEnDown[0]).sumEt();
|
1429 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsTauEnDown[0]));
|
1430 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsTauEnDown[0]).e_longitudinal();
|
1431 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsTauEnDown[0]));
|
1432 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1433 |
|
|
}
|
1434 |
|
|
|
1435 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetTauEnUpHandle;
|
1436 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetTauEnUp",patType1p2CorrectedPFMetTauEnUpHandle);
|
1437 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsTauEnUp = *patType1p2CorrectedPFMetTauEnUpHandle;
|
1438 |
|
|
if(patType1p2CorrectedPFMetsTauEnUp.size()){
|
1439 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsTauEnUp[0]).sumEt();
|
1440 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsTauEnUp[0]));
|
1441 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsTauEnUp[0]).e_longitudinal();
|
1442 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsTauEnUp[0]));
|
1443 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1444 |
|
|
}
|
1445 |
|
|
|
1446 |
|
|
|
1447 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetJetEnDownHandle;
|
1448 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetJetEnDown",patType1p2CorrectedPFMetJetEnDownHandle);
|
1449 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsJetEnDown = *patType1p2CorrectedPFMetJetEnDownHandle;
|
1450 |
|
|
if(patType1p2CorrectedPFMetsJetEnDown.size()){
|
1451 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsJetEnDown[0]).sumEt();
|
1452 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsJetEnDown[0]));
|
1453 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsJetEnDown[0]).e_longitudinal();
|
1454 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsJetEnDown[0]));
|
1455 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1456 |
|
|
}
|
1457 |
|
|
|
1458 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetJetEnUpHandle;
|
1459 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetJetEnUp",patType1p2CorrectedPFMetJetEnUpHandle);
|
1460 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsJetEnUp = *patType1p2CorrectedPFMetJetEnUpHandle;
|
1461 |
|
|
if(patType1p2CorrectedPFMetsJetEnUp.size()){
|
1462 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsJetEnUp[0]).sumEt();
|
1463 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsJetEnUp[0]));
|
1464 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsJetEnUp[0]).e_longitudinal();
|
1465 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsJetEnUp[0]));
|
1466 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1467 |
|
|
}
|
1468 |
|
|
|
1469 |
|
|
|
1470 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetJetResDownHandle;
|
1471 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetJetResDown",patType1p2CorrectedPFMetJetResDownHandle);
|
1472 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsJetResDown = *patType1p2CorrectedPFMetJetResDownHandle;
|
1473 |
|
|
if(patType1p2CorrectedPFMetsJetResDown.size()){
|
1474 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsJetResDown[0]).sumEt();
|
1475 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsJetResDown[0]));
|
1476 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsJetResDown[0]).e_longitudinal();
|
1477 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsJetResDown[0]));
|
1478 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1479 |
|
|
}
|
1480 |
|
|
|
1481 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetJetResUpHandle;
|
1482 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetJetResUp",patType1p2CorrectedPFMetJetResUpHandle);
|
1483 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsJetResUp = *patType1p2CorrectedPFMetJetResUpHandle;
|
1484 |
|
|
if(patType1p2CorrectedPFMetsJetResUp.size()){
|
1485 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsJetResUp[0]).sumEt();
|
1486 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsJetResUp[0]));
|
1487 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsJetResUp[0]).e_longitudinal();
|
1488 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsJetResUp[0]));
|
1489 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1490 |
|
|
}
|
1491 |
|
|
|
1492 |
|
|
|
1493 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetUnclusteredEnDownHandle;
|
1494 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetUnclusteredEnDown",patType1p2CorrectedPFMetUnclusteredEnDownHandle);
|
1495 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsUnclusteredEnDown = *patType1p2CorrectedPFMetUnclusteredEnDownHandle;
|
1496 |
|
|
if(patType1p2CorrectedPFMetsUnclusteredEnDown.size()){
|
1497 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsUnclusteredEnDown[0]).sumEt();
|
1498 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsUnclusteredEnDown[0]));
|
1499 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsUnclusteredEnDown[0]).e_longitudinal();
|
1500 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsUnclusteredEnDown[0]));
|
1501 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1502 |
|
|
}
|
1503 |
|
|
|
1504 |
|
|
edm::Handle<edm::View<reco::MET> > patType1p2CorrectedPFMetUnclusteredEnUpHandle;
|
1505 |
|
|
iEvent.getByLabel("patType1p2CorrectedPFMetUnclusteredEnUp",patType1p2CorrectedPFMetUnclusteredEnUpHandle);
|
1506 |
|
|
edm::View<reco::MET> patType1p2CorrectedPFMetsUnclusteredEnUp = *patType1p2CorrectedPFMetUnclusteredEnUpHandle;
|
1507 |
|
|
if(patType1p2CorrectedPFMetsUnclusteredEnUp.size()){
|
1508 |
|
|
metunc.sumEt =(patType1p2CorrectedPFMetsUnclusteredEnUp[0]).sumEt();
|
1509 |
|
|
metunc.metSig=metSignificance(& (patType1p2CorrectedPFMetsUnclusteredEnUp[0]));
|
1510 |
|
|
metunc.eLong=(patType1p2CorrectedPFMetsUnclusteredEnUp[0]).e_longitudinal();
|
1511 |
|
|
metunc.p4=GENPTOLOR((patType1p2CorrectedPFMetsUnclusteredEnUp[0]));
|
1512 |
|
|
hbbInfo->metUncInfo.push_back(metunc);
|
1513 |
|
|
}
|
1514 |
|
|
|
1515 |
|
|
|
1516 |
|
|
|
1517 |
|
|
//
|
1518 |
|
|
// met is calomet
|
1519 |
|
|
//
|
1520 |
|
|
|
1521 |
|
|
edm::Handle<edm::View<pat::MET> > metTCHandle;
|
1522 |
|
|
iEvent.getByLabel("patMETsTC",metTCHandle);
|
1523 |
|
|
edm::View<pat::MET> metsTC = *metTCHandle;
|
1524 |
|
|
if(metsTC.size()){
|
1525 |
|
|
hbbInfo->tcmet.sumEt=(metsTC[0]).sumEt();
|
1526 |
|
|
hbbInfo->tcmet.metSig=metSignificance(&(metsTC[0]));
|
1527 |
|
|
hbbInfo->tcmet.eLong=(metsTC[0]).e_longitudinal();
|
1528 |
|
|
hbbInfo->tcmet.p4=GENPTOLOR((metsTC[0]));
|
1529 |
|
|
if (verbose_) std::cout <<" METTC "<< hbbInfo->tcmet.metSig <<" " << hbbInfo->tcmet.sumEt<<std::endl;
|
1530 |
|
|
}
|
1531 |
|
|
|
1532 |
|
|
edm::Handle<edm::View<reco::MET> > pfMETNoPUHandle;
|
1533 |
|
|
iEvent.getByLabel("pfMETNoPU",pfMETNoPUHandle);
|
1534 |
|
|
edm::View<reco::MET> metspfMETNoPU = *pfMETNoPUHandle;
|
1535 |
|
|
if(metspfMETNoPU.size()){
|
1536 |
|
|
hbbInfo->metNoPU.sumEt=(metspfMETNoPU[0]).sumEt();
|
1537 |
|
|
hbbInfo->metNoPU.metSig=metSignificance(&(metspfMETNoPU[0]));
|
1538 |
|
|
hbbInfo->metNoPU.eLong=(metspfMETNoPU[0]).e_longitudinal();
|
1539 |
|
|
hbbInfo->metNoPU.p4=GENPTOLOR((metspfMETNoPU[0]));
|
1540 |
|
|
if (verbose_) std::cout <<" pfMETNoPU "<< hbbInfo->metNoPU.metSig <<" " << hbbInfo->metNoPU.sumEt<<std::endl;
|
1541 |
|
|
}
|
1542 |
|
|
|
1543 |
|
|
edm::Handle<edm::View<reco::MET> > mHTHandle;
|
1544 |
|
|
iEvent.getByLabel("patMETsHT",mHTHandle);
|
1545 |
|
|
edm::View<reco::MET> metsHT = *mHTHandle;
|
1546 |
|
|
if(metsHT.size()){
|
1547 |
|
|
hbbInfo->mht.sumEt=(metsHT[0]).sumEt();
|
1548 |
|
|
hbbInfo->mht.metSig=metSignificance(&(metsHT[0]));
|
1549 |
|
|
hbbInfo->mht.eLong=(metsHT[0]).e_longitudinal();
|
1550 |
|
|
hbbInfo->mht.p4=GENPTOLOR((metsHT[0]));
|
1551 |
|
|
if (verbose_) std::cout <<" METHT "<< hbbInfo->mht.metSig <<" " << hbbInfo->mht.sumEt<<std::endl;
|
1552 |
|
|
}
|
1553 |
|
|
|
1554 |
|
|
edm::Handle<edm::View<reco::MET> > metHandle;
|
1555 |
|
|
iEvent.getByLabel(metLabel_,metHandle);
|
1556 |
|
|
edm::View<reco::MET> mets = *metHandle;
|
1557 |
|
|
|
1558 |
|
|
if(mets.size()){
|
1559 |
|
|
hbbInfo->calomet.sumEt=(mets[0]).sumEt();
|
1560 |
|
|
hbbInfo->calomet.metSig=metSignificance(&(mets[0]));
|
1561 |
|
|
hbbInfo->calomet.eLong=(mets[0]).e_longitudinal();
|
1562 |
|
|
hbbInfo->calomet.p4=GENPTOLOR((mets[0]));
|
1563 |
|
|
if (verbose_) std::cout <<" METCALO "<< hbbInfo->calomet.metSig <<" " << hbbInfo->calomet.sumEt<<std::endl;
|
1564 |
|
|
}
|
1565 |
|
|
|
1566 |
|
|
edm::Handle<edm::View<pat::MET> > metPFHandle;
|
1567 |
|
|
iEvent.getByLabel("patMETsPFlow",metPFHandle);
|
1568 |
|
|
edm::View<pat::MET> metsPF = *metPFHandle;
|
1569 |
|
|
|
1570 |
|
|
if(metsPF.size()){
|
1571 |
|
|
hbbInfo->pfmet.sumEt=(metsPF[0]).sumEt();
|
1572 |
|
|
hbbInfo->pfmet.metSig=metSignificance(&(metsPF[0]));
|
1573 |
|
|
hbbInfo->pfmet.eLong=(metsPF[0]).e_longitudinal();
|
1574 |
|
|
hbbInfo->pfmet.p4=GENPTOLOR((metsPF[0]));
|
1575 |
|
|
if (verbose_) std::cout <<" METPF "<< hbbInfo->pfmet.metSig <<" " << hbbInfo->pfmet.sumEt<<std::endl;
|
1576 |
|
|
}
|
1577 |
|
|
|
1578 |
|
|
|
1579 |
|
|
if(verbose_){
|
1580 |
|
|
std::cout << "METs: calomet "<<mets.size()<<" tcmet"<<metsTC.size()<<" pfmet "<<metsPF.size()<<" MHT" <<metsHT.size()<<std::endl;
|
1581 |
|
|
}
|
1582 |
|
|
|
1583 |
|
|
if(verbose_)
|
1584 |
|
|
std::cout << " INPUT MUONS "<<muons.size()<<std::endl;
|
1585 |
|
|
|
1586 |
|
|
for(edm::View<pat::Muon>::const_iterator mu = muons.begin(); mu!=muons.end(); ++mu){
|
1587 |
|
|
VHbbEvent::MuonInfo mf;
|
1588 |
|
|
mf.p4 =GENPTOLORP( mu);
|
1589 |
|
|
mf.charge=mu->charge();
|
1590 |
|
|
mf.tIso=mu->trackIso();
|
1591 |
|
|
mf.eIso=mu->ecalIso();
|
1592 |
|
|
mf.hIso=mu->hcalIso();
|
1593 |
|
|
mf.pfChaIso=mu->chargedHadronIso();
|
1594 |
|
|
mf.pfChaPUIso=mu->puChargedHadronIso(); //userIso(5);
|
1595 |
|
|
mf.pfPhoIso=mu->photonIso();
|
1596 |
|
|
mf.pfNeuIso=mu->neutralHadronIso();
|
1597 |
|
|
Geom::Phi<double> deltaphi(mu->phi()-atan2(mf.p4.Px(), mf.p4.Py()));
|
1598 |
|
|
double acop = deltaphi.value();
|
1599 |
|
|
mf.acop=acop;
|
1600 |
|
|
|
1601 |
|
|
mf.emEnergy = mu->calEnergy().em;
|
1602 |
|
|
mf.hadEnergy = mu->calEnergy().had;
|
1603 |
|
|
|
1604 |
|
|
mf.nMatches = mu->numberOfMatches();
|
1605 |
|
|
|
1606 |
|
|
mf.ipDb=mu->dB();
|
1607 |
|
|
mf.ipErrDb=mu->edB();
|
1608 |
|
|
mf.cat=0;
|
1609 |
|
|
|
1610 |
|
|
if(mu->isGlobalMuon()) mf.cat|=1;
|
1611 |
|
|
if(mu->isTrackerMuon()) mf.cat|=2;
|
1612 |
|
|
if(mu->isStandAloneMuon()) mf.cat|=4;
|
1613 |
|
|
TrackRef trkMu1Ref = mu->get<TrackRef>();
|
1614 |
|
|
if(trkMu1Ref.isNonnull()){
|
1615 |
|
|
const Track* MuTrk1 = mu->get<TrackRef>().get();
|
1616 |
|
|
mf.zPVPt=MuTrk1->dz(RecVtxFirst.position());
|
1617 |
|
|
mf.zPVProb=MuTrk1->dz(RecVtx.position());
|
1618 |
|
|
mf.nHits=MuTrk1->numberOfValidHits();
|
1619 |
|
|
mf.chi2=MuTrk1->normalizedChi2();
|
1620 |
|
|
TrackRef iTrack1 = mu->innerTrack();
|
1621 |
|
|
const reco::HitPattern& p1 = iTrack1->hitPattern();
|
1622 |
|
|
mf.nPixelHits=p1.pixelLayersWithMeasurement();
|
1623 |
|
|
|
1624 |
|
|
mf.nValidTracker = p1.numberOfValidTrackerHits();
|
1625 |
|
|
mf.nValidPixel = p1.numberOfValidPixelHits();
|
1626 |
|
|
mf.nValidLayers = p1.trackerLayersWithMeasurement();
|
1627 |
|
|
mf.isPF = mu->isPFMuon();
|
1628 |
|
|
|
1629 |
|
|
|
1630 |
|
|
|
1631 |
|
|
}
|
1632 |
|
|
if(mu->isGlobalMuon()){
|
1633 |
|
|
TrackRef gTrack = mu->globalTrack();
|
1634 |
|
|
const reco::HitPattern& q = gTrack->hitPattern();
|
1635 |
|
|
mf.globChi2=gTrack.get()->normalizedChi2();
|
1636 |
|
|
mf.globNHits=q.numberOfValidMuonHits();
|
1637 |
|
|
mf.validMuStations = q.muonStationsWithValidHits();
|
1638 |
|
|
}else{
|
1639 |
|
|
mf.globChi2=-99;
|
1640 |
|
|
mf.globNHits=-99;
|
1641 |
|
|
}
|
1642 |
|
|
|
1643 |
|
|
//Muon trigger matching
|
1644 |
|
|
for (int itrig = 0; itrig != ntrigs; ++itrig){
|
1645 |
|
|
std::string trigName=triggerNames_.triggerName(itrig);
|
1646 |
|
|
if( (mu->triggerObjectMatchesByPath(trigName,false,false).size() != 0) ){
|
1647 |
|
|
mf.hltMatchedBits.push_back(itrig);
|
1648 |
|
|
if(verbose_){
|
1649 |
|
|
std::clog << "Trigger Matching box" << std::endl;
|
1650 |
|
|
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
1651 |
|
|
std::clog << "Matching parameters are defined in the cfg" << std::endl;
|
1652 |
|
|
std::clog << "Trigger bit = " << itrig << std::endl;
|
1653 |
|
|
std::clog << "Trigger name = " << trigName << std::endl;
|
1654 |
|
|
std::clog << "Trigger object matched collection size = " << mu->triggerObjectMatchesByPath(trigName,false,false).size() << std::endl;
|
1655 |
|
|
std::clog << "Pat Muon pt = " << mf.p4.Pt() << " HLT object matched = " << mu->triggerObjectMatch(0)->p4().Pt() << std::endl;
|
1656 |
|
|
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
1657 |
|
|
}
|
1658 |
|
|
}
|
1659 |
|
|
}
|
1660 |
|
|
//
|
1661 |
|
|
|
1662 |
|
|
// add stamuon
|
1663 |
|
|
|
1664 |
|
|
// if (mu->isStandAloneMuon()) {
|
1665 |
|
|
// reco::TrackRef sta = mu->standAloneMuon();
|
1666 |
|
|
//
|
1667 |
|
|
// }
|
1668 |
|
|
|
1669 |
|
|
|
1670 |
|
|
// int muInfo[12];
|
1671 |
|
|
// fillMuBlock(mu, muInfo);
|
1672 |
|
|
if(runOnMC_){
|
1673 |
|
|
const GenParticle* muMc = mu->genLepton();
|
1674 |
|
|
if(muMc!=0){
|
1675 |
|
|
mf.mcId=muMc->pdgId();
|
1676 |
|
|
mf.mcFourMomentum=GENPTOLORP(muMc);
|
1677 |
|
|
if(muMc->mother()!=0) mf.mcMomId=muMc->mother()->pdgId();
|
1678 |
|
|
if(muMc->mother()!=0 && muMc->mother()->mother()!=0) mf.mcgMomId=muMc->mother()->mother()->pdgId();
|
1679 |
|
|
} }
|
1680 |
|
|
hbbInfo->muInfo.push_back(mf);
|
1681 |
|
|
}
|
1682 |
|
|
|
1683 |
|
|
if(verbose_)
|
1684 |
|
|
std::cout << " INPUT electrons "<<electrons.size()<<std::endl;
|
1685 |
|
|
InputTag reducedEBRecHitCollection(string("reducedEcalRecHitsEB"));
|
1686 |
|
|
InputTag reducedEERecHitCollection(string("reducedEcalRecHitsEE"));
|
1687 |
|
|
EcalClusterLazyTools lazyTools(iEvent, iSetup, reducedEBRecHitCollection, reducedEERecHitCollection);
|
1688 |
|
|
edm::ESHandle<TransientTrackBuilder> builder;
|
1689 |
|
|
iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
|
1690 |
|
|
const TransientTrackBuilder & transientTrackBuilder= *(builder.product());
|
1691 |
|
|
|
1692 |
|
|
for(edm::View<pat::Electron>::const_iterator elec = electrons.begin(); elec!=electrons.end(); ++elec){
|
1693 |
|
|
VHbbEvent::ElectronInfo ef;
|
1694 |
|
|
ef.p4=GENPTOLORP(elec);
|
1695 |
|
|
ef.scEta =elec->superCluster()->eta();
|
1696 |
|
|
ef.scPhi =elec->superCluster()->phi();
|
1697 |
|
|
// if(ElecEta[eleccont]!=0) ElecEt[eleccont]=elec->superCluster()->energy()/cosh(elec->superCluster()->eta());
|
1698 |
|
|
ef.charge=elec->charge();
|
1699 |
|
|
ef.tIso=elec->trackIso();
|
1700 |
|
|
ef.eIso=elec->ecalIso();
|
1701 |
|
|
ef.hIso=elec->hcalIso();
|
1702 |
|
|
ef.pfChaIso=elec->chargedHadronIso();
|
1703 |
|
|
ef.pfChaPUIso=elec->puChargedHadronIso();//userIso(5);
|
1704 |
|
|
ef.pfPhoIso=elec->photonIso();
|
1705 |
|
|
ef.pfPhoIsoDoubleCounted=0;
|
1706 |
|
|
|
1707 |
|
|
/* Check if there are photons sharing the super cluster*/
|
1708 |
|
|
for(size_t k=0;k<photonsForIso.size();k++) {
|
1709 |
|
|
if(deltaR(elec->eta(),elec->phi(),photonsForIso[k].eta(),photonsForIso[k].phi()) < 0.05 && abs(photonsForIso[k].pt()-elec->pt())/(photonsForIso[k].pt()+elec->pt()) < 0.05 ) {
|
1710 |
|
|
std::cout << "Double counting of supercluster!" << std::endl;
|
1711 |
|
|
ef.pfPhoIsoDoubleCounted+=photonsForIso[k].pt();
|
1712 |
|
|
}
|
1713 |
|
|
}
|
1714 |
|
|
ef.pfNeuIso=elec->neutralHadronIso();
|
1715 |
|
|
|
1716 |
|
|
//
|
1717 |
|
|
// ip info
|
1718 |
|
|
//
|
1719 |
|
|
|
1720 |
|
|
ef.ipDb=elec->dB();
|
1721 |
|
|
ef.ipErrDb=elec->edB();
|
1722 |
|
|
|
1723 |
|
|
|
1724 |
|
|
|
1725 |
|
|
Geom::Phi<double> deltaphi(elec->superCluster()->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px()));
|
1726 |
|
|
ef.acop = deltaphi.value();
|
1727 |
|
|
//
|
1728 |
|
|
ef.sihih = elec->sigmaIetaIeta();
|
1729 |
|
|
ef.Dphi = elec->deltaPhiSuperClusterTrackAtVtx();
|
1730 |
|
|
ef.Deta = elec->deltaEtaSuperClusterTrackAtVtx();
|
1731 |
|
|
ef.HoE = elec->hadronicOverEm();
|
1732 |
|
|
ef.convDist = elec->convDist();
|
1733 |
|
|
ef.convDcot = elec->convDcot();
|
1734 |
|
|
if(elec->gsfTrack().isNonnull())
|
1735 |
|
|
{
|
1736 |
|
|
ef.innerHits = elec->gsfTrack()->trackerExpectedHitsInner().numberOfHits();
|
1737 |
|
|
}
|
1738 |
|
|
ef.isEB = elec->isEB();
|
1739 |
|
|
ef.isEE = elec->isEE();
|
1740 |
|
|
/* 2012 ELEID*/
|
1741 |
|
|
|
1742 |
|
|
const pat::Electron & ele = *elec;
|
1743 |
|
|
bool validKF= false;
|
1744 |
|
|
reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
|
1745 |
|
|
validKF = (myTrackRef.isAvailable());
|
1746 |
|
|
validKF = (myTrackRef.isNonnull());
|
1747 |
|
|
|
1748 |
|
|
// Pure tracking variables
|
1749 |
|
|
ef.fMVAVar_fbrem = ele.fbrem();
|
1750 |
|
|
ef.fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
|
1751 |
|
|
ef.fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
|
1752 |
|
|
// fMVAVar_kfhitsall = (validKF) ? myTrackRef->numberOfValidHits() : -1. ; // save also this in your ntuple as possible alternative
|
1753 |
|
|
ef.fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
|
1754 |
|
|
|
1755 |
|
|
|
1756 |
|
|
// Geometrical matchings
|
1757 |
|
|
ef.fMVAVar_deta = ele.deltaEtaSuperClusterTrackAtVtx();
|
1758 |
|
|
ef.fMVAVar_dphi = ele.deltaPhiSuperClusterTrackAtVtx();
|
1759 |
|
|
ef.fMVAVar_detacalo = ele.deltaEtaSeedClusterTrackAtCalo();
|
1760 |
|
|
// fMVAVar_dphicalo = ele.deltaPhiSeedClusterTrackAtCalo(); // save also this in your ntuple
|
1761 |
|
|
|
1762 |
|
|
|
1763 |
|
|
// Pure ECAL -> shower shapes
|
1764 |
|
|
ef.fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
|
1765 |
|
|
std::vector<float> vCov = lazyTools.localCovariances(*(ele.superCluster()->seed())) ;
|
1766 |
|
|
if (!isnan(vCov[2])) ef.fMVAVar_spp = sqrt (vCov[2]); //EleSigmaIPhiIPhi
|
1767 |
|
|
else ef.fMVAVar_spp = 0.;
|
1768 |
|
|
// fMVAVar_sigmaIEtaIPhi = vCov[1]; // save also this in your ntuple
|
1769 |
|
|
|
1770 |
|
|
ef.fMVAVar_etawidth = ele.superCluster()->etaWidth();
|
1771 |
|
|
ef.fMVAVar_phiwidth = ele.superCluster()->phiWidth();
|
1772 |
|
|
ef.fMVAVar_e1x5e5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
|
1773 |
|
|
ef.fMVAVar_R9 = lazyTools.e3x3(*(ele.superCluster()->seed())) / ele.superCluster()->rawEnergy();
|
1774 |
|
|
//fMVAVar_nbrems = fabs(ele.numberOfBrems()); // save also this in your ntuple
|
1775 |
|
|
|
1776 |
|
|
// Energy matching
|
1777 |
|
|
ef.fMVAVar_HoE = ele.hadronicOverEm();
|
1778 |
|
|
ef.fMVAVar_EoP = ele.eSuperClusterOverP();
|
1779 |
|
|
// fMVAVar_IoEmIoP = (1.0/(ele.superCluster()->energy())) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p()
|
1780 |
|
|
ef.fMVAVar_IoEmIoP = (1.0/ele.ecalEnergy()) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p() // 24/04/2012 changed to correctly access the corrected supercluster energy from CMSSW_52X
|
1781 |
|
|
|
1782 |
|
|
ef.fMVAVar_eleEoPout = ele.eEleClusterOverPout();
|
1783 |
|
|
ef.fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
|
1784 |
|
|
// fMVAVar_EoPout = ele.eSeedClusterOverPout(); // save also this in your ntuple
|
1785 |
|
|
|
1786 |
|
|
|
1787 |
|
|
// Spectators
|
1788 |
|
|
ef.fMVAVar_eta = ele.superCluster()->eta();
|
1789 |
|
|
ef.fMVAVar_pt = ele.pt();
|
1790 |
|
|
|
1791 |
|
|
//additional for cut based
|
1792 |
|
|
ef.dxy = elec->gsfTrack()->dxy(vertex.position());
|
1793 |
|
|
ef.dz = elec->gsfTrack()->dz(vertex.position());
|
1794 |
|
|
|
1795 |
|
|
|
1796 |
|
|
//d0
|
1797 |
|
|
if (ele.gsfTrack().isNonnull()) {
|
1798 |
|
|
ef.fMVAVar_d0 = (-1.0)*ele.gsfTrack()->dxy(vertex.position());
|
1799 |
|
|
} else if (ele.closestCtfTrackRef().isNonnull()) {
|
1800 |
|
|
ef.fMVAVar_d0 = (-1.0)*ele.closestCtfTrackRef()->dxy(vertex.position());
|
1801 |
|
|
} else {
|
1802 |
|
|
ef.fMVAVar_d0 = -9999.0;
|
1803 |
|
|
|
1804 |
|
|
//default values for IP3D
|
1805 |
|
|
ef.fMVAVar_ip3d = -999.0;
|
1806 |
|
|
// fMVAVar_ip3dSig = 0.0;
|
1807 |
|
|
if (ele.gsfTrack().isNonnull()) {
|
1808 |
|
|
const double gsfsign = ( (-ele.gsfTrack()->dxy(vertex.position())) >=0 ) ? 1. : -1.;
|
1809 |
|
|
|
1810 |
|
|
const reco::TransientTrack &tt = transientTrackBuilder.build(ele.gsfTrack());
|
1811 |
|
|
const std::pair<bool,Measurement1D> &ip3dpv = IPTools::absoluteImpactParameter3D(tt,vertex);
|
1812 |
|
|
if (ip3dpv.first) {
|
1813 |
|
|
double ip3d = gsfsign*ip3dpv.second.value();
|
1814 |
|
|
//double ip3derr = ip3dpv.second.error();
|
1815 |
|
|
ef.fMVAVar_ip3d = ip3d;
|
1816 |
|
|
// fMVAVar_ip3dSig = ip3d/ip3derr;
|
1817 |
|
|
}
|
1818 |
|
|
}
|
1819 |
|
|
}
|
1820 |
|
|
|
1821 |
|
|
|
1822 |
|
|
/* end of 2012 ELEID*/
|
1823 |
|
|
|
1824 |
|
|
//
|
1825 |
|
|
// fill eleids
|
1826 |
|
|
//
|
1827 |
|
|
/* ef.id95 = elec->electronID("simpleEleId95cIso");
|
1828 |
|
|
ef.id85 = elec->electronID("simpleEleId85cIso");
|
1829 |
|
|
ef.id70 = elec->electronID("simpleEleId70cIso");
|
1830 |
|
|
ef.id95r = elec->electronID("simpleEleId95relIso");
|
1831 |
|
|
ef.id70r = elec->electronID("simpleEleId70relIso");
|
1832 |
|
|
ef.id85r = elec->electronID("simpleEleId85relIso");
|
1833 |
|
|
*/
|
1834 |
|
|
ef.id95 =elec->electronID("eidVBTFCom95");
|
1835 |
|
|
ef.id95r=elec->electronID("eidVBTFRel95");
|
1836 |
|
|
ef.id85 =elec->electronID("eidVBTFCom85");
|
1837 |
|
|
ef.id85r=elec->electronID("eidVBTFRel85");
|
1838 |
|
|
ef.id80 =elec->electronID("eidVBTFCom80");
|
1839 |
|
|
ef.id80r=elec->electronID("eidVBTFRel80");
|
1840 |
|
|
ef.id70 =elec->electronID("eidVBTFCom70");
|
1841 |
|
|
ef.id70r=elec->electronID("eidVBTFRel70");
|
1842 |
|
|
ef.mvaOut=elec->electronID("mvaNonTrigV0");
|
1843 |
|
|
ef.mvaOutTrig=elec->electronID("mvaTrigV0");
|
1844 |
|
|
|
1845 |
|
|
//Electron trigger matching
|
1846 |
|
|
for (int itrig = 0; itrig != ntrigs; ++itrig){
|
1847 |
|
|
std::string trigName=triggerNames_.triggerName(itrig);
|
1848 |
|
|
if( (elec->triggerObjectMatchesByPath(trigName).size() != 0) ){
|
1849 |
|
|
ef.hltMatchedBits.push_back(itrig);
|
1850 |
|
|
if(verbose_){
|
1851 |
|
|
std::clog << "Trigger Matching box" << std::endl;
|
1852 |
|
|
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
1853 |
|
|
std::clog << "Matching parameters are defined in the cfg" << std::endl;
|
1854 |
|
|
std::clog << "Trigger bit = " << itrig << std::endl;
|
1855 |
|
|
std::clog << "Trigger name = " << trigName << std::endl;
|
1856 |
|
|
std::clog << "Trigger object matched collection size = " << elec->triggerObjectMatchesByPath(trigName).size() << std::endl;
|
1857 |
|
|
std::clog << "Pat Electron pt = " << ef.p4.Pt() << " HLT object matched = " << elec->triggerObjectMatch(0)->p4().Pt() << std::endl;
|
1858 |
|
|
std::clog << "+++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
|
1859 |
|
|
}
|
1860 |
|
|
}
|
1861 |
|
|
}
|
1862 |
|
|
|
1863 |
|
|
if(runOnMC_){
|
1864 |
|
|
const GenParticle* elecMc = elec->genLepton();
|
1865 |
|
|
if(elecMc!=0){
|
1866 |
|
|
ef.mcId=elecMc->pdgId();
|
1867 |
|
|
ef.mcFourMomentum=GENPTOLORP(elecMc);
|
1868 |
|
|
if(elecMc->mother()!=0) ef.mcMomId=elecMc->mother()->pdgId();
|
1869 |
|
|
if(elecMc->mother()!=0 && elecMc->mother()->mother()!=0) ef.mcgMomId=elecMc->mother()->mother()->pdgId();
|
1870 |
|
|
}}
|
1871 |
|
|
hbbInfo->eleInfo.push_back(ef);
|
1872 |
|
|
}
|
1873 |
|
|
|
1874 |
|
|
if(verbose_)
|
1875 |
|
|
std::cout << " INPUT taus "<<taus.size()<<std::endl;
|
1876 |
|
|
for(edm::View<pat::Tau>::const_iterator tau = taus.begin(); tau!=taus.end(); ++tau){
|
1877 |
|
|
VHbbEvent::TauInfo tf;
|
1878 |
|
|
tf.p4=GENPTOLORP(tau);
|
1879 |
|
|
tf.charge=tau->charge();
|
1880 |
|
|
tf.tIso=tau->trackIso();
|
1881 |
|
|
tf.eIso=tau->ecalIso();
|
1882 |
|
|
tf.hIso=tau->hcalIso();
|
1883 |
|
|
Geom::Phi<double> deltaphi(tau->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px()));
|
1884 |
|
|
double acop = deltaphi.value();
|
1885 |
|
|
tf.acop=acop;
|
1886 |
|
|
if (tau->isTauIDAvailable("againstElectronLoose")) tf.againstElectronLoose=tau->tauID("againstElectronLoose");
|
1887 |
|
|
if (tau->isTauIDAvailable("againstElectronMedium")) tf.againstElectronMedium=tau->tauID("againstElectronMedium");
|
1888 |
|
|
if (tau->isTauIDAvailable("againstElectronTight")) tf.againstElectronTight=tau->tauID("againstElectronTight");
|
1889 |
|
|
if (tau->isTauIDAvailable("againstMuonLoose")) tf.againstMuonLoose=tau->tauID("againstMuonLoose");
|
1890 |
|
|
if (tau->isTauIDAvailable("againstMuonTight")) tf.againstMuonTight=tau->tauID("againstMuonTight");
|
1891 |
|
|
if (tau->isTauIDAvailable("byLooseIsolation")) tf.byLooseIsolation=tau->tauID("byLooseIsolation");
|
1892 |
|
|
if (tau->isTauIDAvailable("byMediumIsolation")) tf.byMediumIsolation=tau->tauID("byMediumIsolation");
|
1893 |
|
|
if (tau->isTauIDAvailable("byTightIsolation")) tf.byTightIsolation=tau->tauID("byTightIsolation");
|
1894 |
|
|
if (tau->isTauIDAvailable("byVLooseIsolation")) tf.byVLooseIsolation=tau->tauID("byVLooseIsolation");
|
1895 |
|
|
if (tau->isTauIDAvailable("decayModeFinding")) tf.decayModeFinding=tau->tauID("decayModeFinding");
|
1896 |
|
|
if (tau->isTauIDAvailable("byIsolation")) tf.byIsolation=tau->tauID("byIsolation");
|
1897 |
|
|
if (tau->isTauIDAvailable("trackIsolation")) tf.trackIsolation=tau->tauID("trackIsolation");
|
1898 |
|
|
if (tau->isTauIDAvailable("byTaNCfrOnePercent")) tf.byTaNCfrOnePercent=tau->tauID("byTaNCfrOnePercent");
|
1899 |
|
|
if (tau->isTauIDAvailable("byTaNCfrHalfPercent")) tf.byTaNCfrHalfPercent=tau->tauID("byTaNCfrHalfPercent");
|
1900 |
|
|
if (tau->isTauIDAvailable("byTaNCfrQuarterPercent")) tf.byTaNCfrQuarterPercent=tau->tauID("byTaNCfrQuarterPercent");
|
1901 |
|
|
if (tau->isTauIDAvailable("byTaNCfrTenthPercent")) tf.byTaNCfrTenthPercent=tau->tauID("byTaNCfrTenthPercent");
|
1902 |
|
|
if (tau->isTauIDAvailable("byTaNC")) tf.byTaNC=tau->tauID("byTaNC");
|
1903 |
|
|
if (tau->isTauIDAvailable("byLooseCombinedIsolationDeltaBetaCorr")) tf.byLooseCombinedIsolationDeltaBetaCorr=tau->tauID("byLooseCombinedIsolationDeltaBetaCorr");
|
1904 |
|
|
if (tau->isTauIDAvailable("againstElectronMVA")) tf.againstElectronMVA=tau->tauID("againstElectronMVA");
|
1905 |
|
|
if (tau->isPFTau()) {
|
1906 |
|
|
tf.isolationPFChargedHadrCandsPtSum = tau->isolationPFChargedHadrCandsPtSum();
|
1907 |
|
|
tf.isolationPFGammaCandsEtSum = tau->isolationPFGammaCandsEtSum();
|
1908 |
|
|
if (tau->leadPFChargedHadrCand().isAvailable()) tf.leadPFChargedHadrCandPt = tau->leadPFChargedHadrCand()->pt();
|
1909 |
|
|
tf.NsignalPFChargedHadrCands = tau->signalPFChargedHadrCands().size();
|
1910 |
|
|
tf.NsignalPFGammaCands = tau->signalPFGammaCands().size();
|
1911 |
|
|
}
|
1912 |
|
|
hbbInfo->tauInfo.push_back(tf);
|
1913 |
|
|
if (verbose_) {
|
1914 |
|
|
std::cout << "SCZ DEBUG: againstElectronLoose is " << tf.againstElectronLoose << std::endl;
|
1915 |
|
|
std::cout << "SCZ DEBUG: againstElectronMedium is " << tf.againstElectronMedium << std::endl;
|
1916 |
|
|
std::cout << "SCZ DEBUG: againstElectronTight is " << tf.againstElectronTight << std::endl;
|
1917 |
|
|
std::cout << "SCZ DEBUG: againstMuonLoose is " << tf.againstMuonLoose << std::endl;
|
1918 |
|
|
std::cout << "SCZ DEBUG: againstMuonTight is " << tf.againstMuonTight << std::endl;
|
1919 |
|
|
std::cout << "SCZ DEBUG: byLooseIsolation is " << tf.byLooseIsolation << std::endl;
|
1920 |
|
|
std::cout << "SCZ DEBUG: byMediumIsolation is " << tf.byMediumIsolation << std::endl;
|
1921 |
|
|
std::cout << "SCZ DEBUG: byTightIsolation is " << tf.byTightIsolation << std::endl;
|
1922 |
|
|
std::cout << "SCZ DEBUG: byVLooseIsolation is " << tf.byVLooseIsolation << std::endl;
|
1923 |
|
|
std::cout << "SCZ DEBUG: decayModeFinding is " << tf.decayModeFinding << std::endl;
|
1924 |
|
|
std::cout << "SCZ DEBUG: byIsolation is " << tf.byIsolation<< std::endl;
|
1925 |
|
|
std::cout << "SCZ DEBUG: trackIsolation is " << tf.trackIsolation << std::endl;
|
1926 |
|
|
std::cout << "SCZ DEBUG: byTaNCfrOnePercent is " << tf.byTaNCfrOnePercent << std::endl;
|
1927 |
|
|
std::cout << "SCZ DEBUG: byTaNCfrHalfPercent is " << tf.byTaNCfrHalfPercent << std::endl;
|
1928 |
|
|
std::cout << "SCZ DEBUG: byTaNCfrQuarterPercent is " << tf.byTaNCfrQuarterPercent << std::endl;
|
1929 |
|
|
std::cout << "SCZ DEBUG: byTaNCfrTenthPercent is " << tf.byTaNCfrTenthPercent << std::endl;
|
1930 |
|
|
std::cout << "SCZ DEBUG: byTaNC is " << tf.byTaNC << std::endl;
|
1931 |
|
|
std::cout << "SCZ DEBUG: isolationPFChargedHadrCandsPtSum is " << tf.isolationPFChargedHadrCandsPtSum << std::endl;
|
1932 |
|
|
std::cout << "SCZ DEBUG: isolationPFGammaCandsEtSum is " << tf.isolationPFGammaCandsEtSum << std::endl;
|
1933 |
|
|
std::cout << "SCZ DEBUG: isolationPFGammaCandsEtSum is " << tf.leadPFChargedHadrCandPt << std::endl;
|
1934 |
|
|
std::cout << "SCZ DEBUG: NsignalPFChargedHadrCands is " << tf.NsignalPFChargedHadrCands << std::endl;
|
1935 |
|
|
std::cout << "SCZ DEBUG: NsignalPFGammaCands is " << tf.NsignalPFGammaCands << std::endl;
|
1936 |
|
|
std::cout << "SCZ DEBUG: byLooseCombinedIsolationDeltaBetaCorr is " << tf.byLooseCombinedIsolationDeltaBetaCorr << std::endl;
|
1937 |
|
|
std::cout << "SCZ DEBUG: againstElectronMVA is " << tf.againstElectronMVA << std::endl;
|
1938 |
|
|
}
|
1939 |
arizzi |
1.70 |
}
|
1940 |
ntran |
1.77.2.2 |
|
1941 |
|
|
CompareJetPtMuons ptComparatorMu;
|
1942 |
|
|
CompareJetPtElectrons ptComparatorE;
|
1943 |
|
|
CompareJetPtTaus ptComparatorTau;
|
1944 |
|
|
|
1945 |
|
|
std::sort(hbbInfo->muInfo.begin(), hbbInfo->muInfo.end(), ptComparatorMu);
|
1946 |
|
|
std::sort(hbbInfo->eleInfo.begin(), hbbInfo->eleInfo.end(), ptComparatorE);
|
1947 |
|
|
std::sort(hbbInfo->tauInfo.begin(), hbbInfo->tauInfo.end(), ptComparatorTau);
|
1948 |
|
|
|
1949 |
|
|
|
1950 |
|
|
|
1951 |
|
|
|
1952 |
|
|
if (verbose_){
|
1953 |
|
|
std::cout <<" Pushing hbbInfo "<<std::endl;
|
1954 |
|
|
std::cout <<" SimpleJets1 = "<<hbbInfo->simpleJets.size()<<std::endl<<
|
1955 |
|
|
" SimpleJets2 = "<<hbbInfo->simpleJets2.size()<<std::endl<<
|
1956 |
|
|
" SubJets = "<<hbbInfo->subJets.size()<<std::endl<<
|
1957 |
|
|
" HardJets = "<<hbbInfo->hardJets.size()<<std::endl<<
|
1958 |
|
|
" FilterJets = "<<hbbInfo->filterJets.size()<<std::endl<<
|
1959 |
|
|
" Muons = "<<hbbInfo->muInfo.size()<<std::endl<<
|
1960 |
|
|
" Electrons = "<<hbbInfo->eleInfo.size()<<std::endl<<
|
1961 |
|
|
" Taus = "<<hbbInfo->tauInfo.size()<<std::endl<<
|
1962 |
|
|
" Electrons = "<<hbbInfo->eleInfo.size()<<std::endl<<
|
1963 |
|
|
"--------------------- "<<std::endl;
|
1964 |
bortigno |
1.18 |
}
|
1965 |
ntran |
1.77.2.2 |
|
1966 |
|
|
|
1967 |
|
|
iEvent.put(hbbInfo);
|
1968 |
|
|
iEvent.put(auxInfo);
|
1969 |
|
|
|
1970 |
|
|
|
1971 |
|
|
delete jecUnc;
|
1972 |
|
|
|
1973 |
tboccali |
1.1 |
}
|
1974 |
ntran |
1.77.2.2 |
|
1975 |
tboccali |
1.1 |
void
|
1976 |
|
|
HbbAnalyzerNew::fillMuBlock(edm::View<pat::Muon>::const_iterator mu, int muInfo[15])
|
1977 |
|
|
{
|
1978 |
ntran |
1.77.2.2 |
if(muon::isGoodMuon(*mu,muon::TMLastStationLoose)) muInfo[0]=1;
|
1979 |
|
|
if(muon::isGoodMuon(*mu,muon::TMLastStationTight)) muInfo[1]=1;
|
1980 |
|
|
if(muon::isGoodMuon(*mu,muon::TM2DCompatibilityLoose)) muInfo[2]=1;
|
1981 |
|
|
if(muon::isGoodMuon(*mu,muon::TM2DCompatibilityTight)) muInfo[3]=1;
|
1982 |
|
|
if(muon::isGoodMuon(*mu,muon::TMOneStationLoose)) muInfo[4]=1;
|
1983 |
|
|
if(muon::isGoodMuon(*mu,muon::TMOneStationTight)) muInfo[5]=1;
|
1984 |
|
|
if(muon::isGoodMuon(*mu,muon::TMLastStationOptimizedLowPtLoose)) muInfo[6]=1;
|
1985 |
|
|
if(muon::isGoodMuon(*mu,muon::TMLastStationOptimizedLowPtTight))muInfo[7]=1;
|
1986 |
|
|
if(muon::isGoodMuon(*mu,muon::TMOneStationAngLoose)) muInfo[8]=1;
|
1987 |
|
|
if(muon::isGoodMuon(*mu,muon::TMOneStationAngTight)) muInfo[9]=1;
|
1988 |
|
|
if(muon::isGoodMuon(*mu,muon::TMLastStationAngLoose)) muInfo[10]=1;
|
1989 |
|
|
if(muon::isGoodMuon(*mu,muon::TMLastStationAngTight)) muInfo[11]=1;
|
1990 |
|
|
if(muon::isGoodMuon(*mu,muon::GMTkChiCompatibility)) muInfo[12]=1;
|
1991 |
|
|
if(muon::isGoodMuon(*mu,muon::GMStaChiCompatibility)) muInfo[13]=1;
|
1992 |
|
|
if(muon::isGoodMuon(*mu,muon::GMTkKinkTight)) muInfo[14]=1;
|
1993 |
tboccali |
1.1 |
}
|
1994 |
|
|
|
1995 |
ntran |
1.77.2.2 |
// ------------ method called once each job just before starting event loop ------------
|
1996 |
tboccali |
1.1 |
void
|
1997 |
|
|
HbbAnalyzerNew::beginJob(){
|
1998 |
|
|
}
|
1999 |
|
|
|
2000 |
|
|
|
2001 |
ntran |
1.77.2.2 |
// ------------ method called once each job just after ending the event loop ------------
|
2002 |
tboccali |
1.1 |
void
|
2003 |
|
|
HbbAnalyzerNew::endJob() {
|
2004 |
|
|
}
|
2005 |
|
|
|
2006 |
tboccali |
1.5 |
TVector2 HbbAnalyzerNew::getTvect( const pat::Jet* patJet ){
|
2007 |
ntran |
1.77.2.2 |
|
2008 |
|
|
TVector2 t_Vect(0,0);
|
2009 |
|
|
TVector2 null(0,0);
|
2010 |
|
|
TVector2 ci(0,0);
|
2011 |
|
|
TLorentzVector pi(0,0,0,0);
|
2012 |
|
|
TLorentzVector J(0,0,0,0);
|
2013 |
|
|
TVector2 r(0,0);
|
2014 |
|
|
double patJetpfcPt = 1e10;
|
2015 |
|
|
double r_mag = 1e10;
|
2016 |
|
|
unsigned int nOfconst = 0;
|
2017 |
|
|
|
2018 |
|
|
|
2019 |
|
|
if (patJet->isPFJet() == false) {
|
2020 |
|
|
return t_Vect;
|
2021 |
|
|
}
|
2022 |
|
|
|
2023 |
|
|
|
2024 |
|
|
//re-reconstruct the jet direction with the charged tracks
|
2025 |
|
|
std::vector<reco::PFCandidatePtr>
|
2026 |
tboccali |
1.5 |
patJetpfc = patJet->getPFConstituents();
|
2027 |
ntran |
1.77.2.2 |
for(size_t idx = 0; idx < patJetpfc.size(); idx++){
|
2028 |
|
|
if( patJetpfc.at(idx)->charge() != 0 ){
|
2029 |
|
|
pi.SetPtEtaPhiE( patJetpfc.at(idx)->pt(), patJetpfc.at(idx)->eta(), patJetpfc.at(idx)->phi(), patJetpfc.at(idx)->energy() );
|
2030 |
|
|
J += pi;
|
2031 |
|
|
nOfconst++;
|
2032 |
|
|
}
|
2033 |
|
|
}
|
2034 |
|
|
// if there are less than two charged tracks do not calculate the pull (there is not enough info). It returns a null vector
|
2035 |
|
|
|
2036 |
|
|
if( nOfconst < 2 )
|
2037 |
|
|
return null;
|
2038 |
|
|
|
2039 |
|
|
|
2040 |
|
|
|
2041 |
|
|
TVector2 v_J( J.Rapidity(), J.Phi() );
|
2042 |
|
|
//calculate TVector using only charged tracks
|
2043 |
|
|
for(size_t idx = 0; idx < patJetpfc.size(); idx++){
|
2044 |
|
|
if( patJetpfc.at(idx)->charge() != 0 ){
|
2045 |
|
|
patJetpfcPt = patJetpfc.at(idx)->pt();
|
2046 |
|
|
pi.SetPtEtaPhiE( patJetpfc.at(idx)->pt(), patJetpfc.at(idx)->eta(), patJetpfc.at(idx)->phi(), patJetpfc.at(idx)->energy() );
|
2047 |
|
|
r.Set( pi.Rapidity() - J.Rapidity(), Geom::deltaPhi( patJetpfc.at(idx)->phi(), J.Phi() ) );
|
2048 |
|
|
r_mag = r.Mod();
|
2049 |
|
|
t_Vect += ( patJetpfcPt / J.Pt() ) * r_mag * r;
|
2050 |
|
|
}
|
2051 |
|
|
}
|
2052 |
|
|
|
2053 |
|
|
|
2054 |
|
|
return t_Vect;
|
2055 |
|
|
|
2056 |
tboccali |
1.5 |
}
|
2057 |
|
|
|
2058 |
tboccali |
1.6 |
TLorentzVector HbbAnalyzerNew::getChargedTracksMomentum(const pat::Jet* patJet ){
|
2059 |
ntran |
1.77.2.2 |
// return TLorentzVector();
|
2060 |
|
|
TLorentzVector pi(0,0,0,0);
|
2061 |
|
|
TLorentzVector v_j1(0,0,0,0);
|
2062 |
|
|
|
2063 |
|
|
|
2064 |
|
|
// std::cout <<"fff ECCCCCCOOOOO "<<patJet->isPFJet()<<std::endl;
|
2065 |
|
|
|
2066 |
|
|
if (patJet->isPFJet() == false ){
|
2067 |
|
|
v_j1 = GENPTOLORP(patJet);
|
2068 |
|
|
return v_j1;
|
2069 |
|
|
}
|
2070 |
|
|
std::vector<reco::PFCandidatePtr>
|
2071 |
tboccali |
1.6 |
j1pfc = patJet->getPFConstituents();
|
2072 |
ntran |
1.77.2.2 |
for(size_t idx = 0; idx < j1pfc.size(); idx++){
|
2073 |
|
|
if( j1pfc.at(idx)->charge() != 0 ){
|
2074 |
|
|
pi.SetPtEtaPhiE( j1pfc.at(idx)->pt(), j1pfc.at(idx)->eta(), j1pfc.at(idx)->phi(), j1pfc.at(idx)->energy() );
|
2075 |
|
|
v_j1 += pi;
|
2076 |
|
|
}
|
2077 |
|
|
}
|
2078 |
|
|
return v_j1;
|
2079 |
|
|
//re-
|
2080 |
tboccali |
1.6 |
}
|
2081 |
tboccali |
1.5 |
|
2082 |
bortigno |
1.24 |
|
2083 |
ntran |
1.77.2.2 |
//Btagging scale factors
|
2084 |
tboccali |
1.33 |
void HbbAnalyzerNew::fillScaleFactors(VHbbEvent::SimpleJet& sj, BTagSFContainer iSF){
|
2085 |
ntran |
1.77.2.2 |
|
2086 |
|
|
|
2087 |
|
|
BinningPointByMap measurePoint;
|
2088 |
|
|
//for a USDG
|
2089 |
|
|
//for CB jets
|
2090 |
|
|
//scale factor 1 for CB jets over 240GeV/c
|
2091 |
|
|
if( TMath::Abs(sj.flavour) == 4 or TMath::Abs(sj.flavour) == 5 ){
|
2092 |
|
|
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() );
|
2093 |
|
|
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) );
|
2094 |
|
|
if( iSF.BTAGSF_CSVL->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){
|
2095 |
|
|
sj.SF_CSVL = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint);
|
2096 |
|
|
sj.SF_CSVLerr = iSF.BTAGSF_CSVL->getResult(PerformanceResult::BTAGBERRCORR , measurePoint);
|
2097 |
|
|
if(verbose_){
|
2098 |
|
|
std::clog << "C/B Jet flavour = " << sj.flavour << std::endl;
|
2099 |
|
|
std::clog << "C/B Jet Et = " << sj.p4.Et() << std::endl;
|
2100 |
|
|
std::clog << "C/B Jet eta = " << sj.p4.Eta() << std::endl;
|
2101 |
|
|
std::clog << "C/B CSVL Scale Factor = " << sj.SF_CSVL << std::endl;
|
2102 |
|
|
std::clog << "C/B CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl;
|
2103 |
|
|
}
|
2104 |
|
|
}
|
2105 |
|
|
if( iSF.BTAGSF_CSVM->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){
|
2106 |
|
|
sj.SF_CSVM = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint);
|
2107 |
|
|
sj.SF_CSVMerr = iSF.BTAGSF_CSVM->getResult(PerformanceResult::BTAGBERRCORR , measurePoint);
|
2108 |
|
|
}
|
2109 |
|
|
if( iSF.BTAGSF_CSVT->isResultOk(PerformanceResult::BTAGBEFFCORR , measurePoint) ){
|
2110 |
|
|
sj.SF_CSVT = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBEFFCORR , measurePoint);
|
2111 |
|
|
sj.SF_CSVTerr = iSF.BTAGSF_CSVT->getResult(PerformanceResult::BTAGBERRCORR , measurePoint);
|
2112 |
|
|
}
|
2113 |
|
|
else{
|
2114 |
|
|
if(verbose_){
|
2115 |
|
|
std::cerr << "No SF found in the database for this jet" << std::endl;
|
2116 |
|
|
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl;
|
2117 |
|
|
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl;
|
2118 |
|
|
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl;
|
2119 |
|
|
}
|
2120 |
|
|
}
|
2121 |
|
|
}
|
2122 |
|
|
else {
|
2123 |
|
|
measurePoint.insert( BinningVariables::JetEt, sj.p4.Et() );
|
2124 |
|
|
measurePoint.insert( BinningVariables::JetAbsEta, fabs(sj.p4.Eta()) );
|
2125 |
|
|
if( iSF.MISTAGSF_CSVL->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){
|
2126 |
|
|
sj.SF_CSVL = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint);
|
2127 |
|
|
sj.SF_CSVLerr = iSF.MISTAGSF_CSVL->getResult(PerformanceResult::BTAGLERRCORR , measurePoint);
|
2128 |
|
|
if(verbose_){
|
2129 |
|
|
std::clog << "Light Jet flavour = " << sj.flavour << std::endl;
|
2130 |
|
|
std::clog << "Light Jet Et = " << sj.p4.Et() << std::endl;
|
2131 |
|
|
std::clog << "Light Jet eta = " << sj.p4.Eta() << std::endl;
|
2132 |
|
|
std::clog << "Light CSVL Scale Factor = " << sj.SF_CSVL << std::endl;
|
2133 |
|
|
std::clog << "Light CSVL Scale Factor error = " << sj.SF_CSVLerr << std::endl;
|
2134 |
|
|
}
|
2135 |
|
|
}
|
2136 |
|
|
if( iSF.MISTAGSF_CSVM->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){
|
2137 |
|
|
sj.SF_CSVM = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint);
|
2138 |
|
|
sj.SF_CSVMerr = iSF.MISTAGSF_CSVM->getResult(PerformanceResult::BTAGLERRCORR , measurePoint);
|
2139 |
|
|
}
|
2140 |
|
|
if( iSF.MISTAGSF_CSVT->isResultOk(PerformanceResult::BTAGLEFFCORR , measurePoint) ){
|
2141 |
|
|
sj.SF_CSVT = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLEFFCORR , measurePoint);
|
2142 |
|
|
sj.SF_CSVTerr = iSF.MISTAGSF_CSVT->getResult(PerformanceResult::BTAGLERRCORR , measurePoint);
|
2143 |
|
|
}
|
2144 |
|
|
else{
|
2145 |
|
|
if(verbose_){
|
2146 |
|
|
std::cerr << "No SF found in the database for this jet" << std::endl;
|
2147 |
|
|
std::clog << "No SF found: Jet flavour = " << sj.flavour << std::endl;
|
2148 |
|
|
std::clog << "No SF found: Jet Et = " << sj.p4.Et() << std::endl;
|
2149 |
|
|
std::clog << "No SF found: Jet eta = " << sj.p4.Eta() << std::endl;
|
2150 |
|
|
}
|
2151 |
|
|
}
|
2152 |
bortigno |
1.24 |
}
|
2153 |
|
|
|
2154 |
|
|
}
|
2155 |
|
|
|
2156 |
tboccali |
1.28 |
void HbbAnalyzerNew::setJecUnc(VHbbEvent::SimpleJet& sj,JetCorrectionUncertainty* jecunc){
|
2157 |
ntran |
1.77.2.2 |
//
|
2158 |
|
|
// test
|
2159 |
|
|
//
|
2160 |
|
|
|
2161 |
|
|
// return;
|
2162 |
|
|
double eta = sj.p4.Eta();
|
2163 |
|
|
double pt = sj.p4.Pt();
|
2164 |
|
|
|
2165 |
|
|
jecunc->setJetEta(eta);
|
2166 |
|
|
jecunc->setJetPt(pt); // here you must use the CORRECTED jet pt
|
2167 |
|
|
double unc = jecunc->getUncertainty(true);
|
2168 |
|
|
sj.jecunc= unc;
|
2169 |
tboccali |
1.28 |
}
|
2170 |
|
|
|
2171 |
|
|
|
2172 |
|
|
void HbbAnalyzerNew ::fillSimpleJet (VHbbEvent::SimpleJet& sj, edm::View<pat::Jet>::const_iterator jet_iter){
|
2173 |
ntran |
1.77.2.2 |
sj.flavour = jet_iter->partonFlavour();
|
2174 |
|
|
|
2175 |
tboccali |
1.28 |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags");
|
2176 |
|
|
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags");
|
2177 |
|
|
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags");
|
2178 |
|
|
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags");
|
2179 |
|
|
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags");
|
2180 |
|
|
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags");
|
2181 |
arizzi |
1.65 |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags");
|
2182 |
|
|
sj.csvivf=jet_iter->bDiscriminator("combinedInclusiveSecondaryVertexBJetTags");
|
2183 |
|
|
sj.cmva=jet_iter->bDiscriminator("combinedMVABJetTags");
|
2184 |
tboccali |
1.28 |
sj.charge=jet_iter->jetCharge();
|
2185 |
|
|
sj.ntracks=jet_iter->associatedTracks().size();
|
2186 |
|
|
sj.p4=GENPTOLORP(jet_iter);
|
2187 |
ntran |
1.77.2.2 |
// std::cout << " ECCO "<<sj.csv<< " "<< sj.p4.Pt()<<std::endl;
|
2188 |
tboccali |
1.28 |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter)));
|
2189 |
|
|
sj.SF_CSVL=1;
|
2190 |
|
|
sj.SF_CSVM=1;
|
2191 |
|
|
sj.SF_CSVT=1;
|
2192 |
|
|
sj.SF_CSVLerr=0;
|
2193 |
|
|
sj.SF_CSVMerr=0;
|
2194 |
|
|
sj.SF_CSVTerr=0;
|
2195 |
|
|
|
2196 |
ntran |
1.77.2.2 |
|
2197 |
|
|
|
2198 |
|
|
|
2199 |
degrutto |
1.73 |
|
2200 |
tboccali |
1.29 |
if (jet_iter->isPFJet() == true) {
|
2201 |
ntran |
1.77.2.2 |
|
2202 |
|
|
sj.chargedHadronEFraction = jet_iter-> chargedHadronEnergyFraction();
|
2203 |
|
|
sj.neutralHadronEFraction = jet_iter-> neutralHadronEnergyFraction ();
|
2204 |
|
|
sj.chargedEmEFraction = jet_iter-> chargedEmEnergyFraction ();
|
2205 |
|
|
sj.neutralEmEFraction = jet_iter-> neutralEmEnergyFraction ();
|
2206 |
|
|
sj.nConstituents = jet_iter->getPFConstituents().size();
|
2207 |
|
|
|
2208 |
tboccali |
1.29 |
}
|
2209 |
malbouis |
1.68 |
sj.jetArea = jet_iter->jetArea();
|
2210 |
ntran |
1.77.2.2 |
//
|
2211 |
|
|
// addtaginfo for csv
|
2212 |
|
|
//
|
2213 |
|
|
|
2214 |
|
|
// if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) {
|
2215 |
|
|
|
2216 |
tboccali |
1.28 |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex();
|
2217 |
ntran |
1.77.2.2 |
if (tf){
|
2218 |
|
|
math::XYZTLorentzVectorD vertexSum;
|
2219 |
|
|
for(size_t vi=0;vi< tf->nVertices();vi++)
|
2220 |
|
|
{
|
2221 |
|
|
vertexSum+=tf->secondaryVertex(vi).p4();
|
2222 |
|
|
}
|
2223 |
|
|
sj.vtxP4 = GENPTOLOR(vertexSum);
|
2224 |
|
|
|
2225 |
|
|
if (tf->nVertices() >0){
|
2226 |
|
|
sj.vtxPosition = TVector3(tf->secondaryVertex(0).position().x(),tf->secondaryVertex(0).position().y(),tf->secondaryVertex(0).position().z());
|
2227 |
|
|
sj.vtxMass = tf->secondaryVertex(0).p4().mass();
|
2228 |
|
|
sj.vtxNTracks = tf->secondaryVertex(0).nTracks();
|
2229 |
|
|
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin();
|
2230 |
|
|
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){
|
2231 |
|
|
sj.vtxTrackIds.push_back(tit->key());
|
2232 |
|
|
}
|
2233 |
|
|
Measurement1D m = tf->flightDistance(0);
|
2234 |
|
|
sj.vtx3dL = m.value();
|
2235 |
|
|
sj.vtx3deL = m.error();
|
2236 |
|
|
}
|
2237 |
tboccali |
1.28 |
}
|
2238 |
malbouis |
1.68 |
|
2239 |
ntran |
1.77.2.2 |
// CSV track info
|
2240 |
malbouis |
1.68 |
const reco::SecondaryVertexTagInfo * svTagInfos = jet_iter->tagInfoSecondaryVertex();
|
2241 |
|
|
const reco::TrackIPTagInfo * ipTagInfos = jet_iter->tagInfoTrackIP();
|
2242 |
|
|
for (edm::RefVector<reco::TrackCollection>::const_iterator t = ipTagInfos->selectedTracks().begin(); t != ipTagInfos->selectedTracks().end(); t++){
|
2243 |
ntran |
1.77.2.2 |
sj.btagTrackIds.push_back(t->key());
|
2244 |
malbouis |
1.68 |
}// all btag IP selected tracks
|
2245 |
|
|
std::vector<const reco::BaseTagInfo*> tagInfos;
|
2246 |
|
|
tagInfos.push_back(dynamic_cast<const reco::BaseTagInfo*>(ipTagInfos));
|
2247 |
|
|
tagInfos.push_back(dynamic_cast<const reco::BaseTagInfo*>(svTagInfos));
|
2248 |
|
|
JetTagComputer::TagInfoHelper helper(tagInfos);
|
2249 |
|
|
reco::TaggingVariableList varList = computer->taggingVariables(helper); // computer for getting CSV variables
|
2250 |
ntran |
1.77.2.2 |
|
2251 |
malbouis |
1.68 |
for(reco::TaggingVariableList::const_iterator iter = varList.begin(); iter != varList.end(); ++iter)
|
2252 |
ntran |
1.77.2.2 |
{
|
2253 |
|
|
//std::cout << reco::TaggingVariableTokens[iter->first] << " = " << iter->second << std::endl;
|
2254 |
|
|
for (edm::RefVector<reco::TrackCollection>::const_iterator t = ipTagInfos->selectedTracks().begin(); t != ipTagInfos->selectedTracks().end(); t++){
|
2255 |
|
|
|
2256 |
|
|
if (strcmp(reco::TaggingVariableTokens[iter->first], "trackMomentum") == 0 && (fabs((float)iter->second - (float)(*t)->p()) < 0.0001) ){
|
2257 |
|
|
sj.csvTrackIds.push_back(t->key());
|
2258 |
|
|
}// if tagged track
|
2259 |
|
|
}// loop on IPtracks
|
2260 |
|
|
}// loop on CSV variables
|
2261 |
|
|
|
2262 |
malbouis |
1.68 |
|
2263 |
|
|
sj.btagNTracks= ipTagInfos->selectedTracks().size();
|
2264 |
|
|
sj.csvNTracks = sj.csvTrackIds.size();
|
2265 |
ntran |
1.77.2.2 |
|
2266 |
|
|
//
|
2267 |
|
|
// add tVector
|
2268 |
|
|
//
|
2269 |
tboccali |
1.28 |
sj.tVector = getTvect(&(*jet_iter));
|
2270 |
ntran |
1.77.2.2 |
|
2271 |
dlopes |
1.67 |
sj.ptRaw = jet_iter->correctedJet(0).pt();
|
2272 |
ntran |
1.77.2.2 |
|
2273 |
dlopes |
1.67 |
sj.ptLeadTrack =-9999.;
|
2274 |
|
|
if (jet_iter->isPFJet() == true) {
|
2275 |
ntran |
1.77.2.2 |
std::vector <reco::PFCandidatePtr> constituents = jet_iter->getPFConstituents ();
|
2276 |
|
|
for (unsigned ic = 0; ic < constituents.size (); ++ic) {
|
2277 |
|
|
if ( constituents[ic]->particleId() > 3 ) continue;
|
2278 |
|
|
reco::TrackRef trackRef = constituents[ic]->trackRef();
|
2279 |
|
|
if ( trackRef.isNonnull() ) { if(trackRef->pt() > sj.ptLeadTrack) sj.ptLeadTrack=trackRef->pt(); }
|
2280 |
|
|
}
|
2281 |
|
|
}
|
2282 |
|
|
|
2283 |
|
|
|
2284 |
tboccali |
1.28 |
}
|
2285 |
|
|
|
2286 |
arizzi |
1.56 |
float HbbAnalyzerNew::metSignificance(const reco::MET * met)
|
2287 |
|
|
{
|
2288 |
ntran |
1.77.2.2 |
double sigmaX2= met->getSignificanceMatrix()(0,0);
|
2289 |
|
|
double sigmaY2= met->getSignificanceMatrix()(1,1);
|
2290 |
|
|
double significance = 0;
|
2291 |
|
|
try {
|
2292 |
|
|
if(sigmaX2<1.e10 && sigmaY2<1.e10) significance = met->significance();
|
2293 |
|
|
}
|
2294 |
|
|
catch(...)
|
2295 |
|
|
{
|
2296 |
|
|
std::cout << "PROBLEM WITH MET SIGNIFICANCE sigma X2 and Y2 are: " << sigmaX2 << " " << sigmaY2 << std::endl;
|
2297 |
|
|
}
|
2298 |
|
|
return significance;
|
2299 |
arizzi |
1.56 |
}
|
2300 |
|
|
|
2301 |
tboccali |
1.28 |
|
2302 |
ntran |
1.77.2.2 |
//define this as a plug-in
|
2303 |
tboccali |
1.1 |
DEFINE_FWK_MODULE(HbbAnalyzerNew);
|