17 |
|
// |
18 |
|
// |
19 |
|
|
20 |
+ |
|
21 |
+ |
//uncomment to save also jet collections 1 and 4 |
22 |
+ |
//#define ENABLE_SIMPLEJETS1 |
23 |
+ |
//#define ENABLE_SIMPLEJETS4 |
24 |
+ |
|
25 |
|
#include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h" |
26 |
|
#include "CondFormats/JetMETObjects/interface/JetCorrectionUncertainty.h" |
27 |
|
#include "JetMETCorrections/Objects/interface/JetCorrector.h" |
29 |
|
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
30 |
|
|
31 |
|
#include "VHbbAnalysis/HbbAnalyzer/interface/HbbAnalyzerNew.h" |
32 |
+ |
#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" |
33 |
+ |
|
34 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" |
35 |
|
|
36 |
|
#define GENPTOLOR(a) TLorentzVector((a).px(), (a).py(), (a).pz(), (a).energy()) |
37 |
|
#define GENPTOLORP(a) TLorentzVector((a)->px(), (a)->py(), (a)->pz(), (a)->energy()) |
67 |
|
tauLabel_(iConfig.getParameter<edm::InputTag>("tauTag")), |
68 |
|
metLabel_(iConfig.getParameter<edm::InputTag>("metTag")), |
69 |
|
phoLabel_(iConfig.getParameter<edm::InputTag>("photonTag")), |
62 |
– |
dimuLabel_(iConfig.getParameter<edm::InputTag>("dimuTag")), |
63 |
– |
dielecLabel_(iConfig.getParameter<edm::InputTag>("dielecTag")), |
70 |
|
hltResults_(iConfig.getParameter<edm::InputTag>("hltResultsTag")), |
71 |
|
runOnMC_(iConfig.getParameter<bool>("runOnMC")), verbose_(iConfig.getUntrackedParameter<bool>("verbose")) { |
72 |
|
|
97 |
|
HbbAnalyzerNew::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){ |
98 |
|
using namespace edm; |
99 |
|
using namespace reco; |
100 |
< |
|
100 |
> |
|
101 |
> |
|
102 |
|
// JEC Uncertainty |
103 |
|
|
104 |
|
// JetCorrectionUncertainty *jecUnc=0; |
105 |
< |
edm::ESHandle<g> JetCorParColl; |
105 |
> |
edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl; |
106 |
|
iSetup.get<JetCorrectionsRecord>().get("AK5PF",JetCorParColl); |
107 |
< |
std::cout <<" PIPPO " << JetCorParColl.isValid()<<" " <<std::endl; |
107 |
> |
JetCorrectionUncertainty *jecUnc=0; |
108 |
> |
// if (!runOnMC_){ |
109 |
|
JetCorrectorParameters const & JetCorPar = (*JetCorParColl)["Uncertainty"]; |
110 |
< |
std::cout <<" Pluto " << &JetCorPar<<std::endl; |
111 |
< |
JetCorrectionUncertainty *jecUnc = new JetCorrectionUncertainty(JetCorPar); |
104 |
< |
|
105 |
< |
|
110 |
> |
jecUnc = new JetCorrectionUncertainty(JetCorPar); |
111 |
> |
// } |
112 |
|
|
113 |
|
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() ); |
114 |
|
std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() ); |
115 |
< |
|
115 |
> |
|
116 |
> |
|
117 |
> |
if (runOnMC_){ |
118 |
> |
Handle<GenEventInfoProduct> evt_info; |
119 |
> |
iEvent.getByType(evt_info); |
120 |
> |
auxInfo->weightMCProd = evt_info->weight(); |
121 |
> |
} |
122 |
> |
else |
123 |
> |
{ auxInfo->weightMCProd =1.;} |
124 |
|
// |
125 |
|
// ?? |
126 |
< |
|
126 |
> |
|
127 |
|
// trigger |
128 |
|
|
129 |
|
// trigger |
174 |
|
|
175 |
|
|
176 |
|
edm::Handle<double> rhoHandle; |
177 |
< |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); auxInfo->puInfo.rho = *rhoHandle; |
178 |
< |
|
177 |
> |
iEvent.getByLabel(edm::InputTag("kt6PFJets", "rho"),rhoHandle); |
178 |
> |
auxInfo->puInfo.rho = *rhoHandle; |
179 |
> |
|
180 |
> |
edm::Handle<double> rho25Handle; |
181 |
> |
iEvent.getByLabel(edm::InputTag("kt6PFJets25", "rho"),rho25Handle); |
182 |
> |
auxInfo->puInfo.rho25 = *rho25Handle; |
183 |
> |
|
184 |
> |
edm::Handle<std::vector< PileupSummaryInfo> > puHandle; |
185 |
> |
|
186 |
> |
if (runOnMC_){ |
187 |
> |
iEvent.getByType(puHandle); |
188 |
> |
if (puHandle.isValid()){ |
189 |
> |
|
190 |
> |
std::vector< PileupSummaryInfo> pu = (*puHandle); |
191 |
> |
for (std::vector<PileupSummaryInfo>::const_iterator it= pu.begin(); it!=pu.end(); ++it){ |
192 |
> |
int bx = (*it).getBunchCrossing(); |
193 |
> |
unsigned int num = (*it).getPU_NumInteractions(); |
194 |
> |
// std::cout <<" PU PUSHING "<<bx<<" " <<num<<std::endl; |
195 |
> |
auxInfo->puInfo.pus[bx] =num; |
196 |
> |
} |
197 |
> |
} |
198 |
> |
} |
199 |
> |
|
200 |
|
//// real start |
201 |
|
|
202 |
|
|
386 |
|
iEvent.getByLabel(tauLabel_,tauHandle); |
387 |
|
edm::View<pat::Tau> taus = *tauHandle; |
388 |
|
|
354 |
– |
edm::Handle<CandidateView> dimuons; |
355 |
– |
iEvent.getByLabel(dimuLabel_,dimuons); |
356 |
– |
|
357 |
– |
edm::Handle<CandidateView> dielectrons; |
358 |
– |
iEvent.getByLabel(dielecLabel_,dielectrons); |
389 |
|
|
390 |
|
//BTAGGING SCALE FACTOR FROM DATABASE |
391 |
|
//Combined Secondary Vertex Loose |
392 |
|
edm::ESHandle<BtagPerformance> bTagSF_CSVL_; |
393 |
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVL",bTagSF_CSVL_); |
364 |
– |
const BtagPerformance & bTagSF_CSVL = *(bTagSF_CSVL_.product()); |
394 |
|
//Combined Secondary Vertex Medium |
395 |
|
edm::ESHandle<BtagPerformance> bTagSF_CSVM_; |
396 |
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVM",bTagSF_CSVM_); |
368 |
– |
const BtagPerformance & bTagSF_CSVM = *(bTagSF_CSVM_.product()); |
397 |
|
//Combined Secondary Vertex Tight |
398 |
|
edm::ESHandle<BtagPerformance> bTagSF_CSVT_; |
399 |
|
iSetup.get<BTagPerformanceRecord>().get("BTAGCSVT",bTagSF_CSVT_); |
372 |
– |
const BtagPerformance & bTagSF_CSVT = *(bTagSF_CSVT_.product()); |
400 |
|
|
401 |
|
edm::ESHandle<BtagPerformance> mistagSF_CSVL_; |
402 |
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVL",mistagSF_CSVL_); |
376 |
– |
const BtagPerformance & mistagSF_CSVL = *(mistagSF_CSVL_.product()); |
403 |
|
//Combined Secondary Vertex Medium |
404 |
|
edm::ESHandle<BtagPerformance> mistagSF_CSVM_; |
405 |
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVM",mistagSF_CSVM_); |
380 |
– |
const BtagPerformance & mistagSF_CSVM = *(mistagSF_CSVM_.product()); |
406 |
|
//Combined Secondary Vertex Tight |
407 |
|
edm::ESHandle<BtagPerformance> mistagSF_CSVT_; |
408 |
|
iSetup.get<BTagPerformanceRecord>().get("MISTAGCSVT",mistagSF_CSVT_); |
384 |
– |
const BtagPerformance & mistagSF_CSVT = *(mistagSF_CSVT_.product()); |
409 |
|
|
410 |
|
BTagSFContainer btagSFs; |
411 |
|
btagSFs.BTAGSF_CSVL = (bTagSF_CSVL_.product()); |
415 |
|
btagSFs.MISTAGSF_CSVM = (mistagSF_CSVM_.product()); |
416 |
|
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product()); |
417 |
|
|
418 |
+ |
#ifdef ENABLE_SIMPLEJETS1 |
419 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){ |
420 |
|
// if(jet_iter->pt()>50) |
421 |
|
// njetscounter++; |
422 |
|
VHbbEvent::SimpleJet sj; |
423 |
|
fillSimpleJet(sj,jet_iter); |
424 |
< |
if(runOnMC_) setJecUnc(sj,jecUnc); |
400 |
< |
/* sj.flavour = jet_iter->partonFlavour(); |
424 |
> |
// if(!runOnMC_) |
425 |
|
|
426 |
< |
sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
427 |
< |
sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags"); |
428 |
< |
sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags"); |
405 |
< |
sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags"); |
406 |
< |
sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags"); |
407 |
< |
sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags"); |
408 |
< |
sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags"); |
409 |
< |
sj.charge=jet_iter->jetCharge(); |
410 |
< |
sj.ntracks=jet_iter->associatedTracks().size(); |
411 |
< |
sj.p4=GENPTOLORP(jet_iter); |
412 |
< |
sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter))); |
413 |
< |
sj.SF_CSVL=1; |
414 |
< |
sj.SF_CSVM=1; |
415 |
< |
sj.SF_CSVT=1; |
416 |
< |
sj.SF_CSVLerr=0; |
417 |
< |
sj.SF_CSVMerr=0; |
418 |
< |
sj.SF_CSVTerr=0; |
426 |
> |
setJecUnc(sj,jecUnc); |
427 |
> |
|
428 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
429 |
|
|
430 |
+ |
if(runOnMC_){ |
431 |
+ |
|
432 |
+ |
fillScaleFactors(sj, btagSFs); |
433 |
+ |
|
434 |
+ |
//PAT genJet matching |
435 |
+ |
//genJet |
436 |
+ |
const reco::GenJet *gJ = jet_iter->genJet(); |
437 |
+ |
//physical parton for mother info ONLY |
438 |
+ |
if( (jet_iter->genParton()) |
439 |
+ |
and (jet_iter->genParton()->mother()) ) |
440 |
+ |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
441 |
+ |
TLorentzVector gJp4; |
442 |
+ |
if(gJ){ |
443 |
+ |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
444 |
+ |
sj.bestMCp4mom = gJp4; |
445 |
+ |
if(verbose_){ |
446 |
+ |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
447 |
+ |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
448 |
+ |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
449 |
+ |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
450 |
+ |
} |
451 |
+ |
} |
452 |
+ |
|
453 |
+ |
} //isMC |
454 |
+ |
hbbInfo->simpleJets.push_back(sj); |
455 |
|
|
456 |
+ |
} |
457 |
+ |
#endif //ENABLE_SIMPLEJETS1 |
458 |
|
|
459 |
< |
sj.chargedHadronEFraction = jet_iter-> chargedHadronEnergyFraction(); |
459 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){ |
460 |
> |
// if(jet_iter->pt()>50) |
461 |
> |
// njetscounter++; |
462 |
> |
VHbbEvent::SimpleJet sj; |
463 |
> |
fillSimpleJet(sj,jet_iter); |
464 |
> |
// if(!runOnMC_) |
465 |
> |
setJecUnc(sj,jecUnc); |
466 |
|
|
467 |
|
|
468 |
< |
// |
426 |
< |
// addtaginfo for csv |
427 |
< |
// |
468 |
> |
Particle::LorentzVector p4Jet = jet_iter->p4(); |
469 |
|
|
470 |
< |
if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
470 |
> |
if(runOnMC_){ |
471 |
|
|
472 |
< |
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
432 |
< |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
433 |
< |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
434 |
< |
Measurement1D m = tf->flightDistance(0); |
435 |
< |
sj.vtx3dL = m.value(); |
436 |
< |
sj.vtx3deL = m.error(); |
437 |
< |
} |
472 |
> |
fillScaleFactors(sj, btagSFs); |
473 |
|
|
474 |
+ |
//PAT genJet matching |
475 |
+ |
//genJet |
476 |
+ |
const reco::GenJet *gJ = jet_iter->genJet(); |
477 |
+ |
//physical parton for mother info ONLY |
478 |
+ |
if( (jet_iter->genParton()) |
479 |
+ |
and (jet_iter->genParton()->mother()) ) |
480 |
+ |
sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId(); |
481 |
+ |
TLorentzVector gJp4; |
482 |
+ |
if(gJ){ |
483 |
+ |
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
484 |
+ |
sj.bestMCp4mom = gJp4; |
485 |
+ |
if(verbose_){ |
486 |
+ |
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
487 |
+ |
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
488 |
+ |
std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl; |
489 |
+ |
std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl; |
490 |
+ |
} |
491 |
+ |
} |
492 |
+ |
|
493 |
+ |
} //isMC |
494 |
+ |
hbbInfo->simpleJets3.push_back(sj); |
495 |
+ |
|
496 |
+ |
} |
497 |
|
|
498 |
< |
// |
499 |
< |
// add tVector |
500 |
< |
// |
501 |
< |
sj.tVector = getTvect(&(*jet_iter)); |
498 |
> |
#ifdef ENABLE_SIMPLEJETS4 |
499 |
> |
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){ |
500 |
> |
// if(jet_iter->pt()>50) |
501 |
> |
// njetscounter++; |
502 |
> |
VHbbEvent::SimpleJet sj; |
503 |
> |
fillSimpleJet(sj,jet_iter); |
504 |
> |
// if(!runOnMC_) |
505 |
> |
setJecUnc(sj,jecUnc); |
506 |
|
|
445 |
– |
*/ |
507 |
|
|
508 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
509 |
|
|
521 |
|
TLorentzVector gJp4; |
522 |
|
if(gJ){ |
523 |
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
524 |
< |
sj. bestMCp4mom = gJp4; |
524 |
> |
sj.bestMCp4mom = gJp4; |
525 |
|
if(verbose_){ |
526 |
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
527 |
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
531 |
|
} |
532 |
|
|
533 |
|
} //isMC |
534 |
< |
hbbInfo->simpleJets.push_back(sj); |
534 |
> |
hbbInfo->simpleJets4.push_back(sj); |
535 |
|
|
536 |
|
} |
537 |
< |
|
537 |
> |
#endif //ENABLE SIMPLEJETS4 |
538 |
> |
|
539 |
|
|
540 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){ |
541 |
|
|
542 |
|
VHbbEvent::SimpleJet sj; |
543 |
|
fillSimpleJet(sj,jet_iter); |
544 |
< |
if(runOnMC_) setJecUnc(sj,jecUnc); |
544 |
> |
// if(!runOnMC_) |
545 |
> |
setJecUnc(sj,jecUnc); |
546 |
|
/* sj.flavour = jet_iter->partonFlavour(); |
547 |
|
|
548 |
|
|
586 |
|
*/ |
587 |
|
Particle::LorentzVector p4Jet = jet_iter->p4(); |
588 |
|
|
526 |
– |
|
589 |
|
if(runOnMC_){ |
590 |
|
|
591 |
|
//BTV scale factors |
601 |
|
TLorentzVector gJp4; |
602 |
|
if(gJ){ |
603 |
|
gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy()); |
604 |
< |
sj. bestMCp4mom = gJp4; |
604 |
> |
sj.bestMCp4mom = gJp4; |
605 |
|
if(verbose_){ |
606 |
|
std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl; |
607 |
|
std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl; |
682 |
|
|
683 |
|
VHbbEvent::SimpleJet sj; |
684 |
|
fillSimpleJet(sj,subjet_iter); |
685 |
< |
if(runOnMC_) setJecUnc(sj,jecUnc); |
685 |
> |
// if(!runOnMC_) |
686 |
> |
setJecUnc(sj,jecUnc); |
687 |
|
/* sj.flavour = subjet_iter->partonFlavour(); |
688 |
|
sj.tVector = getTvect(&(*subjet_iter)); |
689 |
|
sj.tche=subjet_iter->bDiscriminator("trackCountingHighEffBJetTags"); |
726 |
|
edm::View<pat::MET> metsTC = *metTCHandle; |
727 |
|
if(metsTC.size()){ |
728 |
|
hbbInfo->tcmet.sumEt=(metsTC[0]).sumEt(); |
729 |
< |
hbbInfo->tcmet.metSig=(metsTC[0]).mEtSig(); |
729 |
> |
hbbInfo->tcmet.metSig=(metsTC[0]).significance(); |
730 |
|
hbbInfo->tcmet.eLong=(metsTC[0]).e_longitudinal(); |
731 |
|
hbbInfo->tcmet.p4=GENPTOLOR((metsTC[0])); |
732 |
|
if (verbose_) std::cout <<" METTC "<< hbbInfo->tcmet.metSig <<" " << hbbInfo->tcmet.sumEt<<std::endl; |
733 |
|
} |
734 |
|
|
735 |
+ |
edm::Handle<edm::View<reco::MET> > pfMETNoPUHandle; |
736 |
+ |
iEvent.getByLabel("pfMETNoPU",pfMETNoPUHandle); |
737 |
+ |
edm::View<reco::MET> metspfMETNoPU = *pfMETNoPUHandle; |
738 |
+ |
if(metspfMETNoPU.size()){ |
739 |
+ |
hbbInfo->metNoPU.sumEt=(metspfMETNoPU[0]).sumEt(); |
740 |
+ |
hbbInfo->metNoPU.metSig=(metspfMETNoPU[0]).significance(); |
741 |
+ |
hbbInfo->metNoPU.eLong=(metspfMETNoPU[0]).e_longitudinal(); |
742 |
+ |
hbbInfo->metNoPU.p4=GENPTOLOR((metspfMETNoPU[0])); |
743 |
+ |
if (verbose_) std::cout <<" pfMETNoPU "<< hbbInfo->metNoPU.metSig <<" " << hbbInfo->metNoPU.sumEt<<std::endl; |
744 |
+ |
} |
745 |
|
|
746 |
|
edm::Handle<edm::View<reco::MET> > mHTHandle; |
747 |
|
iEvent.getByLabel("patMETsHT",mHTHandle); |
748 |
|
edm::View<reco::MET> metsHT = *mHTHandle; |
749 |
|
if(metsHT.size()){ |
750 |
|
hbbInfo->mht.sumEt=(metsHT[0]).sumEt(); |
751 |
< |
hbbInfo->mht.metSig=(metsHT[0]).mEtSig(); |
751 |
> |
hbbInfo->mht.metSig=(metsHT[0]).significance(); |
752 |
|
hbbInfo->mht.eLong=(metsHT[0]).e_longitudinal(); |
753 |
|
hbbInfo->mht.p4=GENPTOLOR((metsHT[0])); |
754 |
|
if (verbose_) std::cout <<" METHT "<< hbbInfo->mht.metSig <<" " << hbbInfo->mht.sumEt<<std::endl; |
755 |
|
} |
756 |
|
|
757 |
< |
edm::Handle<edm::View<pat::MET> > metHandle; |
757 |
> |
edm::Handle<edm::View<reco::MET> > metHandle; |
758 |
|
iEvent.getByLabel(metLabel_,metHandle); |
759 |
< |
edm::View<pat::MET> mets = *metHandle; |
759 |
> |
edm::View<reco::MET> mets = *metHandle; |
760 |
|
|
761 |
|
if(mets.size()){ |
762 |
|
hbbInfo->calomet.sumEt=(mets[0]).sumEt(); |
763 |
< |
hbbInfo->calomet.metSig=(mets[0]).mEtSig(); |
763 |
> |
hbbInfo->calomet.metSig=(mets[0]).significance(); |
764 |
|
hbbInfo->calomet.eLong=(mets[0]).e_longitudinal(); |
765 |
|
hbbInfo->calomet.p4=GENPTOLOR((mets[0])); |
766 |
|
if (verbose_) std::cout <<" METCALO "<< hbbInfo->calomet.metSig <<" " << hbbInfo->calomet.sumEt<<std::endl; |
772 |
|
|
773 |
|
if(metsPF.size()){ |
774 |
|
hbbInfo->pfmet.sumEt=(metsPF[0]).sumEt(); |
775 |
< |
hbbInfo->pfmet.metSig=(metsPF[0]).mEtSig(); |
775 |
> |
hbbInfo->pfmet.metSig=(metsPF[0]).significance(); |
776 |
|
hbbInfo->pfmet.eLong=(metsPF[0]).e_longitudinal(); |
777 |
|
hbbInfo->pfmet.p4=GENPTOLOR((metsPF[0])); |
778 |
|
if (verbose_) std::cout <<" METPF "<< hbbInfo->pfmet.metSig <<" " << hbbInfo->pfmet.sumEt<<std::endl; |
794 |
|
mf.eIso=mu->ecalIso(); |
795 |
|
mf.hIso=mu->hcalIso(); |
796 |
|
mf.pfChaIso=mu->chargedHadronIso(); |
797 |
+ |
mf.pfChaPUIso=mu->userIso(5); |
798 |
|
mf.pfPhoIso=mu->photonIso(); |
799 |
|
mf.pfNeuIso=mu->neutralHadronIso(); |
800 |
|
Geom::Phi<double> deltaphi(mu->phi()-atan2(mf.p4.Px(), mf.p4.Py())); |
823 |
|
const reco::HitPattern& q = gTrack->hitPattern(); |
824 |
|
mf.globChi2=gTrack.get()->normalizedChi2(); |
825 |
|
mf.globNHits=q.numberOfValidMuonHits(); |
826 |
< |
mf. validMuStations = q. muonStationsWithValidHits(); |
826 |
> |
mf.validMuStations = q.muonStationsWithValidHits(); |
827 |
|
}else{ |
828 |
|
mf.globChi2=-99; |
829 |
|
mf.globNHits=-99; |
882 |
|
ef.eIso=elec->ecalIso(); |
883 |
|
ef.hIso=elec->hcalIso(); |
884 |
|
ef.pfChaIso=elec->chargedHadronIso(); |
885 |
+ |
ef.pfChaPUIso=elec->userIso(5); |
886 |
|
ef.pfPhoIso=elec->photonIso(); |
887 |
|
ef.pfNeuIso=elec->neutralHadronIso(); |
888 |
|
|
889 |
< |
Geom::Phi<double> deltaphi(elec->superCluster()->phi()-atan2(hbbInfo->calomet.p4.Py(),hbbInfo->calomet.p4.Px())); |
889 |
> |
Geom::Phi<double> deltaphi(elec->superCluster()->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px())); |
890 |
|
ef.acop = deltaphi.value(); |
891 |
|
// |
892 |
|
// fill eleids |
945 |
|
tf.tIso=tau->trackIso(); |
946 |
|
tf.eIso=tau->ecalIso(); |
947 |
|
tf.hIso=tau->hcalIso(); |
948 |
< |
Geom::Phi<double> deltaphi(tau->phi()-atan2(hbbInfo->calomet.p4.Py(),hbbInfo->calomet.p4.Px())); |
948 |
> |
Geom::Phi<double> deltaphi(tau->phi()-atan2(hbbInfo->pfmet.p4.Py(),hbbInfo->pfmet.p4.Px())); |
949 |
|
double acop = deltaphi.value(); |
950 |
|
tf.acop=acop; |
951 |
|
tf.idbyIso=tau->tauID("byIsolation"); |
967 |
|
std::sort(hbbInfo->tauInfo.begin(), hbbInfo->tauInfo.end(), ptComparatorTau); |
968 |
|
|
969 |
|
|
895 |
– |
// dimuons and dielectrons |
896 |
– |
|
897 |
– |
for( size_t i = 0; i < dimuons->size(); i++ ) { |
898 |
– |
VHbbEvent::DiMuonInfo df; |
899 |
– |
const Candidate & dimuonCand = (*dimuons)[ i ]; |
900 |
– |
df.p4= GENPTOLOR(dimuonCand); |
901 |
– |
const Candidate * lep0 = dimuonCand.daughter( 0 ); |
902 |
– |
const Candidate * lep1 = dimuonCand.daughter( 1 ); |
903 |
– |
// needed to access specific methods of pat::Muon |
904 |
– |
const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone()); |
905 |
– |
const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone()); |
970 |
|
|
907 |
– |
df.daughter1.p4=GENPTOLOR(muonDau0); |
908 |
– |
df.daughter2.p4=GENPTOLOR(muonDau1); |
909 |
– |
|
910 |
– |
df.daughter1.tIso= muonDau0.trackIso(); |
911 |
– |
df.daughter2.tIso= muonDau1.trackIso(); |
912 |
– |
|
913 |
– |
df.daughter1.eIso= muonDau0.ecalIso(); |
914 |
– |
df.daughter2.eIso= muonDau1.ecalIso(); |
915 |
– |
|
916 |
– |
df.daughter1.hIso= muonDau0.hcalIso(); |
917 |
– |
df.daughter2.hIso= muonDau1.hcalIso(); |
918 |
– |
|
919 |
– |
df.daughter1.ipDb=muonDau0.dB(); |
920 |
– |
df.daughter2.ipDb=muonDau1.dB(); |
921 |
– |
|
922 |
– |
df.daughter1.ipErrDb=muonDau0.edB(); |
923 |
– |
df.daughter2.ipErrDb=muonDau1.edB(); |
924 |
– |
|
925 |
– |
df.daughter1.cat=0; |
926 |
– |
if(muonDau0.isGlobalMuon()) df.daughter1.cat|=1; |
927 |
– |
if(muonDau0.isTrackerMuon()) df.daughter1.cat|=2; |
928 |
– |
if(muonDau0.isStandAloneMuon()) df.daughter1.cat|=4; |
929 |
– |
df.daughter2.cat=0; |
930 |
– |
if(muonDau1.isGlobalMuon()) df.daughter2.cat|=1; |
931 |
– |
if(muonDau1.isTrackerMuon()) df.daughter2.cat|=2; |
932 |
– |
if(muonDau1.isStandAloneMuon()) df.daughter2.cat|=4; |
933 |
– |
|
934 |
– |
TrackRef trkMu1Ref = muonDau0.get<TrackRef>(); |
935 |
– |
TrackRef trkMu2Ref = muonDau1.get<TrackRef>(); |
936 |
– |
|
937 |
– |
if(trkMu1Ref.isNonnull() && trkMu2Ref.isNonnull()){ |
938 |
– |
const Track* MuTrk1 = muonDau0.get<TrackRef>().get(); |
939 |
– |
const Track* MuTrk2 = muonDau1.get<TrackRef>().get(); |
940 |
– |
df.daughter1.zPVPt=MuTrk1->dz(RecVtxFirst.position()); |
941 |
– |
df.daughter1.zPVProb=MuTrk1->dz(RecVtx.position()); |
942 |
– |
df.daughter2.zPVPt=MuTrk2->dz(RecVtxFirst.position()); |
943 |
– |
df.daughter2.zPVProb=MuTrk2->dz(RecVtx.position()); |
944 |
– |
|
945 |
– |
df.daughter1.nHits = MuTrk1->numberOfValidHits(); |
946 |
– |
df.daughter2.nHits = MuTrk2->numberOfValidHits(); |
947 |
– |
|
948 |
– |
df.daughter1.chi2 = MuTrk1->normalizedChi2(); |
949 |
– |
df.daughter2.chi2 = MuTrk2->normalizedChi2(); |
950 |
– |
|
951 |
– |
TrackRef iTrack1 = muonDau0.innerTrack(); |
952 |
– |
const reco::HitPattern& p1 = iTrack1->hitPattern(); |
953 |
– |
TrackRef iTrack2 = muonDau1.innerTrack(); |
954 |
– |
const reco::HitPattern& p2 = iTrack2->hitPattern(); |
955 |
– |
|
956 |
– |
df.daughter1.nPixelHits = p1.pixelLayersWithMeasurement(); |
957 |
– |
df.daughter2.nPixelHits = p2.pixelLayersWithMeasurement(); |
958 |
– |
|
959 |
– |
if(muonDau0.isGlobalMuon()){ |
960 |
– |
TrackRef gTrack = muonDau0.globalTrack(); |
961 |
– |
const reco::HitPattern& q = gTrack->hitPattern(); |
962 |
– |
df.daughter1.globNHits=q.numberOfValidMuonHits(); |
963 |
– |
df.daughter1.globChi2=gTrack.get()->normalizedChi2(); |
964 |
– |
df.daughter1.validMuStations = q. muonStationsWithValidHits(); |
965 |
– |
} |
966 |
– |
if(muonDau1.isGlobalMuon()){ |
967 |
– |
TrackRef gTrack = muonDau1.globalTrack(); |
968 |
– |
const reco::HitPattern& q = gTrack->hitPattern(); |
969 |
– |
df.daughter2.globNHits=q.numberOfValidMuonHits(); |
970 |
– |
df.daughter2.globChi2=gTrack.get()->normalizedChi2(); |
971 |
– |
df.daughter2.validMuStations = q. muonStationsWithValidHits(); |
972 |
– |
} |
971 |
|
|
974 |
– |
} |
975 |
– |
|
976 |
– |
hbbInfo->diMuonInfo.push_back(df); |
977 |
– |
} |
978 |
– |
|
979 |
– |
for( size_t i = 0; i < dielectrons->size(); i++ ) { |
980 |
– |
VHbbEvent::DiElectronInfo df; |
981 |
– |
const Candidate & dielecCand = (*dielectrons)[ i ]; |
982 |
– |
|
983 |
– |
df.p4=GENPTOLOR(dielecCand); |
984 |
– |
|
985 |
– |
// accessing the daughters of the dimuon candidate |
986 |
– |
const Candidate * lep0 = dielecCand.daughter( 0 ); |
987 |
– |
const Candidate * lep1 = dielecCand.daughter( 1 ); |
988 |
– |
// needed to access specific methods of pat::Muon |
989 |
– |
const pat::Electron & elecDau0 = dynamic_cast<const pat::Electron &>(*lep0->masterClone()); |
990 |
– |
const pat::Electron & elecDau1 = dynamic_cast<const pat::Electron &>(*lep1->masterClone()); |
991 |
– |
|
992 |
– |
df.daughter1.p4 = GENPTOLOR(elecDau0); |
993 |
– |
df.daughter2.p4= GENPTOLOR(elecDau1); |
994 |
– |
|
995 |
– |
df.daughter1.tIso = elecDau0.trackIso(); |
996 |
– |
df.daughter2.tIso = elecDau1.trackIso(); |
997 |
– |
|
998 |
– |
df.daughter1.eIso = elecDau0.ecalIso(); |
999 |
– |
df.daughter2.eIso = elecDau1.ecalIso(); |
1000 |
– |
|
1001 |
– |
df.daughter1.hIso = elecDau0.hcalIso(); |
1002 |
– |
df.daughter2.hIso = elecDau1.hcalIso(); |
1003 |
– |
|
1004 |
– |
// ids |
1005 |
– |
/*df.daughter1.id95 = elecDau0.electronID("simpleEleId95cIso"); |
1006 |
– |
df.daughter1.id85 = elecDau0.electronID ("simpleEleId85cIso"); |
1007 |
– |
df.daughter1.id70 = elecDau0.electronID ("simpleEleId70cIso"); |
1008 |
– |
df.daughter1.id95r = elecDau0.electronID ("simpleEleId95relIso"); |
1009 |
– |
df.daughter1.id85r = elecDau0.electronID ("simpleEleId85relIso"); |
1010 |
– |
df.daughter1.id70r = elecDau0.electronID ("simpleEleId70relIso"); |
1011 |
– |
|
1012 |
– |
|
1013 |
– |
df.daughter2.id95 = elecDau1.electronID("simpleEleId95cIso"); |
1014 |
– |
df.daughter2.id85 = elecDau1.electronID ("simpleEleId85cIso"); |
1015 |
– |
df.daughter2.id70 = elecDau1.electronID ("simpleEleId70cIso"); |
1016 |
– |
df.daughter2.id95r = elecDau1.electronID ("simpleEleId95relIso"); |
1017 |
– |
df.daughter2.id85r = elecDau1.electronID ("simpleEleId85relIso"); |
1018 |
– |
df.daughter2.id70r = elecDau1.electronID ("simpleEleId70relIso"); |
1019 |
– |
*/ |
1020 |
– |
hbbInfo->diElectronInfo.push_back(df); |
1021 |
– |
|
1022 |
– |
} |
972 |
|
if (verbose_){ |
973 |
|
std::cout <<" Pushing hbbInfo "<<std::endl; |
974 |
|
std::cout <<" SimpleJets1 = "<<hbbInfo->simpleJets.size()<<std::endl<< |
1098 |
|
|
1099 |
|
|
1100 |
|
//Btagging scale factors |
1101 |
< |
void HbbAnalyzerNew::fillScaleFactors(VHbbEvent::SimpleJet sj, BTagSFContainer iSF){ |
1101 |
> |
void HbbAnalyzerNew::fillScaleFactors(VHbbEvent::SimpleJet& sj, BTagSFContainer iSF){ |
1102 |
|
|
1103 |
|
|
1104 |
|
BinningPointByMap measurePoint; |
1214 |
|
sj.neutralHadronEFraction = jet_iter-> neutralHadronEnergyFraction (); |
1215 |
|
sj.chargedEmEFraction = jet_iter-> chargedEmEnergyFraction (); |
1216 |
|
sj.neutralEmEFraction = jet_iter-> neutralEmEnergyFraction (); |
1217 |
< |
sj. nConstituents = jet_iter->getPFConstituents().size(); |
1217 |
> |
sj.nConstituents = jet_iter->getPFConstituents().size(); |
1218 |
|
|
1219 |
|
} |
1220 |
|
// |
1224 |
|
// if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) { |
1225 |
|
|
1226 |
|
const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex(); |
1227 |
< |
if (tf){ |
1228 |
< |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
1229 |
< |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
1230 |
< |
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin(); |
1231 |
< |
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){ |
1232 |
< |
sj.vtxTrackIds.push_back(tit->key()); |
1233 |
< |
} |
1234 |
< |
Measurement1D m = tf->flightDistance(0); |
1235 |
< |
sj.vtx3dL = m.value(); |
1236 |
< |
sj.vtx3deL = m.error(); |
1227 |
> |
if (tf){ |
1228 |
> |
if (tf->nVertices() >0){ |
1229 |
> |
sj.vtxMass = tf->secondaryVertex(0).p4().mass(); |
1230 |
> |
sj.vtxNTracks = tf->secondaryVertex(0).nTracks(); |
1231 |
> |
std::vector<reco::TrackBaseRef >::const_iterator tit = tf->secondaryVertex(0).tracks_begin(); |
1232 |
> |
for (; tit< tf->secondaryVertex(0).tracks_end(); ++tit){ |
1233 |
> |
sj.vtxTrackIds.push_back(tit->key()); |
1234 |
> |
} |
1235 |
> |
Measurement1D m = tf->flightDistance(0); |
1236 |
> |
sj.vtx3dL = m.value(); |
1237 |
> |
sj.vtx3deL = m.error(); |
1238 |
> |
} |
1239 |
|
} |
1240 |
|
// |
1241 |
|
// add tVector |