Exemplo n.º 1
0
 def customizeDiphotonCorrections(self,process,processType):
     
     if self.applyDiphotonCorrections:
         from flashgg.Systematics.SystematicsCustomize import useEGMTools
         useEGMTools(process)
         
         from copy import deepcopy as copy
         
         if processType == "data":
             from flashgg.Systematics.SystematicsCustomize import customizePhotonSystematicsForData
             customizePhotonSystematicsForData(process)
         else:
             from flashgg.Systematics.SystematicsCustomize import customizePhotonSystematicsForMC
             customizePhotonSystematicsForMC(process)
             default1sig = cms.vint32()
             default2sig = cms.PSet( firstVar = cms.vint32(), secondVar = cms.vint32())
             for vpset,dflt in (process.flashggDiPhotonSystematics.SystMethods,default1sig),(process.flashggDiPhotonSystematics.SystMethods2D,default2sig):
                 for pset in vpset:
                     if (processType != "signal") or (not pset.Label.value().startswith("MCSmear")):
                         pset.NSigmas = copy(dflt)
     else:
         process.flashggDiPhotonSystematics.SystMethods = cms.VPSet()
         process.flashggDiPhotonSystematics.SystMethods2D = cms.VPSet()
         
     process.flashggDiPhotonSystematics.SystMethods.extend(self.extraSysModules)
Exemplo n.º 2
0
    def customizeDiphotonCorrections(self, process, processType):

        from flashgg.Systematics.SystematicsCustomize import useEGMTools
        useEGMTools(process)

        from copy import deepcopy as copy

        #        process.flashggDiPhotonSystematics.SystMethods.remove(process.SigmaEOverESmearing)
        if processType == "data":
            from flashgg.Systematics.SystematicsCustomize import customizePhotonSystematicsForData
            customizePhotonSystematicsForData(process)
        else:
            from flashgg.Systematics.SystematicsCustomize import customizePhotonSystematicsForMC
            customizePhotonSystematicsForMC(process)
            default1sig = cms.vint32()
            default2sig = cms.PSet(firstVar=cms.vint32(),
                                   secondVar=cms.vint32())
            for vpset, dflt in (
                    process.flashggDiPhotonSystematics.SystMethods,
                    default1sig), (
                        process.flashggDiPhotonSystematics.SystMethods2D,
                        default2sig):
                for pset in vpset:
                    if (processType != "signal") or (
                            not pset.Label.value().startswith("MCSmear")):
                        pset.NSigmas = copy(dflt)

        process.flashggDiPhotonSystematics.SystMethods.extend(
            self.extraSysModules)
def prepareflashggDiPhotonSystematicsTask(process, processType, doSystematics = False):

    from flashgg.Systematics.SystematicsCustomize import useEGMTools
    process.load("flashgg.Systematics.flashggDiPhotonSystematics_cfi")
    process.flashggPreselectedDiPhotons.src = cms.InputTag('flashggDiPhotonSystematics')

    SystTask = cms.Task(process.flashggDiPhotonSystematics)

    useEGMTools(process)

    if processType == 'sig':
        if doSystematics:
            includeScale_Central_Systematics(process)
        else:
            includeScale_Central(process)
    elif processType == 'bkg':
        includeScale_Central(process)
    elif processType == 'data':
        includeScale(process)
    else:
        print "Please choose processType which is 'sig', 'bkg', 'data' in prepareflashggDiPhotonSystematicsTask(..., processType, ...) "

    if doSystematics:
        for phosystlabel in getDiPhotonSystematicsList():
            setattr( process, 'flashggPreselectedDiPhotons' + phosystlabel,
                            process.flashggPreselectedDiPhotons.clone(
                                src = cms.InputTag('flashggDiPhotonSystematics', phosystlabel)
                            )
            )
            setattr( process, 'flashggDiPhotonMVA' + phosystlabel,
                            process.flashggDiPhotonMVA.clone(
                                DiPhotonTag = cms.InputTag('flashggPreselectedDiPhotons' + phosystlabel)
                            )
            )

            SystTask.add( getattr( process, 'flashggPreselectedDiPhotons' + phosystlabel ) )
            SystTask.add( getattr( process, 'flashggDiPhotonMVA' + phosystlabel ) )

    return SystTask
def prepareflashggDiPhotonSystematicsTask(process,
                                          processType,
                                          condition_dict,
                                          doSystematics=False):

    from flashgg.Systematics.SystematicsCustomize import useEGMTools
    process.load("flashgg.Systematics.flashggDiPhotonSystematics_cfi")
    process.flashggPreselectedDiPhotons.src = cms.InputTag(
        'flashggDiPhotonSystematics')

    process.load("flashgg.Systematics." +
                 condition_dict['flashggDiPhotonSystematics'])
    sysmodule = importlib.import_module(
        "flashgg.Systematics." + condition_dict['flashggDiPhotonSystematics'])

    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleHighR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleLowR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleHighR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleLowR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleGain6EB_EGM)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCScaleGain1EB_EGM)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MaterialCentralBarrel)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MaterialOuterBarrel)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MaterialForward)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.ShowerShapeHighR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.ShowerShapeHighR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.ShowerShapeLowR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.ShowerShapeLowR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.FNUFEB)
    process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.FNUFEE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCSmearHighR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCSmearLowR9EE)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCSmearHighR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.MCSmearLowR9EB)
    process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.MvaShift)
    process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.PreselSF)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.electronVetoSF)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.TriggerWeight)
    process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.LooseMvaSF)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.SigmaEOverEShift)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.SigmaEOverESmearing)
    process.flashggDiPhotonSystematics.SystMethods.append(
        sysmodule.FracRVWeight)
    #process.flashggDiPhotonSystematics.SystMethods.append(sysmodule.FracRVNvtxWeight)

    #    print 'point1'
    #    for pset in process.flashggDiPhotonSystematics.SystMethods:
    #        print "=== 1D syst method pset ==="
    #        print pset
    #        print
    #    print 'point2'

    SystTask = cms.Task(process.flashggDiPhotonSystematics)

    useEGMTools(process)

    if processType == 'sig':
        if doSystematics:
            includeScale_Central_Systematics(process)
        else:
            includeScale_Central(process)
    elif processType == 'bkg':
        includeScale_Central(process)
    elif processType == 'data':
        includeScale(process)
    else:
        print "Please choose processType which is 'sig', 'bkg', 'data' in prepareflashggDiPhotonSystematicsTask(..., processType, ...) "

    if doSystematics:
        for phosystlabel in getDiPhotonSystematicsList():
            setattr(
                process, 'flashggPreselectedDiPhotons' + phosystlabel,
                process.flashggPreselectedDiPhotons.clone(src=cms.InputTag(
                    'flashggDiPhotonSystematics', phosystlabel)))
            setattr(
                process, 'flashggDiPhotonMVA' + phosystlabel,
                process.flashggDiPhotonMVA.clone(
                    DiPhotonTag=cms.InputTag('flashggPreselectedDiPhotons' +
                                             phosystlabel)))

            SystTask.add(
                getattr(process, 'flashggPreselectedDiPhotons' + phosystlabel))
            SystTask.add(getattr(process, 'flashggDiPhotonMVA' + phosystlabel))

    return SystTask