From 57b374dd708d7c65c98a53ed03f9fa1e191dbc33 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Fri, 13 Feb 2015 17:05:21 +0100 Subject: [PATCH] Update multilepton cfg: - allow choosing which loose isolation to use (ptRel recovery, miniIso) - prefetch files if they're on Wigner (run heppy with -o nofetch to disable) - use the getHeppyOption to select tests (as #238) --- .../cfg/run_susyMultilepton_cfg.py | 76 ++++++++++++++----- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/CMGTools/TTHAnalysis/cfg/run_susyMultilepton_cfg.py b/CMGTools/TTHAnalysis/cfg/run_susyMultilepton_cfg.py index 2b1b0005a95..c865d907b06 100644 --- a/CMGTools/TTHAnalysis/cfg/run_susyMultilepton_cfg.py +++ b/CMGTools/TTHAnalysis/cfg/run_susyMultilepton_cfg.py @@ -20,9 +20,6 @@ lepAna.packedCandidates = 'packedPFCandidates' lepAna.miniIsolationPUCorr = 'rhoArea' lepAna.miniIsolationVetoLeptons = None # use 'inclusive' to veto inclusive leptons and their footprint in all isolation cones -## will become miniIso perhaps? -#lepAna.loose_muon_isoCut = lambda muon : muon.relIso03 < 10.5 -#lepAna.loose_electron_isoCut = lambda electron : electron.relIso03 < 10.5 # switch off slow photon MC matching @@ -43,6 +40,31 @@ susyCoreSequence.insert(susyCoreSequence.index(ttHCoreEventAna), ttHHeavyFlavourHadronAna) +## Lepton preselection to use +isolation = "relIso03" +if isolation == "ptRel": + # delay isolation cut for leptons of pt > 10, for which we do pTrel recovery + lepAna.loose_muon_isoCut = lambda muon : muon.relIso03 < 0.5 or muon.pt() > 10 + lepAna.loose_electron_isoCut = lambda elec : elec.relIso03 < 0.5 or elec.pt() > 10 + # in the cleaning, keep the jet if the lepton fails relIso or ptRel + jetAna.jetLepArbitration = lambda jet,lepton : ( + lepton if (lepton.relIso03 < 0.4 or ptRelv1(lepton.p4(),jet.p4()) > 5) else jet + ) + # insert a second skimmer after the jet cleaning + ttHLepSkim2 = cfg.Analyzer( + ttHLepSkimmer, name='ttHLepSkimmer2', + minLeptons = 2, + maxLeptons = 999, + ) + susyCoreSequence.insert(susyCoreSequence.index(jetAna)+1, ttHLepSkim2) +elif isolation == "miniIso": + lepAna.loose_muon_isoCut = lambda muon : muon.miniRelIso < 0.4 + lepAna.loose_electron_isoCut = lambda elec : elec.miniRelIso < 0.4 +else: + # nothing to do, will use normal relIso03 + pass + + from CMGTools.TTHAnalysis.samples.samples_13TeV_PHYS14 import triggers_mumu_iso, triggers_mumu_noniso, triggers_ee, triggers_3e, triggers_mue, triggers_1mu_iso, triggers_1e triggerFlagsAna.triggerBits = { 'DoubleMu' : triggers_mumu_iso, @@ -92,32 +114,46 @@ # comp.splitFactor = 1 # comp.fineSplitFactor = 40 -test = 1 -if test == 1: - comp = TTH; comp.name = "TTH" - #comp = SMS_T1tttt_2J_mGl1500_mLSP100 +from PhysicsTools.HeppyCore.framework.heppy import getHeppyOption +test = getHeppyOption('test') +if test == '1': + comp = TTH + if getHeppyOption('T1tttt'): + comp = SMS_T1tttt_2J_mGl1500_mLSP100 comp.files = comp.files[:1] - #comp.files = [ '/afs/cern.ch/work/g/gpetrucc/micro/CMSSW_7_2_0/src/step3.root' ] comp.splitFactor = 1 - comp.fineSplitFactor = 4 - #ttHLepSkim.minLeptons = 0 + if not getHeppyOption('single'): + comp.fineSplitFactor = 4 selectedComponents = [ comp ] -elif test == 2: +elif test == '2': for comp in selectedComponents: comp.files = comp.files[:1] comp.splitFactor = 1 comp.fineSplitFactor = 1 -elif test == 3: - comp = TTJets +elif test == 'EOS': + comp = DYJetsToLL_M50#TTJets comp.files = comp.files[:1] + if getHeppyOption('Wigner'): + print "Will read from WIGNER" + comp.files = [ 'root://eoscms//eos/cms/store/mc/Phys14DR/DYJetsToLL_M-50_13TeV-madgraph-pythia8/MINIAODSIM/PU20bx25_PHYS14_25_V1-v1/00000/0432E62A-7A6C-E411-87BB-002590DB92A8.root' ] + else: + print "Will read from CERN Meyrin" + comp.files = [ 'root://eoscms//eos/cms/store/mc/Phys14DR/DYJetsToLL_M-50_13TeV-madgraph-pythia8/MINIAODSIM/PU20bx25_PHYS14_25_V1-v1/10000/F675C068-5E6C-E411-B915-0025907DC9AC.root' ] + os.system("/afs/cern.ch/project/eos/installation/0.3.15/bin/eos.select fileinfo "+comp.files[0].replace("root://eoscms//","/")) comp.splitFactor = 1 + comp.fineSplitFactor = 1 selectedComponents = [ comp ] -elif test == 4: +elif test == 'SingleMu': comp = SingleMu comp.files = comp.files[:1] comp.splitFactor = 1 selectedComponents = [ comp ] -elif test == 10: # sync +elif test == '5': + for comp in selectedComponents: + comp.files = comp.files[:5] + comp.splitFactor = 1 + comp.fineSplitFactor = 5 +elif test == '2lss-sync': # sync #eventSelector.toSelect = [ 11809 ] #sequence = cfg.Sequence([eventSelector] + susyCoreSequence+[ ttHEventAna, treeProducer, ]) jetAna.recalibrateJets = False @@ -125,7 +161,7 @@ comp = SMS_T1tttt_2J_mGl1200_mLSP800 comp.files = [ 'root://eoscms//eos/cms/store/mc/Phys14DR/SMS-T1tttt_2J_mGl-1200_mLSP-800_Tune4C_13TeV-madgraph-tauola/MINIAODSIM/PU20bx25_tsg_PHYS14_25_V1-v1/00000/0CD15D7F-4E6B-E411-AEB4-002590DB9216.root' ] comp.splitFactor = 1 - #comp.fineSplitFactor = 10 + comp.fineSplitFactor = 10 selectedComponents = [ comp ] @@ -134,10 +170,10 @@ # the following is declared in case this cfg is used in input to the heppy.py script from PhysicsTools.HeppyCore.framework.eventsfwlite import Events from CMGTools.TTHAnalysis.tools.EOSEventsWithDownload import EOSEventsWithDownload +event_class = EOSEventsWithDownload +if getHeppyOption("nofetch"): + event_class = Events config = cfg.Config( components = selectedComponents, sequence = sequence, services = [], - events_class = EOSEventsWithDownload) - #events_class = Events) - - + events_class = event_class)