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" |
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()) |
38 |
|
|
99 |
|
HbbAnalyzerNew::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){ |
100 |
|
using namespace edm; |
101 |
|
using namespace reco; |
102 |
< |
|
102 |
> |
|
103 |
> |
|
104 |
|
// JEC Uncertainty |
105 |
|
|
106 |
|
// JetCorrectionUncertainty *jecUnc=0; |
114 |
|
|
115 |
|
std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() ); |
116 |
|
std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() ); |
117 |
< |
|
117 |
> |
|
118 |
> |
|
119 |
> |
if (runOnMC_){ |
120 |
> |
Handle<GenEventInfoProduct> evt_info; |
121 |
> |
iEvent.getByType(evt_info); |
122 |
> |
auxInfo->weightMCProd = evt_info->weight(); |
123 |
> |
} |
124 |
> |
else |
125 |
> |
{ auxInfo->weightMCProd =1.;} |
126 |
|
// |
127 |
|
// ?? |
128 |
< |
|
128 |
> |
|
129 |
|
// trigger |
130 |
|
|
131 |
|
// trigger |
424 |
|
btagSFs.MISTAGSF_CSVM = (mistagSF_CSVM_.product()); |
425 |
|
btagSFs.MISTAGSF_CSVT = (mistagSF_CSVT_.product()); |
426 |
|
|
427 |
+ |
#ifdef ENABLE_SIMPLEJETS1 |
428 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets1.begin(); jet_iter!=simplejets1.end(); ++jet_iter){ |
429 |
|
// if(jet_iter->pt()>50) |
430 |
|
// njetscounter++; |
463 |
|
hbbInfo->simpleJets.push_back(sj); |
464 |
|
|
465 |
|
} |
466 |
+ |
#endif //ENABLE_SIMPLEJETS1 |
467 |
|
|
468 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){ |
469 |
|
// if(jet_iter->pt()>50) |
504 |
|
|
505 |
|
} |
506 |
|
|
507 |
+ |
#ifdef ENABLE_SIMPLEJETS4 |
508 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){ |
509 |
|
// if(jet_iter->pt()>50) |
510 |
|
// njetscounter++; |
543 |
|
hbbInfo->simpleJets4.push_back(sj); |
544 |
|
|
545 |
|
} |
546 |
< |
|
546 |
> |
#endif //ENABLE SIMPLEJETS4 |
547 |
> |
|
548 |
|
|
549 |
|
for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){ |
550 |
|
|
965 |
|
std::sort(hbbInfo->tauInfo.begin(), hbbInfo->tauInfo.end(), ptComparatorTau); |
966 |
|
|
967 |
|
|
948 |
– |
// dimuons and dielectrons |
949 |
– |
|
950 |
– |
for( size_t i = 0; i < dimuons->size(); i++ ) { |
951 |
– |
VHbbEvent::DiMuonInfo df; |
952 |
– |
const Candidate & dimuonCand = (*dimuons)[ i ]; |
953 |
– |
df.p4= GENPTOLOR(dimuonCand); |
954 |
– |
const Candidate * lep0 = dimuonCand.daughter( 0 ); |
955 |
– |
const Candidate * lep1 = dimuonCand.daughter( 1 ); |
956 |
– |
// needed to access specific methods of pat::Muon |
957 |
– |
const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone()); |
958 |
– |
const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone()); |
968 |
|
|
960 |
– |
df.daughter1.p4=GENPTOLOR(muonDau0); |
961 |
– |
df.daughter2.p4=GENPTOLOR(muonDau1); |
962 |
– |
|
963 |
– |
df.daughter1.tIso= muonDau0.trackIso(); |
964 |
– |
df.daughter2.tIso= muonDau1.trackIso(); |
965 |
– |
|
966 |
– |
df.daughter1.eIso= muonDau0.ecalIso(); |
967 |
– |
df.daughter2.eIso= muonDau1.ecalIso(); |
968 |
– |
|
969 |
– |
df.daughter1.hIso= muonDau0.hcalIso(); |
970 |
– |
df.daughter2.hIso= muonDau1.hcalIso(); |
971 |
– |
|
972 |
– |
df.daughter1.ipDb=muonDau0.dB(); |
973 |
– |
df.daughter2.ipDb=muonDau1.dB(); |
974 |
– |
|
975 |
– |
df.daughter1.ipErrDb=muonDau0.edB(); |
976 |
– |
df.daughter2.ipErrDb=muonDau1.edB(); |
977 |
– |
|
978 |
– |
df.daughter1.cat=0; |
979 |
– |
if(muonDau0.isGlobalMuon()) df.daughter1.cat|=1; |
980 |
– |
if(muonDau0.isTrackerMuon()) df.daughter1.cat|=2; |
981 |
– |
if(muonDau0.isStandAloneMuon()) df.daughter1.cat|=4; |
982 |
– |
df.daughter2.cat=0; |
983 |
– |
if(muonDau1.isGlobalMuon()) df.daughter2.cat|=1; |
984 |
– |
if(muonDau1.isTrackerMuon()) df.daughter2.cat|=2; |
985 |
– |
if(muonDau1.isStandAloneMuon()) df.daughter2.cat|=4; |
986 |
– |
|
987 |
– |
TrackRef trkMu1Ref = muonDau0.get<TrackRef>(); |
988 |
– |
TrackRef trkMu2Ref = muonDau1.get<TrackRef>(); |
989 |
– |
|
990 |
– |
if(trkMu1Ref.isNonnull() && trkMu2Ref.isNonnull()){ |
991 |
– |
const Track* MuTrk1 = muonDau0.get<TrackRef>().get(); |
992 |
– |
const Track* MuTrk2 = muonDau1.get<TrackRef>().get(); |
993 |
– |
df.daughter1.zPVPt=MuTrk1->dz(RecVtxFirst.position()); |
994 |
– |
df.daughter1.zPVProb=MuTrk1->dz(RecVtx.position()); |
995 |
– |
df.daughter2.zPVPt=MuTrk2->dz(RecVtxFirst.position()); |
996 |
– |
df.daughter2.zPVProb=MuTrk2->dz(RecVtx.position()); |
997 |
– |
|
998 |
– |
df.daughter1.nHits = MuTrk1->numberOfValidHits(); |
999 |
– |
df.daughter2.nHits = MuTrk2->numberOfValidHits(); |
1000 |
– |
|
1001 |
– |
df.daughter1.chi2 = MuTrk1->normalizedChi2(); |
1002 |
– |
df.daughter2.chi2 = MuTrk2->normalizedChi2(); |
1003 |
– |
|
1004 |
– |
TrackRef iTrack1 = muonDau0.innerTrack(); |
1005 |
– |
const reco::HitPattern& p1 = iTrack1->hitPattern(); |
1006 |
– |
TrackRef iTrack2 = muonDau1.innerTrack(); |
1007 |
– |
const reco::HitPattern& p2 = iTrack2->hitPattern(); |
1008 |
– |
|
1009 |
– |
df.daughter1.nPixelHits = p1.pixelLayersWithMeasurement(); |
1010 |
– |
df.daughter2.nPixelHits = p2.pixelLayersWithMeasurement(); |
1011 |
– |
|
1012 |
– |
if(muonDau0.isGlobalMuon()){ |
1013 |
– |
TrackRef gTrack = muonDau0.globalTrack(); |
1014 |
– |
const reco::HitPattern& q = gTrack->hitPattern(); |
1015 |
– |
df.daughter1.globNHits=q.numberOfValidMuonHits(); |
1016 |
– |
df.daughter1.globChi2=gTrack.get()->normalizedChi2(); |
1017 |
– |
df.daughter1.validMuStations = q. muonStationsWithValidHits(); |
1018 |
– |
} |
1019 |
– |
if(muonDau1.isGlobalMuon()){ |
1020 |
– |
TrackRef gTrack = muonDau1.globalTrack(); |
1021 |
– |
const reco::HitPattern& q = gTrack->hitPattern(); |
1022 |
– |
df.daughter2.globNHits=q.numberOfValidMuonHits(); |
1023 |
– |
df.daughter2.globChi2=gTrack.get()->normalizedChi2(); |
1024 |
– |
df.daughter2.validMuStations = q. muonStationsWithValidHits(); |
1025 |
– |
} |
969 |
|
|
1027 |
– |
} |
1028 |
– |
|
1029 |
– |
hbbInfo->diMuonInfo.push_back(df); |
1030 |
– |
} |
1031 |
– |
|
1032 |
– |
for( size_t i = 0; i < dielectrons->size(); i++ ) { |
1033 |
– |
VHbbEvent::DiElectronInfo df; |
1034 |
– |
const Candidate & dielecCand = (*dielectrons)[ i ]; |
1035 |
– |
|
1036 |
– |
df.p4=GENPTOLOR(dielecCand); |
1037 |
– |
|
1038 |
– |
// accessing the daughters of the dimuon candidate |
1039 |
– |
const Candidate * lep0 = dielecCand.daughter( 0 ); |
1040 |
– |
const Candidate * lep1 = dielecCand.daughter( 1 ); |
1041 |
– |
// needed to access specific methods of pat::Muon |
1042 |
– |
const pat::Electron & elecDau0 = dynamic_cast<const pat::Electron &>(*lep0->masterClone()); |
1043 |
– |
const pat::Electron & elecDau1 = dynamic_cast<const pat::Electron &>(*lep1->masterClone()); |
1044 |
– |
|
1045 |
– |
df.daughter1.p4 = GENPTOLOR(elecDau0); |
1046 |
– |
df.daughter2.p4= GENPTOLOR(elecDau1); |
1047 |
– |
|
1048 |
– |
df.daughter1.tIso = elecDau0.trackIso(); |
1049 |
– |
df.daughter2.tIso = elecDau1.trackIso(); |
1050 |
– |
|
1051 |
– |
df.daughter1.eIso = elecDau0.ecalIso(); |
1052 |
– |
df.daughter2.eIso = elecDau1.ecalIso(); |
1053 |
– |
|
1054 |
– |
df.daughter1.hIso = elecDau0.hcalIso(); |
1055 |
– |
df.daughter2.hIso = elecDau1.hcalIso(); |
1056 |
– |
|
1057 |
– |
// ids |
1058 |
– |
/*df.daughter1.id95 = elecDau0.electronID("simpleEleId95cIso"); |
1059 |
– |
df.daughter1.id85 = elecDau0.electronID ("simpleEleId85cIso"); |
1060 |
– |
df.daughter1.id70 = elecDau0.electronID ("simpleEleId70cIso"); |
1061 |
– |
df.daughter1.id95r = elecDau0.electronID ("simpleEleId95relIso"); |
1062 |
– |
df.daughter1.id85r = elecDau0.electronID ("simpleEleId85relIso"); |
1063 |
– |
df.daughter1.id70r = elecDau0.electronID ("simpleEleId70relIso"); |
1064 |
– |
|
1065 |
– |
|
1066 |
– |
df.daughter2.id95 = elecDau1.electronID("simpleEleId95cIso"); |
1067 |
– |
df.daughter2.id85 = elecDau1.electronID ("simpleEleId85cIso"); |
1068 |
– |
df.daughter2.id70 = elecDau1.electronID ("simpleEleId70cIso"); |
1069 |
– |
df.daughter2.id95r = elecDau1.electronID ("simpleEleId95relIso"); |
1070 |
– |
df.daughter2.id85r = elecDau1.electronID ("simpleEleId85relIso"); |
1071 |
– |
df.daughter2.id70r = elecDau1.electronID ("simpleEleId70relIso"); |
1072 |
– |
*/ |
1073 |
– |
hbbInfo->diElectronInfo.push_back(df); |
1074 |
– |
|
1075 |
– |
} |
970 |
|
if (verbose_){ |
971 |
|
std::cout <<" Pushing hbbInfo "<<std::endl; |
972 |
|
std::cout <<" SimpleJets1 = "<<hbbInfo->simpleJets.size()<<std::endl<< |