From 8ae9c3ddb04ae9988a63d914e9af79286df05ed6 Mon Sep 17 00:00:00 2001 From: maria Date: Tue, 17 Dec 2019 16:11:58 +0100 Subject: [PATCH 1/4] add DeepAK8 --- Core/interface/BareFatJets.hpp | 18 ++--- Core/src/BareFatJets.cpp | 95 ++++++++++++----------- Nero/python/Nero_cfi.py | 15 ++-- Nero/src/NeroFatJets.cpp | 133 ++++++--------------------------- Nero/test/testNero.py | 62 +++++++++++---- 5 files changed, 129 insertions(+), 194 deletions(-) diff --git a/Core/interface/BareFatJets.hpp b/Core/interface/BareFatJets.hpp index 8d01ad1..17729d5 100644 --- a/Core/interface/BareFatJets.hpp +++ b/Core/interface/BareFatJets.hpp @@ -27,13 +27,6 @@ class BareFatJets : virtual public BareP4 vector *tau1{0}; vector *tau2{0}; vector *tau3{0}; - vector *sdtau1{0}; - vector *sdtau2{0}; - vector *sdtau3{0}; - - vector *trimmedMass{0}; - vector *prunedMass{0}; - vector *corrprunedMass{0}; vector *softdropMass{0}; TClonesArray *subjet{0}; @@ -42,10 +35,15 @@ class BareFatJets : virtual public BareP4 vector *subjet_btag{0}; vector *hbb{0}; - vector *topMVA{0}; + vector *TvsQCD{0}; + vector *WvsQCD{0}; + vector *ZvsQCD{0}; + vector *ZbbvsQCD{0}; + vector *TvsQCDMD{0}; + vector *WvsQCDMD{0}; + vector *ZHbbvsQCDMD{0}; + vector *ZHccvsQCDMD{0}; - vector *puppi_softdrop_masscorr{0}; - vector *puppi_softdrop_mass{0}; }; diff --git a/Core/src/BareFatJets.cpp b/Core/src/BareFatJets.cpp index 18d59c8..730135c 100644 --- a/Core/src/BareFatJets.cpp +++ b/Core/src/BareFatJets.cpp @@ -12,20 +12,20 @@ BareFatJets::~BareFatJets(){ BareFunctions::Delete(tau1 ); BareFunctions::Delete(tau2 ); BareFunctions::Delete(tau3 ); - BareFunctions::Delete(sdtau1); - BareFunctions::Delete(sdtau2); - BareFunctions::Delete(sdtau3); - BareFunctions::Delete(trimmedMass ); - BareFunctions::Delete(prunedMass ); - BareFunctions::Delete(corrprunedMass ); BareFunctions::Delete(softdropMass ); BareFunctions::Delete(subjet ); BareFunctions::Delete(nSubjets ); BareFunctions::Delete(firstSubjet ); BareFunctions::Delete(subjet_btag ); - BareFunctions::Delete(topMVA ); - BareFunctions::Delete(puppi_softdrop_masscorr); - BareFunctions::Delete(puppi_softdrop_mass); + BareFunctions::Delete(hbb ); + BareFunctions::Delete(TvsQCD ); + BareFunctions::Delete(WvsQCD ); + BareFunctions::Delete(ZvsQCD ); + BareFunctions::Delete(ZbbvsQCD ); + BareFunctions::Delete(TvsQCDMD ); + BareFunctions::Delete(WvsQCDMD ); + BareFunctions::Delete(ZHbbvsQCDMD ); + BareFunctions::Delete(ZHccvsQCDMD ); } @@ -38,22 +38,20 @@ void BareFatJets::init(){ BareFunctions::New(tau1); BareFunctions::New(tau2); BareFunctions::New(tau3); - BareFunctions::New(sdtau1); - BareFunctions::New(sdtau2); - BareFunctions::New(sdtau3); - BareFunctions::New(trimmedMass ); - BareFunctions::New(prunedMass ); - BareFunctions::New(corrprunedMass ); BareFunctions::New(softdropMass ); BareFunctions::New(subjet ); BareFunctions::New(nSubjets ); BareFunctions::New(firstSubjet ); BareFunctions::New(subjet_btag ); - BareFunctions::New(topMVA ); - BareFunctions::New(hbb ); - BareFunctions::New(puppi_softdrop_masscorr); - BareFunctions::New(puppi_softdrop_mass); - + BareFunctions::New(hbb ); + BareFunctions::New(TvsQCD ); + BareFunctions::New(WvsQCD ); + BareFunctions::New(ZvsQCD ); + BareFunctions::New(ZbbvsQCD ); + BareFunctions::New(TvsQCDMD ); + BareFunctions::New(WvsQCDMD ); + BareFunctions::New(ZHbbvsQCDMD ); + BareFunctions::New(ZHccvsQCDMD ); } void BareFatJets::clear(){ @@ -65,21 +63,21 @@ void BareFatJets::clear(){ tau1 -> clear(); tau2 -> clear(); tau3 -> clear(); - sdtau1 -> clear(); - sdtau2 -> clear(); - sdtau3 -> clear(); - trimmedMass -> clear(); - prunedMass -> clear(); - corrprunedMass -> clear(); softdropMass -> clear(); subjet->Clear(); nSubjets->clear(); firstSubjet->clear(); subjet_btag ->clear(); hbb -> clear(); - topMVA->clear(); - puppi_softdrop_masscorr->clear(); - puppi_softdrop_mass->clear(); + TvsQCD->clear(); + WvsQCD->clear(); + ZvsQCD->clear(); + ZbbvsQCD->clear(); + TvsQCDMD->clear(); + WvsQCDMD->clear(); + ZHbbvsQCDMD->clear(); + ZHccvsQCDMD->clear(); + } void BareFatJets::defineBranches(TTree *t){ @@ -95,13 +93,7 @@ void BareFatJets::defineBranches(TTree *t){ t->Branch(jetName + "Tau1","vector",&tau1); t->Branch(jetName + "Tau2","vector",&tau2); t->Branch(jetName + "Tau3","vector",&tau3); - t->Branch(jetName + "SDTau1","vector",&sdtau1); - t->Branch(jetName + "SDTau2","vector",&sdtau2); - t->Branch(jetName + "SDTau3","vector",&sdtau3); - // - t->Branch(jetName + "TrimmedMass","vector",&trimmedMass); - t->Branch(jetName + "PrunedMass","vector",&prunedMass); - t->Branch(jetName + "CorrectedPrunedMass","vector",&corrprunedMass); + t->Branch(jetName + "SoftdropMass","vector",&softdropMass); t->Branch(jetName + "subjet","TClonesArray", &subjet, 128000, 0); @@ -110,11 +102,18 @@ void BareFatJets::defineBranches(TTree *t){ t->Branch(jetName + "subjet_btag","vector",&subjet_btag); t->Branch(jetName + "Hbb","vector",&hbb); + t->Branch(jetName + "TvsQCD","vector",&TvsQCD); + t->Branch(jetName + "WvsQCD","vector",&WvsQCD); + t->Branch(jetName + "ZvsQCD","vector",&ZvsQCD); + t->Branch(jetName + "ZbbvsQCD","vector",&ZbbvsQCD); - t->Branch(jetName + "topMVA","vector",&topMVA); + t->Branch(jetName + "TvsQCDMD","vector",&TvsQCDMD); + t->Branch(jetName + "WvsQCDMD","vector",&WvsQCDMD); + t->Branch(jetName + "ZHbbvsQCDMD","vector",&ZHbbvsQCDMD); + t->Branch(jetName + "ZHccvsQCDMD","vector",&ZHccvsQCDMD); - t->Branch("puppi_softdrop_masscorr","vector",&puppi_softdrop_masscorr); - t->Branch("puppi_softdrop_mass","vector",&puppi_softdrop_mass); + // t->Branch("puppi_softdrop_masscorr","vector",&puppi_softdrop_masscorr); + // t->Branch("puppi_softdrop_mass","vector",&puppi_softdrop_mass); } @@ -132,9 +131,6 @@ void BareFatJets::setBranchAddresses(TTree *t, std::string prefix){ BareFunctions::SetBranchAddress(t,jetName + "Tau2" ,&tau2); BareFunctions::SetBranchAddress(t,jetName + "Tau3" ,&tau3); - BareFunctions::SetBranchAddress(t,jetName + "TrimmedMass" ,&trimmedMass); - BareFunctions::SetBranchAddress(t,jetName + "PrunedMass" ,&prunedMass); - BareFunctions::SetBranchAddress(t,jetName + "CorrectedPrunedMass" ,&corrprunedMass); BareFunctions::SetBranchAddress(t,jetName + "SoftdropMass" ,&softdropMass); BareFunctions::SetBranchAddress(t,jetName + "subjet" ,&subjet); @@ -143,12 +139,15 @@ void BareFatJets::setBranchAddresses(TTree *t, std::string prefix){ BareFunctions::SetBranchAddress(t,jetName + "subjet_btag",&subjet_btag); BareFunctions::SetBranchAddress(t,jetName + "Hbb",&hbb); - BareFunctions::SetBranchAddress(t,jetName + "topMVA",&topMVA); - - //puppi - - BareFunctions::SetBranchAddress(t,"puppi_softdrop_masscorr",&puppi_softdrop_masscorr); - BareFunctions::SetBranchAddress(t,"puppi_softdrop_mass",&puppi_softdrop_mass); + BareFunctions::SetBranchAddress(t,jetName + "TvsQCD",&TvsQCD); + BareFunctions::SetBranchAddress(t,jetName + "WvsQCD",&WvsQCD); + BareFunctions::SetBranchAddress(t,jetName + "ZvsQCD",&ZvsQCD); + BareFunctions::SetBranchAddress(t,jetName + "ZbbvsQCD",&ZbbvsQCD); + + BareFunctions::SetBranchAddress(t,jetName + "TvsQCDMD",&TvsQCDMD); + BareFunctions::SetBranchAddress(t,jetName + "WvsQCDMD",&WvsQCDMD); + BareFunctions::SetBranchAddress(t,jetName + "ZHbbvsQCDMD",&ZHbbvsQCDMD); + BareFunctions::SetBranchAddress(t,jetName + "ZHccvsQCDMD",&ZHccvsQCDMD); } void BareFatJets::compress(){ diff --git a/Nero/python/Nero_cfi.py b/Nero/python/Nero_cfi.py index 678e6d6..ec6c6bb 100644 --- a/Nero/python/Nero_cfi.py +++ b/Nero/python/Nero_cfi.py @@ -54,15 +54,14 @@ NeroFatJets = cms.PSet( - chsAK8 = cms.InputTag("slimmedJetsAK8"), + AK8Jet = cms.InputTag("slimmedJetsAK8"), ## Mass Corrections - chsAK8JEC = cms.string("jec/Summer16_23Sep2016V4"), - chsAK8JECMC = cms.string("jec/Fall17_17Nov2017_V32"), - minAK8CHSPt = cms.double (170.), - minAK8CHSEta = cms.double (4.7), - minAK8CHSN = cms.int32 (0), - minAK8CHSId = cms.string ('loose'), - AK8CHSName = cms.string ('AK8CHS'), + AK8JEC = cms.string("jec/Summer16_23Sep2016V4"), + AK8JECMC = cms.string("jec/Fall17_17Nov2017_V32"), + minAK8Pt = cms.double (170.), + minAK8Eta = cms.double (4.7), + minAK8Id = cms.string ('loose'), + AK8Name = cms.string ('AK8WithDeepTag'), rho = cms.InputTag("fixedGridRhoFastjetAll"), vertices = cms.InputTag("offlineSlimmedPrimaryVertices"), ), diff --git a/Nero/src/NeroFatJets.cpp b/Nero/src/NeroFatJets.cpp index 71e1f55..aad5004 100644 --- a/Nero/src/NeroFatJets.cpp +++ b/Nero/src/NeroFatJets.cpp @@ -8,69 +8,28 @@ NeroFatJets::NeroFatJets(edm::ConsumesCollector & cc,edm::ParameterSet iConfig): BareFatJets(), mRunJEC(false), mMinId("loose"), - jetRadius(0.8), - mMCJetCorrector(0), - mDataJetCorrector(0), - mMCJetCorrectorPuppi(0), - mDataJetCorrectorPuppi(0) + jetRadius(0.8) { - token = cc.consumes(iConfig.getParameter("chsAK8")); + token = cc.consumes(iConfig.getParameter("AK8Jet")); rho_token = cc.consumes(iConfig.getParameter("rho")); vertex_token = cc.consumes(iConfig.getParameter("vertices")); - sd_tau1_token = cc.consumes > ( edm::InputTag("NjettinessGroomed","Nsubjettiness:softdrop:tau1") ) ; - sd_tau2_token = cc.consumes > ( edm::InputTag("NjettinessGroomed","Nsubjettiness:softdrop:tau2") ) ; - sd_tau3_token = cc.consumes > ( edm::InputTag("NjettinessGroomed","Nsubjettiness:softdrop:tau3") ) ; - mMinPt = iConfig.getParameter("minAK8CHSPt"); - mMaxEta = iConfig.getParameter("minAK8CHSEta"); - mMinId = iConfig.getParameter("minAK8CHSId"); - cachedPrefix = iConfig.getParameter("AK8CHSName"); + mMinPt = iConfig.getParameter("minAK8Pt"); + mMaxEta = iConfig.getParameter("minAK8Eta"); + mMinId = iConfig.getParameter("minAK8Id"); + cachedPrefix = iConfig.getParameter("AK8Name"); jetRadius = 0.8; subjets_token = cc.mayConsume(edm::InputTag("PFJetsSoftDrop"+ cachedPrefix ,"SubJets")); btags_token = cc.mayConsume(edm::InputTag(cachedPrefix + "PFCombinedInclusiveSecondaryVertexV2BJetTags") ) ; - jecBasePath= iConfig.getParameter("chsAK8JEC"); - jecBasePathMC= iConfig.getParameter("chsAK8JECMC"); + jecBasePath= iConfig.getParameter("AK8JEC"); + jecBasePathMC= iConfig.getParameter("AK8JECMC"); } NeroFatJets::~NeroFatJets(){ - BareFunctions::Delete(mMCJetCorrector); - BareFunctions::Delete(mDataJetCorrector); - BareFunctions::Delete(mMCJetCorrectorPuppi); - BareFunctions::Delete(mDataJetCorrectorPuppi); } void NeroFatJets::init() { BareFatJets::init(); - // set up jet energy corrections - //string jecBasePathMC="jec/Summer16_23Sep2016V4"; - //string jecBasePathMC="jec/Fall17_17Nov2017_V32"; - // - cout<<"[NeroFatJets]::[init]::[INFO] Taking JEC for MC="< mcParams; - mcParams.push_back(JetCorrectorParameters(jecBasePathMC+"_MC_L2Relative_AK8PFchs.txt")); - mcParams.push_back(JetCorrectorParameters(jecBasePathMC+"_MC_L3Absolute_AK8PFchs.txt")); - mMCJetCorrector = new FactorizedJetCorrector(mcParams); - - std::vector dataParams; - dataParams.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L2Relative_AK8PFchs.txt")); - dataParams.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L3Absolute_AK8PFchs.txt")); - dataParams.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L2L3Residual_AK8PFchs.txt")); - mDataJetCorrector = new FactorizedJetCorrector(dataParams); - - //Puppi - std::vector mcParamsPuppi; - mcParamsPuppi.push_back(JetCorrectorParameters(jecBasePathMC+"_MC_L2Relative_AK8PFPuppi.txt")); - mcParamsPuppi.push_back(JetCorrectorParameters(jecBasePathMC+"_MC_L3Absolute_AK8PFPuppi.txt")); - mMCJetCorrectorPuppi = new FactorizedJetCorrector(mcParamsPuppi); - - std::vector dataParamsPuppi; - dataParamsPuppi.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L2Relative_AK8PFPuppi.txt")); - dataParamsPuppi.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L3Absolute_AK8PFPuppi.txt")); - dataParamsPuppi.push_back(JetCorrectorParameters(jecBasePath + "_DATA_L2L3Residual_AK8PFPuppi.txt")); - mDataJetCorrectorPuppi = new FactorizedJetCorrector(dataParamsPuppi); } @@ -80,21 +39,13 @@ int NeroFatJets::analyze(const edm::Event& iEvent){ // maybe handle should be taken before iEvent.getByToken(token, handle); - iEvent.getByToken(sd_tau1_token,sd_tau1_handle); - iEvent.getByToken(sd_tau2_token,sd_tau2_handle); - iEvent.getByToken(sd_tau3_token,sd_tau3_handle); - //Vertex iEvent.getByToken(vertex_token,vertex_handle); //Rho iEvent.getByToken(rho_token,rho_handle); // this jet collection is straight from miniAOD - skip all the fancy stuff - if ( not handle.isValid() ) cout<<"[NeroFatJets]::[analyze]::[ERROR] handle is not valid"< FatJet IDED "< jetRef(edm::Ref(handle, ijetRef) ); - float sdtau1_ = (*sd_tau1_handle)[jetRef]; - sdtau1 -> push_back( sdtau1_); - float sdtau2_ = (*sd_tau2_handle)[jetRef]; - sdtau2 -> push_back( sdtau2_); - float sdtau3_ = (*sd_tau3_handle)[jetRef]; - sdtau3 -> push_back( sdtau3_); //cout<<"[NeroFatJets]::[DEBUG] -> FatJet Fill "<GetEntriesFast()]) TLorentzVector(j.px(), j.py(), j.pz(), j.energy()); rawPt -> push_back (j.pt()*j.jecFactor("Uncorrected")); - - //L2L3 Corrected Jet only for the pruned mass correction - double corr=0.; - FactorizedJetCorrector *jecAK8_ = ( iEvent.isRealData() ) ? mDataJetCorrector : mMCJetCorrector; - jecAK8_->setJetEta( j.eta()*j.jecFactor("Uncorrected") ); - jecAK8_->setJetPt ( j.pt()*j.jecFactor("Uncorrected") ); - jecAK8_->setJetE ( j.energy()*j.jecFactor("Uncorrected") ); - jecAK8_->setJetA ( j.jetArea() ); - jecAK8_->setRho ( *rho_handle ); - jecAK8_->setNPV ( vertex_handle->size() ); - corr = jecAK8_->getCorrection(); flavour -> push_back( j.partonFlavour() ); @@ -141,12 +71,20 @@ int NeroFatJets::analyze(const edm::Event& iEvent){ tau2 -> push_back(j.userFloat("NjettinessAK8Puppi:tau2")); tau3 -> push_back(j.userFloat("NjettinessAK8Puppi:tau3")); - corrprunedMass ->push_back(j.userFloat("ak8PFJetsCHSValueMap:ak8PFJetsCHSPrunedMass")*corr); - prunedMass ->push_back(j.userFloat("ak8PFJetsCHSValueMap:ak8PFJetsCHSPrunedMass")); - softdropMass->push_back(j.userFloat("ak8PFJetsCHSValueMap:ak8PFJetsCHSSoftDropMass")); - + softdropMass->push_back(j.groomedMass("SoftDropPuppi")); + + TvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:TvsQCD")); + WvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:WvsQCD")); + ZvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZvsQCD")); + ZbbvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZbbvsQCD")); + + TvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:TvsQCDMD")); + WvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:WvsQCDMD")); + ZHbbvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZHbbvsQCDMD")); + ZHccvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZHccvsQCDMD")); + hbb -> push_back( j.bDiscriminator("pfBoostedDoubleSecondaryVertexAK8BJetTags") ) ; - + // Using SoftDropPuppi Subjets in 94X unsigned int nsubjetThisJet=0; firstSubjet->push_back(nsubjet); @@ -158,35 +96,6 @@ int NeroFatJets::analyze(const edm::Event& iEvent){ nsubjet++; } nSubjets->push_back(nsubjetThisJet); - - ///////////////////////////////////// - // Fill Puppi - ///////////////////////////////////// - - // SubJets > 170 - TLorentzVector puppi_softdrop, puppi_softdrop_subjet; - auto const & sdSubjetsPuppi = j.subjets("SoftDropPuppi"); - for ( auto const & it : sdSubjetsPuppi ) { - puppi_softdrop_subjet.SetPtEtaPhiM(it->correctedP4(0).pt(),it->correctedP4(0).eta(),it->correctedP4(0).phi(),it->correctedP4(0).mass()); - puppi_softdrop+=puppi_softdrop_subjet; - } - - puppi_softdrop_mass->push_back(puppi_softdrop.M()); - - //L2L3 Corrected Jet only for the pruned mass correction - double corrpuppi=0.; - FactorizedJetCorrector *jecAK8Puppi_ = ( iEvent.isRealData() ) ? mDataJetCorrectorPuppi : mMCJetCorrectorPuppi; - - jecAK8Puppi_->setJetEta( puppi_softdrop.Eta() ); - jecAK8Puppi_->setJetPt ( puppi_softdrop.Pt() ); - jecAK8Puppi_->setJetE ( puppi_softdrop.Energy() ); - jecAK8Puppi_->setJetA ( j.jetArea() ); - jecAK8Puppi_->setRho ( *rho_handle ); - jecAK8Puppi_->setNPV ( vertex_handle->size() ); - corrpuppi = jecAK8Puppi_->getCorrection(); - - puppi_softdrop_masscorr->push_back(corrpuppi*puppi_softdrop.M()); - } return 0; diff --git a/Nero/test/testNero.py b/Nero/test/testNero.py index f8d3fb8..ab27dd2 100644 --- a/Nero/test/testNero.py +++ b/Nero/test/testNero.py @@ -20,7 +20,7 @@ options.register("nerotag", "YYY", VarParsing.multiplicity.singleton,VarParsing.varType.string,"Set to the tag of the repository. use check_output 'git rev-parse HEAD' in the crab py file. active only if isGrid.") options.register('isParticleGun', False, VarParsing.multiplicity.singleton,VarParsing.varType.bool,"Set it to true if MonteCarlo is ParticleGun") -options.register('isRun', 'Run2017B', VarParsing.multiplicity.singleton,VarParsing.varType.string," Run2016A/B/C Run2017A/B/C/D/E/F") +options.register('isRun', 'Run2016B', VarParsing.multiplicity.singleton,VarParsing.varType.string," Run2016A/B/C Run2017A/B/C/D/E/F") options.parseArguments() @@ -47,7 +47,8 @@ ] else: options.inputFiles = [ - '/store/user/amarini/Sync/5AC9148F-9842-E811-892B-3417EBE535DA.root' ## GGH Hmm Apr2018 + '/store/group/phys_higgs/cmshmm/amarini/ZbbZhadJJ_EWK_LO_SM_mjj100_pTj10_13TeV_madgraphMLM_pythia8/FullSim_94X-MINIAODSIM/191118_105306/0000/step4_1.root' +## '/store/user/amarini/Sync/5AC9148F-9842-E811-892B-3417EBE535DA.root' ## GGH Hmm Apr2018 ] ### do not remove the line below! @@ -255,9 +256,27 @@ process.es_prefer_jer = cms.ESPrefer('PoolDBESSource', 'jer') +################ +#####https://twiki.cern.ch/twiki/bin/viewauth/CMS/DeepAKXTagging + +from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection + +print "-> Updating the AK8WithDeepTags" +from RecoBTag.MXNet.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll, _pfDeepBoostedJetTagsProbs, _pfDeepBoostedJetTagsMetaDiscrs, _pfMassDecorrelatedDeepBoostedJetTagsProbs, _pfMassDecorrelatedDeepBoostedJetTagsMetaDiscrs +updateJetCollection( + process, + jetSource = cms.InputTag('slimmedJetsAK8'), + pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'), + svSource = cms.InputTag('slimmedSecondaryVertices'), + rParam = 0.8, + jetCorrections = ('AK8PFPuppi', cms.vstring(['L2Relative', 'L3Absolute', 'L2L3Residual']), 'None'), + btagDiscriminators = _pfDeepBoostedJetTagsAll, + postfix='AK8WithDeepTags', + printWarning = False + ) + ################ end sqlite connection #### RECOMPUTE JEC From GT ### -from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection jecLevels= ['L1FastJet', 'L2Relative', 'L3Absolute'] if options.isData: @@ -270,12 +289,12 @@ jetCorrections = ('AK4PFchs', cms.vstring(jecLevels), 'None') # Do not forget 'L2L3Residual' on data! ) -updateJetCollection( - process, - jetSource = process.nero.NeroFatJets.chsAK8, - labelName = 'UpdatedJECAK8', - jetCorrections = ('AK8PFchs', cms.vstring(jecLevels), 'None') # Do not forget 'L2L3Residual' on data! -) +#updateJetCollection( +# process, +# jetSource = process.nero.NeroFatJets.chsAK8, +# labelName = 'UpdatedJECAK8', +# jetCorrections = ('AK8PFchs', cms.vstring(jecLevels), 'None') # Do not forget 'L2L3Residual' on data! +#) from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD @@ -316,13 +335,15 @@ print "-> Updating the jets collection to run on to 'updatedPatJetsUpdatedJEC' with the new jec in the GT/or DB" process.nero.NeroJets.jets=cms.InputTag('updatedPatJetsUpdatedJEC') -process.nero.NeroFatJets.chsAK8=cms.InputTag('updatedPatJetsUpdatedJECAK8') +#process.nero.NeroFatJets.chsAK8=cms.InputTag('updatedPatJetsUpdatedJECAK8') +process.nero.NeroFatJets.AK8Jet=cms.InputTag('selectedUpdatedPatJetsAK8WithDeepTags') + if isYear==2017: process.nero.NeroMet.mets=cms.InputTag("slimmedMETsModifiedMET") process.jecSequence = cms.Sequence( #process.patJetCorrFactorsReapplyJEC + process.patJetsReapplyJEC process.patJetCorrFactorsUpdatedJEC* process.updatedPatJetsUpdatedJEC - * process.patJetCorrFactorsUpdatedJECAK8* process.updatedPatJetsUpdatedJECAK8 +# * process.patJetCorrFactorsUpdatedJECAK8* process.updatedPatJetsUpdatedJECAK8 * process.fullPatMetSequenceModifiedMET * process.ecalBadCalibReducedMINIAODFilter ) @@ -331,12 +352,22 @@ process.jecSequence = cms.Sequence( #process.patJetCorrFactorsReapplyJEC + process.patJetsReapplyJEC process.patJetCorrFactorsUpdatedJEC* process.updatedPatJetsUpdatedJEC - * process.patJetCorrFactorsUpdatedJECAK8* process.updatedPatJetsUpdatedJECAK8 +# * process.patJetCorrFactorsUpdatedJECAK8* process.updatedPatJetsUpdatedJECAK8 * process.fullPatMetSequence * process.ecalBadCalibReducedMINIAODFilter ) +process.jetAK8Sequence = cms.Sequence( + process.patJetCorrFactorsAK8WithDeepTags * process.updatedPatJetsAK8WithDeepTags + * process.pfDeepBoostedJetTagInfosAK8WithDeepTags * process.pfDeepBoostedJetTagsAK8WithDeepTags * process.pfDeepBoostedDiscriminatorsJetTagsAK8WithDeepTags + * process.pfMassDecorrelatedDeepBoostedJetTagsAK8WithDeepTags * process.pfMassDecorrelatedDeepBoostedDiscriminatorsJetTagsAK8WithDeepTags + * process.patJetCorrFactorsTransientCorrectedAK8WithDeepTags + * process.updatedPatJetsTransientCorrectedAK8WithDeepTags + * process.selectedUpdatedPatJetsAK8WithDeepTags +) + + #-----------------------ELECTRON ID------------------------------- #from NeroProducer.Nero.egammavid_cfi import * @@ -475,8 +506,8 @@ process.QGVariables.isData = cms.bool(isData) ### Groomed variables -process.load('NeroProducer.Skim.NjettinesGroomed_cff') -process.NjettinessGroomed.srcJets = process.nero.NeroFatJets.chsAK8 +#process.load('NeroProducer.Skim.NjettinesGroomed_cff') +#process.NjettinessGroomed.srcJets = process.nero.NeroFatJets.chsAK8 ### BRegression process.load('NeroProducer.Skim.bRegressionProducer_cfi') @@ -493,15 +524,14 @@ process.p = cms.Path( process.infoProducerSequence * process.egammaPostRecoSeq * #-> should be everything from EGamma - #process.electronIDValueMapProducer * #process.electronMVAValueMapProducer * # needs to be produced on to of new slimmed electrons. process.jecSequence * + process.jetAK8Sequence * process.QGTagger * ## after jec, because it will produce the new jet collection process.ttbarcat * process.QGVariablesSequence* process.puid* - process.NjettinessGroomed* process.chsForSATkJets * process.softActivityJets * ## track jtes process.bRegressionProducer* process.FSRphotonSequence* From f9785e7dfd9fd2e640e4ece7fec2f4c25cfaa5ed Mon Sep 17 00:00:00 2001 From: maria Date: Tue, 17 Dec 2019 17:42:47 +0100 Subject: [PATCH 2/4] to run on CMSSW_9_4_13 --- Nero/script/setup.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Nero/script/setup.sh b/Nero/script/setup.sh index 9022614..f22bfc5 100755 --- a/Nero/script/setup.sh +++ b/Nero/script/setup.sh @@ -58,9 +58,25 @@ function CMSSW_9_4_9 { ## postReco for EGamma git cms-merge-topic cms-egamma:EgammaPostRecoTools_940 git cms-merge-topic cms-egamma:EgammaID_949 + ## additional variables for qg: (axis1,cmult,nmult). Optional + git cms-merge-topic amarini:topic_qgmorvar_94X + git cms-merge-topic cms-met:METFixEE2017_949_v2 + git clone ssh://git@gitlab.cern.ch:7999/uhh-cmssw/fsr-photon-recovery.git FSRPhotonRecovery + #git clone -b final_CMSSW_9_4_9 ssh://git@gitlab.cern.ch:7999/uhh-cmssw/CAST.git + #cd CAST && echo "/.gitignore" > .git/info/sparse_checkout && echo "/FSRPhotons/" >> .git/info/sparse-checkout && git read-tree -mu HEAD && cd - + ## new pileupid + #git cms-merge-topic singh-ramanpreet:PUID_102_15 + git cms-merge-topic amarini:PUID_port92X #as above + git clone -b 94X_weights_DYJets_inc git@github.com:singh-ramanpreet/RecoJets-JetProducers.git RecoJets/JetProducers/data.new + rsync -avP RecoJets/JetProducers/data.new/pileupJetId_94X_Eta* RecoJets/JetProducers/data/ +} + +function CMSSW_9_4_13 { + git cms-init + ## postReco for EGamma + git cms-merge-topic cms-egamma:EgammaPostRecoTools ## additional variables for qg: (axis1,cmult,nmult). Optional git cms-merge-topic amarini:topic_qgmorvar_94X - git cms-merge-topic cms-met:METFixEE2017_949_v2 git clone ssh://git@gitlab.cern.ch:7999/uhh-cmssw/fsr-photon-recovery.git FSRPhotonRecovery #git clone -b final_CMSSW_9_4_9 ssh://git@gitlab.cern.ch:7999/uhh-cmssw/CAST.git #cd CAST && echo "/.gitignore" > .git/info/sparse_checkout && echo "/FSRPhotons/" >> .git/info/sparse-checkout && git read-tree -mu HEAD && cd - From d1b45a7b217089e0d4ff9b9a6a5c4ffe2ca64797 Mon Sep 17 00:00:00 2001 From: maria Date: Tue, 17 Dec 2019 21:43:28 +0100 Subject: [PATCH 3/4] fix MassDecorrelated --- Nero/src/NeroFatJets.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Nero/src/NeroFatJets.cpp b/Nero/src/NeroFatJets.cpp index aad5004..c289415 100644 --- a/Nero/src/NeroFatJets.cpp +++ b/Nero/src/NeroFatJets.cpp @@ -78,10 +78,10 @@ int NeroFatJets::analyze(const edm::Event& iEvent){ ZvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZvsQCD")); ZbbvsQCD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZbbvsQCD")); - TvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:TvsQCDMD")); - WvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:WvsQCDMD")); - ZHbbvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZHbbvsQCDMD")); - ZHccvsQCDMD->push_back(j.bDiscriminator("pfDeepBoostedDiscriminatorsJetTags:ZHccvsQCDMD")); + TvsQCDMD->push_back(j.bDiscriminator("pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:TvsQCD")); + WvsQCDMD->push_back(j.bDiscriminator("pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:WvsQCD")); + ZHbbvsQCDMD->push_back(j.bDiscriminator("pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZHbbvsQCD")); + ZHccvsQCDMD->push_back(j.bDiscriminator("pfMassDecorrelatedDeepBoostedDiscriminatorsJetTags:ZHccvsQCD")); hbb -> push_back( j.bDiscriminator("pfBoostedDoubleSecondaryVertexAK8BJetTags") ) ; From 500d204c2ab35318c3650ee498db36ce0523a4ac Mon Sep 17 00:00:00 2001 From: Andrea Carlo Marini Date: Wed, 18 Dec 2019 14:30:10 +0100 Subject: [PATCH 4/4] changing cmssw for robot --- Nero/script/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nero/script/setup.sh b/Nero/script/setup.sh index f22bfc5..63e3f34 100755 --- a/Nero/script/setup.sh +++ b/Nero/script/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Instruct builder to use a particular CMSSW release -# [CMSSW] CMSSW_9_4_9 +# [CMSSW] CMSSW_9_4_13 # [Options] isData=False # [fileList] /store/user/amarini/Sync/5AC9148F-9842-E811-892B-3417EBE535DA.root # [MaxEvents] 5000