Пример #1
0
class ElectronSFs:
    
    def __init__(self, year=2017):
        """Load histograms from files."""
        
        assert year in [2016,2017,2018], "ElectronSFs: You must choose a year from: 2016, 2017, or 2018."
        
        if year==2016:
          #self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016BtoH/Electron_Ele27Loose_OR_Ele25Tight_eff.root",'ZMass','ele_trig')
          self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_Ele25.root",'ZMass','ele_trig')
          self.sftool_reco  = ScaleFactor(pathPOG+"2016/EGM2D_BtoH_GT20GeV_RecoSF_Legacy2016.root",'EGamma_SF2D','ele_reco')
          #self.sftool_idiso = ScaleFactor(pathPOG+"2016/2016LegacyReReco_ElectronMVA90noiso_Fall17V2.root",'EGamma_SF2D','ele_id')
          self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
        elif year==2017:
          self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2017/Electron_Ele32orEle35.root",'ZMass','ele_trig')
          self.sftool_reco  = ScaleFactor(pathPOG+"2017/egammaEffi.txt_EGM2D_runBCDEF_passingRECO.root",'EGamma_SF2D','ele_reco')
          #self.sftool_idiso = ScaleFactor(pathPOG+"2017/2017_ElectronMVA90noiso.root",'EGamma_SF2D','ele_id')
          self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2017/Electron_Run2017_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
        else:
          self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_Ele32orEle35.root",'ZMass','ele_trig')
          self.sftool_reco  = ScaleFactor(pathPOG+"2018/egammaEffi.txt_EGM2D_updatedAll.root",'EGamma_SF2D','ele_reco')
          #self.sftool_idiso = ScaleFactor(pathPOG+"2018/2018_ElectronMVA90noiso.root",'EGamma_SF2D','ele_id')
          self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
        
        if self.sftool_reco:
          self.sftool_idiso = self.sftool_reco * self.sftool_idiso
        
    def getTriggerSF(self, pt, eta):
        """Get SF for single electron trigger."""
        return self.sftool_trig.getSF(pt,eta)
        
    def getIdIsoSF(self, pt, eta):
        """Get SF for electron identification + isolation."""
        return self.sftool_idiso.getSF(pt,eta)
Пример #2
0
 def __init__(self, year=2017):
     """Load histograms from files."""
     
     # TRIGGER (HTT)
     self.sftool_trig = ScaleFactorHTT(pathHTT+"Electron_Ele32orEle35.root","ZMass",'ele_trig')
     
     # RECO, IDISO (EGamme POG)
     self.sftool_reco  = ScaleFactor(path+"egammaEffi.txt_EGM2D_runBCDEF_passingRECO.root","EGamma_SF2D",'ele_reco',ptvseta=True)
     self.sftool_idiso = ScaleFactor(path+"gammaEffi.txt_EGM2D_runBCDEF_passingMVA94Xwp80iso.root","EGamma_SF2D",'ele_idiso',ptvseta=True)
Пример #3
0
class ElectronSFs:
  
  def __init__(self,era='2017'):
    """Load histograms from files."""
    
    #assert era in ['2016','2017','2018'], "ElectronSFs: You must choose a year from: 2016, 2017, or 2018."
    
    self.sftool_trig = None
    self.sftool_idiso = None
    if 'UL' in era:
      # https://twiki.cern.ch/twiki/bin/view/CMS/EgammaUL2016To2018
      if '2016' in era and 'preVFP' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_Ele25.root",'ZMass','ele_trig')
        self.sftool_reco  = ScaleFactor(pathPOG+"UL2016_preVFP/egammaEffi_ptAbove20.txt_EGM2D_UL2016preVFP.root",'EGamma_SF2D','ele_reco')
        self.sftool_idiso = ScaleFactor(pathPOG+"UL2016_preVFP/egammaEffi.txt_Ele_wp90noiso_preVFP_EGM2D.root",'EGamma_SF2D','ele_id')
      elif '2016' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_Ele25.root",'ZMass','ele_trig')
        self.sftool_reco  = ScaleFactor(pathPOG+"UL2016_postVFP/egammaEffi_ptAbove20.txt_EGM2D_UL2016postVFP.root",'EGamma_SF2D','ele_reco')
        self.sftool_idiso = ScaleFactor(pathPOG+"UL2016_postVFP/egammaEffi.txt_Ele_wp90noiso_postVFP_EGM2D.root",'EGamma_SF2D','ele_id')
      elif '2017' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2017/Electron_Ele35.root",'ZMass','ele_trig') #Electron_Ele32orEle35
        self.sftool_reco  = ScaleFactor(pathPOG+"UL2017/egammaEffi_ptAbove20.txt_EGM2D_UL2017.root",'EGamma_SF2D','ele_reco')
        self.sftool_idiso = ScaleFactor(pathPOG+"UL2017/egammaEffi.txt_EGM2D_MVA90noIso_UL17.root",'EGamma_SF2D','ele_id')
      elif '2018' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_Ele32orEle35.root",'ZMass','ele_trig')
        self.sftool_reco  = ScaleFactor(pathPOG+"UL2018/egammaEffi_ptAbove20.txt_EGM2D_UL2018.root",'EGamma_SF2D','ele_reco')
        self.sftool_idiso = ScaleFactor(pathPOG+"UL2018/egammaEffi.txt_Ele_wp90noiso_EGM2D.root",'EGamma_SF2D','ele_id')
    else: # pre-UL
      # https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaRunIIRecommendations
      if '2016' in era:
        #self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016BtoH/Electron_Ele27Loose_OR_Ele25Tight_eff.root",'ZMass','ele_trig')
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_Ele25.root",'ZMass','ele_trig')
        self.sftool_reco  = ScaleFactor(pathPOG+"2016/EGM2D_BtoH_GT20GeV_RecoSF_Legacy2016.root",'EGamma_SF2D','ele_reco')
        #self.sftool_idiso = ScaleFactor(pathPOG+"2016/2016LegacyReReco_ElectronMVA90noiso_Fall17V2.root",'EGamma_SF2D','ele_id')
        self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2016_legacy/Electron_Run2016_legacy_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
      elif '2017' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2017/Electron_Ele35.root",'ZMass','ele_trig') #Electron_Ele32orEle35
        self.sftool_reco  = ScaleFactor(pathPOG+"2017/egammaEffi.txt_EGM2D_runBCDEF_passingRECO.root",'EGamma_SF2D','ele_reco')
        #self.sftool_idiso = ScaleFactor(pathPOG+"2017/2017_ElectronMVA90noiso.root",'EGamma_SF2D','ele_id')
        self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2017/Electron_Run2017_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
      elif '2018' in era:
        self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_Ele32orEle35.root",'ZMass','ele_trig')
        self.sftool_reco  = ScaleFactor(pathPOG+"2018/egammaEffi.txt_EGM2D_updatedAll.root",'EGamma_SF2D','ele_reco')
        #self.sftool_idiso = ScaleFactor(pathPOG+"2018/2018_ElectronMVA90noiso.root",'EGamma_SF2D','ele_id')
        self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_IdIso.root",'ZMass','ele_idiso') # MVA noIso Fall17 WP90, rho-corrected iso(dR<0.3)<0.1
    assert self.sftool_trig!=None and self.sftool_idiso!=None, "ElectronSFs.__init__: Did not find electron SF tool for %r"%(era)
    
    if self.sftool_reco:
      self.sftool_idiso = self.sftool_reco * self.sftool_idiso
  
  def getTriggerSF(self, pt, eta):
    """Get SF for single electron trigger."""
    return self.sftool_trig.getSF(pt,eta)
  
  def getIdIsoSF(self, pt, eta):
    """Get SF for electron identification + isolation."""
    return self.sftool_idiso.getSF(pt,eta)
Пример #4
0
class MuonSFs:
    def __init__(self, year=2017):
        # Load the TH1s containing the bin by bin values

        # TRIGGER (Muon POG)
        self.sftool_trig = ScaleFactor(
            path + "EfficienciesAndSF_RunBtoF_Nov17Nov2017.root",
            "IsoMu27_PtEtaBins/abseta_pt_ratio",
            'mu_trig',
            ptvseta=True)

        ## TRIGGER (HTT)
        #self.sftool_trig = ScaleFactorHTT(pathHTT+"Muon_IsoMu24orIsoMu27.root","ZMass",'mu_idiso')

        # ID ISO (HTT)
        self.sftool_idiso = ScaleFactorHTT(
            pathHTT + "Muon_IdIso_IsoLt0p15_eff_RerecoFall17.root", "ZMass",
            'mu_idiso')

        ## ID (Muon POG)
        #self.sftool_id  = ScaleFactor(path+"RunBCDEF_SF_ID.root","NUM_MediumID_DEN_genTracks",'mu_id')
        #self.sftool_iso = ScaleFactor(path+"RunBCDEF_SF_ISO.root","NUM_TightRelIso_DEN_MediumID",'mu_iso')

    def getTriggerSF(self, pt, eta):
        """Get SF for single muon trigger."""
        return self.sftool_trig.getSF(pt, abs(eta))

    def getIdIsoSF(self, pt, eta):
        """Get SF for muon identification + isolation."""
        return self.sftool_idiso.getSF(pt, eta)
Пример #5
0
    def __init__(self, year=2017):
        # Load the TH1s containing the bin by bin values

        # TRIGGER (Muon POG)
        self.sftool_trig = ScaleFactor(
            path + "EfficienciesAndSF_RunBtoF_Nov17Nov2017.root",
            "IsoMu27_PtEtaBins/abseta_pt_ratio",
            'mu_trig',
            ptvseta=True)

        ## TRIGGER (HTT)
        #self.sftool_trig = ScaleFactorHTT(pathHTT+"Muon_IsoMu24orIsoMu27.root","ZMass",'mu_idiso')

        # ID ISO (HTT)
        self.sftool_idiso = ScaleFactorHTT(
            pathHTT + "Muon_IdIso_IsoLt0p15_eff_RerecoFall17.root", "ZMass",
            'mu_idiso')
Пример #6
0
class MuonSFs:
    def __init__(self, year=2017):
        """Load histograms from files."""

        assert year in [
            2016, 2017, 2018
        ], "MuonSFs: You must choose a year from: 2016, 2017, or 2018."

        if year == 2016:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2016_legacy/Muon_Run2016_legacy_IsoMu22.root",
                'ZMass', 'mu_trig')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2016_legacy/Muon_Run2016_legacy_IdIso.root",
                'ZMass', 'mu_idiso')
        elif year == 2017:
            #self.sftool_trig  = ScaleFactor(pathPOG+"Run2017/EfficienciesAndSF_RunBtoF_Nov17Nov2017.root","IsoMu27_PtEtaBins/abseta_pt_ratio",'mu_trig')
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root", 'ZMass',
                'mu_idiso')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IdIso_IsoLt0.15_eff_RerecoFall17.root",
                'ZMass', 'mu_idiso')
            #sftool_id         = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
            #sftool_iso        = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
            #self.sftool_idiso = sftool_id*sftool_iso
        else:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IsoMu24orIsoMu27.root",
                'ZMass', 'mu_trig')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IdIso.root"
            )  # MediumID, DB corrected iso (dR<0.4) < 0.15
            #sftool_id         = ScaleFactor(pathPOG+"Run2018/RunABCD_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
            #sftool_iso        = ScaleFactor(pathPOG+"Run2018/RunABCD_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
            #self.sftool_idiso = sftool_id*sftool_iso

    def getTriggerSF(self, pt, eta):
        """Get SF for single muon trigger."""
        return self.sftool_trig.getSF(pt, abs(eta))

    def getIdIsoSF(self, pt, eta):
        """Get SF for muon identification + isolation."""
        return self.sftool_idiso.getSF(pt, abs(eta))
Пример #7
0
    def __init__(self, year=2017):
        """Load histograms from files."""

        assert year in [
            2016, 2017, 2018
        ], "ElectronSFs: You must choose a year from: 2016, 2017, or 2018."

        if year == 2016:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT +
                "Run2016BtoH/Electron_Ele27Loose_OR_Ele25Tight_eff.root",
                'ZMass', 'ele_trig')
            self.sftool_reco = ScaleFactor(
                pathPOG + "2016/EGM2D_BtoH_GT20GeV_RecoSF_Legacy2016.root",
                'EGamma_SF2D', 'ele_reco')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "2016/Run2016BtoH/Electron_IdIso_IsoLt0p1_eff.root",
                'ZMass', 'ele_idiso')
        elif year == 2017:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2017/Electron_Ele32orEle35.root", 'ZMass',
                'ele_trig')
            self.sftool_reco = ScaleFactor(
                pathPOG +
                "2017/egammaEffi.txt_EGM2D_runBCDEF_passingRECO.root",
                'EGamma_SF2D', 'ele_reco')
            self.sftool_idiso = ScaleFactor(
                pathPOG + "2017/2017_ElectronMVA80noiso.root", 'EGamma_SF2D',
                'ele_id')
            #self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2017/Electron_IdIso_IsoLt0.15_IsoID_eff.root","ZMass",'ele_idiso')
        else:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2018/Electron_Run2018_Ele32orEle35.root",
                'ZMass', 'ele_trig')
            #self.sftool_idiso = ScaleFactorHTT(pathHTT+"Run2018/Electron_Run2018_IdIso.root",'ZMass','ele_idiso') # MVA nonIso Fall17 WP90, rho-corrected Iso(dR<0.3)<0.1
            self.sftool_reco = ScaleFactor(
                pathPOG + "2018/egammaEffi.txt_EGM2D_updatedAll.root",
                'EGamma_SF2D', 'ele_reco')
            self.sftool_idiso = ScaleFactor(
                pathPOG + "2018/2018_ElectronMVA80noiso.root", 'EGamma_SF2D',
                'ele_id')

        if self.sftool_reco:
            self.sftool_idiso = self.sftool_reco * self.sftool_idiso
Пример #8
0
class ElectronSFs:
    
    def __init__(self, year=2017):
        """Load histograms from files."""
        
        # TRIGGER (HTT)
        self.sftool_trig = ScaleFactorHTT(pathHTT+"Electron_Ele32orEle35.root","ZMass",'ele_trig')
        
        # RECO, IDISO (EGamme POG)
        self.sftool_reco  = ScaleFactor(path+"egammaEffi.txt_EGM2D_runBCDEF_passingRECO.root","EGamma_SF2D",'ele_reco',ptvseta=True)
        self.sftool_idiso = ScaleFactor(path+"gammaEffi.txt_EGM2D_runBCDEF_passingMVA94Xwp80iso.root","EGamma_SF2D",'ele_idiso',ptvseta=True)
        #self.sftool_idiso = ScaleFactorHTT(pathHTT+"Electron_IdIso_IsoLt0.15_IsoID_eff.root","ZMass",'ele_idiso')
        
    def getTriggerSF(self, pt, eta):
        """Get SF for single electron trigger."""
        return self.sftool_trig.getSF(pt,eta)
        
    def getIdIsoSF(self, pt, eta):
        """Get SF for electron identification + isolation."""
        sf_reco  = self.sftool_reco.getSF(pt,eta)
        sf_idiso = self.sftool_idiso.getSF(pt,eta)
        return sf_reco*sf_idiso
Пример #9
0
    def __init__(self, era='2017', verb=0):
        """Load histograms from files."""

        #eras = ['2016','2017','2018','UL2017']
        #assert era in eras, "MuonSFs: You must choose a year from: %s."%(', '.join(eras))
        self.sftool_trig = None
        self.sftool_idiso = None
        if 'UL' in era:
            if '2016' in era and 'preVFP' in era:
                # https://twiki.cern.ch/twiki/bin/view/CMS/MuonUL2016
                ###self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Muon_Run2016_legacy_IsoMu22.root",'ZMass','mu_trig',verb=verb) # placeholder
                self.sftool_trig = ScaleFactor(
                    pathPOG +
                    "Run2016UL_preVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_HIPM_SingleMuonTriggers.root",
                    'NUM_IsoMu24_or_IsoTkMu24_DEN_CutBasedIdTight_and_PFIsoTight_eta_pt',
                    'mu_trig',
                    verb=verb)
                sftool_id = ScaleFactor(
                    pathPOG +
                    "Run2016UL_preVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_HIPM_ID.root",
                    "NUM_MediumID_DEN_TrackerMuons_abseta_pt",
                    'mu_id',
                    ptvseta=True,
                    verb=verb)
                sftool_iso = ScaleFactor(
                    pathPOG +
                    "Run2016UL_preVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_HIPM_ISO.root",
                    "NUM_TightRelIso_DEN_MediumID_abseta_pt",
                    'mu_iso',
                    ptvseta=False,
                    verb=verb)
                self.sftool_idiso = sftool_id * sftool_iso
            elif '2016' in era:
                # https://twiki.cern.ch/twiki/bin/view/CMS/MuonUL2016
                ###self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2016_legacy/Muon_Run2016_legacy_IsoMu22.root",'ZMass','mu_trig',verb=verb) # placeholder
                self.sftool_trig = ScaleFactor(
                    pathPOG +
                    "Run2016UL_postVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_SingleMuonTriggers.root",
                    'NUM_IsoMu24_or_IsoTkMu24_DEN_CutBasedIdTight_and_PFIsoTight_eta_pt',
                    'mu_trig',
                    verb=verb)
                sftool_id = ScaleFactor(
                    pathPOG +
                    "Run2016UL_postVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_ID.root",
                    "NUM_MediumID_DEN_TrackerMuons_abseta_pt",
                    'mu_id',
                    ptvseta=True,
                    verb=verb)
                sftool_iso = ScaleFactor(
                    pathPOG +
                    "Run2016UL_postVFP/Efficiencies_muon_generalTracks_Z_Run2016_UL_ISO.root",
                    "NUM_TightRelIso_DEN_MediumID_abseta_pt",
                    'mu_iso',
                    ptvseta=False,
                    verb=verb)
                self.sftool_idiso = sftool_id * sftool_iso
            elif '2017' in era:
                # https://twiki.cern.ch/twiki/bin/view/CMS/MuonUL2017
                self.sftool_trig = ScaleFactorHTT(
                    pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root",
                    'ZMass',
                    'mu_trig',
                    verb=verb)  # placeholder
                ###self.sftool_trig  = ScaleFactor(pathPOG+"Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_SingleMuonTriggers.root",
                ###                                   'NUM_IsoMu27_DEN_CutBasedIdTight_and_PFIsoTight_eta_pt','mu_trig',verb=verb)
                sftool_id = ScaleFactor(
                    pathPOG +
                    "Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ID.root",
                    "NUM_MediumID_DEN_TrackerMuons_abseta_pt",
                    'mu_id',
                    ptvseta=True,
                    verb=verb)
                sftool_iso = ScaleFactor(
                    pathPOG +
                    "Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ISO.root",
                    "NUM_TightRelIso_DEN_MediumID_abseta_pt",
                    'mu_iso',
                    ptvseta=False,
                    verb=verb)
                self.sftool_idiso = sftool_id * sftool_iso
            elif '2018' in era:
                # https://twiki.cern.ch/twiki/bin/view/CMS/MuonUL2017
                self.sftool_trig = ScaleFactorHTT(
                    pathHTT + "Run2018/Muon_Run2018_IsoMu24orIsoMu27.root",
                    'ZMass',
                    'mu_trig',
                    verb=verb)  # placeholder
                ###self.sftool_trig  = ScaleFactor(pathPOG+"Run2018UL/Efficiencies_muon_generalTracks_Z_Run2018_UL_SingleMuonTriggers.root",
                ###                                   'NUM_IsoMu24_DEN_CutBasedIdTight_and_PFIsoTight_eta_pt','mu_trig',verb=verb)
                sftool_id = ScaleFactor(
                    pathPOG +
                    "Run2018UL/Efficiencies_muon_generalTracks_Z_Run2018_UL_ID.root",
                    "NUM_MediumID_DEN_TrackerMuons_abseta_pt",
                    'mu_id',
                    ptvseta=True,
                    verb=verb)
                sftool_iso = ScaleFactor(
                    pathPOG +
                    "Run2018UL/Efficiencies_muon_generalTracks_Z_Run2018_UL_ISO.root",
                    "NUM_TightRelIso_DEN_MediumID_abseta_pt",
                    'mu_iso',
                    ptvseta=False,
                    verb=verb)
                self.sftool_idiso = sftool_id * sftool_iso
        else:
            if era == '2016':
                self.sftool_trig = ScaleFactorHTT(
                    pathHTT +
                    "Run2016_legacy/Muon_Run2016_legacy_IsoMu22.root",
                    'ZMass',
                    'mu_trig',
                    verb=verb)
                self.sftool_idiso = ScaleFactorHTT(
                    pathHTT + "Run2016_legacy/Muon_Run2016_legacy_IdIso.root",
                    'ZMass',
                    'mu_idiso',
                    verb=verb)
                ###self.sftool_trig  = ScaleFactorHTT(pathHTT+"Run2017/Muon_IsoMu24orIsoMu27.root",'ZMass','mu_idiso',verb=verb) # placeholder
                ###sftool_id         = ScaleFactor(pathPOG+"Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ID.root","NUM_MediumID_DEN_TrackerMuons_abseta_pt",'mu_id',ptvseta=True,verb=verb)
                ###sftool_iso        = ScaleFactor(pathPOG+"Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ISO.root","NUM_TightRelIso_DEN_MediumID_abseta_pt",'mu_iso',ptvseta=False,verb=verb)
                self.sftool_idiso = sftool_id * sftool_iso
            elif era == '2017':
                #self.sftool_trig  = ScaleFactor(pathPOG+"Run2017/EfficienciesAndSF_RunBtoF_Nov17Nov2017.root","IsoMu27_PtEtaBins/abseta_pt_ratio",'mu_trig')
                self.sftool_trig = ScaleFactorHTT(
                    pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root",
                    'ZMass',
                    'mu_idiso',
                    verb=verb)
                self.sftool_idiso = ScaleFactorHTT(
                    pathHTT +
                    "Run2017/Muon_IdIso_IsoLt0.15_eff_RerecoFall17.root",
                    'ZMass',
                    'mu_idiso',
                    verb=verb)
                ###sftool_id         = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
                ###sftool_iso        = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
                ###self.sftool_idiso = sftool_id*sftool_iso
            elif era == '2018':
                self.sftool_trig = ScaleFactorHTT(
                    pathHTT + "Run2018/Muon_Run2018_IsoMu24orIsoMu27.root",
                    'ZMass',
                    'mu_trig',
                    verb=verb)
                self.sftool_idiso = ScaleFactorHTT(
                    pathHTT + "Run2018/Muon_Run2018_IdIso.root"
                )  # MediumID, DB corrected iso (dR<0.4) < 0.15
                ###sftool_id         = ScaleFactor(pathPOG+"Run2018/RunABCD_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
                ###sftool_iso        = ScaleFactor(pathPOG+"Run2018/RunABCD_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
                ###self.sftool_idiso = sftool_id*sftool_iso
        assert self.sftool_trig != None and self.sftool_idiso != None, "MuonSFs.__init__: Did not find muon SF tool for %r" % (
            era)
        print "Loading MuonSF for %s, %s" % (self.sftool_trig.filename,
                                             self.sftool_idiso.filename)
Пример #10
0
    def __init__(self, year=2017):
        """Load histograms from files."""

        assert year in [
            2016, 2017, 2018
        ], "MuonSFs: You must choose a year from: 2016, 2017, or 2018."

        if year == 2016:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2016BtoH/Muon_Mu22OR_eta2p1_eff.root", 'ZMass',
                'mu_trig')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2016BtoH/Muon_IdIso_IsoLt0p15_2016BtoH_eff.root",
                'ZMass', 'mu_idiso')
        elif year == 2017:
            #self.sftool_trig  = ScaleFactor(pathPOG+"Run2017/EfficienciesAndSF_RunBtoF_Nov17Nov2017.root","IsoMu27_PtEtaBins/abseta_pt_ratio",'mu_trig')
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root", 'ZMass',
                'mu_idiso')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IdIso_IsoLt0p15_eff_RerecoFall17.root",
                'ZMass', 'mu_idiso')
            #sftool_id         = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
            #sftool_iso        = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
            #self.sftool_idiso = sftool_id*sftool_iso
        else:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IsoMu24orIsoMu27.root",
                'ZMass', 'mu_trig')
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IdIso.root"
            )  # MediumID, DB corrected iso (dR<0.4) < 0.15
Пример #11
0
    def __init__(self, era=2017, verb=0):
        """Load histograms from files."""

        eras = ['2016', '2017', '2018', 'UL2017']
        assert era in eras, "MuonSFs: You must choose a year from: %s." % (
            ', '.join(eras))

        if era == '2016':
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2016_legacy/Muon_Run2016_legacy_IsoMu22.root",
                'ZMass',
                'mu_trig',
                verb=verb)
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2016_legacy/Muon_Run2016_legacy_IdIso.root",
                'ZMass',
                'mu_idiso',
                verb=verb)
        elif era == '2017':
            #self.sftool_trig  = ScaleFactor(pathPOG+"Run2017/EfficienciesAndSF_RunBtoF_Nov17Nov2017.root","IsoMu27_PtEtaBins/abseta_pt_ratio",'mu_trig')
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root",
                'ZMass',
                'mu_idiso',
                verb=verb)
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IdIso_IsoLt0.15_eff_RerecoFall17.root",
                'ZMass',
                'mu_idiso',
                verb=verb)
            #sftool_id         = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ID.root","NUM_MediumID_DEN_genTracks_pt_abseta",'mu_id',ptvseta=False)
            #sftool_iso        = ScaleFactor(pathPOG+"Run2017/RunBCDEF_SF_ISO.root","NUM_TightRelIso_DEN_MediumID_pt_abseta",'mu_iso',ptvseta=False)
            #self.sftool_idiso = sftool_id*sftool_iso
        elif era == 'UL2017':
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2017/Muon_IsoMu24orIsoMu27.root",
                'ZMass',
                'mu_idiso',
                verb=verb)  # placeholder
            sftool_id = ScaleFactor(
                pathPOG +
                "Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ID.root",
                "NUM_MediumID_DEN_TrackerMuons_abseta_pt",
                'mu_id',
                ptvseta=True,
                verb=verb)
            sftool_iso = ScaleFactor(
                pathPOG +
                "Run2017UL/Efficiencies_muon_generalTracks_Z_Run2017_UL_ISO.root",
                "NUM_TightRelIso_DEN_MediumID_abseta_pt",
                'mu_iso',
                ptvseta=False,
                verb=verb)
            self.sftool_idiso = sftool_id * sftool_iso
        else:
            self.sftool_trig = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IsoMu24orIsoMu27.root",
                'ZMass',
                'mu_trig',
                verb=verb)
            self.sftool_idiso = ScaleFactorHTT(
                pathHTT + "Run2018/Muon_Run2018_IdIso.root"
            )  # MediumID, DB corrected iso (dR<0.4) < 0.15