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 |
+ |
event_->isRealData(aEvt.isRealData()); |
115 |
|
|
116 |
|
edm::Handle<reco::GenParticleCollection> lGenParticles; |
117 |
|
try { |
118 |
|
aEvt.getByLabel(genParticleSrc_,lGenParticles); |
119 |
|
if (debug_) std::cout << "** ngenParticles = " << lGenParticles->size() << std::endl; |
120 |
|
} catch(cms::Exception& e) { |
121 |
< |
std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
121 |
> |
if (!processData_) std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
122 |
|
} |
123 |
|
|
124 |
< |
if (doGen_) HbbParticles(lGenParticles,event_->particles()); |
124 |
> |
if (doGen_ && !processData_) HbbParticles(lGenParticles,event_->particles()); |
125 |
|
|
126 |
< |
unsigned int lNPartons = jetFlav_.fillPartons(lGenParticles); |
126 |
> |
unsigned int lNPartons = 0; |
127 |
> |
if (!processData_) lNPartons = jetFlav_.fillPartons(lGenParticles); |
128 |
|
|
129 |
< |
if (debug_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
129 |
> |
if (debug_ && !processData_) std::cout << "--- Number of partons = " << lNPartons << "." << std::endl; |
130 |
|
|
131 |
|
|
132 |
|
edm::Handle<std::vector<reco::Vertex> > lRecoVertices; |
140 |
|
std::cout << "AMM: Collection " << vertexSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
141 |
|
} |
142 |
|
|
143 |
+ |
HbbVertices(lRecoVertices,event_->vertices()); |
144 |
+ |
|
145 |
|
edm::Handle<std::vector<pat::Electron> > lElectronCollection; |
146 |
|
|
147 |
|
try { |
172 |
|
HbbMuons(lMuonCollection,lRecoVertices,event_->muons()); |
173 |
|
|
174 |
|
|
175 |
< |
edm::Handle<std::vector<pat::Tau> > lTauCollection; |
175 |
> |
if (!( caloTauSrc_.label()=="" && caloTauSrc_.instance()=="" )) { |
176 |
> |
edm::Handle<std::vector<pat::Tau> > lTauCollection; |
177 |
|
|
178 |
< |
try { |
179 |
< |
aEvt.getByLabel(caloTauSrc_,lTauCollection); |
180 |
< |
if (!lTauCollection.isValid()){ |
181 |
< |
edm::LogInfo("ERROR")<< "Error! Can't get caloTau by label. "; |
182 |
< |
} |
183 |
< |
if (debug_) std::cout << "** caloTaucollection = " << lTauCollection->size() << " elements." << std::endl; |
184 |
< |
} catch(cms::Exception& e) { |
185 |
< |
std::cout << "AMM: Collection " << caloTauSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
186 |
< |
} |
178 |
> |
try { |
179 |
> |
aEvt.getByLabel(caloTauSrc_,lTauCollection); |
180 |
> |
if (!lTauCollection.isValid()){ |
181 |
> |
edm::LogInfo("ERROR")<< "Error! Can't get caloTau by label. "; |
182 |
> |
} |
183 |
> |
if (debug_) std::cout << "** caloTaucollection = " << lTauCollection->size() << " elements." << std::endl; |
184 |
> |
} catch(cms::Exception& e) { |
185 |
> |
std::cout << "AMM: Collection " << caloTauSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
186 |
> |
} |
187 |
|
|
188 |
< |
HbbTaus(lTauCollection,lRecoVertices,event_->caloTaus()); |
188 |
> |
HbbTaus(lTauCollection,lRecoVertices,event_->caloTaus()); |
189 |
> |
} |
190 |
|
|
191 |
|
edm::Handle<std::vector<pat::Tau> > lPFTauCollection; |
192 |
|
|
214 |
|
std::cout << "AMM: Collection " << caloJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
215 |
|
} |
216 |
|
|
217 |
+ |
//std::cout << "Processing calo jets:" << std::endl; |
218 |
|
HbbJets(lCaloJetCollection,jetFlav_,lGenParticles,event_->caloJets()); |
219 |
|
|
220 |
|
edm::Handle<std::vector<pat::Jet> > lJptJetCollection; |
229 |
|
std::cout << "AMM: Collection " << jptJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
230 |
|
} |
231 |
|
|
232 |
+ |
//std::cout << "Processing JPT jets:" << std::endl; |
233 |
|
HbbJets(lJptJetCollection,jetFlav_,lGenParticles,event_->jptJets()); |
234 |
|
|
235 |
|
edm::Handle<std::vector<pat::Jet> > lPfJetCollection; |
244 |
|
std::cout << "AMM: Collection " << pfJetSrc_ << " not available! Exception : " << e.what() << ". " << std::endl; |
245 |
|
} |
246 |
|
|
247 |
+ |
//std::cout << "Processing PF jets:" << std::endl; |
248 |
|
HbbJets(lPfJetCollection,jetFlav_,lGenParticles,event_->pfJets()); |
249 |
|
|
250 |
|
edm::Handle<std::vector<pat::MET> > lCaloMetCol; |
327 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
328 |
|
|
329 |
|
HbbAnalysis::GenVars lGen; |
330 |
< |
if ((*iter).genLepton()){ |
330 |
> |
if (!processData_ && (*iter).genLepton()){ |
331 |
|
lGen.valid = true; |
332 |
|
lGen.E = (*iter).genLepton()->energy(); |
333 |
|
lGen.pT = (*iter).genLepton()->pt(); |
412 |
|
const reco::Muon* recoMuon = dynamic_cast<const reco::Muon*>((*iter).originalObject()); |
413 |
|
|
414 |
|
HbbAnalysis::GenVars lGen; |
415 |
< |
if ((*iter).genLepton()){ |
415 |
> |
if (!processData_ && (*iter).genLepton()){ |
416 |
|
lGen.valid = true; |
417 |
|
lGen.E = (*iter).genLepton()->energy(); |
418 |
|
lGen.pT = (*iter).genLepton()->pt(); |
494 |
|
else if (recoMuon->isCaloMuon()) lID.type = 4; |
495 |
|
else lID.type = 0; |
496 |
|
|
497 |
< |
if (recoMuon->isGood(reco::Muon::AllGlobalMuons)) lID.ids.push_back(1); |
498 |
< |
if (recoMuon->isGood(reco::Muon::AllStandAloneMuons)) lID.ids.push_back(2); |
499 |
< |
if (recoMuon->isGood(reco::Muon::AllTrackerMuons)) lID.ids.push_back(3); |
500 |
< |
if (recoMuon->isGood(reco::Muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
501 |
< |
if (recoMuon->isGood(reco::Muon::AllArbitrated)) lID.ids.push_back(5); |
502 |
< |
if (recoMuon->isGood(reco::Muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
503 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationLoose)) lID.ids.push_back(7); |
504 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationTight)) lID.ids.push_back(8); |
505 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
506 |
< |
if (recoMuon->isGood(reco::Muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
507 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationLoose)) lID.ids.push_back(11); |
508 |
< |
if (recoMuon->isGood(reco::Muon::TMOneStationTight)) lID.ids.push_back(12); |
509 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
510 |
< |
if (recoMuon->isGood(reco::Muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
497 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllGlobalMuons)) lID.ids.push_back(1); |
498 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllStandAloneMuons)) lID.ids.push_back(2); |
499 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllTrackerMuons)) lID.ids.push_back(3); |
500 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TrackerMuonArbitrated)) lID.ids.push_back(4); |
501 |
> |
if (muon::isGoodMuon(*recoMuon,muon::AllArbitrated)) lID.ids.push_back(5); |
502 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GlobalMuonPromptTight)) lID.ids.push_back(6); |
503 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationLoose)) lID.ids.push_back(7); |
504 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationTight)) lID.ids.push_back(8); |
505 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityLoose)) lID.ids.push_back(9); |
506 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TM2DCompatibilityTight)) lID.ids.push_back(10); |
507 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationLoose)) lID.ids.push_back(11); |
508 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationTight)) lID.ids.push_back(12); |
509 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtLoose)) lID.ids.push_back(13); |
510 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedLowPtTight)) lID.ids.push_back(14); |
511 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkChiCompatibility)) lID.ids.push_back(15); |
512 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMStaChiCompatibility)) lID.ids.push_back(16); |
513 |
> |
if (muon::isGoodMuon(*recoMuon,muon::GMTkKinkTight)) lID.ids.push_back(17); |
514 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngLoose)) lID.ids.push_back(18); |
515 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationAngTight)) lID.ids.push_back(19); |
516 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngLoose)) lID.ids.push_back(20); |
517 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMOneStationAngTight)) lID.ids.push_back(21); |
518 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtLoose)) lID.ids.push_back(22); |
519 |
> |
if (muon::isGoodMuon(*recoMuon,muon::TMLastStationOptimizedBarrelLowPtTight)) lID.ids.push_back(23); |
520 |
|
|
521 |
|
lID.caloCompat = recoMuon->caloCompatibility(); |
522 |
< |
lID.segCompat = recoMuon->segmentCompatibility(); |
522 |
> |
lID.segCompat = muon::segmentCompatibility(*recoMuon); |
523 |
|
lID.nChambers = recoMuon->numberOfChambers(); |
524 |
|
lID.nMatchesLoose = recoMuon->numberOfMatches(reco::Muon::NoArbitration); |
525 |
|
lID.nMatchesMedium = recoMuon->numberOfMatches(reco::Muon::SegmentArbitration); |
550 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
551 |
|
|
552 |
|
HbbAnalysis::GenVars lGen; |
553 |
< |
if ((*iter).genLepton()){ |
553 |
> |
if (!processData_ && (*iter).genLepton()){ |
554 |
|
lGen.valid = true; |
555 |
|
lGen.E = (*iter).genLepton()->energy(); |
556 |
|
lGen.pT = (*iter).genLepton()->pt(); |
581 |
|
|
582 |
|
|
583 |
|
HbbAnalysis::GenVars lGenJet; |
584 |
< |
if ((*iter).genJet()){ |
584 |
> |
if (!processData_ && (*iter).genJet()){ |
585 |
|
lGenJet.valid = true; |
586 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
587 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
588 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
589 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
597 |
|
} |
598 |
|
else { |
599 |
|
lGenJet.valid = false; |
600 |
+ |
lGenJet.E = 0; |
601 |
|
lGenJet.pT = 0; |
602 |
|
lGenJet.eta = 0; |
603 |
|
lGenJet.phi = 0; |
699 |
|
const std::vector<std::pair<std::string,float> > & lIDs = (*iter).tauIDs(); |
700 |
|
bool lPrint = false; |
701 |
|
//a few warning if additional discriminants are found: |
702 |
< |
if ((isPF && lIDs.size() != 7) || |
702 |
> |
if ((isPF && lIDs.size() != 16) || |
703 |
|
(isCalo && lIDs.size() != 3)) |
704 |
|
lPrint = true; |
705 |
|
|
706 |
|
if (lPrint) { |
707 |
< |
std::cout << "!!!!!!! Discriminants changed, please update histograms !!!!!!!" << std::endl; |
707 |
> |
std::cout << "!!!!!!! Discriminants changed, please update tree !!!!!!!" << std::endl; |
708 |
|
std::cout << "--- isCaloTau = " << isCalo << ", isPFTau = " << isPF << std::endl; |
709 |
|
std::cout << "------ ID names = " << std::endl; |
710 |
|
} |
711 |
|
|
712 |
|
|
687 |
– |
HbbAnalysis::PFTauIDVars lpfId; |
713 |
|
HbbAnalysis::CaloTauIDVars lcaloId; |
714 |
+ |
lcaloId.byIsolation = 0; |
715 |
+ |
lcaloId.byLeadingTrackFinding = 0; |
716 |
+ |
lcaloId.byLeadingTrackPtCut = 0; |
717 |
+ |
|
718 |
+ |
HbbAnalysis::PFTauIDVars lpfId; |
719 |
+ |
lpfId.byLeadingTrackFinding = 0; |
720 |
+ |
lpfId.byLeadingTrackPtCut = 0; |
721 |
+ |
lpfId.byTrackIsolation = 0; |
722 |
+ |
lpfId.byECALIsolation = 0; |
723 |
+ |
lpfId.byIsolation = 0; |
724 |
+ |
lpfId.againstElectron = 0; |
725 |
+ |
lpfId.againstMuon = 0; |
726 |
+ |
lpfId.byIsolationUsingLeadingPion = 0; |
727 |
+ |
lpfId.byTaNC = 0; |
728 |
+ |
lpfId.byTaNCfrHalfPercent = 0; |
729 |
+ |
lpfId.byTaNCfrOnePercent = 0; |
730 |
+ |
lpfId.byTaNCfrQuarterPercent = 0; |
731 |
+ |
lpfId.byTaNCfrTenthPercent = 0; |
732 |
+ |
lpfId.ecalIsolationUsingLeadingPion = 0; |
733 |
+ |
lpfId.leadingPionPtCut = 0; |
734 |
+ |
lpfId.trackIsolationUsingLeadingPion = 0; |
735 |
+ |
|
736 |
+ |
|
737 |
|
|
738 |
|
for (unsigned int id(0); id<lIDs.size(); id++){ |
739 |
|
|
746 |
|
if (isPF) { |
747 |
|
if (lName.find("leadingTrackFinding") != lName.npos) lpfId.byLeadingTrackFinding = lDiscri; |
748 |
|
if (lName.find("leadingTrackPtCut") != lName.npos) lpfId.byLeadingTrackPtCut = lDiscri; |
749 |
< |
if (lName.find("trackIsolation") != lName.npos) lpfId.byTrackIsolation = lDiscri; |
750 |
< |
if (lName.find("ecalIsolation") != lName.npos) lpfId.byECALIsolation = lDiscri; |
751 |
< |
if (lName.find("byIsolation") != lName.npos) lpfId.byIsolation = lDiscri; |
749 |
> |
if (lName.find("trackIsolationUsingLeadingPion") != lName.npos) lpfId.trackIsolationUsingLeadingPion = lDiscri; |
750 |
> |
if (lName.find("trackIsolation") != lName.npos && |
751 |
> |
lName.find("trackIsolationUsingLeadingPion") == lName.npos) lpfId.byTrackIsolation = lDiscri; |
752 |
> |
if (lName.find("ecalIsolationUsingLeadingPion") != lName.npos) lpfId.ecalIsolationUsingLeadingPion = lDiscri; |
753 |
> |
if (lName.find("ecalIsolation") != lName.npos && |
754 |
> |
lName.find("ecalIsolationUsingLeadingPion") == lName.npos) lpfId.byECALIsolation = lDiscri; |
755 |
> |
if (lName.find("byIsolationUsingLeadingPion") != lName.npos) lpfId.byIsolationUsingLeadingPion = lDiscri; |
756 |
> |
if (lName.find("byIsolation") != lName.npos && |
757 |
> |
lName.find("byIsolationUsingLeadingPion") == lName.npos) lpfId.byIsolation = lDiscri; |
758 |
|
if (lName.find("againstElectron") != lName.npos) lpfId.againstElectron = lDiscri; |
759 |
|
if (lName.find("againstMuon") != lName.npos) lpfId.againstMuon = lDiscri; |
760 |
+ |
if (lName.find("byTaNCfrHalfPercent") != lName.npos) lpfId.byTaNCfrHalfPercent = lDiscri; |
761 |
+ |
if (lName.find("byTaNCfrOnePercent") != lName.npos) lpfId.byTaNCfrOnePercent = lDiscri; |
762 |
+ |
if (lName.find("byTaNCfrQuarterPercent") != lName.npos) lpfId.byTaNCfrQuarterPercent = lDiscri; |
763 |
+ |
if (lName.find("byTaNCfrTenthPercent") != lName.npos) lpfId.byTaNCfrTenthPercent = lDiscri; |
764 |
+ |
if (lName.find("byTaNC") != lName.npos && |
765 |
+ |
lName.find("byTaNCfr") == lName.npos) lpfId.byTaNC = lDiscri; |
766 |
+ |
if (lName.find("leadingPionPtCut") != lName.npos) lpfId.leadingPionPtCut = lDiscri; |
767 |
|
} |
768 |
|
if (isCalo){ |
769 |
|
if (lName.find("byIsolation") != lName.npos) lcaloId.byIsolation = lDiscri; |
812 |
|
HbbAnalysis::PFTauCandVars lNeutr; |
813 |
|
lNeutr.nSigCands = (*iter).signalPFNeutrHadrCands().size(); |
814 |
|
lNeutr.nIsoCands = (*iter).isolationPFNeutrHadrCands().size(); |
815 |
< |
lNeutr.isolationPtSum = 0; |
815 |
> |
lNeutr.isolationPtSum = (*iter).neutralHadronIso(); |
816 |
|
|
817 |
|
HbbAnalysis::PFTauCandVars lGamma; |
818 |
|
lGamma.nSigCands = (*iter).signalPFGammaCands().size(); |
866 |
|
//if (debug_ > 1) std::cout << "**** Ele #" << iEle << ", pT,eta,phi = " << (*iter).pt() << " " << (*iter).eta() << " " << (*iter).phi() << std::endl; |
867 |
|
|
868 |
|
HbbAnalysis::GenVars lGen; |
869 |
< |
if ((*iter).genParton()){ |
869 |
> |
if (!processData_ && (*iter).genParton()){ |
870 |
|
lGen.valid = true; |
871 |
|
lGen.E = (*iter).genParton()->energy(); |
872 |
|
lGen.pT = (*iter).genParton()->pt(); |
897 |
|
|
898 |
|
|
899 |
|
HbbAnalysis::GenVars lGenJet; |
900 |
< |
if ((*iter).genJet()){ |
900 |
> |
if (!processData_ && (*iter).genJet()){ |
901 |
|
lGenJet.valid = true; |
902 |
+ |
lGenJet.E = (*iter).genJet()->energy(); |
903 |
|
lGenJet.pT = (*iter).genJet()->pt(); |
904 |
|
lGenJet.eta = (*iter).genJet()->eta(); |
905 |
|
lGenJet.phi = (*iter).genJet()->phi(); |
913 |
|
} |
914 |
|
else { |
915 |
|
lGenJet.valid = false; |
916 |
+ |
lGenJet.E = 0; |
917 |
|
lGenJet.pT = 0; |
918 |
|
lGenJet.eta = 0; |
919 |
|
lGenJet.phi = 0; |
937 |
|
lReco.vz = (*iter).vz(); |
938 |
|
|
939 |
|
unsigned int lFlav = 0; |
940 |
< |
if (aJetFlav.nPartons()) { |
940 |
> |
if (!processData_ && aJetFlav.nPartons()) { |
941 |
|
lFlav = aJetFlav.partonMatchingGenJet((*iter),aGenParticles,0.4).second; |
942 |
|
} |
943 |
|
|
946 |
|
lCommon.partonFlavour = (*iter).partonFlavour(); |
947 |
|
lCommon.nAssociatedTracks = ((*iter).associatedTracks()).size(); |
948 |
|
lCommon.rawpT = (*iter).pt(); |
949 |
< |
if ((*iter).hasJetCorrFactors()) |
950 |
< |
lCommon.rawpT = (*iter).pt()/((*iter).jetCorrFactors().scaleDefault()); |
949 |
> |
if ((*iter).hasCorrFactors()) |
950 |
> |
lCommon.rawpT = (*iter).pt()/((*iter).corrFactor((*iter).corrStep())); |
951 |
> |
|
952 |
> |
lCommon.etaMean = (*iter).etaPhiStatistics().etaMean; |
953 |
> |
lCommon.phiMean = (*iter).etaPhiStatistics().phiMean; |
954 |
> |
lCommon.etaEtaMoment = (*iter).etaPhiStatistics().etaEtaMoment; |
955 |
> |
lCommon.phiPhiMoment = (*iter).etaPhiStatistics().phiPhiMoment; |
956 |
> |
lCommon.etaPhiMoment = (*iter).etaPhiStatistics().etaPhiMoment; |
957 |
> |
|
958 |
|
//lCommon.rawEta = (*iter).; |
959 |
|
//lCommon.rawPhi = (*iter).; |
960 |
|
// p_hasJetCorrFactors->Fill(aJet.hasJetCorrFactors()); |
966 |
|
lBtag.bProba = (*iter).bDiscriminator("jetBProbabilityBJetTags"); |
967 |
|
lBtag.probability = (*iter).bDiscriminator("jetProbabilityBJetTags"); |
968 |
|
lBtag.sSV = (*iter).bDiscriminator("simpleSecondaryVertexBJetTags"); |
969 |
< |
lBtag.softElectron = (*iter).bDiscriminator("softElectronBJetTags"); |
970 |
< |
lBtag.softMuon = (*iter).bDiscriminator("softMuonBJetTags"); |
971 |
< |
lBtag.softMuonNoIP = (*iter).bDiscriminator("softMuonNoIPBJetTags"); |
969 |
> |
lBtag.softElectronByPt = ((*iter).bDiscriminator("softElectronByPtBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softElectronByPtBJetTags"); |
970 |
> |
lBtag.softElectronByIP3d = ((*iter).bDiscriminator("softElectronByIP3dBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softElectronByIP3dBJetTags"); |
971 |
> |
lBtag.softMuon = ((*iter).bDiscriminator("softMuonBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonBJetTags"); |
972 |
> |
lBtag.softMuonByPt = ((*iter).bDiscriminator("softMuonByPtBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonByPtBJetTags"); |
973 |
> |
lBtag.softMuonByIP3d = ((*iter).bDiscriminator("softMuonByIP3dBJetTags") < -1000) ? -1000 : (*iter).bDiscriminator("softMuonByIP3dBJetTags"); |
974 |
> |
|
975 |
> |
//std::cout << " -- New values of b-discri for jet : " << iEle << std::endl |
976 |
> |
// << " ---- softElecs: " << lBtag.softElectronByPt << " " << lBtag.softElectronByIP3d << std::endl |
977 |
> |
// << " ---- softMus: " << lBtag.softMuon << " " << lBtag.softMuonByPt << " " << lBtag.softMuonByIP3d << std::endl; |
978 |
> |
|
979 |
> |
|
980 |
|
lBtag.tCHE = (*iter).bDiscriminator("trackCountingHighEffBJetTags"); |
981 |
|
lBtag.tCHP = (*iter).bDiscriminator("trackCountingHighPurBJetTags"); |
982 |
< |
|
982 |
> |
|
983 |
> |
|
984 |
|
bool isCalo = (*iter).isCaloJet(); |
985 |
|
bool isPF = (*iter).isPFJet(); |
986 |
|
|
987 |
|
assert (isCalo == !isPF); |
988 |
|
if (isCalo) { |
989 |
+ |
HbbAnalysis::JetIDVars lId; |
990 |
+ |
lId.fHPD = (*iter).jetID().fHPD; |
991 |
+ |
lId.fRBX = (*iter).jetID().fRBX; |
992 |
+ |
lId.n90Hits = (*iter).jetID().n90Hits; |
993 |
+ |
|
994 |
|
HbbAnalysis::CaloJetVars lCalo; |
995 |
|
lCalo.maxEInEmTowers = (*iter).maxEInEmTowers(); |
996 |
|
lCalo.maxEInHadTowers = (*iter).maxEInHadTowers(); |
1007 |
|
lCalo.n90 = (*iter).n90(); |
1008 |
|
lCalo.n60 = (*iter).n60(); |
1009 |
|
|
1010 |
< |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag); |
1010 |
> |
HbbAnalysis::Jet lObj(lGen,lGenJet,lReco,lCommon,lCalo,lBtag,lId); |
1011 |
|
aVec.push_back(lObj); |
1012 |
|
|
1013 |
|
} |
1033 |
|
|
1034 |
|
} |
1035 |
|
|
1036 |
+ |
|
1037 |
+ |
|
1038 |
|
iEle++; |
1039 |
|
}//loop on element |
1040 |
|
}//non empty |
1060 |
|
|
1061 |
|
const reco::GenMET *lGenMET = lMet.genMET(); |
1062 |
|
|
1063 |
< |
if (lGenMET){ |
1063 |
> |
if (!processData_ && lGenMET){ |
1064 |
|
lGen.mET = lGenMET->pt(); |
1065 |
|
lGen.mEx = lGenMET->px(); |
1066 |
|
lGen.mEy = lGenMET->py(); |
1172 |
|
|
1173 |
|
|
1174 |
|
}//genparticles |
1175 |
+ |
|
1176 |
+ |
|
1177 |
+ |
|
1178 |
+ |
void HbbTreeMaker::HbbVertices(const edm::Handle<std::vector<reco::Vertex> > & aCol, |
1179 |
+ |
std::vector<HbbAnalysis::Vertex> & aVec) |
1180 |
+ |
{ |
1181 |
+ |
|
1182 |
+ |
for (std::vector<reco::Vertex>::const_iterator iter = aCol->begin(); |
1183 |
+ |
iter != aCol->end(); |
1184 |
+ |
iter++) |
1185 |
+ |
{ |
1186 |
+ |
|
1187 |
+ |
if (!((*iter).isValid()) || (*iter).isFake()) continue; |
1188 |
+ |
|
1189 |
+ |
HbbAnalysis::VertexVars lVtx; |
1190 |
+ |
|
1191 |
+ |
if ((*iter).tracksSize() > 0) { |
1192 |
+ |
for (std::vector<reco::TrackBaseRef>::const_iterator lTrk = (*iter).tracks_begin(); |
1193 |
+ |
lTrk != (*iter).tracks_end(); |
1194 |
+ |
lTrk++) { |
1195 |
+ |
lVtx.trackWeights.push_back((*iter).trackWeight(*lTrk)); |
1196 |
+ |
} |
1197 |
+ |
} |
1198 |
+ |
|
1199 |
+ |
if (lVtx.trackWeights.size() != (*iter).tracksSize()) { |
1200 |
+ |
std::cout<< " -- Problem with tracks, size is not as expected ! " |
1201 |
+ |
<< std::endl |
1202 |
+ |
<< " --- Size of recoVertex tracks = " << (*iter).tracksSize() |
1203 |
+ |
<< std::endl |
1204 |
+ |
<< " --- Size of trackWeights = " << lVtx.trackWeights.size() |
1205 |
+ |
<< std::endl; |
1206 |
+ |
} |
1207 |
+ |
|
1208 |
+ |
lVtx.chi2 = (*iter).chi2(); |
1209 |
+ |
lVtx.ndof = (*iter).ndof(); |
1210 |
+ |
lVtx.x = (*iter).x(); |
1211 |
+ |
lVtx.y = (*iter).y(); |
1212 |
+ |
lVtx.z = (*iter).z(); |
1213 |
+ |
lVtx.xError = (*iter).xError(); |
1214 |
+ |
lVtx.yError = (*iter).yError(); |
1215 |
+ |
lVtx.zError = (*iter).zError(); |
1216 |
+ |
lVtx.cov01 = (*iter).covariance(0,1); |
1217 |
+ |
lVtx.cov02 = (*iter).covariance(0,2); |
1218 |
+ |
lVtx.cov12 = (*iter).covariance(1,2); |
1219 |
+ |
|
1220 |
+ |
HbbAnalysis::Vertex lObj(lVtx); |
1221 |
+ |
aVec.push_back(lObj); |
1222 |
+ |
} |
1223 |
+ |
|
1224 |
+ |
} |
1225 |
+ |
|
1226 |
+ |
#include "FWCore/Framework/interface/MakerMacros.h" |
1227 |
+ |
DEFINE_FWK_MODULE(HbbTreeMaker); |
1228 |
+ |
|
1229 |
+ |
|