Example #1
0
    'name': 'lumi_13TeV_CurrCalib',
    'type': 'lnN',
    'samples': dict((skey, '1.003') for skey in mc if skey not in ['WZ', 'Zg'])
}

nuisances['lumi_Ghosts'] = {
    'name': 'lumi_13TeV_Ghosts',
    'type': 'lnN',
    'samples': dict((skey, '1.001') for skey in mc if skey not in ['WZ', 'Zg'])
}

#### Theoretical Systematics

# Scale
from LatinoAnalysis.Tools.HiggsXSection import *
HiggsXS = HiggsXSection()

nuisances['QCDscale_VH'] = {
    'name': 'QCDscale_VH',
    'samples': {
        'WH_hww':
        HiggsXS.GetHiggsProdXSNP('YR4', '13TeV', 'WH', '125.09', 'scale',
                                 'sm'),
        'ZH_hww':
        HiggsXS.GetHiggsProdXSNP('YR4', '13TeV', 'ZH', '125.09', 'scale',
                                 'sm'),
        'H_htt':
        HiggsXS.GetHiggsProdXSNP('YR4', '13TeV', 'ZH', '125.09', 'scale',
                                 'sm'),
    },
    'type': 'lnN',
        'ggZH_hww': '1.058',
        'VVV': '1.058',
        'ZZ': '1.058',
        #               'WZ'       : '1.050',
        'WW': '1.058',
        #    'ggWW'     : '1.050',
        'Vg': '1.058',
    },
    'type': 'lnN',
}

# Theoritical Systematics

from LatinoAnalysis.Tools.HiggsXSection import *

HiggsXS = HiggsXSection()

nuisances['QCDscale_WH_wh3l'] = {
    'name': 'QCDscale_WH',
    'samples': {
        'WH_hww':
        HiggsXS.GetHiggsProdXSNP('YR4prel', '13TeV', 'WH', '125.0', 'scale',
                                 'sm'),
    },
    'type': 'lnN',
}

nuisances['QCDscale_ZH_wh3l'] = {
    'name': 'QCDscale_ZH',
    'samples': {
        'ZH_hww':
    def readYR(self, YRVersion, YREnergy):

        self._useYR = True
        self._YRVersion = YRVersion
        self._YREnergy = YREnergy
        self._HiggsXS = HiggsXSection()
class xsectionDB:
    def __init__(self):

        self.xsections = {}
        self._useYR = False
        self._YRVersion = ''
        self._YREnergy = ''

    def readGDoc(self, gdocKey='1wH73CYA_T4KMkl1Cw-xLTj8YG7OPqayDnP53N-lZwFQ'):

        opener = build_opener(HTTPCookieProcessor(CookieJar()))
        resp = opener.open('https://docs.google.com/spreadsheet/ccc?key=' +
                           gdocKey + '&output=csv')
        data = resp.read()
        for line in data.splitlines():
            info = line.split(",")
            iID = info[0].replace(' ', '')
            if iID.isdigit():
                iKey = info[1].replace(' ', '')
                self.xsections[iKey] = {}
                #self.xsections[iKey]['ID']     = iID
                #self.xsections[iKey]['sample'] = info[1].replace(' ','')
                if len(info) > 4:
                    self.xsections[iKey]['xs'] = info[5].replace(' ', '')
                    self.xsections[iKey]['kfact'] = '1.0'
                    self.xsections[iKey]['src'] = 'gDOC'
                else:
                    self.xsections[iKey]['xs'] = ''
                    self.xsections[iKey]['kfact'] = ''
                    self.xsections[iKey]['src'] = ''

        #print self.xsections

    def readPython(self, xsFile):
        handle = open(xsFile)
        for iLine in handle.read().split('\n'):
            if 'samples' in iLine.split('#')[0]:
                #print iLine
                iKey = iLine.split('\'')[1].replace(' ', '')
                #print iKey
                #if iKey in self.xsections : print 'Replacing ....',iKey,self.xsections[iKey]
                #else : print 'Adding ....',iKey
                self.xsections[iKey] = {}
                vec = iLine.split('[')[2].split(']')[0]
                #print vec
                for iVec in vec.split(','):
                    info = iVec.split('\'')[1]
                    iName = info.split('=')[0]
                    iVal = info.split('=')[1]
                    if iName == 'xsec': self.xsections[iKey]['xs'] = iVal
                    if iName == 'kfact': self.xsections[iKey]['kfact'] = iVal
                    if iName == 'ref':
                        self.xsections[iKey]['src'] = 'Python,ref=' + iVal
        handle.close()

    def readYR(self, YRVersion, YREnergy):

        self._useYR = True
        self._YRVersion = YRVersion
        self._YREnergy = YREnergy
        self._HiggsXS = HiggsXSection()

    def get(self, iSample):
        if self._useYR:
            Higgs = self._HiggsXS.GetHiggsXS4Sample(self._YRVersion,
                                                    self._YREnergy, iSample)
            print Higgs
            if not Higgs['xs'] == 0.: return str(Higgs['xs'])

        if iSample in self.xsections:
            print iSample, self.xsections[iSample]['xs'], self.xsections[
                iSample]['kfact']
            return str(
                float(self.xsections[iSample]['xs']) *
                float(self.xsections[iSample]['kfact']))
        else:
            return ''

    def Print(self):
        print self.xsections
               'type'  : 'lnN'
              }

nuisances['QCDscale_WWewk']  = {
               'name'  : 'QCDscale_WWewk',
               'samples'  : {
                   'WWewk' : '1.11',
                   },
               'type'  : 'lnN'
              }


#### QCD scale uncertainties for Higgs signals other than ggH

from LatinoAnalysis.Tools.HiggsXSection  import *
HiggsXS = HiggsXSection()

nuisances['QCDscale_ggH']  = {
               'name'  : 'QCDscale_ggH', 
               'samples'  : {
                   'H_htt'   : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','ggH','125.0','scale','sm'),
                   },
               'type'  : 'lnN',
              }


nuisances['QCDscale_qqH']  = {
               'name'  : 'QCDscale_qqH', 
               'samples'  : {
                   'qqH_hww' : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','vbfH','125.0','scale','sm'),
                   'qqH_htt' : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','vbfH','125.0','scale','sm'),
Example #6
0
    'name': 'lumi_13TeV_CurrCalib',
    'type': 'lnN',
    'samples': dict((skey, '1.003') for skey in mc if skey not in ['WZ', 'Zg'])
}

nuisances['lumi_Ghosts'] = {
    'name': 'lumi_13TeV_Ghosts',
    'type': 'lnN',
    'samples': dict((skey, '1.001') for skey in mc if skey not in ['WZ', 'Zg'])
}

#### Theoretical Systematics

# Scale
from LatinoAnalysis.Tools.HiggsXSection  import *
HiggsXS = HiggsXSection()

nuisances['QCDscale_VH']  = {
  'name'  : 'QCDscale_VH',
  'samples'  : {
    'WH_hww' : HiggsXS.GetHiggsProdXSNP('YR4','13TeV','WH','125.09','scale','sm'),
    #'ZH_hww' : HiggsXS.GetHiggsProdXSNP('YR4','13TeV','ZH','125.09','scale','sm'),
    'WH_htt' : HiggsXS.GetHiggsProdXSNP('YR4','13TeV','WH','125.09','scale','sm'),
    'ZH_htt' : HiggsXS.GetHiggsProdXSNP('YR4','13TeV','ZH','125.09','scale','sm')
  },
  'type'  : 'lnN',
}

#nuisances['QCDscale_ggZH']  = {
#  'name'  : 'QCDscale_ggZH', 
#  'samples'  : {
Example #7
0
# WZ from
# https://twiki.cern.ch/twiki/bin/view/CMS/StandardModelCrossSectionsat13TeV
#
#nuisances['QCDscale_VW']  = {
#'name'  : 'QCDscale_VW',
#'samples'  : {
#'VW' : '1.03',
#},
#'type'  : 'lnN'
#}

# PDF: 0.0064 / 0.1427 = 0.0448493
# QCD: 0.0046 / 0.1427 = 0.0322355

from LatinoAnalysis.Tools.HiggsXSection import *
HiggsXS = HiggsXSection()

#nuisances['QCDscale_ggH']  = {
#'name'  : 'QCDscale_ggH',
#'samples'  : {
##'DY' : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','ggH','125.0','scale','sm'),     ----> already included in jet bin migration QCD uncertainty?
#'ggWpWpJJ' : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','ggH','125.0','scale','sm'),
#'WpWpJJ'   : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','ggH','125.0','scale','sm'),
#},
#'type'  : 'lnN',
#}

#nuisances['QCDscale_qqH']  = {
#'name'  : 'QCDscale_qqH',
#'samples'  : {
#'lep_TT' : HiggsXS.GetHiggsProdXSNP('YR4prel','13TeV','vbfH','125.0','scale','sm'),
    'type': 'shape',
    'samples': {
        'qqWWqq': [
            'std_vector_LHE_weight[8]/std_vector_LHE_weight[0]',
            'std_vector_LHE_weight[4]/std_vector_LHE_weight[0]'
        ],
        'WW2J': [
            'std_vector_LHE_weight[8]/std_vector_LHE_weight[0]',
            'std_vector_LHE_weight[4]/std_vector_LHE_weight[0]'
        ],
    }
}

from LatinoAnalysis.Tools.HiggsXSection import *

HiggsXS = HiggsXSection()

####################QCD scale uncertainties for Higgs signals other than ggH

nuisances['QCDscale_ggH'] = {
    'name': 'QCDscale_ggH',
    'samples': {
        'ggH_hww':
        HiggsXS.GetHiggsProdXSNP(
            'YR4prel', '13TeV', 'ggH', '125.0', 'scale',
            'sm'),  #-> already included in jet bin migration QCD uncertainty?
        'ggH_htt':
        HiggsXS.GetHiggsProdXSNP('YR4prel', '13TeV', 'ggH', '125.0', 'scale',
                                 'sm'),
        'H_htt':
        HiggsXS.GetHiggsProdXSNP('YR4prel', '13TeV', 'ggH', '125.0', 'scale',
Example #9
0
#nuisances = {}

# name of samples here must match keys in samples.py

# imported from samples.py:
# samples, treeBaseDir, mcProduction, mcSteps
# imported from cuts.py
# cuts

mc = [skey for skey in samples if skey not in ('Fake', 'DATA')]

topcr = [ckey for ckey in cuts if 'cattop' in ckey]
dycr = [ckey for ckey in cuts if 'catDY' in ckey]

from LatinoAnalysis.Tools.HiggsXSection import *
HiggsXS = HiggsXSection()

################################ EXPERIMENTAL UNCERTAINTIES  #################################

#### Luminosity

# Will be dropped from DY, top, and WW but that's taken care of in datacard generation
nuisances['lumi'] = {
    'name': 'lumi_2016',
    'type': 'lnN',
    'samples': dict((skey, '1.025') for skey in mc)
}

#### FAKES

nuisances['fake_syst'] = {