def __init__(self, fname, **kwargs): kwargs['channel'] = 'etau' super(ModuleETau,self).__init__(fname,**kwargs) self.out = TreeProducerETau(fname,self) # TRIGGERS jsonfile = os.path.join(datadir,"trigger/tau_triggers_%d.json"%(self.year)) self.trigger = TrigObjMatcher(jsonfile,trigger='SingleElectron',isdata=self.isdata) self.eleCutPt = self.trigger.ptmins[0] self.tauCutPt = 20 self.eleCutEta = 2.3 self.tauCutEta = 2.3 # CORRECTIONS if self.ismc: self.eleSFs = ElectronSFs(year=self.year) # electron id/iso/trigger SFs self.tesTool = TauESTool(tauSFVersion[self.year]) # real tau energy scale corrections self.fesTool = TauFESTool(tauSFVersion[self.year]) # e -> tau fake energy scale self.tauSFs = TauIDSFTool(tauSFVersion[self.year],'DeepTau2017v2p1VSjet','Tight') self.etfSFs = TauIDSFTool(tauSFVersion[self.year],'DeepTau2017v2p1VSe', 'VLoose') self.mtfSFs = TauIDSFTool(tauSFVersion[self.year],'DeepTau2017v2p1VSmu', 'Tight') # CUTFLOW self.out.cutflow.addcut('none', "no cut" ) self.out.cutflow.addcut('trig', "trigger" ) self.out.cutflow.addcut('electron', "electron" ) self.out.cutflow.addcut('tau', "tau" ) self.out.cutflow.addcut('pair', "pair" ) self.out.cutflow.addcut('weight', "no cut, weighted", 15 ) self.out.cutflow.addcut('weight_no0PU', "no cut, weighted, PU>0", 16 ) # use for normalization
def printTESTable(year): testool = TauESTool(year) dmvals = [0,1,5,6,10,11] print ">>> " print ">>> TES for '%s'"%(year) print ">>> " print ">>> %10s"%('var \ DM')+''.join("%9d"%dm for dm in dmvals) print ">>> %10s"%("central") +''.join("%9.5f"%testool.getTES(dm,5) for dm in dmvals) print ">>> %10s"%("up") +''.join("%9.5f"%testool.getTES(dm,5,'Up') for dm in dmvals) print ">>> %10s"%("down") +''.join("%9.5f"%testool.getTES(dm,5,'Down') for dm in dmvals) print ">>> "
def printTESTable(year,id): testool = TauESTool(year,id) ptvals = [25,102,175] #[25,30,102,170,175] dmvals = [0,1,5,10,11] for pt in ptvals: print(">>> ") print(">>> TES for '%s' ('%s') and pT = %s GeV"%(green(id),year,pt)) print(">>> ") print(">>> %10s"%('var \ DM')+''.join("%9d"%dm for dm in dmvals)) print(">>> %10s"%("central") +''.join("%9.5f"%testool.getTES(pt,dm,5) for dm in dmvals)) print(">>> %10s"%("up") +''.join("%9.5f"%testool.getTES(pt,dm,5,'Up') for dm in dmvals)) print(">>> %10s"%("down") +''.join("%9.5f"%testool.getTES(pt,dm,5,'Down') for dm in dmvals)) print(">>> ")
def __init__(self, fname, **kwargs): kwargs['channel'] = 'mutau' super(ModuleMuTau, self).__init__(fname, **kwargs) self.out = TreeProducerMuTau(fname, self) # TRIGGERS if self.year == 2016: self.trigger = lambda e: e.HLT_IsoMu22 or e.HLT_IsoMu22_eta2p1 or e.HLT_IsoTkMu22 or e.HLT_IsoTkMu22_eta2p1 #or e.HLT_IsoMu19_eta2p1_LooseIsoPFTau20_SingleL1 self.muonCutPt = lambda e: 23 self.muonCutEta = lambda e: 2.4 if e.HLT_IsoMu22 or e.HLT_IsoTkMu22 else 2.1 elif self.year == 2017: self.trigger = lambda e: e.HLT_IsoMu24 or e.HLT_IsoMu27 #or e.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1 self.muonCutPt = lambda e: 25 if e.HLT_IsoMu24 else 28 self.muonCutEta = lambda e: 2.4 else: self.trigger = lambda e: e.HLT_IsoMu24 or e.HLT_IsoMu27 #or e.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1 self.muonCutPt = lambda e: 25 self.muonCutEta = lambda e: 2.4 self.tauCutPt = 20 self.tauCutEta = 2.3 # CORRECTIONS if self.ismc: self.muSFs = MuonSFs( era=self.era, verb=self.verbosity) # muon id/iso/trigger SFs self.tesTool = TauESTool( tauSFVersion[self.year]) # real tau energy scale corrections self.fesTool = TauFESTool( tauSFVersion[self.year]) # for mu -> tau fake negligible self.tauSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSjet', 'Tight') self.etfSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSe', 'VLoose') self.mtfSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSmu', 'Tight') # CUTFLOW self.out.cutflow.addcut('none', "no cut") self.out.cutflow.addcut('trig', "trigger") self.out.cutflow.addcut('muon', "muon") self.out.cutflow.addcut('tau', "tau") self.out.cutflow.addcut('pair', "pair") self.out.cutflow.addcut('weight', "no cut, weighted", 15) self.out.cutflow.addcut('weight_no0PU', "no cut, weighted, PU>0", 16) # use for normalization
def __init__(self, fname, **kwargs): kwargs['channel'] = 'mutau' super(ModuleTauTau, self).__init__(fname, **kwargs) self.out = TreeProducerTauTau(fname, self) # TRIGGERS jsonfile = os.path.join(datadir, "trigger/tau_triggers_%d.json" % (self.year)) self.trigger = TrigObjMatcher(jsonfile, trigger='ditau', isdata=self.isdata) self.tauCutPt = 40 self.tauCutEta = 2.1 # CORRECTIONS if self.ismc: self.trigTool = TauTriggerSFs('tautau', 'Medium', year=self.year) self.trigTool_tight = TauTriggerSFs('tautau', 'Tight', year=self.year) self.tesTool = TauESTool( tauSFVersion[self.year]) # real tau energy scale self.fesTool = TauFESTool( tauSFVersion[self.year]) # e -> tau fake energy scale self.tauSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSjet', 'Medium', dm=True) self.tauSFs_tight = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSjet', 'Tight', dm=True) self.etfSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSe', 'VVLoose') self.mtfSFs = TauIDSFTool(tauSFVersion[self.year], 'DeepTau2017v2p1VSmu', 'Loose') # CUTFLOW self.out.cutflow.addcut('none', "no cut") self.out.cutflow.addcut('trig', "trigger") self.out.cutflow.addcut('tau', "tau") self.out.cutflow.addcut('pair', "ditau pair") self.out.cutflow.addcut('weight', "no cut, weighted", 15) self.out.cutflow.addcut('weight_no0PU', "no cut, weighted, PU>0", 16) # use for normalization
def __init__(self, year, algorithm): self.testool = TauESTool(YEARLIB[year], algorithm) self.tfestool = TauESTool(YEARLIB[year])
import ROOT import math ROOT.PyConfig.IgnoreCommandLineOptions = True from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection from PhysicsTools.NanoAODTools.postprocessing.framework.eventloop import Module from TauPOG.TauIDSFs.TauIDSFTool import TauIDSFTool tauSFTool_jet = TauIDSFTool('2018ReReco', 'DeepTau2017v2p1VSjet', 'VVTight') tauSFTool_ele = TauIDSFTool('2018ReReco', 'DeepTau2017v2p1VSe', 'VVTight') tauSFTool_muo = TauIDSFTool('2018ReReco', 'DeepTau2017v2p1VSmu', 'Tight') from TauPOG.TauIDSFs.TauIDSFTool import TauESTool testool_jet = TauESTool('2018ReReco', 'DeepTau2017v2p1VSjet') from TauPOG.TauIDSFs.TauIDSFTool import TauFESTool testool_ele = TauFESTool('2018ReReco', 'DeepTau2017v2p1VSe') from MuonPOG.MuonSFs.MuonSFTool import MuonSFTool muonSFTool = MuonSFTool() from PhysicsTools.NanoAODTools.postprocessing.tools import deltaR class ZMuTauProducer(Module): def __init__(self, isMC_): self.isMC__ = isMC_ pass def beginJob(self): pass def endJob(self):