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 |
|
|
213 |
|
std::cout << "AMM: Collection " << caloJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
214 |
|
} |
215 |
|
|
216 |
+ |
//std::cout << "Processing calo jets:" << std::endl; |
217 |
|
HbbJets(lCaloJetCollection,jetFlav_,lGenParticles,event_->caloJets()); |
218 |
|
|
219 |
|
edm::Handle<std::vector<pat::Jet> > lJptJetCollection; |
228 |
|
std::cout << "AMM: Collection " << jptJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
229 |
|
} |
230 |
|
|
231 |
+ |
//std::cout << "Processing JPT jets:" << std::endl; |
232 |
|
HbbJets(lJptJetCollection,jetFlav_,lGenParticles,event_->jptJets()); |
233 |
|
|
234 |
|
edm::Handle<std::vector<pat::Jet> > lPfJetCollection; |
243 |
|
std::cout << "AMM: Collection " << pfJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
244 |
|
} |
245 |
|
|
246 |
+ |
//std::cout << "Processing PF jets:" << std::endl; |
247 |
|
HbbJets(lPfJetCollection,jetFlav_,lGenParticles,event_->pfJets()); |
248 |
|
|
249 |
|
edm::Handle<std::vector<pat::MET> > lCaloMetCol; |
326 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
327 |
|
|
328 |
|
HbbAnalysis::GenVars lGen; |
329 |
< |
if ((*iter).genLepton()){ |
329 |
> |
if (!processData_ && (*iter).genLepton()){ |
330 |
|
lGen.valid = true; |
331 |
|
lGen.E = (*iter).genLepton()->energy(); |
332 |
|
lGen.pT = (*iter).genLepton()->pt(); |
396 |
|
|
397 |
|
|
398 |
|
void HbbTreeMaker::HbbMuons(const edm::Handle<std::vector<pat::Muon> > & aCol, |
399 |
< |
std::vector<HbbAnalysis::Muon> & aVec) |
399 |
> |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
400 |
> |
std::vector<HbbAnalysis::Muon> & aVec) |
401 |
|
{//HbbMuons |
402 |
|
|
403 |
|
if (aCol.isValid()){ |
411 |
|
const reco::Muon* recoMuon = dynamic_cast<const reco::Muon*>((*iter).originalObject()); |
412 |
|
|
413 |
|
HbbAnalysis::GenVars lGen; |
414 |
< |
if ((*iter).genLepton()){ |
414 |
> |
if (!processData_ && (*iter).genLepton()){ |
415 |
|
lGen.valid = true; |
416 |
|
lGen.E = (*iter).genLepton()->energy(); |
417 |
|
lGen.pT = (*iter).genLepton()->pt(); |
450 |
|
lReco.vy = (*iter).vy(); |
451 |
|
lReco.vz = (*iter).vz(); |
452 |
|
|
453 |
+ |
HbbAnalysis::MuTrkVars lTrk; |
454 |
+ |
|
455 |
+ |
reco::TrackRef lTrackerTrk = (*iter).innerTrack(); |
456 |
+ |
if ( lTrackerTrk.isAvailable() && lTrackerTrk.isNonnull() ) { |
457 |
+ |
if ( aRecoVertices->size() >= 1 ) { |
458 |
+ |
const reco::Vertex& thePrimaryEventVertex = (*aRecoVertices->begin()); |
459 |
+ |
lTrk.IPd0 = -lTrackerTrk->dxy(thePrimaryEventVertex.position()); |
460 |
+ |
lTrk.IPdz = lTrackerTrk->dz(thePrimaryEventVertex.position()); |
461 |
+ |
} |
462 |
+ |
else { |
463 |
+ |
lTrk.IPd0 = 0; |
464 |
+ |
lTrk.IPdz = 0; |
465 |
+ |
} |
466 |
+ |
|
467 |
+ |
lTrk.nHits = lTrackerTrk->numberOfValidHits(); |
468 |
+ |
} |
469 |
+ |
else { |
470 |
+ |
lTrk.IPd0 = 0; |
471 |
+ |
lTrk.IPdz = 0; |
472 |
+ |
lTrk.nHits = 0; |
473 |
+ |
} |
474 |
+ |
|
475 |
|
HbbAnalysis::MuIsoVars lIsoR03; |
476 |
|
lIsoR03.sumPt = recoMuon->isolationR03().sumPt; |
477 |
|
lIsoR03.emEt = recoMuon->isolationR03().emEt; |
493 |
|
else if (recoMuon->isCaloMuon()) lID.type = 4; |
494 |
|
else lID.type = 0; |
495 |
|
|
496 |
< |
if (recoMuon->isGood(reco::Muon::AllGlobalMuons)) lID.ids.push_back(1); |
497 |
< |
if (recoMuon->isGood(reco::Muon::AllStandAloneMuons)) lID.ids.push_back(2); |
498 |
< |
if (recoMuon->isGood(reco::Muon::AllTrackerMuons)) lID.ids.push_back(3); |
499 |
< |
if (recoMuon->isGood(reco::Muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
500 |
< |
if (recoMuon->isGood(reco::Muon::AllArbitrated)) lID.ids.push_back(5); |
501 |
< |
if (recoMuon->isGood(reco::Muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
502 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationLoose)) lID.ids.push_back(7); |
503 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationTight)) lID.ids.push_back(8); |
504 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
505 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
506 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationLoose)) lID.ids.push_back(11); |
507 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationTight)) lID.ids.push_back(12); |
508 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
509 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
496 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllGlobalMuons)) lID.ids.push_back(1); |
497 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllStandAloneMuons)) lID.ids.push_back(2); |
498 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllTrackerMuons)) lID.ids.push_back(3); |
499 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
500 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllArbitrated)) lID.ids.push_back(5); |
501 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
502 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationLoose)) lID.ids.push_back(7); |
503 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationTight)) lID.ids.push_back(8); |
504 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
505 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
506 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationLoose)) lID.ids.push_back(11); |
507 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationTight)) lID.ids.push_back(12); |
508 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
509 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
510 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkChiCompatibility)) lID.ids.push_back(15); |
511 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMStaChiCompatibility)) lID.ids.push_back(16); |
512 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkKinkTight)) lID.ids.push_back(17); |
513 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngLoose)) lID.ids.push_back(18); |
514 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngTight)) lID.ids.push_back(19); |
515 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngLoose)) lID.ids.push_back(20); |
516 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngTight)) lID.ids.push_back(21); |
517 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtLoose)) lID.ids.push_back(22); |
518 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtTight)) lID.ids.push_back(23); |
519 |
|
|
520 |
|
lID.caloCompat = recoMuon->caloCompatibility(); |
521 |
< |
lID.segCompat = recoMuon->segmentCompatibility(); |
521 |
> |
lID.segCompat = muon::segmentCompatibility(*recoMuon); |
522 |
|
lID.nChambers = recoMuon->numberOfChambers(); |
523 |
|
lID.nMatchesLoose = recoMuon->numberOfMatches(reco::Muon::NoArbitration); |
524 |
|
lID.nMatchesMedium = recoMuon->numberOfMatches(reco::Muon::SegmentArbitration); |
525 |
|
lID.nMatchesTight = recoMuon->numberOfMatches(reco::Muon::SegmentAndTrackArbitration); |
526 |
|
|
527 |
< |
HbbAnalysis::Muon lObj(lGen,lReco,lIsoR03,lIsoR05,lID); |
527 |
> |
HbbAnalysis::Muon lObj(lGen,lReco,lTrk,lIsoR03,lIsoR05,lID); |
528 |
|
aVec.push_back(lObj); |
529 |
|
iEle++; |
530 |
|
} |
534 |
|
}//HbbMuons |
535 |
|
|
536 |
|
void HbbTreeMaker::HbbTaus(const edm::Handle<std::vector<pat::Tau> > & aCol, |
537 |
< |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
538 |
< |
std::vector<HbbAnalysis::Tau> & aVec) |
537 |
> |
const edm::Handle<std::vector<reco::Vertex> > & aRecoVertices, |
538 |
> |
std::vector<HbbAnalysis::Tau> & aVec) |
539 |
|
{//HbbTaus |
540 |
|
|
541 |
|
if (aCol.isValid()){ |
549 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
550 |
|
|
551 |
|
HbbAnalysis::GenVars lGen; |
552 |
< |
if ((*iter).genLepton()){ |
552 |
> |
if (!processData_ && (*iter).genLepton()){ |
553 |
|
lGen.valid = true; |
554 |
|
lGen.E = (*iter).genLepton()->energy(); |
555 |
|
lGen.pT = (*iter).genLepton()->pt(); |
580 |
|
|
581 |
|
|
582 |
|
HbbAnalysis::GenVars lGenJet; |
583 |
< |
if ((*iter).genJet()){ |
583 |
> |
if (!processData_ && (*iter).genJet()){ |
584 |
|
lGenJet.valid = true; |
585 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
586 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
587 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
588 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
596 |
|
} |
597 |
|
else { |
598 |
|
lGenJet.valid = false; |
599 |
+ |
lGenJet.E = 0; |
600 |
|
lGenJet.pT = 0; |
601 |
|
lGenJet.eta = 0; |
602 |
|
lGenJet.phi = 0; |
698 |
|
const std::vector<std::pair<std::string,float> > & lIDs = (*iter).tauIDs(); |
699 |
|
bool lPrint = false; |
700 |
|
//a few warning if additional discriminants are found: |
701 |
< |
if ((isPF && lIDs.size() != 7) || |
701 |
> |
if ((isPF && lIDs.size() != 16) || |
702 |
|
(isCalo && lIDs.size() != 3)) |
703 |
|
lPrint = true; |
704 |
|
|
705 |
|
if (lPrint) { |
706 |
< |
std::cout << "!!!!!!! Discriminants changed, please update histograms !!!!!!!" << std::endl; |
706 |
> |
std::cout << "!!!!!!! Discriminants changed, please update tree !!!!!!!" << std::endl; |
707 |
|
std::cout << "--- isCaloTau = " << isCalo << ", isPFTau = " << isPF << std::endl; |
708 |
|
std::cout << "------ ID names = " << std::endl; |
709 |
|
} |
710 |
|
|
711 |
|
|
664 |
– |
HbbAnalysis::PFTauIDVars lpfId; |
712 |
|
HbbAnalysis::CaloTauIDVars lcaloId; |
713 |
+ |
lcaloId.byIsolation = 0; |
714 |
+ |
lcaloId.byLeadingTrackFinding = 0; |
715 |
+ |
lcaloId.byLeadingTrackPtCut = 0; |
716 |
+ |
|
717 |
+ |
HbbAnalysis::PFTauIDVars lpfId; |
718 |
+ |
lpfId.byLeadingTrackFinding = 0; |
719 |
+ |
lpfId.byLeadingTrackPtCut = 0; |
720 |
+ |
lpfId.byTrackIsolation = 0; |
721 |
+ |
lpfId.byECALIsolation = 0; |
722 |
+ |
lpfId.byIsolation = 0; |
723 |
+ |
lpfId.againstElectron = 0; |
724 |
+ |
lpfId.againstMuon = 0; |
725 |
+ |
lpfId.byIsolationUsingLeadingPion = 0; |
726 |
+ |
lpfId.byTaNC = 0; |
727 |
+ |
lpfId.byTaNCfrHalfPercent = 0; |
728 |
+ |
lpfId.byTaNCfrOnePercent = 0; |
729 |
+ |
lpfId.byTaNCfrQuarterPercent = 0; |
730 |
+ |
lpfId.byTaNCfrTenthPercent = 0; |
731 |
+ |
lpfId.ecalIsolationUsingLeadingPion = 0; |
732 |
+ |
lpfId.leadingPionPtCut = 0; |
733 |
+ |
lpfId.trackIsolationUsingLeadingPion = 0; |
734 |
+ |
|
735 |
+ |
|
736 |
|
|
737 |
|
for (unsigned int id(0); id<lIDs.size(); id++){ |
738 |
|
|
745 |
|
if (isPF) { |
746 |
|
if (lName.find("leadingTrackFinding") != lName.npos) lpfId.byLeadingTrackFinding = lDiscri; |
747 |
|
if (lName.find("leadingTrackPtCut") != lName.npos) lpfId.byLeadingTrackPtCut = lDiscri; |
748 |
< |
if (lName.find("trackIsolation") != lName.npos) lpfId.byTrackIsolation = lDiscri; |
749 |
< |
if (lName.find("ecalIsolation") != lName.npos) lpfId.byECALIsolation = lDiscri; |
750 |
< |
if (lName.find("byIsolation") != lName.npos) lpfId.byIsolation = lDiscri; |
748 |
> |
if (lName.find("trackIsolationUsingLeadingPion") != lName.npos) lpfId.trackIsolationUsingLeadingPion = lDiscri; |
749 |
> |
if (lName.find("trackIsolation") != lName.npos && |
750 |
> |
lName.find("trackIsolationUsingLeadingPion") == lName.npos) lpfId.byTrackIsolation = lDiscri; |
751 |
> |
if (lName.find("ecalIsolationUsingLeadingPion") != lName.npos) lpfId.ecalIsolationUsingLeadingPion = lDiscri; |
752 |
> |
if (lName.find("ecalIsolation") != lName.npos && |
753 |
> |
lName.find("ecalIsolationUsingLeadingPion") == lName.npos) lpfId.byECALIsolation = lDiscri; |
754 |
> |
if (lName.find("byIsolationUsingLeadingPion") != lName.npos) lpfId.byIsolationUsingLeadingPion = lDiscri; |
755 |
> |
if (lName.find("byIsolation") != lName.npos && |
756 |
> |
lName.find("byIsolationUsingLeadingPion") == lName.npos) lpfId.byIsolation = lDiscri; |
757 |
|
if (lName.find("againstElectron") != lName.npos) lpfId.againstElectron = lDiscri; |
758 |
|
if (lName.find("againstMuon") != lName.npos) lpfId.againstMuon = lDiscri; |
759 |
+ |
if (lName.find("byTaNCfrHalfPercent") != lName.npos) lpfId.byTaNCfrHalfPercent = lDiscri; |
760 |
+ |
if (lName.find("byTaNCfrOnePercent") != lName.npos) lpfId.byTaNCfrOnePercent = lDiscri; |
761 |
+ |
if (lName.find("byTaNCfrQuarterPercent") != lName.npos) lpfId.byTaNCfrQuarterPercent = lDiscri; |
762 |
+ |
if (lName.find("byTaNCfrTenthPercent") != lName.npos) lpfId.byTaNCfrTenthPercent = lDiscri; |
763 |
+ |
if (lName.find("byTaNC") != lName.npos && |
764 |
+ |
lName.find("byTaNCfr") == lName.npos) lpfId.byTaNC = lDiscri; |
765 |
+ |
if (lName.find("leadingPionPtCut") != lName.npos) lpfId.leadingPionPtCut = lDiscri; |
766 |
|
} |
767 |
|
if (isCalo){ |
768 |
|
if (lName.find("byIsolation") != lName.npos) lcaloId.byIsolation = lDiscri; |
811 |
|
HbbAnalysis::PFTauCandVars lNeutr; |
812 |
|
lNeutr.nSigCands = (*iter).signalPFNeutrHadrCands().size(); |
813 |
|
lNeutr.nIsoCands = (*iter).isolationPFNeutrHadrCands().size(); |
814 |
< |
lNeutr.isolationPtSum = 0; |
814 |
> |
lNeutr.isolationPtSum = (*iter).neutralHadronIso(); |
815 |
|
|
816 |
|
HbbAnalysis::PFTauCandVars lGamma; |
817 |
|
lGamma.nSigCands = (*iter).signalPFGammaCands().size(); |
865 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
866 |
|
|
867 |
|
HbbAnalysis::GenVars lGen; |
868 |
< |
if ((*iter).genParton()){ |
868 |
> |
if (!processData_ && (*iter).genParton()){ |
869 |
|
lGen.valid = true; |
870 |
|
lGen.E = (*iter).genParton()->energy(); |
871 |
|
lGen.pT = (*iter).genParton()->pt(); |
896 |
|
|
897 |
|
|
898 |
|
HbbAnalysis::GenVars lGenJet; |
899 |
< |
if ((*iter).genJet()){ |
899 |
> |
if (!processData_ && (*iter).genJet()){ |
900 |
|
lGenJet.valid = true; |
901 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
902 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
903 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
904 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
912 |
|
} |
913 |
|
else { |
914 |
|
lGenJet.valid = false; |
915 |
+ |
lGenJet.E = 0; |
916 |
|
lGenJet.pT = 0; |
917 |
|
lGenJet.eta = 0; |
918 |
|
lGenJet.phi = 0; |
936 |
|
lReco.vz = (*iter).vz(); |
937 |
|
|
938 |
|
unsigned int lFlav = 0; |
939 |
< |
if (aJetFlav.nPartons()) { |
939 |
> |
if (!processData_ && aJetFlav.nPartons()) { |
940 |
|
lFlav = aJetFlav.partonMatchingGenJet((*iter),aGenParticles,0.4).second; |
941 |
|
} |
942 |
|
|
945 |
|
lCommon.partonFlavour = (*iter).partonFlavour(); |
946 |
|
lCommon.nAssociatedTracks = ((*iter).associatedTracks()).size(); |
947 |
|
lCommon.rawpT = (*iter).pt(); |
948 |
< |
if ((*iter).hasJetCorrFactors()) |
949 |
< |
lCommon.rawpT = (*iter).pt()/((*iter).jetCorrFactors().scaleDefault()); |
948 |
> |
if ((*iter).hasCorrFactors()) |
949 |
> |
lCommon.rawpT = (*iter).pt()/((*iter).corrFactor((*iter).corrStep())); |
950 |
|
//lCommon.rawEta = (*iter).; |
951 |
|
//lCommon.rawPhi = (*iter).; |
952 |
|
// p_hasJetCorrFactors->Fill(aJet.hasJetCorrFactors()); |
958 |
|
lBtag.bProba = (*iter).bDiscriminator("jetBProbabilityBJetTags"); |
959 |
|
lBtag.probability = (*iter).bDiscriminator("jetProbabilityBJetTags"); |
960 |
|
lBtag.sSV = (*iter).bDiscriminator("simpleSecondaryVertexBJetTags"); |
961 |
< |
lBtag.softElectron = (*iter).bDiscriminator("softElectronBJetTags"); |
962 |
< |
lBtag.softMuon = (*iter).bDiscriminator("softMuonBJetTags"); |
963 |
< |
lBtag.softMuonNoIP = (*iter).bDiscriminator("softMuonNoIPBJetTags"); |
961 |
> |
lBtag.softElectronByPt = ((*iter).bDiscriminator("softElectronByPtBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softElectronByPtBJetTags"); |
962 |
> |
lBtag.softElectronByIP3d = ((*iter).bDiscriminator("softElectronByIP3dBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softElectronByIP3dBJetTags"); |
963 |
> |
lBtag.softMuon = ((*iter).bDiscriminator("softMuonBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonBJetTags"); |
964 |
> |
lBtag.softMuonByPt = ((*iter).bDiscriminator("softMuonByPtBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonByPtBJetTags"); |
965 |
> |
lBtag.softMuonByIP3d = ((*iter).bDiscriminator("softMuonByIP3dBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonByIP3dBJetTags"); |
966 |
> |
|
967 |
> |
//std::cout << " -- New values of b-discri for jet : " << iEle << std::endl |
968 |
> |
// << " ---- softElecs: " << lBtag.softElectronByPt << " " << lBtag.softElectronByIP3d << std::endl |
969 |
> |
// << " ---- softMus: " << lBtag.softMuon << " " << lBtag.softMuonByPt << " " << lBtag.softMuonByIP3d << std::endl; |
970 |
> |
|
971 |
> |
|
972 |
|
lBtag.tCHE = (*iter).bDiscriminator("trackCountingHighEffBJetTags"); |
973 |
|
lBtag.tCHP = (*iter).bDiscriminator("trackCountingHighPurBJetTags"); |
974 |
< |
|
974 |
> |
|
975 |
> |
|
976 |
|
bool isCalo = (*iter).isCaloJet(); |
977 |
|
bool isPF = (*iter).isPFJet(); |
978 |
|
|
979 |
|
assert (isCalo == !isPF); |
980 |
|
if (isCalo) { |
981 |
+ |
HbbAnalysis::JetIDVars lId; |
982 |
+ |
lId.fHPD = (*iter).jetID().fHPD; |
983 |
+ |
lId.fRBX = (*iter).jetID().fRBX; |
984 |
+ |
lId.n90Hits = (*iter).jetID().n90Hits; |
985 |
+ |
|
986 |
|
HbbAnalysis::CaloJetVars lCalo; |
987 |
|
lCalo.maxEInEmTowers = (*iter).maxEInEmTowers(); |
988 |
|
lCalo.maxEInHadTowers = (*iter).maxEInHadTowers(); |
999 |
|
lCalo.n90 = (*iter).n90(); |
1000 |
|
lCalo.n60 = (*iter).n60(); |
1001 |
|
|
1002 |
< |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag); |
1002 |
> |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag,lId); |
1003 |
|
aVec.push_back(lObj); |
1004 |
|
|
1005 |
|
} |
1025 |
|
|
1026 |
|
} |
1027 |
|
|
1028 |
+ |
|
1029 |
+ |
|
1030 |
|
iEle++; |
1031 |
|
}//loop on element |
1032 |
|
}//non empty |
1052 |
|
|
1053 |
|
const reco::GenMET *lGenMET = lMet.genMET(); |
1054 |
|
|
1055 |
< |
if (lGenMET){ |
1055 |
> |
if (!processData_ && lGenMET){ |
1056 |
|
lGen.mET = lGenMET->pt(); |
1057 |
|
lGen.mEx = lGenMET->px(); |
1058 |
|
lGen.mEy = lGenMET->py(); |
1164 |
|
|
1165 |
|
|
1166 |
|
}//genparticles |
1167 |
+ |
|
1168 |
+ |
|
1169 |
+ |
|
1170 |
+ |
void HbbTreeMaker::HbbVertices(const edm::Handle<std::vector<reco::Vertex> > & aCol, |
1171 |
+ |
std::vector<HbbAnalysis::Vertex> & aVec) |
1172 |
+ |
{ |
1173 |
+ |
|
1174 |
+ |
for (std::vector<reco::Vertex>::const_iterator iter = aCol->begin(); |
1175 |
+ |
iter != aCol->end(); |
1176 |
+ |
iter++) |
1177 |
+ |
{ |
1178 |
+ |
|
1179 |
+ |
if (!((*iter).isValid()) || (*iter).isFake()) continue; |
1180 |
+ |
|
1181 |
+ |
HbbAnalysis::VertexVars lVtx; |
1182 |
+ |
|
1183 |
+ |
if ((*iter).tracksSize() > 0) { |
1184 |
+ |
for (std::vector<reco::TrackBaseRef>::const_iterator lTrk = (*iter).tracks_begin(); |
1185 |
+ |
lTrk != (*iter).tracks_end(); |
1186 |
+ |
lTrk++) { |
1187 |
+ |
lVtx.trackWeights.push_back((*iter).trackWeight(*lTrk)); |
1188 |
+ |
} |
1189 |
+ |
} |
1190 |
+ |
|
1191 |
+ |
if (lVtx.trackWeights.size() != (*iter).tracksSize()) { |
1192 |
+ |
std::cout<< " -- Problem with tracks, size is not as expected ! " |
1193 |
+ |
<< std::endl |
1194 |
+ |
<< " --- Size of recoVertex tracks = " << (*iter).tracksSize() |
1195 |
+ |
<< std::endl |
1196 |
+ |
<< " --- Size of trackWeights = " << lVtx.trackWeights.size() |
1197 |
+ |
<< std::endl; |
1198 |
+ |
} |
1199 |
+ |
|
1200 |
+ |
lVtx.chi2 = (*iter).chi2(); |
1201 |
+ |
lVtx.ndof = (*iter).ndof(); |
1202 |
+ |
lVtx.x = (*iter).x(); |
1203 |
+ |
lVtx.y = (*iter).y(); |
1204 |
+ |
lVtx.z = (*iter).z(); |
1205 |
+ |
lVtx.xError = (*iter).xError(); |
1206 |
+ |
lVtx.yError = (*iter).yError(); |
1207 |
+ |
lVtx.zError = (*iter).zError(); |
1208 |
+ |
lVtx.cov01 = (*iter).covariance(0,1); |
1209 |
+ |
lVtx.cov02 = (*iter).covariance(0,2); |
1210 |
+ |
lVtx.cov12 = (*iter).covariance(1,2); |
1211 |
+ |
|
1212 |
+ |
HbbAnalysis::Vertex lObj(lVtx); |
1213 |
+ |
aVec.push_back(lObj); |
1214 |
+ |
} |
1215 |
+ |
|
1216 |
+ |
} |