diff --git a/CMGTools/TTHAnalysis/cfg/run_susyEdge_cfg.py b/CMGTools/TTHAnalysis/cfg/run_susyEdge_cfg.py new file mode 100644 index 000000000000..151e3b1eadb1 --- /dev/null +++ b/CMGTools/TTHAnalysis/cfg/run_susyEdge_cfg.py @@ -0,0 +1,299 @@ +########################################################## +## CONFIGURATION FOR SUSY EDGE TREES ## +## skim condition: >= 2 loose leptons, no pt cuts or id ## +########################################################## +import PhysicsTools.HeppyCore.framework.config as cfg + + +#-------- LOAD ALL ANALYZERS ----------- + +from CMGTools.TTHAnalysis.analyzers.susyCore_modules_cff import * + + +#-------- REDEFINE WHAT I NEED ----------- + +# Lepton Skimming +ttHLepSkim.minLeptons = 2 +ttHLepSkim.maxLeptons = 999 +#ttHLepSkim.idCut = "" +#ttHLepSkim.ptCuts = [] + +# Run miniIso +lepAna.doMiniIsolation = True +lepAna.packedCandidates = 'packedPFCandidates' +lepAna.miniIsolationPUCorr = 'rhoArea' +lepAna.miniIsolationVetoLeptons = None # use 'inclusive' to veto inclusive leptons and their footprint in all isolation cones + +# Electron Preselection +lepAna.inclusive_electron_id = "POG_Cuts_ID_PHYS14_25ns_v1_ConvVetoDxyDz_Loose_full5x5" +lepAna.inclusive_electron_pt = 5 +lepAna.inclusive_electron_eta = 2.4 +lepAna.inclusive_electron_lostHits = 4.0 +lepAna.inclusive_electron_dxy = 0.5 +lepAna.inclusive_electron_dz = 1.0 + + +lepAna.loose_electron_id = "POG_Cuts_ID_PHYS14_25ns_v1_ConvVetoDxyDz_Loose_full5x5" +lepAna.loose_electron_pt = 5 +lepAna.loose_electron_eta = 2.4 +lepAna.loose_electron_relIso = 999 +lepAna.loose_electron_dxy = 0.1 +lepAna.loose_electron_dz = 0.2 +lepAna.loose_electron_lostHits = 4.0 +lepAna.ele_tightId = "Cuts_PHYS14_25ns_v1_ConvVetoDxyDz" + +# Muon Preselection +lepAna.inclusive_muon_id = "POG_ID_Tight" +lepAna.inclusive_muon_pt = 5 +lepAna.inclusive_muon_eta = 2.4 +lepAna.inclusive_muon_dxy = 0.2 +lepAna.inclusive_muon_dz = 0.5 + +lepAna.loose_muon_id = "POG_ID_Tight" +lepAna.loose_muon_pt = 5 +lepAna.loose_muon_eta = 2.4 +lepAna.loose_muon_dxy = 0.2, +lepAna.loose_muon_dz = 0.5, +lepAna.loose_muon_relIso = 999 +lepAna.mu_tightId = "POG_ID_Tight" + +isolation = "relIso03" +## not needed for edge if isolation == "ptRel": +## not needed for edge # delay isolation cut for leptons of pt > 10, for which we do pTrel recovery +## not needed for edge lepAna.loose_muon_isoCut = lambda muon : muon.relIso03 < 0.5 or muon.pt() > 10 +## not needed for edge lepAna.loose_electron_isoCut = lambda elec : elec.relIso03 < 0.5 or elec.pt() > 10 +## not needed for edge # in the cleaning, keep the jet if the lepton fails relIso or ptRel +## not needed for edge jetAna.jetLepArbitration = lambda jet,lepton : ( +## not needed for edge lepton if (lepton.relIso03 < 0.4 or ptRelv1(lepton.p4(),jet.p4()) > 5) else jet +## not needed for edge ) +## not needed for edge ttHCoreEventAna.leptonMVAKindTTH = "SusyWithBoost" +## not needed for edge ttHCoreEventAna.leptonMVAKindSusy = "SusyWithBoost" +## not needed for edge ttHCoreEventAna.leptonMVAPathTTH = "CMGTools/TTHAnalysis/macros/leptons/trainingPHYS14leptonMVA_PHYS14eleMVA_MiniIso_ttH/weights/%s_BDTG.weights.xml" +## not needed for edge ttHCoreEventAna.leptonMVAPathSusy = "CMGTools/TTHAnalysis/macros/leptons/trainingPHYS14leptonMVA_PHYS14eleMVA_MiniIso_SusyT1/weights/%s_BDTG.weights.xml" +## not needed for edge # insert a second skimmer after the jet cleaning +## not needed for edge ttHLepSkim2 = cfg.Analyzer( +## not needed for edge ttHLepSkimmer, name='ttHLepSkimmer2', +## not needed for edge minLeptons = 2, +## not needed for edge maxLeptons = 999, +## not needed for edge ) +## not needed for edge susyCoreSequence.insert(susyCoreSequence.index(jetAna)+1, ttHLepSkim2) +## not needed for edge elif isolation == "miniIso": +## not needed for edge lepAna.loose_muon_isoCut = lambda muon : muon.miniRelIso < 0.4 +## not needed for edge lepAna.loose_electron_isoCut = lambda elec : elec.miniRelIso < 0.4 +## not needed for edge elif isolation == None: +## not needed for edge lepAna.loose_muon_isoCut = lambda muon : True +## not needed for edge lepAna.loose_electron_isoCut = lambda elec : True +## not needed for edge else: +## not needed for edge # nothing to do, will use normal relIso03 +## not needed for edge pass + +# Switch off slow photon MC matching +photonAna.do_mc_match = False + + +#-------- ADDITIONAL ANALYZERS ----------- + +## Event Analyzer for susy multi-lepton (at the moment, it's the TTH one) +from CMGTools.TTHAnalysis.analyzers.ttHLepEventAnalyzer import ttHLepEventAnalyzer +ttHEventAna = cfg.Analyzer( + ttHLepEventAnalyzer, name="ttHLepEventAnalyzer", + minJets25 = 0, + ) + +## JetTau analyzer, to be called (for the moment) once bjetsMedium are produced +from CMGTools.TTHAnalysis.analyzers.ttHJetTauAnalyzer import ttHJetTauAnalyzer +ttHJetTauAna = cfg.Analyzer( + ttHJetTauAnalyzer, name="ttHJetTauAnalyzer", + ) + +## Insert the FatJet, SV, HeavyFlavour analyzers in the sequence +susyCoreSequence.insert(susyCoreSequence.index(ttHCoreEventAna), + ttHFatJetAna) +susyCoreSequence.insert(susyCoreSequence.index(ttHCoreEventAna), + ttHSVAna) +susyCoreSequence.insert(susyCoreSequence.index(ttHCoreEventAna), + ttHHeavyFlavourHadronAna) + +## Insert declustering analyzer +from CMGTools.TTHAnalysis.analyzers.ttHDeclusterJetsAnalyzer import ttHDeclusterJetsAnalyzer +ttHDecluster = cfg.Analyzer( + ttHDeclusterJetsAnalyzer, name='ttHDecluster', + lepCut = lambda lep,ptrel : lep.pt() > 10, + maxSubjets = 6, # for exclusive reclustering + ptMinSubjets = 5, # for inclusive reclustering + drMin = 0.2, # minimal deltaR(l,subjet) required for a successful subjet match + ptRatioMax = 1.5, # maximum pt(l)/pt(subjet) required for a successful match + ptRatioDiff = 0.1, # cut on abs( pt(l)/pt(subjet) - 1 ) sufficient to call a match successful + drMatch = 0.02, # deltaR(l,subjet) sufficient to call a match successful + ptRelMin = 5, # maximum ptRelV1(l,subjet) sufficient to call a match successful + prune = True, # also do pruning of the jets + pruneZCut = 0.1, # pruning parameters (usual value in CMS: 0.1) + pruneRCutFactor = 0.5, # pruning parameters (usual value in CMS: 0.5) + verbose = 0, # print out the first N leptons + jetCut = lambda jet : jet.pt() > 20, + mcPartonPtCut = 20, + mcLeptonPtCut = 5, + mcTauPtCut = 15, + ) +susyCoreSequence.insert(susyCoreSequence.index(ttHFatJetAna)+1, ttHDecluster) + +##------------------------------------------ +## JZB specific VARIABLES: jzb, pt1, pt2, phi1, phi2, eta1, eta2, mll, index1, index2 +##------------------------------------------ +from CMGTools.TTHAnalysis.analyzers.ttHJZBTopologicalVars import ttHJZBTopologicalVars + +ttHJZBTopologicalVars = cfg.Analyzer( + ttHJZBTopologicalVars, name = 'ttHJZBTopologicalVars' + ) + + +from CMGTools.TTHAnalysis.analyzers.treeProducerSusyEdge import * +## Tree Producer +treeProducer = cfg.Analyzer( + AutoFillTreeProducer, name='treeProducerSusyEdge', + vectorTree = True, + saveTLorentzVectors = False, # can set to True to get also the TLorentzVectors, but trees will be bigger + defaultFloatType = 'F', # use Float_t for floating point + PDFWeights = PDFWeights, + globalVariables = susyJZBEdge_globalVariables, + globalObjects = susyJZBEdge_globalObjects, + collections = susyJZBEdge_collections, +) + +## histo counter +susyCoreSequence.insert(susyCoreSequence.index(skimAnalyzer), + susyCounter) + + +#-------- SAMPLES AND TRIGGERS ----------- + + +## 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, +## 'DoubleMuNoIso' : triggers_mumu_noniso, +## 'DoubleEl' : triggers_ee, +## 'TripleEl' : triggers_3e, +## 'MuEG' : triggers_mue, +## 'SingleMu' : triggers_1mu_iso, +## 'SingleEl' : triggers_1e, +## } + +from CMGTools.TTHAnalysis.samples.samples_13TeV_PHYS14 import * + +selectedComponents = [ + ] + WJetsToLNuHT + DYJetsM50HT + [ #DYJetsToLL_M50, + TTJets ]+ SingleTop +[ + TTWJets,TTZJets, TTH, + WZJetsTo3LNu, ZZTo4L, + #GGHZZ4L, GGHTT, VBFTT, + SMS_T1tttt_2J_mGl1500_mLSP100, SMS_T1tttt_2J_mGl1200_mLSP800, + T5ttttDeg_mGo1000_mStop300_mCh285_mChi280, T5ttttDeg_mGo1000_mStop300_mCh285_mChi280_dil, + T5qqqqWW_mGo1200_mCh1000_mChi800_dilep, T5qqqqWWDeg_mGo1000_mCh315_mChi300_dilep +] +if False: + ttHLepSkim.minLeptons = 1 + QCDPtEMEnriched.remove(QCD_Pt10to20_EMEnriched) + selectedComponents = [ QCD_Mu15 ] + QCD_Mu5 + QCDPtEMEnriched + QCDPtbcToE + +selectedComponents = [TTJets] + + +# -- fine splitting, for some private MC samples with a single file +for comp in selectedComponents: + comp.splitFactor = 400 + #comp.fineSplitFactor = 4 + + +#-------- SEQUENCE ----------- + +sequence = cfg.Sequence(susyCoreSequence+[ + ttHJetTauAna, + ttHEventAna, + ttHJZBTopologicalVars, + treeProducer, + ]) + + +#-------- HOW TO RUN ----------- + +from PhysicsTools.HeppyCore.framework.heppy import getHeppyOption +test = getHeppyOption('test') +if test == '1': + comp = TTH + if getHeppyOption('T1tttt'): + comp = SMS_T1tttt_2J_mGl1500_mLSP100 + if getHeppyOption('H4L'): + comp = GGHZZ4L + comp.files = comp.files[:1] + comp.splitFactor = 1 + if not getHeppyOption('single'): + comp.fineSplitFactor = 4 + selectedComponents = [ comp ] +elif test == '2': + comp = TTJets + comp.files = comp.files[:1] + comp.splitFactor = 1 + comp.finesplitFactor = 4 + selectedComponents = [comp] +## 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 == 'SingleMu': +## comp = SingleMu +## comp.files = comp.files[:1] +## comp.splitFactor = 1 +## selectedComponents = [ comp ] +## elif test == '3': +## for comp in selectedComponents: +## comp.files = comp.files[:1] +## comp.splitFactor = 1 +## comp.fineSplitFactor = 4 +## 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 +## jetAna.smearJets = False +## 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 +## selectedComponents = [ comp ] + +## output histogram +outputService=[] +from PhysicsTools.HeppyCore.framework.services.tfile import TFileService +output_service = cfg.Service( + TFileService, + 'outputfile', + name="outputfile", + fname='treeProducerSusyEdge/tree.root', + option='recreate' + ) +outputService.append(output_service) + +# 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 = outputService, + events_class = event_class) diff --git a/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyEdge.py b/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyEdge.py new file mode 100644 index 000000000000..b640bea8b170 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyEdge.py @@ -0,0 +1,37 @@ +from CMGTools.TTHAnalysis.analyzers.treeProducerSusyCore import * +from CMGTools.TTHAnalysis.analyzers.ntupleTypes import * + +# including the multilepton analyzer and all its stuff +from CMGTools.TTHAnalysis.analyzers.treeProducerSusyMultilepton import * + +susyJZBEdge_globalVariables = susyMultilepton_globalVariables + [ + + NTupleVariable("l1l2_m", lambda ev : ev.l1l2_m, help="Invariant mass of two leading leptons"), + NTupleVariable("l1l2_pt", lambda ev : ev.l1l2_pt, help="Pt of the two leading leptons"), + NTupleVariable("l1l2_eta", lambda ev : ev.l1l2_eta, help="Eta of the two leading leptons"), + NTupleVariable("l1l2_phi", lambda ev : ev.l1l2_phi, help="Phi of the two leading leptons"), + NTupleVariable("l1l2_DR", lambda ev : ev.l1l2_DR, help="DR of the two leading leptons"), + NTupleVariable("genl1l2_m", lambda ev : ev.genl1l2_m, help="Invariant mass of two leading gen leptons"), + NTupleVariable("genl1l2_pt", lambda ev : ev.genl1l2_pt, help="Pt of the two gen leading leptons"), + NTupleVariable("genl1l2_eta", lambda ev : ev.genl1l2_eta, help="Eta of the two gen leading leptons"), + NTupleVariable("genl1l2_phi", lambda ev : ev.genl1l2_phi, help="Phi of the two gen leading leptons"), + NTupleVariable("genl1l2_DR", lambda ev : ev.genl1l2_DR, help="DR of the two gen leading leptons"), + NTupleVariable("jzb", lambda ev : ev.jzb, help="JZB variable"), +] + + +susyJZBEdge_globalObjects = susyCore_globalObjects.copy() + +susyJZBEdge_collections = susyMultilepton_collections.copy() +susyJZBEdge_collections.update({ + + + "genleps" : NTupleCollection("genLep", genParticleWithLinksType, 10, help="Generated leptons (e/mu) from W/Z decays"), + #"selectedLeptons" : NTupleCollection("lep", leptonTypeSusy, 50, help="Leptons after the preselection", filter=lambda l : l.pt()>10 ), + "cleanJetsAll" : NTupleCollection("jet", jetTypeSusy, 100, help="all jets (w/ x-cleaning, w/ ID applied w/o PUID applied pt>10 |eta|<5.2) , sorted by pt", filter=lambda l : l.pt()>10 ), + "selectedPhotons" : NTupleCollection("gamma", photonTypeSusy, 50, help="photons with pt>20 and loose cut based ID"), + "generatorSummary" : NTupleCollection("GenPart", genParticleWithLinksType, 100 , help="Hard scattering particles, with ancestry and links"), + +}) + + diff --git a/CMGTools/TTHAnalysis/python/analyzers/ttHJZBTopologicalVars.py b/CMGTools/TTHAnalysis/python/analyzers/ttHJZBTopologicalVars.py new file mode 100644 index 000000000000..d80569d79c80 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/analyzers/ttHJZBTopologicalVars.py @@ -0,0 +1,97 @@ +import operator +import itertools +import copy +from math import * + +from ROOT import std +from ROOT import TLorentzVector, TVectorD + +from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer +from PhysicsTools.HeppyCore.framework.event import Event +from PhysicsTools.HeppyCore.statistics.counter import Counter, Counters +from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle + +from PhysicsTools.HeppyCore.utils.deltar import deltaR + + +import ROOT + +import os + + +class ttHJZBTopologicalVars( Analyzer ): + def __init__(self, cfg_ana, cfg_comp, looperName ): + super(ttHJZBTopologicalVars,self).__init__(cfg_ana,cfg_comp,looperName) + + def declareHandles(self): + super(ttHJZBTopologicalVars, self).declareHandles() + #genJets + self.handles['genJets'] = AutoHandle( 'slimmedGenJets','std::vector') + + def beginLoop(self, setup): + super(ttHJZBTopologicalVars,self).beginLoop(setup) + self.counters.addCounter('pairs') + count = self.counters.counter('pairs') + count.register('all events') + + def makeMETRecoil(self, event): + + if len(event.selectedLeptons) > 1: + event.METRecoil = event.met.p4() + event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4() + + + def makeHadronicRecoil(self, event): + objectsjet40 = [ j for j in event.cleanJets if j.pt() > 40 and abs(j.eta())<3.0 ] + if len(objectsjet40)>0: + for jet in objectsjet40: + event.HadronicRecoil = event.HadronicRecoil + jet.p4() + + def makeJZB(self, event): + + if len(event.selectedLeptons) > 1: + event.jzb = event.METRecoil.pt() - (event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4()).pt() + + def makeZVars(self, event): + + if len(event.selectedLeptons) > 1: + event.l1l2_m = (event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4()).M() + event.l1l2_pt = (event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4()).pt() + event.l1l2_eta = (event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4()).eta() + event.l1l2_phi = (event.selectedLeptons[0].p4() + event.selectedLeptons[1].p4()).phi() + event.l1l2_DR = deltaR(event.selectedLeptons[0].eta(), event.selectedLeptons[0].phi(), event.selectedLeptons[1].eta(), event.selectedLeptons[1].phi()) + + def makeZGenVars(self, event): + + if len(event.genleps) > 1: + event.genl1l2_m = (event.genleps[0].p4() + event.genleps[1].p4()).M() + event.genl1l2_pt = (event.genleps[0].p4() + event.genleps[1].p4()).pt() + event.genl1l2_eta = (event.genleps[0].p4() + event.genleps[1].p4()).eta() + event.genl1l2_phi = (event.genleps[0].p4() + event.genleps[1].p4()).phi() + event.genl1l2_DR = deltaR(event.genleps[0].eta(), event.genleps[0].phi(), event.genleps[1].eta(), event.genleps[1].phi()) + + def process(self, event): + self.readCollections( event.input ) + + event.l1l2_m = 0 + event.l1l2_pt = 0 + event.l1l2_eta = 0 + event.l1l2_phi = 0 + event.l1l2_DR = 0 + + event.genl1l2_m = 0 + event.genl1l2_pt = 0 + event.genl1l2_eta = 0 + event.genl1l2_phi = 0 + event.genl1l2_DR = 0 + + event.jzb = 0 + event.HadronicRecoil = ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ) + event.METRecoil = ROOT.reco.Particle.LorentzVector( 0, 0, 0, 0 ) + + self.makeZVars(event) + self.makeZGenVars(event) + self.makeMETRecoil(event) + self.makeHadronicRecoil(event) + self.makeJZB(event) + + return True diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/basic_plots.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/basic_plots.txt new file mode 100644 index 000000000000..3862209242f4 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/basic_plots.txt @@ -0,0 +1,20 @@ +mll : mass_2(LepGood1_pt,LepGood1_eta,LepGood1_phi,LepGood1_mass, LepGood2_pt,LepGood2_eta,LepGood2_phi,LepGood2_mass): 50,0,500; XTitle="m(ll) [GeV]", Logy=True +## nLep: nLepGood: [1.5,2.5,3.5,4.5,5.5]; XTitle="N(lep)", Logy=True +met: met_pt: 32,0,400 ; XTitle="E_{T}^{miss} [GeV]" +lep1Pt: LepGood1_pt: 25,0,250; XTitle="Leading lepton p_{T} [GeV]", Legend='TR' +lep2Pt: LepGood2_pt: 20,0,100; XTitle="Second lepton p_{T} [GeV]", Legend='TR' +## lep3Pt: LepGood3_pt: 10,0,50; XTitle="Third lepton p_{T} [GeV]", Legend='TR' +## lep4Pt: LepGood4_pt: 10,0,50; XTitle="Fourth lepton p_{T} [GeV]", Legend='TR' +## nJet25 : nJet25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5] ; XTitle='N(jet\, p_{T} > 25)' +nJet40 : nJet40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5] ; XTitle='N(jet\, p_{T} > 40)' +jzb : jzb : 50, -100, 300 ; XTitle='JZB', Logy=True +## htJet25: htJet25: 20,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 25) [GeV]" +## htJet40: htJet40: 20,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 40) [GeV]" +## htJet40j: htJet40j: 20,0,2000 ; XTitle="H_{T}(jet p_{T} > 40) [GeV]" +## mhtJet25: mhtJet25: 32,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 25) [GeV]" +## mhtJet40: mhtJet40: 32,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 40) [GeV]" +## nBJet25 : nBJetMedium25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 25\, CSVM)' +## nBJet40 : nBJetMedium40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 40\, CSVM)' +## minMllAFAS: minMllAFAS: [0,4,8,12,15,20,30,40,60]; XTitle="min m(ll') [GeV]", Density=True +## minMllAFOS: minMllAFOS: [0,4,8,12,15,20,30,40,60]; XTitle="min m(l^{+}l^{-}') [GeV]", Density=True +## minMllSFOS: minMllSFOS: [0,4,8,12,15,20,30,40,60]; XTitle="min m(l^{+}l^{-}') [GeV]", Density=True diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/cutflow_example.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/cutflow_example.txt new file mode 100644 index 000000000000..81aafcc70182 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/cutflow_example.txt @@ -0,0 +1,16 @@ +## minMllAS8: minMllAFAS > 8 +## minMllOS12: minMllAFOS <= 0 || minMllAFOS > 12 +## zveto3l: mZ1 < 76 || mZ1 > 106 +## exclusive: nLepGood10 == 2 +## anyll: abs(LepGood1_pdgId) > 0 && abs(LepGood2_pdgId) > 0 +## same-sign: LepGood1_charge*LepGood2_charge > 0 +## lep1_pt25: LepGood1_pt > 25 +## lep2_pt25: LepGood2_pt > 25 +## lep iso: max(LepGood1_relIso03,LepGood2_relIso03) < 0.1 +## lep id: LepGood1_tightId > (abs(LepGood1_pdgId) == 11) && LepGood2_tightId > (abs(LepGood2_pdgId) == 11) +## lep dxy: max(LepGood1_sip3d,LepGood2_sip3d) < 4 +## ele cuts: (abs(LepGood1_pdgId) == 13 || (LepGood1_convVeto && LepGood1_lostHits == 0 && LepGood1_tightCharge > 1)) && (abs(LepGood2_pdgId) == 13 || (LepGood2_convVeto && LepGood2_lostHits == 0 && LepGood2_tightCharge > 1)) +## ht: htJet40j > 80 +## met: met_pt > 30 || htJet40j > 500 +## njet: nJet40 >=2 +## nBjet: nBJetMedium25 >= 0 diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/make_susy_cards.sh b/CMGTools/TTHAnalysis/python/plotter/susy-edge/make_susy_cards.sh new file mode 100644 index 000000000000..809a416b936a --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/make_susy_cards.sh @@ -0,0 +1,180 @@ +#!/bin/bash + +if [[ "$1" == "afs" ]]; then + T="/afs/cern.ch/work/g/gpetrucc/TREES_72X_040115"; + J=4; +elif [[ "$HOSTNAME" == "cmsphys10" ]]; then + T="/data/g/gpetrucc/TREES_72X_040115"; + J=8; +else + T="/afs/cern.ch/work/g/gpetrucc/TREES_72X_040115"; + J=4; +fi + +LUMI=10.0 +OUTDIR="susy_cards" +OPTIONS=" -P $T -j $J -l $LUMI -f --s2v --tree treeProducerSusyMultilepton --od $OUTDIR --asimov " +#OPTIONS=" $OPTIONS -F sf/t $T/0_lepMVA_v1/evVarFriend_{cname}.root " + + +function makeCard_2lss { + local EXPR=$1; local BINS=$2; local SYSTS=$3; local OUT=$4; local GO=$5 + + # b-jet cuts + case $SR in + 0[0-9X]) GO="${GO} -R nBjet nBjet0 nBJetMedium40==0 " ;; + 1[0-9X]) GO="${GO} -R nBjet nBjet1 nBJetMedium40==1 " ;; + 2[0-9X]) GO="${GO} -R nBjet nBjet2 nBJetMedium40==2 " ;; + 3[0-9X]) GO="${GO} -R nBjet nBjet3 nBJetMedium40>=3 " ;; + 2[0-9X]+) GO="${GO} -R nBjet nBjet2 nBJetMedium40>=2 " ;; + 0[0-9X]s) GO="${GO} -R nBjet nBjet3 nBJetMedium40+min(nBJetMedium25+nSoftBTight25-nBJetMedium40,1)==0 " ;; + 1[0-9X]s) GO="${GO} -R nBjet nBjet3 nBJetMedium40+min(nBJetMedium25+nSoftBTight25-nBJetMedium40,1)==1 " ;; + 2[0-9X]s) GO="${GO} -R nBjet nBjet3 nBJetMedium40+min(nBJetMedium25+nSoftBTight25-nBJetMedium40,1)==2 " ;; + 3[0-9X]s) GO="${GO} -R nBjet nBjet3 nBJetMedium40+min(nBJetMedium25+nSoftBTight25-nBJetMedium40,1)>=3 " ;; + esac; + + # kinematics + case $SR in + [0-3]X|[0-3]X+) GO="${GO} -R met met met_pt>50 -R ht ht htJet40j>200 " ;; + esac; + + # lepton final state + case $LL in + ee) GO="${GO} -R anyll ee abs(LepGood1_pdgId)==11&&abs(LepGood2_pdgId)==11 " ;; + em) GO="${GO} -R anyll em abs(LepGood1_pdgId)!=abs(LepGood2_pdgId) " ;; + mm) GO="${GO} -R anyll mm abs(LepGood1_pdgId)==13&&abs(LepGood2_pdgId)==13 " ;; + 3l) GO="${GO} -I exclusive -X same-sign -R anyll lep3-cuts LepGood3_relIso03<0.1&&LepGood3_tightId>(abs(LepGood3_pdgId)==11)&&LepGood3_sip3d<4&&(abs(LepGood3_pdgId)==13||(LepGood3_convVeto&&LepGood3_lostHits==0&&LepGood3_tightCharge>1))" + esac; + + # lepton pt categories + case $LPt in + hl) GO="${GO} -I lep2_pt25" ;; + ll) GO="${GO} -I lep1_pt25 -X lep2_pt25" ;; + ii) GO="${GO} -X lep1_pt25 -X lep2_pt25" ;; + 2020) GO="${GO} -R lep1_pt25 lep2020 LepGood2_pt>20 -X lep2_pt25" ;; + esac; + + # inclusive vs exclusive + case $MOD in + inc) GO="${GO} -X exclusive --mcc bins/susy_2lssinc_lepchoice.txt" ;; + esac; + + if [[ "$PRETEND" == "1" ]]; then + echo "making datacard $OUT from makeShapeCardsSusy.py mca-Phys14.txt bins/susy_2lss_sync.txt \"$EXPR\" \"$BINS\" $SYSTS $GO;" + else + echo "making datacard $OUT from makeShapeCardsSusy.py mca-Phys14.txt bins/susy_2lss_sync.txt \"$EXPR\" \"$BINS\" $SYSTS $GO;" + python makeShapeCardsSusy.py mca-Phys14.txt bins/susy_2lss_sync.txt "$EXPR" "$BINS" $SYSTS -o $OUT $GO; + echo " -- done at $(date)"; + fi; +} + +function combineCardsSmart { + CMD="" + for C in $*; do + # missing datacards + test -f $C || continue; + # datacards with no event yield + grep -q "observation 0.0$" $C && continue + CMD="${CMD} $(basename $C .card.txt)=$C "; + done + if [[ "$CMD" == "" ]]; then + echo "Not any card found in $*" 1>&2 ; + else + combineCards.py $CMD + fi +} + +if [[ "$1" == "--pretend" ]]; then + PRETEND=1; shift; +fi; +if [[ "$1" == "2lss-2012" ]]; then + OPTIONS=" $OPTIONS -F sf/t $T/1_susyVars_2lssInc_v0/evVarFriend_{cname}.root " + SYSTS="syst/susyDummy.txt" + CnC_expr="1+4*(met_pt>120)+(htJet40j>400)+2*(nJet40>=4)" + CnC_bins="[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5]" + MOD=inc; + + echo "Making individual datacards" + for LL in ee em mm; do for LPt in 2020; do for SR in 0X 1X 2X+; do + echo " --- CnC2012_${SR}_${LL} ---" + #makeCard_2lss $CnC_expr $CnC_bins $SYSTS CnC2012_${SR}_${LL} "$OPTIONS"; + done; done; done + echo "Making combined datacards" + for D in $OUTDIR/T[0-9]*; do + test -f $D/CnC2012_0X_ee.card.txt || continue + (cd $D; + for SR in 0X 1X 2X+; do + combineCards.py CnC2012_${SR}_{ee,em,mm}.card.txt > CnC2012_${SR}.card.txt + done + combineCards.py CnC2012_{0X,1X,2X+}.card.txt > CnC2012.card.txt + ); + echo "Made combined card $D/CnC2012.card.txt" + done + echo "Done at $(date)"; + +elif [[ "$1" == "2lss-2015" ]]; then + OPTIONS=" $OPTIONS -F sf/t $T/1_susyVars_2lssInc_v0/evVarFriend_{cname}.root " + SYSTS="syst/susyDummy.txt" + CnC_expr="1+4*(met_pt>120)+(htJet40j>400)+2*(nJet40>=4)" + CnC_bins="[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5]" + MOD=inc; + + echo "Making individual datacards" + for LL in ee em mm; do for LPt in hh hl ll; do for SR in 0X 1X 2X 3X 2X+; do + #for LL in ee em mm; do for LPt in hh hl ll ; do for SR in 0Xs 1Xs 2Xs 3Xs; do + echo " --- CnC2015_${SR}_${LL}_${LPt} ---" + makeCard_2lss $CnC_expr $CnC_bins $SYSTS CnC2015_${SR}_${LL}_${LPt} "$OPTIONS"; + done; done; done + #exit + echo "Making combined datacards" + for D in $OUTDIR/T[0-9]*; do + test -f $D/CnC2015_0X_ee_hh.card.txt || continue + (cd $D && echo " $D"; + for SR in 0X 1X 2X 3X 2X+; do + #for SR in 0Xs 1Xs 2Xs 3Xs; do + combineCardsSmart CnC2015_${SR}_{ee,em,mm}_hh.card.txt > CnC2015_${SR}_hh.card.txt + combineCardsSmart CnC2015_${SR}_{ee,em,mm}_{hh,hl,ll}.card.txt > CnC2015_${SR}.card.txt + done + combineCardsSmart CnC2015_{0X,1X,2X+}.card.txt > CnC2015_2b.card.txt + combineCardsSmart CnC2015_{0X,1X,2X+}_hh.card.txt > CnC2015_2b_hh.card.txt + combineCardsSmart CnC2015_{0X,1X,2X,3X}_hh.card.txt > CnC2015_3b_hh.card.txt + combineCardsSmart CnC2015_{0X,1X,2X,3X}.card.txt > CnC2015_3b.card.txt + #combineCardsSmart CnC2015_{0Xs,1Xs,2Xs,3Xs}_hh.card.txt > CnC2015_3bs_hh.card.txt + #combineCardsSmart CnC2015_{0Xs,1Xs,2Xs,3Xs}.card.txt > CnC2015_3bs.card.txt + ) + done + echo "Done at $(date)"; + +elif [[ "$1" == "2lss-2015x" ]]; then + OPTIONS=" $OPTIONS -F sf/t $T/1_susyVars_2lssInc_v0/evVarFriend_{cname}.root " + SYSTS="syst/susyDummy.txt" + CnC_expr="1+4*(met_pt>120)+(htJet40j>400)+2*(nJet40>=4)" + CnC_bins="[0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5]" + MOD=excl; + + echo "Making individual datacards" + for LL in ee em mm 3l; do for LPt in hh hl ll; do for SR in 0X 1X 2X 3X; do + echo " --- CnC2015X_${SR}_${LL}_${LPt} ---" + makeCard_2lss $CnC_expr $CnC_bins $SYSTS CnC2015X_${SR}_${LL}_${LPt} "$OPTIONS"; + done; done; done + #exit + echo "Making combined datacards" + for D in $OUTDIR/T[0-9]*; do + test -f $D/CnC2015X_0X_ee_hh.card.txt || continue + (cd $D && echo " $D"; + for SR in 0X 1X 2X 3X; do + combineCardsSmart CnC2015X_${SR}_{ee,em,mm}_hh.card.txt > CnC2015X_${SR}_hh.card.txt + combineCardsSmart CnC2015X_${SR}_{ee,em,mm}_{hh,hl,ll}.card.txt > CnC2015X_${SR}.card.txt + combineCardsSmart CnC2015X_${SR}_{ee,em,mm,3l}_hh.card.txt > CnC2015X_${SR}_hh_w3l.card.txt + combineCardsSmart CnC2015X_${SR}_{ee,em,mm,3l}_{hh,hl,ll}.card.txt > CnC2015X_${SR}_w3l.card.txt + done + combineCardsSmart CnC2015X_{0X,1X,2X,3X}_hh.card.txt > CnC2015X_3b_hh.card.txt + combineCardsSmart CnC2015X_{0X,1X,2X,3X}.card.txt > CnC2015X_3b.card.txt + combineCardsSmart CnC2015X_{0X,1X,2X,3X}_hh_w3l.card.txt > CnC2015X_3b_hh_w3l.card.txt + combineCardsSmart CnC2015X_{0X,1X,2X,3X}_w3l.card.txt > CnC2015X_3b_w3l.card.txt + ) + done + echo "Done at $(date)"; + +fi + diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice.txt new file mode 100644 index 000000000000..d15aed1ab514 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice.txt @@ -0,0 +1,2 @@ +LepGood1_(\w+) : LepGood_\1[iL1]; AlsoData +LepGood2_(\w+) : LepGood_\1[iL2]; AlsoData diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice_sync.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice_sync.txt new file mode 100644 index 000000000000..7af2bd3ab52b --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_2lssinc_lepchoice_sync.txt @@ -0,0 +1,5 @@ +LepGood1_(\w+) : LepGood_\1[iL1T]; AlsoData +LepGood2_(\w+) : LepGood_\1[iL2T]; AlsoData +\bmZ1\b: mZ1cut10TL; AlsoData +minMllAFOS\b: minMllAFOSTL; AlsoData +minMllAFAS\b: minMllAFASTL; AlsoData diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_plots.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_plots.txt new file mode 100644 index 000000000000..1efa6b444b26 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_plots.txt @@ -0,0 +1,43 @@ +met: met_pt: 18,0,800 ; XTitle="E_{T}^{miss} [GeV]" +lep1Pt: LepGood1_pt: 25,0,250; XTitle="Leading lepton p_{T} [GeV]", Legend='TR' +lep2Pt: LepGood2_pt: 18,0,100; XTitle="Second lepton p_{T} [GeV]", Legend='TR' +nJet25 : nJet25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5] ; XTitle='N(jet\, p_{T} > 25)' +nJet40 : nJet40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5] ; XTitle='N(jet\, p_{T} > 40)' +htJet25: htJet25: 18,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 25) [GeV]",XNDiv=505 +htJet40: htJet40: 18,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 40) [GeV]",XNDiv=505 +htJet40j: htJet40j: 18,0,2000 ; XTitle="H_{T}(jet p_{T} > 40) [GeV]",XNDiv=505 +mhtJet25: mhtJet25: 18,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 25) [GeV]" +mhtJet40: mhtJet40: 18,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 40) [GeV]" +nBJet25 : nBJetMedium25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 25\, CSVM)' +nBJet40 : nBJetMedium40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 40\, CSVM)' +jet1Pt: Jet1_pt: 18,0,600; XTitle="Leading jet p_{T} [GeV]", Legend='TR' +jet2Pt: Jet2_pt: 18,0,300; XTitle="Second jet p_{T} [GeV]", Legend='TR' +jet2qgl: Jet2_qgl: 18,0,1; XTitle="Second jet QG Tag", Legend='TR' +ptavgEtaJets: (abs(Jet_eta[0])*Jet_pt[0]+abs(Jet_eta[1])*Jet_pt[1])/(Jet_pt[0]+Jet_pt[1]): 18,0,2.5; XTitle="average jet |#eta| (p_{T} weighted)", Legend='TL' +mtW1: mt_2(LepGood1_pt,LepGood1_phi,met_pt,met_phi) : 18,0,350; XTitle="M_{T}(l_{1}\,E_{T}^{miss}) [GeV]",NXDiv=505 +mtW2: mt_2(LepGood2_pt,LepGood2_phi,met_pt,met_phi) : 18,0,250; XTitle="M_{T}(l_{2}\,E_{T}^{miss}) [GeV]",NXDiv=505 +mtWmin: min(mt_2(LepGood1_pt,LepGood1_phi,met_pt,met_phi),mt_2(LepGood2_pt,LepGood2_phi,met_pt,met_phi)) : 18,0,200; XTitle="min M_{T}(l_{i}\,E_{T}^{miss}) [GeV]",NXDiv=505 +maxLepEta: max(abs(LepGood1_eta),abs(LepGood2_eta)): 18,0,2.5; XTitle="max |#eta| (l1\, l2)" +minLepEta: min(abs(LepGood1_eta),abs(LepGood2_eta)): 18,0,2.5; XTitle="min |#eta| (l1\, l2)" +htCenRatio4j : (LepGood1_pt*(abs(LepGood1_eta)<1.2) + LepGood2_pt*(abs(LepGood2_eta)<1.2) + Jet1_pt*(abs(Jet1_eta) < 1.2) + Jet2_pt*(abs(Jet2_eta) < 1.2) + Jet3_pt*(abs(Jet3_eta) < 1.2) + Jet4_pt*(abs(Jet4_eta) < 1.2))/ \ + (LepGood1_pt + LepGood2_pt + Jet1_pt*(abs(Jet1_eta) < 2.4) + Jet2_pt*(abs(Jet2_eta) < 2.4) + Jet3_pt*(abs(Jet3_eta) < 2.4) + Jet4_pt*(abs(Jet4_eta) < 2.4)) \ + : 8, 0, 1; XTitle='H_{T}(|#eta| < 1.2)/H_{T}(|#eta| < 2.4) 4j',XNDiv=505,Legend='TL' +htCenRatio4jT: (LepGood1_pt*(abs(LepGood1_eta)<0.8) + LepGood2_pt*(abs(LepGood2_eta)<0.8) + Jet1_pt*(abs(Jet1_eta) < 0.8) + Jet2_pt*(abs(Jet2_eta) < 0.8) + Jet3_pt*(abs(Jet3_eta) < 0.8) + Jet4_pt*(abs(Jet4_eta) < 0.8))/ \ + (LepGood1_pt + LepGood2_pt + Jet1_pt*(abs(Jet1_eta) < 2.4) + Jet2_pt*(abs(Jet2_eta) < 2.4) + Jet3_pt*(abs(Jet3_eta) < 2.4) + Jet4_pt*(abs(Jet4_eta) < 2.4)) \ + : 8, 0, 1; XTitle='H_{T}(|#eta| < 0.8)/H_{T}(|#eta| < 2.4) 4j',XNDiv=505,Legend='TL' +htCenRatio2j : (LepGood1_pt*(abs(LepGood1_eta)<1.2) + LepGood2_pt*(abs(LepGood2_eta)<1.2) + Jet1_pt*(abs(Jet1_eta) < 1.2) + Jet2_pt*(abs(Jet2_eta) < 1.2))/ \ + (LepGood1_pt + LepGood2_pt + Jet1_pt*(abs(Jet1_eta) < 2.4) + Jet2_pt*(abs(Jet2_eta) < 2.4)) \ + : 8, 0, 1; XTitle='H_{T}(|#eta| < 1.2)/H_{T}(|#eta| < 2.4) 2j',XNDiv=505,Legend='TL' +mll : mass_2(LepGood1_pt,LepGood1_eta,LepGood1_phi,LepGood1_mass, LepGood2_pt,LepGood2_eta,LepGood2_phi,LepGood2_mass): 15,0,300; XTitle="m(ll) [GeV]" +ptll : pt_2(LepGood1_pt,LepGood1_phi, LepGood2_pt,LepGood2_phi): 18,0,240; XTitle="p_{T}(ll) [GeV]", XNDiv=505 +htll : LepGood1_pt+LepGood2_pt: 15,0,300; XTitle="H_{T}(ll) [GeV]" +drll : deltaR(LepGood1_eta,LepGood1_phi, LepGood2_eta,LepGood2_phi): 8,0,4; XTitle="#DeltaR(ll)", MoreY=1.3, Legend='TL' +dphill : abs(deltaPhi(LepGood1_phi, LepGood2_phi)): 6,0,3.1416; XTitle="#Delta#phi(ll)", MoreY=1.5, Legend='TL' +bestMWjj: bestMWjj: 18, 50, 180; XTitle="best m(W->jj) [GeV]" +bestMWjjPt: bestMWjjPt: 18, 0, 500; XTitle="p_{T} of best m(W->jj) [GeV]" +bestMTopHad: bestMTopHad: 18, 50, 350; XTitle="best m(t->jjb) [GeV]" +bestMTopHad_noBin0: bestMTopHad: 18, 50, 350; XTitle="best m(t->jjb) [GeV]", IncludeOverflows=False +bestMTopHadPt: bestMTopHadPt: 18, 0, 350; XTitle="p_{T} of best m(t->jjb) [GeV]" + +susyBin: 1+4*(met_pt > 120)+(htJet40j > 400)+2*(nJet40 >= 4): [0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5]; XTitle="SUS-13-013 bin", Legend='TL' +finalMVA_susy_2LSS: finalMVA_susy_2LSS: 12,0,1; XTitle="Kin MVA", Legend='TL' diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.sh b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.sh new file mode 100644 index 000000000000..05cf728975d2 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +#T="~/w/TREES_72X_SYNC" +#CORE="-P $T --s2v --tree treeProducerSusyMultilepton " +#CORE="${CORE} -F sf/t $T/1_susyVars_2lssInc_v0/evVarFriend_{cname}.root -X exclusive --mcc bins/susy_2lssinc_lepchoice_sync.txt" +T=" /data/g/gpetrucc/TREES_72X_040115/9_skim_2lssSR_sync_v1" +CORE="-P $T --s2v --tree treeProducerSusyMultilepton " +CORE="${CORE} -F sf/t $T/0_allfriends/evVarFriend_{cname}.root -X exclusive --mcc bins/susy_2lssinc_lepchoice_sync.txt" + +POST=""; +if [[ "$1" == "mccounts" ]]; then + GO="python mcAnalysis.py $CORE mca-Phys14.txt bins/susy_2lss_sync.txt -p T1tttt_HM -f -G -u " + POST="| awk '/all/{print \$2}' " +elif [[ "$1" == "mcyields" ]]; then + GO="python mcAnalysis.py $CORE mca-Phys14.txt bins/susy_2lss_sync.txt -p 'T1tttt_HM,T5tttt_MLDx,T5qqqqWW_HM,T5qqqqWWD,TTX,WZ,TT,WJets,DY' --pgroup TTX=TT[WZH] -f -G -l 4.0" +elif [[ "$1" == "mcdumps" ]]; then + FMT='{run:1d} {lumi:9d} {evt:12d}\t{nLepGood10:2d}\t{LepGood1_pdgId:+2d} {LepGood1_pt:5.1f}\t{LepGood2_pdgId:+2d} {LepGood2_pt:5.1f}\t{nJet40}\t{nBJetMedium40:2d}\t{met_pt:5.1f}\t{htJet40j:6.1f}' + python mcDump.py $CORE mca-Phys14.txt bins/susy_2lss_sync.txt -p T1tttt_HM -X lep1_pt25 -X lep2_pt25 | sort -n -k1 -k2 > 2lssInc_all.txt + python mcDump.py $CORE mca-Phys14.txt bins/susy_2lss_sync.txt -p T1tttt_HM -X lep1_pt25 -X lep2_pt25 -X 'lep id' -X 'lep iso' -X 'lep dxy' -X 'ele cuts' $FMT | sort -n -k1 -k2 > 2lssInc_all_relaxLept.txt + wc -l 2lssInc_all.txt 2lssInc_all_relaxLept.txt + exit; +else + echo "I don't know what you want" + exit; +fi + +SAVE="${GO}" +for LL in ee em mm; do +for SR in 00 10 20 30; do +for LPt in hh hl ll; do + +GO="${SAVE}" +case $SR in +0) GO="${GO} -R nBjet nBjet0 'nBJetMedium25 >= 0' " ;; +00) GO="${GO} -R nBjet nBjet0 'nBJetMedium25 == 0' " ;; +10) GO="${GO} -R nBjet nBjet1 'nBJetMedium25 == 1' " ;; +20) GO="${GO} -R nBjet nBjet2 'nBJetMedium25 == 2' " ;; +30) GO="${GO} -R nBjet nBjet3 'nBJetMedium25 >= 3' " ;; +0[1-9X]) GO="${GO} -R nBjet nBjet0 'nBJetMedium25 == 0' -R met metSR 'met_pt > 50' -R ht htSR 'htJet40j > 200'" ;; +1[1-9X]) GO="${GO} -R nBjet nBjet1 'nBJetMedium25 == 1' -R met metSR 'met_pt > 50' -R ht htSR 'htJet40j > 200'" ;; +2[1-9X]) GO="${GO} -R nBjet nBjet2 'nBJetMedium25 == 2' -R met metSR 'met_pt > 50' -R ht htSR 'htJet40j > 200'" ;; +3[1-9X]) GO="${GO} -R nBjet nBjet3 'nBJetMedium25 >= 3' -R met metSR 'met_pt > 50' -R ht htSR 'htJet40j > 200'" ;; +esac; +case $LL in +ee) GO="${GO} -R anyll ee 'abs(LepGood1_pdgId) == 11 && abs(LepGood2_pdgId) == 11' " ;; +em) GO="${GO} -R anyll em 'abs(LepGood1_pdgId) != abs(LepGood2_pdgId)' " ;; +mm) GO="${GO} -R anyll mm 'abs(LepGood1_pdgId) == 13 && abs(LepGood2_pdgId) == 13' " ;; +esac; +case $LPt in +hl) GO="${GO} -I lep2_pt25" ;; +ll) GO="${GO} -I lep1_pt25 -X lep2_pt25" ;; +ii) GO="${GO} -X lep1_pt25 -X lep2_pt25" ;; +esac; + +echo "echo; echo \" ===== SR $SR $LL $LPt ===== \"" +echo "$GO $POST" + +done +done +done diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.txt new file mode 100644 index 000000000000..a2ebf0dd46b4 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/susy_edge_sync.txt @@ -0,0 +1,50 @@ +################################################# +############## MUONS ######################## +################################################# +only muons for now: LepGood_pdgId[0] * LepGood_pdgId[1] == -13*13 +within eta 2.4: (abs(LepGood_eta[0]) < 2.4 && abs(LepGood_eta[1]) < 2.4) +exclude 1.4 - 1.6 in |eta|: !(abs(LepGood_eta[0]) > 1.4 && abs(LepGood_eta[0]) < 1.6) && !(abs(LepGood_eta[1]) > 1.4 && abs(LepGood_eta[1]) < 1.6) +#lep1 and lep2 pass tight ID+iso (muons): LepGood_tightId[0] == 1 && LepGood_relIso03[0] < 0.15 && LepGood_tightId[1] == 1 && LepGood_relIso03[1] < 0.15 +lep1 and lep2 pass tight ID (muons): LepGood_tightId[0] == 1 && LepGood_tightId[1] == 1 +lep1_pt25: LepGood_pt[0] > 25 +lep2_pt20: LepGood_pt[1] > 20 +separated 0.3 in dR: l1l2_DR > 0.3 +isolation of both < 0.15: LepGood_relIso03[0] < 0.15 && LepGood_relIso03[1] < 0.15 +################################################# +############## ELECTRONS ######################## +################################################# +## only electrons for now: LepGood_pdgId[0] * LepGood_pdgId[1] == -11*11 +## within eta 2.4: (abs(LepGood_eta[0]) < 2.4 && abs(LepGood_eta[1]) < 2.4) +## lep1_pt25: LepGood_pt[0] > 25 +## lep2_pt20: LepGood_pt[1] > 20 +## lep1 and lep2 pass loose ID (electrons): LepGood_tightId[0] >=1 && LepGood_tightId[1] >= 1 +## # lep1 and lep2 pass loose ID (electrons): LepGood_eleCutIdCSA14_25ns_v1[0] >=1 && LepGood_eleCutIdCSA14_25ns_v1[1] >= 1 +## exclude 1.4 - 1.6 in |eta|: (abs(LepGood_eta[0]) < 1.4 || abs(LepGood_eta[0]) > 1.6) && (abs(LepGood_eta[1]) < 1.4 || abs(LepGood_eta[1]) > 1.6) +## opposite-sign: LepGood_charge[0]*LepGood_charge[1] < 0 +## separated 0.3 in dR: l1l2_DR > 0.3 +## isolation of both < 0.15: LepGood_relIso03[0] < 0.15 && LepGood_relIso03[1] < 0.15 +################################################# +############## ELMU/OF ####################### +################################################# +## only muons for now: LepGood_pdgId[0] * LepGood_pdgId[1] == -13*11 +## within eta 2.4: (abs(LepGood_eta[0]) < 2.4 && abs(LepGood_eta[1]) < 2.4) +## lep1_pt25: LepGood_pt[0] > 25 +## lep2_pt20: LepGood_pt[1] > 20 +## lep1 and lep2 pass ID (elmu): LepGood_tightId[0] >= 1 && LepGood_tightId[1] >= 1 +## exclude 1.4 - 1.6 in |eta|: (abs(LepGood_eta[0]) < 1.4 || abs(LepGood_eta[0]) > 1.6) && (abs(LepGood_eta[1]) < 1.4 || abs(LepGood_eta[1]) > 1.6) +## opposite-sign: LepGood_charge[0]*LepGood_charge[1] < 0 +## separated 0.3 in dR: l1l2_DR > 0.3 +## #same using other code: l1l2_DR > 0.3 +## isolation of both < 0.15: LepGood_relIso03[0] < 0.15 && LepGood_relIso03[1] < 0.15 +################################################# +############## SF ####################### +################################################# +## only muons for now: (LepGood_pdgId[0] * LepGood_pdgId[1] == -11*11) || (LepGood_pdgId[0] * LepGood_pdgId[1] == -13*13) +## within eta 2.4: (abs(LepGood_eta[0]) < 2.4 && abs(LepGood_eta[1]) < 2.4) +## lep1_pt25: LepGood_pt[0] > 25 +## lep2_pt20: LepGood_pt[1] > 20 +## lep1 and lep2 pass ID (sf): LepGood_tightId[0] >= 1 && LepGood_tightId[1] >= 1 +## exclude 1.4 - 1.6 in |eta|: (abs(LepGood_eta[0]) < 1.4 || abs(LepGood_eta[0]) > 1.6) && (abs(LepGood_eta[1]) < 1.4 || abs(LepGood_eta[1]) > 1.6) +## opposite-sign: LepGood_charge[0]*LepGood_charge[1] < 0 +## separated 0.3 in dR: l1l2_DR > 0.3 +## isolation of both < 0.15: LepGood_relIso03[0] < 0.15 && LepGood_relIso03[1] < 0.15 diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susyDummy.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susyDummy.txt new file mode 100644 index 000000000000..7b09054da68d --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susyDummy.txt @@ -0,0 +1,4 @@ +TTV : TT[WZ] : .* : 1.2 +ttH : ttH : .* : 1.2 +WZ : WZ : .* : 1.2 +Fakes : TT$|WJets|DY : .* : 1.50 diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susySyst.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susySyst.txt new file mode 100644 index 000000000000..b526e54bd5ff --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/syst/susySyst.txt @@ -0,0 +1,45 @@ +# luminosity + +# lepton efficiencies +CMS_lepEff : ttH.*|TT[WZ] : .*2lss.* : 1.10 +CMS_lepEff : ttH.*|TT[WZ] : .*3l* : 1.15 +CMS_lepEffL : ttH.*|TT[WZ] : .*4l* : 1.10 + +# common theoretical uncertainties (fully correlated everywhere) +# note: pdf_gg is entered as 1/kappa since it has to be anti-correlated with Hgg +QCDscale_ttH : ttH.* : .* : 1.06 +QCDscale_ttW : TTW : .* : 1.10 +QCDscale_ttZ : TTZ : .* : 1.11 +pdf_gg : ttH.* : .* : 0.926 +pdf_gg : TTZ : .* : 0.919 +pdf_qqbar : TTW : .* : 1.072 +# +# shape theoretical uncertainties (private to this channel) +#CMS_ttHl_pdf_shape_ttH : ttH.* : .* : 1.03: shapeOnly +#CMS_ttHl_thu_shape_ttH : ttH.* : .* : 1.10: shapeOnly +#CMS_ttHl_pdf_shape_ttW : TTW : .* : 1.05: shapeOnly +#CMS_ttHl_pdf_shape_ttZ : TTZ : .* : 1.03: shapeOnly +#CMS_ttHl_thu_shape_ttW : TTW : .* : 1.10: shapeOnly +#CMS_ttHl_thu_shape_ttZ : TTZ : .* : 1.10: shapeOnly +# +## acceptance uncertainties (assume the same for ttW/ttZ) +#CMS_ttHl_thu_acc_ttW : TTW : .* : 1.10 +#CMS_ttHl_thu_acc_ttZ : TTZ : .* : 1.10 + +# Fake rate uncertainties (private to this channel) +# 1) overall normalizations +CMS_FRe_norm : TT$ : .*2lss_ee.* : 1.5 +CMS_FRe_norm : TT$ : .*2lss_em.* : 1.4 +CMS_FRe_norm : TT$ : .*3l.* : 1.3 +CMS_FRm_norm : TT$ : .*2lss_mu.* : 1.5 +CMS_FRm_norm : TT$ : .*2lss_em.* : 1.2 +CMS_FRm_norm : TT$ : .*3l.* : 1.25 + +# 3) shape +#CMS_FRe_shape2l : TT : .*2lss_ee.* : 1.25 : shapeOnly +#CMS_FRe_shape2l : TT : .*2lss_em.* : 1.15 : shapeOnly +#CMS_FRe_shape3l : TT : .*3l.* : 1.15 : shapeOnly +#CMS_FRm_shape2l : TT : .*2lss_mu.* : 1.12 : shapeOnly +#CMS_FRm_shape2l : TT : .*2lss_em.* : 1.06 : shapeOnly +#CMS_FRm_shape3l : TT : .*3l.* : 1.06 : shapeOnly + diff --git a/CMGTools/TTHAnalysis/python/plotter/susy-edge/validation_plots.txt b/CMGTools/TTHAnalysis/python/plotter/susy-edge/validation_plots.txt new file mode 100644 index 000000000000..4326387cbd05 --- /dev/null +++ b/CMGTools/TTHAnalysis/python/plotter/susy-edge/validation_plots.txt @@ -0,0 +1,51 @@ +nLep: nLepGood: [1.5,2.5,3.5,4.5,5.5]; XTitle="N(lep)" +nLep10: nLepGood10: [1.5,2.5,3.5,4.5,5.5]; XTitle="N(lep)" +nLep20: nLepGood20: [1.5,2.5,3.5,4.5,5.5]; XTitle="N(lep)" +met: met_pt: 16,0,800 ; XTitle="E_{T}^{miss} [GeV]" +met_phi: met_phi: 8,-3.15,3.15 ; XTitle="phi of E_{T}^{miss}" +lep1pt: LepGood1_pt: 15,0,250; XTitle="Leading lepton p_{T} [GeV]", Legend='TR' +lep2pt: LepGood2_pt: 15,0,100; XTitle="Second lepton p_{T} [GeV]", Legend='TR' +lep3pt: LepGood3_pt: 10,0,50; XTitle="Third lepton p_{T} [GeV]", Legend='TR' +lep4pt: LepGood4_pt: 10,0,50; XTitle="Fourth lepton p_{T} [GeV]", Legend='TR' +lep1relIso03: LepGood1_relIso03: 15,0,.5; Legend='TR' +lep2relIso03: LepGood2_relIso03: 15,0,.5; Legend='TR' +lep1miniRelIso: LepGood1_miniRelIso: 15,0,.5; Legend='TR' +lep2miniRelIso: LepGood2_miniRelIso: 15,0,.5; Legend='TR' +lep1jetPtRel: LepGood1_jetPtRel: 15,0,25; Legend='TR' +lep2jetPtRel: LepGood2_jetPtRel: 15,0,25; Legend='TR' +lep1sip3d: LepGood1_sip3d: 15,0,5; Legend='TR' +lep2sip3d: LepGood2_sip3d: 15,0,5; Legend='TR' +lep1tightId: LepGood1_tightId: [-0.5,0.5,1.5]; Legend='TL' +lep2tightId: LepGood2_tightId: [-0.5,0.5,1.5]; Legend='TL' +lep1mvaSusy: LepGood1_mvaSusy: 20,-1,1; Legend='TL' +lep2mvaSusy: LepGood2_mvaSusy: 20,-1,1; Legend='TL' +lep1mcMatchId: abs(LepGood1_mcMatchId): 28,-1.5,26.5; Legend='TR' +lep2mcMatchId: abs(LepGood2_mcMatchId): 28,-1.5,26.5; Legend='TR' +lep1mcMatchAny: LepGood1_mcMatchAny: [-1.5,-0.5,0.5,1.5,2.5,3.5]; Legend='TR' +lep2mcMatchAny: LepGood2_mcMatchAny: [-1.5,-0.5,0.5,1.5,2.5,3.5]; Legend='TR' +nJet25 : nJet25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5] ; XTitle='N(jet\, p_{T} > 25)' +nJet40 : nJet40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5] ; XTitle='N(jet\, p_{T} > 40)' +nJet40NoTau : nJet40NoTau : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5] ; XTitle='N(jet\, p_{T} > 40\, #tau veto)' +jet1pt: Jet1_pt: 15,0,400; XTitle="Leading jet p_{T} [GeV]", Legend='TR' +jet2pt: Jet2_pt: 15,0,200; XTitle="Second jet p_{T} [GeV]", Legend='TR' +jet3pt: Jet3_pt: 10,0,150; XTitle="Third jet p_{T} [GeV]", Legend='TR' +jet4pt: Jet4_pt: 10,0,100; XTitle="Fourth jet p_{T} [GeV]", Legend='TR' +jet1rawPt: Jet1_rawPt: 15,0,400; Legend='TR' +jet2rawPt: Jet2_rawPt: 15,0,200; Legend='TR' +jet1btagCSV: Jet1_btagCSV: 12,0.0,1.5; Legend='TR' +jet2btagCSV: Jet2_btagCSV: 12,0.0,1.5; Legend='TR' +jet1mcPt: Jet1_mcPt: 15,0,400; Legend='TR' +jet2mcPt: Jet2_mcPt: 15,0,200; Legend='TR' +jet1mcFlavour: Jet1_mcFlavour: 29,-6.5,22.5; Legend='TR' +jet2mcFlavour: Jet2_mcFlavour: 29,-6.5,22.5; Legend='TR' +jet1mcMatchId: abs(Jet1_mcMatchId): 28,-1.5,26.5; Legend='TR' +jet2mcMatchId: abs(Jet2_mcMatchId): 28,-1.5,26.5; Legend='TR' +htJet25: htJet25: 15,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 25) [GeV]" +htJet40: htJet40: 15,0,2000 ; XTitle="H_{T}(lep + jet p_{T} > 40) [GeV]" +htJet40j: htJet40j: 15,0,2000 ; XTitle="H_{T}(jet p_{T} > 40) [GeV]" +mhtJet25: mhtJet25: 15,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 25) [GeV]" +mhtJet40: mhtJet40: 15,0,800 ; XTitle="H_{T}^{miss}(lep + jet p_{T} > 40) [GeV]" +nBJet25 : nBJetMedium25 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 25\, CSVM)' +nBJet40 : nBJetMedium40 : [-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5] ; XTitle='N(b-jet\, p_{T} > 40\, CSVM)' +minMllAFAS: minMllAFAS: 20,0,200; XTitle="min m(ll') [GeV]" +mZ1: mZ1: 20,0,200; XTitle="best mZ4 [GeV]"