Example #1
0
def TileDCSCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile DCS conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        ReadHV -- Read Tile DCS HV folder from DB. Defaults True.
        ReadHVSET -- Read Tile DCS HVSET folder from DB. Defaults to False.
        ReadSTATES -- Read Tile DCS STATES folder from DB. Defaults to True.
        TileDCS -- name of Tile DCS conditions object. Defaults to TileDCS.
    """

    isMC = flags.Input.isMC
    isOnline = flags.Common.isOnline

    if isOnline or isMC:
        raise (Exception('No Tile DCS information in online [%s] or MC [%s]' %
                         (isOnline, isMC)))

    acc = ComponentAccumulator()

    dcs = kwargs.get('TileDCS', 'TileDCS')
    readHV = kwargs.get('ReadHV', True)
    readHVSET = kwargs.get('ReadHVSET', False)
    readSTATES = kwargs.get('ReadSTATES', True)

    name = dcs + 'CondAlg'

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))

    if not readHVSET:
        from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
        acc.merge(TileEMScaleCondAlgCfg(flags))

    from TileConditions.TileFolders import TileFolders
    folders = TileFolders(isMC=flags.Input.isMC,
                          isOnline=flags.Common.isOnline)

    db = 'DCS_OFL'
    if readHV:
        folders.add('/TILE/DCS/HV', db)
    if readHVSET:
        folders.add('/TILE/DCS/HVSET', db)
    if readSTATES:
        folders.add('/TILE/DCS/STATES', db)

    from IOVDbSvc.IOVDbSvcConfig import addFolderList
    acc.merge(addFolderList(flags, folders.get()))

    TileDCSCondAlg = CompFactory.TileDCSCondAlg
    dcsCondAlg = TileDCSCondAlg(name=name,
                                ReadHV=readHV,
                                ReadHVSET=readHVSET,
                                ReadSTATES=readSTATES,
                                TileDCS=dcs)

    acc.addCondAlgo(dcsCondAlg)

    return acc
Example #2
0
def TileDSP_ThresholdCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile DSP threshold conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile auto correlation conditions (COOL, FILE). Defaults to COOL.
        TileDSP_Threshold -- name of Tile auto correlation conditions object. Defaults to TileDSP_Threshold.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    dspThreshold = kwargs.get('TileDSP_Threshold', 'TileDSP_Threshold')

    name = dspThreshold + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            dspThresholdFolder = folders.addSplitOnline(
                '/TILE/ONL01/DSP/THRESHOLD', '/TILE/OFL02/DSP/THRESHOLD')
        else:
            raise (Exception("No Tile DSP threshold folder in %s" %
                             flags.IOVDb.DatabaseInstancea))

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        dspThresholdProxy = TileCondProxyCoolFlt(
            'TileCondProxyCool_DspThreshold', Source=dspThresholdFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        dspThresholdProxy = TileCondProxyFileFlt(
            'TileCondProxyFile_DspThreshold',
            Source='TileDefault.dspThreshold')
    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")
    dspThresholdCondAlg = TileCalibFltCondAlg(
        name=name,
        ConditionsProxy=dspThresholdProxy,
        TileCalibData=dspThreshold)

    acc.addCondAlgo(dspThresholdCondAlg)

    return acc
Example #3
0
def TileMuIDCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile MuID conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile MuID conditions (COOL, FILE). Defaults to COOL.
        TileMuID -- name of Tile MuID conditions object. Defaults to TileMuID.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    muID = kwargs.get('TileMuID', 'TileMuID')

    name = muID + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        muIDFolder = folders.addSplitMC('/TILE/ONL01/MUID', '/TILE/ONL01/MUID')

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        muIDProxy = TileCondProxyCoolFlt('TileCondProxyCool_MuID',
                                         Source=muIDFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        muIDProxy = TileCondProxyFileFlt('TileCondProxyFile_MuID',
                                         Source='TileDefault.muid')
    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")
    muIDCondAlg = TileCalibFltCondAlg(name=name,
                                      ConditionsProxy=muIDProxy,
                                      TileCalibData=muID)

    acc.addCondAlgo(muIDCondAlg)

    return acc
Example #4
0
def LArElecCalibDBMCCfg(ConfigFlags, folders):
    _larCondDBFoldersMC = {
        "Ramp":
        ("LArRampMC", "/LAR/ElecCalibMC/Ramp", "LArRamp", LArRampSymAlg),
        "AutoCorr": ("LArAutoCorrMC", "/LAR/ElecCalibMC/AutoCorr",
                     "LArAutoCorr", LArAutoCorrSymAlg),
        "DAC2uA": ("LArDAC2uAMC", "/LAR/ElecCalibMC/DAC2uA", "LArDAC2uA",
                   LArDAC2uASymAlg),
        "Pedestal":
        ("LArPedestalMC", "/LAR/ElecCalibMC/Pedestal", "LArPedestal", None),
        "Noise": ("LArNoiseMC", "/LAR/ElecCalibMC/Noise", "LArNoise",
                  LArNoiseSymAlg),
        "fSampl": ("LArfSamplMC", "/LAR/ElecCalibMC/fSampl", "LArfSampl",
                   LArfSamplSymAlg),
        "uA2MeV": ("LAruA2MeVMC", "/LAR/ElecCalibMC/uA2MeV", "LAruA2MeV",
                   LAruA2MeVSymAlg),
        "MinBias": ("LArMinBiasMC", "/LAR/ElecCalibMC/MinBias", "LArMinBias",
                    LArMinBiasSymAlg),
        "Shape": ("LArShape32MC", "/LAR/ElecCalibMC/Shape", "LArShape",
                  LArShapeSymAlg),
        "MinBiasAvc":
        ("LArMinBiasAverageMC", "/LAR/ElecCalibMC/MinBiasAverage",
         "LArMinBiasAverage", LArMinBiasAverageSymAlg),
        "MphysOverMcal":
        ("LArMphysOverMcalMC", "/LAR/ElecCalibMC/MphysOverMcal",
         "LArMphysOverMcal", LArMPhysOverMcalSymAlg),
        "HVScaleCorr": ("LArHVScaleCorrComplete",
                        '/LAR/ElecCalibMC/HVScaleCorr', "LArHVScaleCorr", None)
    }

    result = ComponentAccumulator()
    #Add cabling
    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    result.merge(LArOnOffIdMappingCfg(ConfigFlags))
    LArMCSymCondAlg = CompFactory.LArMCSymCondAlg
    result.addCondAlgo(LArMCSymCondAlg(ReadKey="LArOnOffIdMap"))
    folderlist = []
    for folder in folders:
        try:
            classname, fldr, key, calg = _larCondDBFoldersMC[folder]
        except KeyError:
            raise ConfigurationError(
                "No conditions data %s found for Monte Carlo" % folder)

        folderlist += [
            (fldr, "LAR_OFL", classname),
        ]
        if calg is not None:
            result.addCondAlgo(calg(ReadKey=key, WriteKey=key + "Sym"))

    result.merge(addFolderList(ConfigFlags, folderlist))
    return result
Example #5
0
def TileIntegratorCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile integrator conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile integrator conditions (COOL, FILE). Defaults to COOL.
        TileIntegrator -- name of Tile integrator conditions object. Defaults to TileIntegrator.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    integrator = kwargs.get('TileIntegrator', 'TileIntegrator')

    name = integrator + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)

        if flags.IOVDb.DatabaseInstance  == 'CONDBR2':
            integratorFolder = folders.addSplitOnline('/TILE/ONL01/INTEGRATOR', '/TILE/OFL02/INTEGRATOR')
        else:
            integratorFolder = folders.addSplitOnline('/TILE/OFL01/INTEGRATOR', '/TILE/OFL02/INTEGRATOR')

        TileCondProxyCoolFlt=CompFactory.getComp("TileCondProxyCool<TileCalibDrawerFlt>")
        integratorProxy = TileCondProxyCoolFlt('TileCondProxyCool_Integrator', Source = integratorFolder)
        
        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge( addFolderList(flags, folders.get()) )

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileFlt=CompFactory.getComp("TileCondProxyFile<TileCalibDrawerFlt>")
        integratorProxy = TileCondProxyFileFlt('TileCondProxyFile_Integrator', Source = 'TileDefault.int')
    else:
        raise(Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg=CompFactory.getComp("TileCalibCondAlg<TileCalibDrawerFlt>")
    integratorCondAlg = TileCalibFltCondAlg( name = name,
                                             ConditionsProxy = integratorProxy,
                                             TileCalibData = integrator)

    acc.addCondAlgo(integratorCondAlg)

    return acc
Example #6
0
def LArElecCalibDBRun1Cfg(ConfigFlags, condObjs):

    _larCondDBFoldersDataR1 = {
        "Ramp": ("/LAR/ElecCalibOnl/Ramp", "LAR_ONL", "LArRampComplete", None),
        "DAC2uA": ("/LAR/ElecCalibOfl/DAC2uA", "LAr_ONL", "LArDAC2uAMC",
                   LArDAC2uASymAlg),
        "Pedestal": ("/LAR/ElecCalibOnl/Pedestal<key>LArPedestal</key>",
                     "LAR_ONL", "LArPedestalComplete", None),
        "uA2MeV": ("/LAR/ElecCalibOfl/uA2MeV/Symmetry", "LAr_OFL",
                   "LAruA2MeVMC", LAruA2MeVSymAlg),
        "MphysOverMcal": ("/LAR/ElecCalibOfl/MphysOverMcal/RTM", "LAr_OFL",
                          "LArMphysOverMcalComplete", None),
        "HVScale": ("/LAR/ElecCalibOnl/HVScaleCorr", "LAR_ONL",
                    "LArHVScaleCorrComplete", None),
        "OFC":
        ("/LAR/ElecCalibOfl/OFC/PhysWave/RTM/" + ConfigFlags.LAr.OFCShapeFolder
         if len(ConfigFlags.LAr.OFCShapeFolder) > 0 else "5samples1phase",
         "LAr_OFL", "LArOFCComplete", None),
        "Shape":
        ("/LAR/ElecCalibOfl/Shape/RTM/" + ConfigFlags.LAr.OFCShapeFolder
         if len(ConfigFlags.LAr.OFCShapeFolder) > 0 else "5samples1phase",
         "LAr_OFL", "LArShapeComplete", None),
    }

    result = ComponentAccumulator()
    folderlist = []
    for condData in condObjs:
        try:
            folder, db, obj, calg = _larCondDBFoldersDataR1[condData]
        except KeyError:
            raise ConfigurationError(
                "No conditions data %s found for Run-1 data" % condData)
        folderlist.append((folder, db, obj))
        if (calg):
            result.addCondAlgo(
                calg(ReadKey="LAr" + obj, WriteKey="LAr" + obj + "Sym"))
    result.merge(addFolderList(ConfigFlags, folderlist))

    return result
Example #7
0
def TileTMDBCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile TMDB conditions algorithms

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile TMDB conditions (COOL, FILE). Defaults to COOL.
        TileTMDBThreshold -- name of Tile TMDB threshold conditions object. Defaults to TileTMDBThreshold.
        TileTMDBDelay -- name of Tile TMDB dealy conditions object. Defaults to TileTMDBDelay.
        TileTMDBTMF -- name of Tile TMDB TMF conditions object. Defaults to TileTMDBTMF.
        TileTMDBCalib -- name of Tile TMDB calibration conditions object. Defaults to TileTMDBCalib.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    threshod = kwargs.get('TileTMDBThreshold', 'TileTMDBThreshold')
    delay = kwargs.get('TileTMDBDelay', 'TileTMDBDelay')
    tmf = kwargs.get('TileTMDBTMF', 'TileTMDBTMF')
    calib = kwargs.get('TileTMDBCalib', 'TileTMDBCalib')

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")

    def __addCondAlg(calibData, proxy):
        condAlg = TileCalibFltCondAlg(name=calibData + 'CondAlg',
                                      ConditionsProxy=proxy,
                                      TileCalibData=calibData)
        acc.addCondAlgo(condAlg)

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        runType = flags.Tile.RunType
        runType = runType.upper()

        if runType not in ['PHY', 'PED', 'CIS', 'MONOCIS', 'LAS', 'BILAS']:
            raise (Exception("Invalid Tile run type: %s" % runType))

        actualRunType = {
            'PHY': 'PHY',
            'PED': 'PHY',
            'LAS': 'LAS',
            'BILAS': 'LAS',
            'CIS': 'CIS',
            'MONICIS': 'CIS'
        }

        run = actualRunType.get(runType, runType)

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            thrFolder = folders.addSplitMC('/TILE/ONL01/TMDB/THRESHOLD/' + run,
                                           '/TILE/ONL01/TMDB/THRESHOLD/' + run)
            delayFolder = folders.addSplitMC('/TILE/ONL01/TMDB/DELAY/' + run,
                                             '/TILE/ONL01/TMDB/DELAY/' + run)
            tmfFolder = folders.addSplitMC('/TILE/ONL01/TMDB/TMF/' + run,
                                           '/TILE/ONL01/TMDB/TMF/' + run)
            calibFolder = folders.addSplitMC('/TILE/ONL01/TMDB/CALIB/PHY',
                                             '/TILE/ONL01/TMDB/CALIB/PHY')
        else:
            raise (Exception("No Tile TMDB folders in %s" %
                             flags.IOVDb.DatabaseInstancea))

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        thrProxy = TileCondProxyCoolFlt('TileCondProxyCool_TMDBThreshold',
                                        Source=thrFolder)
        delayProxy = TileCondProxyCoolFlt('TileCondProxyCool_TMDBDelay',
                                          Source=delayFolder)
        tmfProxy = TileCondProxyCoolFlt('TileCondProxyCool_TMDBTmf',
                                        Source=tmfFolder)
        calibProxy = TileCondProxyCoolFlt('TileCondProxyCool_TMDBCalib',
                                          Source=calibFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    else:
        # Connect FILE Tile conditions proxies to the algorithm
        raise (Exception("Not implemented source %s" % source))

    __addCondAlg(threshod, thrProxy)
    __addCondAlg(delay, delayProxy)
    __addCondAlg(tmf, tmfProxy)
    __addCondAlg(calib, calibProxy)

    return acc
Example #8
0
def TileEMScaleCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile EM scale conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of EM scale conditions (COOL, FILE). Defaults to COOL.
        TileEMScale -- name of Tile EM scale conditions object. Defaults to TileEMScale.
    """

    acc = ComponentAccumulator()
    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg

    acc.merge(TileCablingSvcCfg(flags))

    source = kwargs.get('Source', 'COOL')
    emScale = kwargs.get('TileEMScale', 'TileEMScale')

    if source not in _validSources:
        raise (Exception("Invalid source: %s" % source))

    name = emScale + 'CondAlg'
    onlCacheUnit = "Invalid"

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the tool
        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        if not flags.Input.isMC:
            onlCacheUnit = 'OnlineMegaElectronVolts'

        oflLasLinFolder = folders.addSplitOnline('/TILE/ONL01/CALIB/LAS/LIN',
                                                 '/TILE/OFL02/CALIB/LAS/LIN')
        oflCesFolder = folders.addSplitOnline('/TILE/ONL01/CALIB/CES',
                                              '/TILE/OFL02/CALIB/CES')
        oflEmsFolder = folders.addSplitOnline('/TILE/ONL01/CALIB/EMS',
                                              '/TILE/OFL02/CALIB/EMS')

        onlCisLinFolder = folders.addSplitMC('/TILE/ONL01/CALIB/CIS/LIN',
                                             '/TILE/OFL02/CALIB/CIS/FIT/LIN')
        onlLasLinFolder = folders.addSplitMC('/TILE/ONL01/CALIB/LAS/LIN',
                                             '/TILE/OFL02/CALIB/LAS/LIN')
        onlCesFolder = folders.addSplitMC('/TILE/ONL01/CALIB/CES',
                                          '/TILE/OFL02/CALIB/CES')
        onlEmsFolder = folders.addSplitMC('/TILE/ONL01/CALIB/EMS',
                                          '/TILE/OFL02/CALIB/EMS')

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            oflCisLinFolder = folders.addSplitOnline(
                '/TILE/ONL01/CALIB/CIS/LIN', '/TILE/OFL02/CALIB/CIS/LIN')
            oflCisNlnFolder = folders.addSplitOnline(
                '/TILE/ONL01/CALIB/CIS/NLN', '/TILE/OFL02/CALIB/CIS/NLN')
            oflLasNlnFolder = folders.addSplitOnline(
                '/TILE/ONL01/CALIB/LAS/NLN', '/TILE/OFL02/CALIB/LAS/NLN')
            if not flags.Common.isOnline:
                oflLasFibFolder = folders.add('/TILE/OFL02/CALIB/LAS/FIBER',
                                              'TILE_OFL')
            else:
                oflLasFibFolder = None
        else:
            oflCisLinFolder = folders.addSplitOnline(
                '/TILE/ONL01/CALIB/CIS/LIN', '/TILE/OFL02/CALIB/CIS/FIT/LIN')
            oflCisNlnFolder = folders.addSplitOnline(
                '/TILE/OFL01/CALIB/CIS/FIT/NLN',
                '/TILE/OFL02/CALIB/CIS/FIT/NLN')
            oflLasNlnFolder = folders.addSplitOnline(
                '/TILE/OFL01/CALIB/LAS/NLN', '/TILE/OFL02/CALIB/LAS/NLN')
            oflLasFibFolder = folders.addSplitOnline(
                '/TILE/OFL01/CALIB/LAS/FIBER', '/TILE/OFL02/CALIB/LAS/FIBER')

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        if not oflLasFibFolder:
            oflLasFibProxy = None
        else:
            oflLasFibProxy = TileCondProxyCoolFlt(
                'TileCondProxyCool_OflLasFib', Source=oflLasFibFolder)
        oflCisLinProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCisLin',
                                              Source=oflCisLinFolder)
        oflCisNlnProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCisNln',
                                              Source=oflCisNlnFolder)
        oflLasLinProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflLasLin',
                                              Source=oflLasLinFolder)
        oflLasNlnProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflLasNln',
                                              Source=oflLasNlnFolder)
        oflCesProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflCes',
                                           Source=oflCesFolder)
        oflEmsProxy = TileCondProxyCoolFlt('TileCondProxyCool_OflEms',
                                           Source=oflEmsFolder)
        onlCisProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlCis',
                                           Source=onlCisLinFolder)
        onlLasProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlLas',
                                           Source=onlLasLinFolder)
        onlCesProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlCes',
                                           Source=onlCesFolder)
        onlEmsProxy = TileCondProxyCoolFlt('TileCondProxyCool_OnlEms',
                                           Source=onlEmsFolder)

    else:
        # Connect FILE Tile conditions proxies to the tool
        # Undoing "online" calibrations makes no sense here and is disabled
        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        oflCisLinProxy = TileCondProxyFileFlt('TileCondProxyFile_OflCisLin',
                                              Source='TileDefault.cisFitLin')
        oflCisNlnProxy = TileCondProxyFileFlt('TileCondProxyFile_OflCisNln',
                                              Source='TileDefault.cisFitNln')
        oflLasLinProxy = TileCondProxyFileFlt('TileCondProxyFile_OflLasLin',
                                              Source='TileDefault.lasLin')
        oflLasNlnProxy = TileCondProxyFileFlt('TileCondProxyFile_OflLasNln',
                                              Source='TileDefault.lasNln')
        oflLasFibProxy = TileCondProxyFileFlt('TileCondProxyFile_OflLasFib',
                                              Source='TileDefault.lasFib')
        oflCesProxy = TileCondProxyFileFlt('TileCondProxyFile_OflCes',
                                           Source='TileDefault.ces')
        oflEmsProxy = TileCondProxyFileFlt('TileCondProxyFile_OflEms',
                                           Source='TileDefault.ems')
        onlCisProxy = TileCondProxyFileFlt('TileCondProxyFile_OflCisLin',
                                           Source='TileDefault.cisFitLin')
        onlLasProxy = TileCondProxyFileFlt('TileCondProxyFile_OflLasLin',
                                           Source='TileDefault.lasLin')
        onlCesProxy = TileCondProxyFileFlt('TileCondProxyFile_OflCes',
                                           Source='TileDefault.ces')
        onlEmsProxy = TileCondProxyFileFlt('TileCondProxyFile_OflEms',
                                           Source='TileDefault.ems')

    TileEMScaleCondAlg = CompFactory.TileEMScaleCondAlg
    emScaleCondAlg = TileEMScaleCondAlg(name=name,
                                        OnlCacheUnit=onlCacheUnit,
                                        OflCisLinProxy=oflCisLinProxy,
                                        OflCisNlnProxy=oflCisNlnProxy,
                                        OflLasLinProxy=oflLasLinProxy,
                                        OflLasNlnProxy=oflLasNlnProxy,
                                        OflLasFibProxy=oflLasFibProxy,
                                        OflCesProxy=oflCesProxy,
                                        OflEmsProxy=oflEmsProxy,
                                        OnlCisProxy=onlCisProxy,
                                        OnlLasProxy=onlLasProxy,
                                        OnlCesProxy=onlCesProxy,
                                        OnlEmsProxy=onlEmsProxy,
                                        TileEMScale=emScale)

    acc.addCondAlgo(emScaleCondAlg)

    return acc
Example #9
0
def TileBadChannelsCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile bad channels conditions algorithm

    Arguments:
        flags:  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source: -- source of Tile bad channels (COOL, FILE). Defaults to COOL.
        TileBadChannels -- name of Tile bad channels object. Defaults to TileBadChannels.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    badChannels = kwargs.get('TileBadChannels', 'TileBadChannels')

    if source not in _validSources:
        raise(Exception("Invalid source: %s" % source))

    name = badChannels + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC = flags.Input.isMC, isOnline = flags.Common.isOnline)

        TileCondProxyCoolBch=CompFactory.getComp("TileCondProxyCool<TileCalibDrawerBch>")
        onlineFolder = folders.addSplitMC('/TILE/ONL01/STATUS/ADC', '/TILE/ONL01/STATUS/ADC')
        onlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OnlBch', Source = onlineFolder)

        if flags.IOVDb.DatabaseInstance  == 'CONDBR2':
            if not flags.Common.isOnline:
                oflineFolder = folders.add('/TILE/OFL02/STATUS/ADC', 'TILE_OFL')
                offlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OflBch', Source = oflineFolder)
            else:
                offlineBadChannelsProxy = None
        else:
            oflineFolder = folders.addSplitOnline('/TILE/OFL01/STATUS/ADC', '/TILE/OFL02/STATUS/ADC')
            offlineBadChannelsProxy = TileCondProxyCoolBch('TileCondProxyCool_OflBch', Source = oflineFolder)
        
        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge( addFolderList(flags, folders.get()) )

    else:
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileBch=CompFactory.getComp("TileCondProxyFile<TileCalibDrawerBch>")
        onlineBadChannelsProxy = TileCondProxyFileBch('TileCondProxyFile_OnlBch', Source = 'TileDefault.onlBch')
        offlineBadChannelsProxy = TileCondProxyFileBch('TileCondProxyFile_OflBch', Source = 'TileDefault.oflBch')
        

    TileCondIdTransforms=CompFactory.TileCondIdTransforms
    TileBadChannelsCondAlg=CompFactory.TileBadChannelsCondAlg
    badChannelsCondAlg = TileBadChannelsCondAlg( name = name,
                                                 OnlBchProxy = onlineBadChannelsProxy,
                                                 OflBchProxy = offlineBadChannelsProxy,
                                                 TileCondIdTransforms = TileCondIdTransforms(),
                                                 TileBadChannels = badChannels)

    acc.addCondAlgo(badChannelsCondAlg)

    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge( TileCablingSvcCfg(flags) )
    
    return acc
Example #10
0
def TileTimingCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile timing conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile timing conditions (COOL, FILE). Defaults to COOL.
        TileTiming -- name of Tile timing conditions object. Defaults to TileTiming.
        ForceOnline -- flag to use online timing in offline. Defaults to False.
    """

    acc = ComponentAccumulator()

    runType = flags.Tile.RunType
    runType = runType.upper()
    if runType not in ['PHY', 'PED', 'CIS', 'MONOCIS', 'LAS', 'BILAS']:
        raise (Exception("Invalid Tile run type: %s" % runType))

    source = kwargs.get('Source', 'COOL')
    timing = kwargs.get('TileTiming', 'TileTiming')
    forceOnline = kwargs.get('ForceOnline', False)

    timingType = flags.Tile.TimingType

    if timingType not in ['PHY', 'LAS', 'GAP/LAS', 'CIS']:
        raise (Exception("Invalid Tile timing type: %s" % timingType))

    name = timing + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            onlineTimingFolder = '/TILE/ONL01/TIME/CHANNELOFFSET/' + timingType
        else:
            if timingType == 'GAP/LAS':
                raise (Exception("No Tile GAP/LAS timing in DB: %s" %
                                 flags.IOVDb.DatabaseInstance))

            onlineTimingFolder = '/TILE/OFL01/TIME/CHANNELOFFSET/' + timingType

        if forceOnline:
            timingFolder = folders.add(onlineTimingFolder, 'TILE')
        else:
            timingFolder = folders.addSplitOnline(
                onlineTimingFolder,
                '/TILE/OFL02/TIME/CHANNELOFFSET/' + timingType)

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        timingProxy = TileCondProxyCoolFlt('TileCondProxyCool_AdcOffset',
                                           Source=timingFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        fileExtention = {'PHY': 'tcphy', 'LAS': 'tclas', 'CIS': 'tccis'}

        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        timingProxy = TileCondProxyFileFlt('TileCondProxyFile_AdcOffset',
                                           Source='TileDefault.' +
                                           fileExtention[timingType])
    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")
    timingCondAlg = TileCalibFltCondAlg(name=name,
                                        ConditionsProxy=timingProxy,
                                        TileCalibData=timing)

    acc.addCondAlgo(timingCondAlg)

    return acc
Example #11
0
def TileOFCCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile OFC conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile OFC conditions (COOL, FILE). Defaults to COOL.
        TileOfc -- name of Tile OFC conditions object starts with. Defaults to TileOfc. 
        OfcType -- type of Tile OFC. Defaults to OF2. Possible OFC types: OF1, OF2.
    """

    acc = ComponentAccumulator()

    runType = flags.Tile.RunType
    runType = runType.upper()
    if runType not in ['PHY', 'PED', 'CIS', 'MONOCIS', 'LAS', 'BILAS']:
        raise (Exception("Invalid Tile run type: %s" % runType))

    actualRunType = {
        'PHY': 'PHY',
        'PED': 'PHY',
        'LAS': 'LAS',
        'BILAS': 'LAS',
        'CIS': 'CIS',
        'MONOCIS': 'CIS'
    }

    runType = actualRunType.get(runType, runType)

    source = kwargs.get('Source', 'COOL')
    ofc = kwargs.get('TileOfc', 'TileOfc')
    ofcType = kwargs.get('OfcType', 'OF2')

    ofcType = ofcType.upper()
    if ofcType not in ['OF1', 'OF2']:
        raise (Exception("Invalid Tile OFC type: %s" % ofcType))

    name = ofc + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        ofcType = ofcType + '/' + runType

        runNumber = flags.Input.RunNumber[0]
        runSplitOnline = 314449  #Use OFC stored in online folder for all runs before 2017
        if flags.IOVDb.DatabaseInstance == 'CONDBR2' and runType == 'PHY' and runNumber > runSplitOnline:
            ofcFolder = folders.addSplitOnline('/TILE/ONL01/FILTER/' + ofcType,
                                               '/TILE/OFL02/FILTER/' + ofcType)
        else:
            ofcFolder = folders.addSplitMC('/TILE/ONL01/FILTER/' + ofcType,
                                           '/TILE/ONL01/FILTER/' + ofcType)

        TileCondProxyCoolOfc = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerOfc>")
        ofcProxy = TileCondProxyCoolOfc('TileCondProxyCool_Ofc',
                                        Source=ofcFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibOfcCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerOfc>")
    ofcCondAlg = TileCalibOfcCondAlg(name=name,
                                     ConditionsProxy=ofcProxy,
                                     TileCalibData=ofc)

    acc.addCondAlgo(ofcCondAlg)

    return acc
Example #12
0
def CaloBCIDCoeffsCondAlgCfg(flags):
    result = ComponentAccumulator()

    from LArRecUtils.LArRecUtilsConfig import LArMCSymCondAlgCfg
    result.merge(LArMCSymCondAlgCfg(flags))

    if flags.Input.isMC is False:
        #For data, the regular shape is the 4-sample one used to Q-factor computation by LArRawChannelBuilder
        #Here we need a 32-sample, symmetrized shape. Therfore the re-key'ing and the dedicated LArPileUpShapeSymCondAlg

        if flags.Common.isOnline:
            result.merge(
                addFolderList(
                    flags,
                    (('/LAR/LArPileup/LArPileupShape<key>LArShape32</key>',
                      'LAR_ONL', 'LArShape32MC'),
                     ('/LAR/LArPileup/LArPileupAverage', 'LAR_ONL',
                      'LArMinBiasAverageMC'))))
        else:
            result.merge(
                addFolderList(
                    flags,
                    (('/LAR/ElecCalibOfl/LArPileupShape<key>LArShape32</key>',
                      'LAR_OFL', 'LArShape32MC'),
                     ('/LAR/ElecCalibOfl/LArPileupAverage', 'LAR_OFL',
                      'LArMinBiasAverageMC'))))

        LArMinBiasAverageSymAlg = CompFactory.getComp(
            "LArSymConditionsAlg<LArMinBiasAverageMC,LArMinBiasAverageSym>")
        result.addCondAlgo(
            LArMinBiasAverageSymAlg("LArPileUpAvgSymCondAlg",
                                    ReadKey="LArPileupAverage",
                                    WriteKey="LArPileupAverageSym"))

        LArShapeSymAlg = CompFactory.getComp(
            "LArSymConditionsAlg<LArShape32MC,LArShape32Sym>")
        result.addCondAlgo(
            LArShapeSymAlg("LArPileUpShapeSymCondAlg",
                           ReadKey="LArShape32",
                           WriteKey="LArShape32Sym"))

        ShapeKey = 'LArShape32Sym'
    else:
        from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
        from LArRecUtils.LArRecUtilsConfig import LArOFCCondAlgCfg, LArAutoCorrTotalCondAlgCfg

        result.merge(LArADC2MeVCondAlgCfg(flags))
        result.merge(LArOFCCondAlgCfg(flags))
        result.merge(LArAutoCorrTotalCondAlgCfg(flags))

        result.merge(
            addFolderList(
                flags, (('/LAR/ElecCalibMC/Shape', 'LAR_OFL', 'LArShape32MC'),
                        ('/LAR/ElecCalibMC/LArPileupAverage', 'LAR_OFL',
                         'LArMinBiasAverageMC'))))

        LArMinBiasAverageSymAlg = CompFactory.getComp(
            "LArSymConditionsAlg<LArMinBiasAverageMC,LArMinBiasAverageSym>")
        result.addCondAlgo(
            LArMinBiasAverageSymAlg("LArPileUpAvgSymCondAlg",
                                    ReadKey="LArPileupAverage",
                                    WriteKey="LArPileupAverageSym"))

        ShapeKey = 'LArShapeSym'

    CaloBCIDCoeffsCondAlg = CompFactory.CaloBCIDCoeffsCondAlg  # CaloRec
    alg = CaloBCIDCoeffsCondAlg('CaloBCIDCoeffsCondAlg',
                                MCSymKey='LArMCSym',
                                OFCKey='LArOFC',
                                ShapeKey=ShapeKey,
                                MinBiasAvgKey='LArPileupAverageSym',
                                OutputCoeffsKey='CaloBCIDCoeffs')
    result.addCondAlgo(alg)

    return result
Example #13
0
def TileSampleNoiseCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile sample noise conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile sample noise conditions (COOL, FILE). Defaults to COOL.
        ForceOnline -- flag to use online sample noise in offline. Defaults to False.
        TileSampleNoise -- name of Tile sample noise conditions object. 
                           Defaults to TileOnlineSampleNoise if ForceOnline else TileSampleNoise.
    """

    acc = ComponentAccumulator()

    source = kwargs.get('Source', 'COOL')
    sampleNoise = kwargs.get('TileSampleNoise', 'TileSampleNoise')
    forceOnline = kwargs.get('ForceOnline', False)

    name = sampleNoise + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            onlineSampleNoiseFolder = '/TILE/ONL01/NOISE/SAMPLE'
        else:
            onlineSampleNoiseFolder = '/TILE/OFL01/NOISE/SAMPLE'

        if forceOnline:
            sampleNoiseFolder = folders.add(onlineSampleNoiseFolder, 'TILE')
        else:
            sampleNoiseFolder = folders.addSplitOnline(
                onlineSampleNoiseFolder, '/TILE/OFL02/NOISE/SAMPLE')

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        sampleNoiseProxy = TileCondProxyCoolFlt(
            'TileCondProxyCool_NoiseSample', Source=sampleNoiseFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        sampleNoiseProxy = TileCondProxyFileFlt(
            'TileCondProxyFile_NoiseSample', Source='TileDefault.ped')

    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")
    sampleNoiseCondAlg = TileCalibFltCondAlg(name=name,
                                             ConditionsProxy=sampleNoiseProxy,
                                             TileCalibData=sampleNoise)

    acc.addCondAlgo(sampleNoiseCondAlg)

    return acc
Example #14
0
def TilePulseShapeCondAlgCfg(flags, **kwargs):
    """Return component accumulator with configured Tile pulse shape conditions algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    Keyword arguments:
        Source -- source of Tile pulse shape conditions (COOL, FILE). Defaults to COOL.
        TilePulseShape -- name of Tile pulse shape conditions object. Defaults to TilePulseShape.
        PulseType -- type of Tile pulse shape. Defaults to run type (PED->PHY, BILAS->LAS).
                     Possible Tile pulse shape types:
                        PHY, LAS, CIS/PULSE100, CIS/PULSE5P2, CIS/LEAK100, CIS/LEAK5P2, MURCV.
    """

    acc = ComponentAccumulator()

    runType = flags.Tile.RunType
    runType = runType.upper()
    if runType not in ['PHY', 'PED', 'CIS', 'MONOCIS', 'LAS', 'BILAS']:
        raise (Exception("Invalid Tile run type: %s" % runType))

    source = kwargs.get('Source', 'COOL')
    pulseShape = kwargs.get('TilePulseShape', 'TilePulseShape')
    pulseType = kwargs.get('PulseType', runType)

    actualPulseType = {
        'PHY': 'PHY',
        'PED': 'PHY',
        'LAS': 'LAS',
        'BILAS': 'LAS',
        'CISPULSE100': 'CIS/PULSE100',
        'CISPULSE5P2': 'CIS/PULSE5P2',
        'CISLEAK100': 'CIS/LEAK100',
        'CISLEAK5P2': 'CIS/LEAK5P2'
    }

    pulse = actualPulseType.get(pulseType, pulseType)

    if pulse not in [
            'PHY', 'LAS', 'CIS/PULSE100', 'CIS/PULSE5P2', 'CIS/LEAK100',
            'CIS/LEAK5P2', 'MURCV'
    ]:
        raise (Exception("Invalid Tile pulse shape type: %s" % pulse))

    name = pulseShape + 'CondAlg'

    if source == 'COOL':
        # Connect COOL Tile conditions proxies to the algorithm (default)

        if pulse in ['MURCV']:
            raise (Exception('No Tile pulse shape [%s] in source: %s' %
                             (pulse, source)))

        from TileConditions.TileFolders import TileFolders
        folders = TileFolders(isMC=flags.Input.isMC,
                              isOnline=flags.Common.isOnline)

        if flags.IOVDb.DatabaseInstance == 'CONDBR2':
            if not flags.Common.isOnline:
                pulseFolder = folders.add('/TILE/OFL02/PULSESHAPE/' + pulse,
                                          'TILE_OFL')
            else:
                raise (Exception('No Tile pulse shapes in online CONDBR2'))
        else:
            pulseFolder = folders.addSplitOnline(
                '/TILE/OFL01/PULSESHAPE/' + pulse,
                '/TILE/OFL02/PULSESHAPE/' + pulse)

        TileCondProxyCoolFlt = CompFactory.getComp(
            "TileCondProxyCool<TileCalibDrawerFlt>")
        pulseProxy = TileCondProxyCoolFlt('TileCondProxyCool_PulseShape',
                                          Source=pulseFolder)

        from IOVDbSvc.IOVDbSvcConfig import addFolderList
        acc.merge(addFolderList(flags, folders.get()))

    elif source == 'FILE':
        # Connect FILE Tile conditions proxies to the algorithm
        fileExtention = {
            'PHY': 'plsPhy',
            'LAS': 'plsLas',
            'MURCV': 'plsMuRcv',
            'CIS/PULSE100': 'plsCisPulse100',
            'CIS/PULSE5P2': 'plsCisPulse5p2',
            'CIS/LEAK100': 'plsCisLeak100',
            'CIS/LEAK5P2': 'plsCisLeak5p2'
        }

        TileCondProxyFileFlt = CompFactory.getComp(
            "TileCondProxyFile<TileCalibDrawerFlt>")
        pulseProxy = TileCondProxyFileFlt('TileCondProxyFile_PulseShape',
                                          Source='TileDefault.' +
                                          fileExtention[pulse])
    else:
        raise (Exception("Invalid source: %s" % source))

    TileCalibFltCondAlg = CompFactory.getComp(
        "TileCalibCondAlg<TileCalibDrawerFlt>")
    pulseShapeCondAlg = TileCalibFltCondAlg(name=name,
                                            ConditionsProxy=pulseProxy,
                                            TileCalibData=pulseShape)

    acc.addCondAlgo(pulseShapeCondAlg)

    return acc