Skip to content

Commit

Permalink
implementation of the updated ecalBadCalibReducedMINIAODFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
tomc committed Jan 11, 2019
1 parent 551af8c commit 3bb8b5f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
1 change: 1 addition & 0 deletions multilep/plugins/multilep.cc
Expand Up @@ -30,6 +30,7 @@ multilep::multilep(const edm::ParameterSet& iConfig):
isSUSY( iConfig.getUntrackedParameter<bool>("isSUSY")),
storeLheParticles( iConfig.getUntrackedParameter<bool>("storeLheParticles"))
{
if(is2017 or is2018) ecalBadCalibFilterToken = consumes<bool>(edm::InputTag("ecalBadCalibReducedMINIAODFilter"));
triggerAnalyzer = new TriggerAnalyzer(iConfig, this);
leptonAnalyzer = new LeptonAnalyzer(iConfig, this);
photonAnalyzer = new PhotonAnalyzer(iConfig, this);
Expand Down
1 change: 1 addition & 0 deletions multilep/plugins/multilep.h
Expand Up @@ -89,6 +89,7 @@ class multilep : public edm::one::EDAnalyzer<edm::one::WatchLuminosityBlocks, ed
edm::EDGetTokenT<edm::TriggerResults> recoResultsSecondaryToken; //MET filter information (fallback if primary is not available)
edm::EDGetTokenT<edm::TriggerResults> triggerToken;
edm::EDGetTokenT<pat::PackedTriggerPrescales> prescalesToken;
edm::EDGetTokenT<bool> ecalBadCalibFilterToken;
std::string skim;
bool isData;
bool is2017;
Expand Down
32 changes: 31 additions & 1 deletion multilep/python/jetSequence_cff.py
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms
import os

def addJetSequence(process, isData, is2017):
def addJetSequence(process, isData, is2017, is2018):
#
# Latest JEC through globaltag, see https://twiki.cern.ch/twiki/bin/viewauth/CMS/JECDataMC
#
Expand Down Expand Up @@ -49,3 +49,33 @@ def addJetSequence(process, isData, is2017):
fixEE2017 = is2017,
fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139}
)

#
# To get updated ecalBadCalibReducedMINIAODFilter
# See https://twiki.cern.ch/twiki/bin/viewauth/CMS/MissingETOptionalFiltersRun2#How_to_run_ecal_BadCalibReducedM
# Recipe is preliminary, i.e. recommended to check for updates
#
if(is2017 or is2018):
process.load('RecoMET.METFilters.ecalBadCalibFilter_cfi')

baddetEcallist = cms.vuint32(
[872439604,872422825,872420274,872423218,
872423215,872416066,872435036,872439336,
872420273,872436907,872420147,872439731,
872436657,872420397,872439732,872439339,
872439603,872422436,872439861,872437051,
872437052,872420649,872422436,872421950,
872437185,872422564,872421566,872421695,
872421955,872421567,872437184,872421951,
872421694,872437056,872437057,872437313])


process.ecalBadCalibReducedMINIAODFilter = cms.EDFilter("EcalBadCalibFilter",
EcalRecHitSource = cms.InputTag("reducedEgamma:reducedEERecHits"),
ecalMinEt = cms.double(50.),
baddetEcal = baddetEcallist,
taggingMode = cms.bool(True),
debug = cms.bool(False)
)

process.jetSequence *= process.ecalBadCalibReducedMINIAODFilter
16 changes: 10 additions & 6 deletions multilep/src/TriggerAnalyzer.cc
Expand Up @@ -13,7 +13,7 @@ TriggerAnalyzer::TriggerAnalyzer(const edm::ParameterSet& iConfig, multilep* mul
multilepAnalyzer(multilepAnalyzer){

// MET Filters: first add common ones for 2016, 2017, 2018
// MET filter are taken in AND (based on the occurence of capitalized 'MET' in the allFlags key)
// MET filter are taken in AND (based on the occurence of capitalized 'MET' in the allFlags key) and always start with "Flag"
// References: https://twiki.cern.ch/twiki/bin/view/CMS/MissingETOptionalFiltersRun2#Analysis_Recommendations_for_ana
allFlags["passMETFilters"] = {"Flag_goodVertices", "Flag_HBHENoiseFilter", "Flag_HBHENoiseIsoFilter", "Flag_EcalDeadCellTriggerPrimitiveFilter",
"Flag_BadPFMuonFilter", "Flag_BadChargedCandidateFilter"};
Expand All @@ -27,11 +27,11 @@ TriggerAnalyzer::TriggerAnalyzer(const edm::ParameterSet& iConfig, multilep* mul
}

if(multilepAnalyzer->is2017 || multilepAnalyzer->is2018){ // This one is only for 2017 and 2018 data
allFlags["passMETFilters"].push_back("Flag_ecalBadCalibFilter"); // TODO: this filter is incomplete, need to reimplement this by hand following https://twiki.cern.ch/twiki/bin/view/CMS/MissingETOptionalFiltersRun2#How_to_run_the_Bad_Charged_Hadro
allFlags["passMETFilters"].push_back("updated_ecalBadCalibFilter"); // improved version over the Flag_ecalBadCalibFilter, implementation manually
}

// Triggers, grouped per year
// Triggers are taken in OR
// Triggers are taken in OR and always start with "HLT"
// WARNING/TODO: the 2018 year is currently a placeholder using the 2017 triggers, please check before starting analysis
// Also for the other years the triggers might be checked and optimized in detail, could use https://tomc.web.cern.ch/tomc/triggerPrescales to check prescales
if(multilepAnalyzer->is2018){
Expand Down Expand Up @@ -96,8 +96,9 @@ TriggerAnalyzer::TriggerAnalyzer(const edm::ParameterSet& iConfig, multilep* mul
allFlags["passTrigger_mmm"] = {"HLT_TripleMu_12_10_5"};

allFlags["passTrigger_met"] = {"HLT_MET200", "HLT_MET250", "HLT_MET300", "HLT_MET600", "HLT_MET700", "HLT_PFMET300", "HLT_PFMET400", // MET cross triggers as used for TTGamma 2016
"HLT_PFMET500", "HLT_PFMET600", "HLT_PFMET170_HBHECleaned", "HLT_PFMET170_HBHE_BeamHaloCleaned", "HLT_PFMET120_PFMHT120_IDTight"}
"HLT_PFMET500", "HLT_PFMET600", "HLT_PFMET170_HBHECleaned", "HLT_PFMET170_HBHE_BeamHaloCleaned", "HLT_PFMET120_PFMHT120_IDTight"};
}

}

void TriggerAnalyzer::beginJob(TTree* outputTree){
Expand Down Expand Up @@ -162,8 +163,11 @@ void TriggerAnalyzer::analyze(const edm::Event& iEvent){
edm::Handle<edm::TriggerResults> recoResultsPrimary; iEvent.getByToken(multilepAnalyzer->recoResultsPrimaryToken, recoResultsPrimary);
edm::Handle<edm::TriggerResults> recoResultsSecondary; iEvent.getByToken(multilepAnalyzer->recoResultsSecondaryToken, recoResultsSecondary);
edm::Handle<edm::TriggerResults> triggerResults; iEvent.getByToken(multilepAnalyzer->triggerToken, triggerResults);
edm::Handle<bool> badPFMuonFilter;
edm::Handle<bool> badChCandFilter;

if(multilepAnalyzer->is2017 || multilepAnalyzer->is2018){ // The updated ecalBadCalibFilter
edm::Handle<bool> passEcalBadCalibFilterUpdate; iEvent.getByToken(multilepAnalyzer->ecalBadCalibFilterToken, passEcalBadCalibFilterUpdate);
flag["updated_ecalBadCalibFilter"] = (*passEcalBadCalibFilterUpdate);
}

// Get all flags
getResults(iEvent, triggerResults, triggersToSave, true);
Expand Down
10 changes: 2 additions & 8 deletions multilep/test/multilep.py
Expand Up @@ -3,15 +3,9 @@

# Default input file (could be overwritten by parameters given on the command line and by crab), some examples:
#inputFile = 'file:///pnfs/iihe/cms/ph/sc4/store/data/Run2017F/DoubleMuon/MINIAOD/17Nov2017-v1/70000/E4B6F7A1-7BDE-E711-8C42-02163E019DE8.root'
#inputFile = "root://xrootd-cms.infn.it///store/mc/RunIISummer16MiniAODv2/SMS-TChiWZ_ZToLL_mZMin-0p1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUSummer16Fast_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/18589842-DCBD-E611-B8BF-0025905A48D8.root"
#inputFile = "root://cmsxrootd.fnal.gov///store/mc/RunIIFall17MiniAOD/tZq_ll_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8/MINIAODSIM/94X_mc2017_realistic_v10-v1/20000/02041699-0BFB-E711-AAD4-FA163E965751.root"
#inputFile = "root://cmsxrootd.fnal.gov///store/mc/RunIISummer16MiniAODv2/TTJets_SingleLeptFromTbar_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/60000/00A25ADE-DFD4-E611-8EAC-0025905A48B2.root"
#inputFile = "root://cms-xrd-global.cern.ch//store/mc/RunIISummer16MiniAODv2/TTJets_SingleLeptFromTbar_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/60000/00A25ADE-DFD4-E611-8EAC-0025905A48B2.root"
#inputFile = '/store/mc/RunIISummer16MiniAODv2/TTJets_DiLept_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/80000/C0EC0176-2ABE-E611-99E3-0025904C51D8.root'
#inputFile = '/store/data/Run2016E/SingleMuon/MINIAOD/07Aug17-v1/110000/00A51C60-CE80-E711-8B18-0025905A6060.root'
#inputFile = '/store/data/Run2017F/SingleMuon/MINIAOD/17Nov2017-v1/00000/3E7C07F9-E6F1-E711-841A-0CC47A4C8E46.root'
#inputFile = 'file:///pnfs/iihe/cms/store/user/tomc/heavyNeutrinoMiniAOD/Moriond17_aug2018/displaced/HeavyNeutrino_lljj_M-1_V-0.212367605816_e_massiveAndCKM_LO/heavyNeutrino_1.root'
#inputFile ='/store/data/Run2018A/SingleMuon/MINIAOD/PromptReco-v3/000/316/569/00000/0085320B-4E64-E811-A2D3-FA163E2A55D6.root'
#inputFile = '/store/data/Run2018A/SingleMuon/MINIAOD/PromptReco-v3/000/316/569/00000/0085320B-4E64-E811-A2D3-FA163E2A55D6.root'
#inputFile = '/store/data/Run2018A/MET/MINIAOD/PromptReco-v3/000/316/666/00000/0CC8EDCD-FD64-E811-BCA8-02163E01A020.root'
inputFile = 'file:///pnfs/iihe/cms/store/user/tomc/heavyNeutrino/testFiles/store/data/Run2018A/SingleMuon/MINIAOD/17Sep2018-v2/100000/42EFAC9D-DC91-DB47-B931-B6B816C60C21.root'

Expand Down Expand Up @@ -70,7 +64,7 @@ def getVal(arg):
# Import some objectsequences sequence (details in cff files)
#
from heavyNeutrino.multilep.jetSequence_cff import addJetSequence
addJetSequence(process, isData, is2017)
addJetSequence(process, isData, is2017, is2018)

from RecoEgamma.EgammaTools.EgammaPostRecoTools import setupEgammaPostRecoSeq
if is2018: setupEgammaPostRecoSeq(process, runEnergyCorrections=False, era='2018-Prompt') # No scale and smearings available yet
Expand Down

0 comments on commit 3bb8b5f

Please sign in to comment.