6 |
|
#include "DataFormats/HepMCCandidate/interface/GenParticle.h" |
7 |
|
#include "DataFormats/MuonReco/interface/Muon.h" |
8 |
|
#include "DataFormats/MuonReco/interface/MuonFwd.h" |
9 |
+ |
#include "DataFormats/MuonReco/interface/MuonSelectors.h" |
10 |
|
#include "DataFormats/VertexReco/interface/Vertex.h" |
11 |
|
#include "DataFormats/HLTReco/interface/TriggerEvent.h" |
12 |
|
#include "DataFormats/TrackReco/interface/TrackFwd.h" |
28 |
|
#include "UserCode/HbbAnalysis/interface/Jet.hh" |
29 |
|
#include "UserCode/HbbAnalysis/interface/Met.hh" |
30 |
|
#include "UserCode/HbbAnalysis/interface/Trigger.hh" |
31 |
+ |
#include "UserCode/HbbAnalysis/interface/Vertex.hh" |
32 |
|
|
33 |
|
#include "UserCode/HbbAnalysis/plugins/HbbTreeMaker.hh" |
34 |
|
|
36 |
|
|
37 |
|
HbbTreeMaker::HbbTreeMaker(const edm::ParameterSet & pset): |
38 |
|
debug_(pset.getParameter<int>("DEBUG")), |
39 |
+ |
processData_(false), |
40 |
|
flavour_(pset.getParameter<unsigned int>("JetFlavour")), |
41 |
|
doGen_(pset.getParameter<bool>("DOGEN")), |
42 |
|
genParticleSrc_(pset.getParameter<edm::InputTag>("GenParticles")), |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
< |
void HbbTreeMaker::beginJob(const edm::EventSetup&){//beginJob |
73 |
> |
void HbbTreeMaker::beginJob(){//beginJob |
74 |
|
|
75 |
|
|
76 |
|
edm::Service<TFileService> lFileService; |
84 |
|
if (debug_) std::cout << "Initialising JetFlavour : " << std::endl; |
85 |
|
|
86 |
|
lDir = lFileService->mkdir("JetFlavours"); |
84 |
– |
|
87 |
|
jetFlav_.Initialise(lDir, debug_, flavour_); |
88 |
|
|
89 |
|
}//beginJob |
90 |
|
|
91 |
|
void HbbTreeMaker::endJob(){//endJob |
92 |
< |
jetFlav_.printSummary(); |
92 |
> |
if (!processData_) jetFlav_.printSummary(); |
93 |
|
|
94 |
|
//tree_->Write(); |
95 |
|
//delete tree_; |
107 |
|
|
108 |
|
event_->Clear(); |
109 |
|
event_->event(aEvt.id().event()); |
110 |
+ |
processData_ = aEvt.isRealData(); |
111 |
+ |
|
112 |
+ |
event_->run(aEvt.run()); |
113 |
+ |
event_->lumiBlock(aEvt.luminosityBlock()); |
114 |
|
|
115 |
|
edm::Handle<reco::GenParticleCollection> lGenParticles; |
116 |
|
try { |
117 |
|
aEvt.getByLabel(genParticleSrc_,lGenParticles); |
118 |
|
if (debug_) std::cout << "** ngenParticles = " << lGenParticles->size() << std::endl; |
119 |
|
} catch(cms::Exception& e) { |
120 |
< |
std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
120 |
> |
if (!processData_) std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
121 |
|
} |
122 |
|
|
123 |
< |
if (doGen_) HbbParticles(lGenParticles,event_->particles()); |
123 |
> |
if (doGen_ && !processData_) HbbParticles(lGenParticles,event_->particles()); |
124 |
|
|
125 |
< |
unsigned int lNPartons = jetFlav_.fillPartons(lGenParticles); |
125 |
> |
unsigned int lNPartons = 0; |
126 |
> |
if (!processData_) lNPartons = jetFlav_.fillPartons(lGenParticles); |
127 |
|
|
128 |
< |
if (debug_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
128 |
> |
if (debug_ && !processData_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
129 |
|
|
130 |
|
|
131 |
|
edm::Handle<std::vector<reco::Vertex> > lRecoVertices; |
139 |
|
std::cout << "AMM: Collection " << vertexSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
140 |
|
} |
141 |
|
|
142 |
+ |
HbbVertices(lRecoVertices,event_->vertices()); |
143 |
+ |
|
144 |
|
edm::Handle<std::vector<pat::Electron> > lElectronCollection; |
145 |
|
|
146 |
|
try { |
168 |
|
std::cout << "AMM: Collection " << muonSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
169 |
|
} |
170 |
|
|
171 |
< |
HbbMuons(lMuonCollection,event_->muons()); |
171 |
> |
HbbMuons(lMuonCollection,lRecoVertices,event_->muons()); |
172 |
|
|
173 |
|
|
174 |
< |
edm::Handle<std::vector<pat::Tau> > lTauCollection; |
174 |
> |
if (!( caloTauSrc_.label()=="" && caloTauSrc_.instance()=="" )) { |
175 |
> |
edm::Handle<std::vector<pat::Tau> > lTauCollection; |
176 |
|
|
177 |
< |
try { |
178 |
< |
aEvt.getByLabel(caloTauSrc_,lTauCollection); |
179 |
< |
if (!lTauCollection.isValid()){ |
180 |
< |
edm::LogInfo("ERROR")<< "Error! Can't get caloTau by label. "; |
181 |
< |
} |
182 |
< |
if (debug_) std::cout << "** caloTaucollection = " << lTauCollection->size() << " elements." << std::endl; |
183 |
< |
} catch(cms::Exception& e) { |
184 |
< |
std::cout << "AMM: Collection " << caloTauSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
185 |
< |
} |
177 |
> |
try { |
178 |
> |
aEvt.getByLabel(caloTauSrc_,lTauCollection); |
179 |
> |
if (!lTauCollection.isValid()){ |
180 |
> |
edm::LogInfo("ERROR")<< "Error! Can't get caloTau by label. "; |
181 |
> |
} |
182 |
> |
if (debug_) std::cout << "** caloTaucollection = " << lTauCollection->size() << " elements." << std::endl; |
183 |
> |
} catch(cms::Exception& e) { |
184 |
> |
std::cout << "AMM: Collection " << caloTauSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
185 |
> |
} |
186 |
|
|
187 |
< |
HbbTaus(lTauCollection,lRecoVertices,event_->caloTaus()); |
187 |
> |
HbbTaus(lTauCollection,lRecoVertices,event_->caloTaus()); |
188 |
> |
} |
189 |
|
|
190 |
|
edm::Handle<std::vector<pat::Tau> > lPFTauCollection; |
191 |
|
|
323 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
324 |
|
|
325 |
|
HbbAnalysis::GenVars lGen; |
326 |
< |
if ((*iter).genLepton()){ |
326 |
> |
if (!processData_ && (*iter).genLepton()){ |
327 |
|
lGen.valid = true; |
328 |
|
lGen.E = (*iter).genLepton()->energy(); |
329 |
|
lGen.pT = (*iter).genLepton()->pt(); |
393 |
|
|
394 |
|
|
395 |
|
void HbbTreeMaker::HbbMuons(const edm::Handle<std::vector<pat::Muon> > & aCol, |
396 |
< |
std::vector<HbbAnalysis::Muon> & aVec) |
396 |
> |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
397 |
> |
std::vector<HbbAnalysis::Muon> & aVec) |
398 |
|
{//HbbMuons |
399 |
|
|
400 |
|
if (aCol.isValid()){ |
408 |
|
const reco::Muon* recoMuon = dynamic_cast<const reco::Muon*>((*iter).originalObject()); |
409 |
|
|
410 |
|
HbbAnalysis::GenVars lGen; |
411 |
< |
if ((*iter).genLepton()){ |
411 |
> |
if (!processData_ && (*iter).genLepton()){ |
412 |
|
lGen.valid = true; |
413 |
|
lGen.E = (*iter).genLepton()->energy(); |
414 |
|
lGen.pT = (*iter).genLepton()->pt(); |
447 |
|
lReco.vy = (*iter).vy(); |
448 |
|
lReco.vz = (*iter).vz(); |
449 |
|
|
450 |
+ |
HbbAnalysis::MuTrkVars lTrk; |
451 |
+ |
|
452 |
+ |
reco::TrackRef lTrackerTrk = (*iter).innerTrack(); |
453 |
+ |
if ( lTrackerTrk.isAvailable() && lTrackerTrk.isNonnull() ) { |
454 |
+ |
if ( aRecoVertices->size() >= 1 ) { |
455 |
+ |
const reco::Vertex& thePrimaryEventVertex = (*aRecoVertices->begin()); |
456 |
+ |
lTrk.IPd0 = -lTrackerTrk->dxy(thePrimaryEventVertex.position()); |
457 |
+ |
lTrk.IPdz = lTrackerTrk->dz(thePrimaryEventVertex.position()); |
458 |
+ |
} |
459 |
+ |
else { |
460 |
+ |
lTrk.IPd0 = 0; |
461 |
+ |
lTrk.IPdz = 0; |
462 |
+ |
} |
463 |
+ |
|
464 |
+ |
lTrk.nHits = lTrackerTrk->numberOfValidHits(); |
465 |
+ |
} |
466 |
+ |
else { |
467 |
+ |
lTrk.IPd0 = 0; |
468 |
+ |
lTrk.IPdz = 0; |
469 |
+ |
lTrk.nHits = 0; |
470 |
+ |
} |
471 |
+ |
|
472 |
|
HbbAnalysis::MuIsoVars lIsoR03; |
473 |
|
lIsoR03.sumPt = recoMuon->isolationR03().sumPt; |
474 |
|
lIsoR03.emEt = recoMuon->isolationR03().emEt; |
490 |
|
else if (recoMuon->isCaloMuon()) lID.type = 4; |
491 |
|
else lID.type = 0; |
492 |
|
|
493 |
< |
if (recoMuon->isGood(reco::Muon::AllGlobalMuons)) lID.ids.push_back(1); |
494 |
< |
if (recoMuon->isGood(reco::Muon::AllStandAloneMuons)) lID.ids.push_back(2); |
495 |
< |
if (recoMuon->isGood(reco::Muon::AllTrackerMuons)) lID.ids.push_back(3); |
496 |
< |
if (recoMuon->isGood(reco::Muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
497 |
< |
if (recoMuon->isGood(reco::Muon::AllArbitrated)) lID.ids.push_back(5); |
498 |
< |
if (recoMuon->isGood(reco::Muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
499 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationLoose)) lID.ids.push_back(7); |
500 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationTight)) lID.ids.push_back(8); |
501 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
502 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
503 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationLoose)) lID.ids.push_back(11); |
504 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationTight)) lID.ids.push_back(12); |
505 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
506 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
493 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllGlobalMuons)) lID.ids.push_back(1); |
494 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllStandAloneMuons)) lID.ids.push_back(2); |
495 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllTrackerMuons)) lID.ids.push_back(3); |
496 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
497 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllArbitrated)) lID.ids.push_back(5); |
498 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
499 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationLoose)) lID.ids.push_back(7); |
500 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationTight)) lID.ids.push_back(8); |
501 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
502 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
503 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationLoose)) lID.ids.push_back(11); |
504 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationTight)) lID.ids.push_back(12); |
505 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
506 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
507 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkChiCompatibility)) lID.ids.push_back(15); |
508 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMStaChiCompatibility)) lID.ids.push_back(16); |
509 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkKinkTight)) lID.ids.push_back(17); |
510 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngLoose)) lID.ids.push_back(18); |
511 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngTight)) lID.ids.push_back(19); |
512 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngLoose)) lID.ids.push_back(20); |
513 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngTight)) lID.ids.push_back(21); |
514 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtLoose)) lID.ids.push_back(22); |
515 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtTight)) lID.ids.push_back(23); |
516 |
|
|
517 |
|
lID.caloCompat = recoMuon->caloCompatibility(); |
518 |
< |
lID.segCompat = recoMuon->segmentCompatibility(); |
518 |
> |
lID.segCompat = muon::segmentCompatibility(*recoMuon); |
519 |
|
lID.nChambers = recoMuon->numberOfChambers(); |
520 |
|
lID.nMatchesLoose = recoMuon->numberOfMatches(reco::Muon::NoArbitration); |
521 |
|
lID.nMatchesMedium = recoMuon->numberOfMatches(reco::Muon::SegmentArbitration); |
522 |
|
lID.nMatchesTight = recoMuon->numberOfMatches(reco::Muon::SegmentAndTrackArbitration); |
523 |
|
|
524 |
< |
HbbAnalysis::Muon lObj(lGen,lReco,lIsoR03,lIsoR05,lID); |
524 |
> |
HbbAnalysis::Muon lObj(lGen,lReco,lTrk,lIsoR03,lIsoR05,lID); |
525 |
|
aVec.push_back(lObj); |
526 |
|
iEle++; |
527 |
|
} |
531 |
|
}//HbbMuons |
532 |
|
|
533 |
|
void HbbTreeMaker::HbbTaus(const edm::Handle<std::vector<pat::Tau> > & aCol, |
534 |
< |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
535 |
< |
std::vector<HbbAnalysis::Tau> & aVec) |
534 |
> |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
535 |
> |
std::vector<HbbAnalysis::Tau> & aVec) |
536 |
|
{//HbbTaus |
537 |
|
|
538 |
|
if (aCol.isValid()){ |
546 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
547 |
|
|
548 |
|
HbbAnalysis::GenVars lGen; |
549 |
< |
if ((*iter).genLepton()){ |
549 |
> |
if (!processData_ && (*iter).genLepton()){ |
550 |
|
lGen.valid = true; |
551 |
|
lGen.E = (*iter).genLepton()->energy(); |
552 |
|
lGen.pT = (*iter).genLepton()->pt(); |
577 |
|
|
578 |
|
|
579 |
|
HbbAnalysis::GenVars lGenJet; |
580 |
< |
if ((*iter).genJet()){ |
580 |
> |
if (!processData_ && (*iter).genJet()){ |
581 |
|
lGenJet.valid = true; |
582 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
583 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
584 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
585 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
593 |
|
} |
594 |
|
else { |
595 |
|
lGenJet.valid = false; |
596 |
+ |
lGenJet.E = 0; |
597 |
|
lGenJet.pT = 0; |
598 |
|
lGenJet.eta = 0; |
599 |
|
lGenJet.phi = 0; |
695 |
|
const std::vector<std::pair<std::string,float> > & lIDs = (*iter).tauIDs(); |
696 |
|
bool lPrint = false; |
697 |
|
//a few warning if additional discriminants are found: |
698 |
< |
if ((isPF && lIDs.size() != 7) || |
698 |
> |
if ((isPF && lIDs.size() != 16) || |
699 |
|
(isCalo && lIDs.size() != 3)) |
700 |
|
lPrint = true; |
701 |
|
|
702 |
|
if (lPrint) { |
703 |
< |
std::cout << "!!!!!!! Discriminants changed, please update histograms !!!!!!!" << std::endl; |
703 |
> |
std::cout << "!!!!!!! Discriminants changed, please update tree !!!!!!!" << std::endl; |
704 |
|
std::cout << "--- isCaloTau = " << isCalo << ", isPFTau = " << isPF << std::endl; |
705 |
|
std::cout << "------ ID names = " << std::endl; |
706 |
|
} |
707 |
|
|
708 |
|
|
664 |
– |
HbbAnalysis::PFTauIDVars lpfId; |
709 |
|
HbbAnalysis::CaloTauIDVars lcaloId; |
710 |
+ |
lcaloId.byIsolation = 0; |
711 |
+ |
lcaloId.byLeadingTrackFinding = 0; |
712 |
+ |
lcaloId.byLeadingTrackPtCut = 0; |
713 |
+ |
|
714 |
+ |
HbbAnalysis::PFTauIDVars lpfId; |
715 |
+ |
lpfId.byLeadingTrackFinding = 0; |
716 |
+ |
lpfId.byLeadingTrackPtCut = 0; |
717 |
+ |
lpfId.byTrackIsolation = 0; |
718 |
+ |
lpfId.byECALIsolation = 0; |
719 |
+ |
lpfId.byIsolation = 0; |
720 |
+ |
lpfId.againstElectron = 0; |
721 |
+ |
lpfId.againstMuon = 0; |
722 |
+ |
lpfId.byIsolationUsingLeadingPion = 0; |
723 |
+ |
lpfId.byTaNC = 0; |
724 |
+ |
lpfId.byTaNCfrHalfPercent = 0; |
725 |
+ |
lpfId.byTaNCfrOnePercent = 0; |
726 |
+ |
lpfId.byTaNCfrQuarterPercent = 0; |
727 |
+ |
lpfId.byTaNCfrTenthPercent = 0; |
728 |
+ |
lpfId.ecalIsolationUsingLeadingPion = 0; |
729 |
+ |
lpfId.leadingPionPtCut = 0; |
730 |
+ |
lpfId.trackIsolationUsingLeadingPion = 0; |
731 |
+ |
|
732 |
+ |
|
733 |
|
|
734 |
|
for (unsigned int id(0); id<lIDs.size(); id++){ |
735 |
|
|
742 |
|
if (isPF) { |
743 |
|
if (lName.find("leadingTrackFinding") != lName.npos) lpfId.byLeadingTrackFinding = lDiscri; |
744 |
|
if (lName.find("leadingTrackPtCut") != lName.npos) lpfId.byLeadingTrackPtCut = lDiscri; |
745 |
< |
if (lName.find("trackIsolation") != lName.npos) lpfId.byTrackIsolation = lDiscri; |
746 |
< |
if (lName.find("ecalIsolation") != lName.npos) lpfId.byECALIsolation = lDiscri; |
747 |
< |
if (lName.find("byIsolation") != lName.npos) lpfId.byIsolation = lDiscri; |
745 |
> |
if (lName.find("trackIsolationUsingLeadingPion") != lName.npos) lpfId.trackIsolationUsingLeadingPion = lDiscri; |
746 |
> |
if (lName.find("trackIsolation") != lName.npos && |
747 |
> |
lName.find("trackIsolationUsingLeadingPion") == lName.npos) lpfId.byTrackIsolation = lDiscri; |
748 |
> |
if (lName.find("ecalIsolationUsingLeadingPion") != lName.npos) lpfId.ecalIsolationUsingLeadingPion = lDiscri; |
749 |
> |
if (lName.find("ecalIsolation") != lName.npos && |
750 |
> |
lName.find("ecalIsolationUsingLeadingPion") == lName.npos) lpfId.byECALIsolation = lDiscri; |
751 |
> |
if (lName.find("byIsolationUsingLeadingPion") != lName.npos) lpfId.byIsolationUsingLeadingPion = lDiscri; |
752 |
> |
if (lName.find("byIsolation") != lName.npos && |
753 |
> |
lName.find("byIsolationUsingLeadingPion") == lName.npos) lpfId.byIsolation = lDiscri; |
754 |
|
if (lName.find("againstElectron") != lName.npos) lpfId.againstElectron = lDiscri; |
755 |
|
if (lName.find("againstMuon") != lName.npos) lpfId.againstMuon = lDiscri; |
756 |
+ |
if (lName.find("byTaNCfrHalfPercent") != lName.npos) lpfId.byTaNCfrHalfPercent = lDiscri; |
757 |
+ |
if (lName.find("byTaNCfrOnePercent") != lName.npos) lpfId.byTaNCfrOnePercent = lDiscri; |
758 |
+ |
if (lName.find("byTaNCfrQuarterPercent") != lName.npos) lpfId.byTaNCfrQuarterPercent = lDiscri; |
759 |
+ |
if (lName.find("byTaNCfrTenthPercent") != lName.npos) lpfId.byTaNCfrTenthPercent = lDiscri; |
760 |
+ |
if (lName.find("byTaNC") != lName.npos && |
761 |
+ |
lName.find("byTaNCfr") == lName.npos) lpfId.byTaNC = lDiscri; |
762 |
+ |
if (lName.find("leadingPionPtCut") != lName.npos) lpfId.leadingPionPtCut = lDiscri; |
763 |
|
} |
764 |
|
if (isCalo){ |
765 |
|
if (lName.find("byIsolation") != lName.npos) lcaloId.byIsolation = lDiscri; |
808 |
|
HbbAnalysis::PFTauCandVars lNeutr; |
809 |
|
lNeutr.nSigCands = (*iter).signalPFNeutrHadrCands().size(); |
810 |
|
lNeutr.nIsoCands = (*iter).isolationPFNeutrHadrCands().size(); |
811 |
< |
lNeutr.isolationPtSum = 0; |
811 |
> |
lNeutr.isolationPtSum = (*iter).neutralHadronIso(); |
812 |
|
|
813 |
|
HbbAnalysis::PFTauCandVars lGamma; |
814 |
|
lGamma.nSigCands = (*iter).signalPFGammaCands().size(); |
862 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
863 |
|
|
864 |
|
HbbAnalysis::GenVars lGen; |
865 |
< |
if ((*iter).genParton()){ |
865 |
> |
if (!processData_ && (*iter).genParton()){ |
866 |
|
lGen.valid = true; |
867 |
|
lGen.E = (*iter).genParton()->energy(); |
868 |
|
lGen.pT = (*iter).genParton()->pt(); |
893 |
|
|
894 |
|
|
895 |
|
HbbAnalysis::GenVars lGenJet; |
896 |
< |
if ((*iter).genJet()){ |
896 |
> |
if (!processData_ && (*iter).genJet()){ |
897 |
|
lGenJet.valid = true; |
898 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
899 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
900 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
901 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
909 |
|
} |
910 |
|
else { |
911 |
|
lGenJet.valid = false; |
912 |
+ |
lGenJet.E = 0; |
913 |
|
lGenJet.pT = 0; |
914 |
|
lGenJet.eta = 0; |
915 |
|
lGenJet.phi = 0; |
933 |
|
lReco.vz = (*iter).vz(); |
934 |
|
|
935 |
|
unsigned int lFlav = 0; |
936 |
< |
if (aJetFlav.nPartons()) { |
936 |
> |
if (!processData_ && aJetFlav.nPartons()) { |
937 |
|
lFlav = aJetFlav.partonMatchingGenJet((*iter),aGenParticles,0.4).second; |
938 |
|
} |
939 |
|
|
942 |
|
lCommon.partonFlavour = (*iter).partonFlavour(); |
943 |
|
lCommon.nAssociatedTracks = ((*iter).associatedTracks()).size(); |
944 |
|
lCommon.rawpT = (*iter).pt(); |
945 |
< |
if ((*iter).hasJetCorrFactors()) |
946 |
< |
lCommon.rawpT = (*iter).pt()/((*iter).jetCorrFactors().scaleDefault()); |
945 |
> |
if ((*iter).hasCorrFactors()) |
946 |
> |
lCommon.rawpT = (*iter).pt()/((*iter).corrFactor((*iter).corrStep())); |
947 |
|
//lCommon.rawEta = (*iter).; |
948 |
|
//lCommon.rawPhi = (*iter).; |
949 |
|
// p_hasJetCorrFactors->Fill(aJet.hasJetCorrFactors()); |
955 |
|
lBtag.bProba = (*iter).bDiscriminator("jetBProbabilityBJetTags"); |
956 |
|
lBtag.probability = (*iter).bDiscriminator("jetProbabilityBJetTags"); |
957 |
|
lBtag.sSV = (*iter).bDiscriminator("simpleSecondaryVertexBJetTags"); |
958 |
< |
lBtag.softElectron = (*iter).bDiscriminator("softElectronBJetTags"); |
958 |
> |
lBtag.softElectronByPt = (*iter).bDiscriminator("softElectronByPtBJetTags"); |
959 |
> |
lBtag.softElectronByIP3d = (*iter).bDiscriminator("softElectronByIP3dBJetTags"); |
960 |
|
lBtag.softMuon = (*iter).bDiscriminator("softMuonBJetTags"); |
961 |
< |
lBtag.softMuonNoIP = (*iter).bDiscriminator("softMuonNoIPBJetTags"); |
961 |
> |
lBtag.softMuonByPt = (*iter).bDiscriminator("softMuonByPtBJetTags"); |
962 |
> |
lBtag.softMuonByIP3d = (*iter).bDiscriminator("softMuonByIP3dBJetTags"); |
963 |
> |
|
964 |
> |
std::cout << " -- New values of b-discri for jet : " << iEle << std::endl |
965 |
> |
<< " ---- softElecs: " << lBtag.softElectronByPt << " " << lBtag.softElectronByIP3d << std::endl |
966 |
> |
<< " ---- softMus: " << lBtag.softMuon << " " << lBtag.softMuonByPt << " " << lBtag.softMuonByIP3d << std::endl; |
967 |
> |
|
968 |
> |
|
969 |
|
lBtag.tCHE = (*iter).bDiscriminator("trackCountingHighEffBJetTags"); |
970 |
|
lBtag.tCHP = (*iter).bDiscriminator("trackCountingHighPurBJetTags"); |
971 |
< |
|
971 |
> |
|
972 |
> |
|
973 |
|
bool isCalo = (*iter).isCaloJet(); |
974 |
|
bool isPF = (*iter).isPFJet(); |
975 |
|
|
976 |
|
assert (isCalo == !isPF); |
977 |
|
if (isCalo) { |
978 |
+ |
HbbAnalysis::JetIDVars lId; |
979 |
+ |
lId.fHPD = (*iter).jetID().fHPD; |
980 |
+ |
lId.fRBX = (*iter).jetID().fRBX; |
981 |
+ |
lId.n90Hits = (*iter).jetID().n90Hits; |
982 |
+ |
|
983 |
|
HbbAnalysis::CaloJetVars lCalo; |
984 |
|
lCalo.maxEInEmTowers = (*iter).maxEInEmTowers(); |
985 |
|
lCalo.maxEInHadTowers = (*iter).maxEInHadTowers(); |
996 |
|
lCalo.n90 = (*iter).n90(); |
997 |
|
lCalo.n60 = (*iter).n60(); |
998 |
|
|
999 |
< |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag); |
999 |
> |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag,lId); |
1000 |
|
aVec.push_back(lObj); |
1001 |
|
|
1002 |
|
} |
1022 |
|
|
1023 |
|
} |
1024 |
|
|
1025 |
+ |
|
1026 |
+ |
|
1027 |
|
iEle++; |
1028 |
|
}//loop on element |
1029 |
|
}//non empty |
1049 |
|
|
1050 |
|
const reco::GenMET *lGenMET = lMet.genMET(); |
1051 |
|
|
1052 |
< |
if (lGenMET){ |
1052 |
> |
if (!processData_ && lGenMET){ |
1053 |
|
lGen.mET = lGenMET->pt(); |
1054 |
|
lGen.mEx = lGenMET->px(); |
1055 |
|
lGen.mEy = lGenMET->py(); |
1161 |
|
|
1162 |
|
|
1163 |
|
}//genparticles |
1164 |
+ |
|
1165 |
+ |
|
1166 |
+ |
|
1167 |
+ |
void HbbTreeMaker::HbbVertices(const edm::Handle<std::vector<reco::Vertex> > & aCol, |
1168 |
+ |
std::vector<HbbAnalysis::Vertex> & aVec) |
1169 |
+ |
{ |
1170 |
+ |
|
1171 |
+ |
for (std::vector<reco::Vertex>::const_iterator iter = aCol->begin(); |
1172 |
+ |
iter != aCol->end(); |
1173 |
+ |
iter++) |
1174 |
+ |
{ |
1175 |
+ |
|
1176 |
+ |
if (!((*iter).isValid()) || (*iter).isFake()) continue; |
1177 |
+ |
|
1178 |
+ |
HbbAnalysis::VertexVars lVtx; |
1179 |
+ |
|
1180 |
+ |
if ((*iter).tracksSize() > 0) { |
1181 |
+ |
for (std::vector<reco::TrackBaseRef>::const_iterator lTrk = (*iter).tracks_begin(); |
1182 |
+ |
lTrk != (*iter).tracks_end(); |
1183 |
+ |
lTrk++) { |
1184 |
+ |
lVtx.trackWeights.push_back((*iter).trackWeight(*lTrk)); |
1185 |
+ |
} |
1186 |
+ |
} |
1187 |
+ |
|
1188 |
+ |
if (lVtx.trackWeights.size() != (*iter).tracksSize()) { |
1189 |
+ |
std::cout<< " -- Problem with tracks, size is not as expected ! " |
1190 |
+ |
<< std::endl |
1191 |
+ |
<< " --- Size of recoVertex tracks = " << (*iter).tracksSize() |
1192 |
+ |
<< std::endl |
1193 |
+ |
<< " --- Size of trackWeights = " << lVtx.trackWeights.size() |
1194 |
+ |
<< std::endl; |
1195 |
+ |
} |
1196 |
+ |
|
1197 |
+ |
lVtx.chi2 = (*iter).chi2(); |
1198 |
+ |
lVtx.ndof = (*iter).ndof(); |
1199 |
+ |
lVtx.x = (*iter).x(); |
1200 |
+ |
lVtx.y = (*iter).y(); |
1201 |
+ |
lVtx.z = (*iter).z(); |
1202 |
+ |
lVtx.xError = (*iter).xError(); |
1203 |
+ |
lVtx.yError = (*iter).yError(); |
1204 |
+ |
lVtx.zError = (*iter).zError(); |
1205 |
+ |
lVtx.cov01 = (*iter).covariance(0,1); |
1206 |
+ |
lVtx.cov02 = (*iter).covariance(0,2); |
1207 |
+ |
lVtx.cov12 = (*iter).covariance(1,2); |
1208 |
+ |
|
1209 |
+ |
HbbAnalysis::Vertex lObj(lVtx); |
1210 |
+ |
aVec.push_back(lObj); |
1211 |
+ |
} |
1212 |
+ |
|
1213 |
+ |
} |