예제 #1
0
def BunchLumisCondAlgCfg(configFlags):
    name = 'BunchLumisCondAlg'
    result = ComponentAccumulator()

    # Should only be used for Run 1.
    if configFlags.IOVDb.DatabaseInstance != 'COMP200':
        return result

    folder = '/TDAQ/OLC/BUNCHLUMIS'
    if configFlags.Detector.Overlay:
        # Load reduced channel list for overlay jobs to try to reduce COOL access
        # Need Lucid AND, OR, HitOR, BcmH OR, BcmV OR
        folder = '<channelSelection>101,102,103,201,211</channelSelection> ' + folder

    result.merge(
        addFolders(configFlags,
                   folder,
                   'TDAQ',
                   className='CondAttrListCollection'))

    from CoolLumiUtilities.FillParamsCondAlgConfig import FillParamsCondAlgCfg
    result.merge(FillParamsCondAlgCfg(configFlags))
    fpalg = result.getCondAlgo('FillParamsCondAlg')

    BunchLumisCondAlg = CompFactory.BunchLumisCondAlg
    alg = BunchLumisCondAlg(name,
                            BunchLumisFolderInputKey=folder,
                            FillParamsInputKey=fpalg.FillParamsOutputKey,
                            BunchLumisOutputKey='BunchLumisCondData')

    result.addCondAlgo(alg)
    return result
예제 #2
0
def BadLBFilterAlgCfg(inputFlags,name, defects, writekey, ignoreRecoverable=False, origDbTag=None):
    log = logging.getLogger('BadLBFilterAlgCfg')
    result=ComponentAccumulator()

    from DQDefects import DefectsDB
    ddb = DefectsDB('COOLOFL_GLOBAL/' + inputFlags.IOVDb.DatabaseInstance, 
                    tag=origDbTag or inputFlags.IOVDb.GlobalTag)

    primary_defects = set()
    for defect in defects:
        if defect in ddb.defect_names:
            primary_defects.add(defect)
        elif defect in ddb.virtual_defect_names:
            primary_defects |= ddb.virtual_defect_logics(defect).primary_defects
        else:
            raise ValueError('%s is not a known defect' % defect)
        
    log.info ("Algorithm %s configured with intolerable defects %s" % (name, list(primary_defects)))

    primary_defect_ids = [ddb.defect_id_map[id] for id in primary_defects]

    monFilterAlg =CompFactory.DQBadLBFilterAlg(name)
    monFilterAlg.defectList = primary_defect_ids
    monFilterAlg.ignoreRecoverable = ignoreRecoverable
    monFilterAlg.WriteKey = writekey

    from IOVDbSvc.IOVDbSvcConfig import addFolders

    if not inputFlags.Input.isMC:
        result.merge(addFolders(inputFlags,'/GLOBAL/DETSTATUS/DEFECTS',detDb='GLOBAL_OFL',className='CondAttrListCollection'))

    result.addCondAlgo(monFilterAlg)
    return result
예제 #3
0
def HLTPrescaleCondAlgCfg(flags):
    log = logging.getLogger('TrigConfigSvcCfg')
    log.info("Setting up HLTPrescaleCondAlg")
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()
    TrigConf__HLTPrescaleCondAlg = CompFactory.getComp(
        "TrigConf::HLTPrescaleCondAlg")
    hltPrescaleCondAlg = TrigConf__HLTPrescaleCondAlg("HLTPrescaleCondAlg")

    tc = getTrigConfigFromFlag(flags)
    hltPrescaleCondAlg.Source = tc["source"]
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    if athenaCommonFlags.isOnline():
        from IOVDbSvc.IOVDbSvcConfig import addFolders
        acc.merge(
            addFolders(flags,
                       getHLTPrescaleFolderName(),
                       "TRIGGER_ONL",
                       className="AthenaAttributeList"))
        log.info("Adding folder %s to CompAcc", getHLTPrescaleFolderName())
    if tc["source"] == "COOL":
        hltPrescaleCondAlg.TriggerDB = tc["dbconn"]
    elif tc["source"] == "DB":
        hltPrescaleCondAlg.TriggerDB = tc["dbconn"]
        hltPrescaleCondAlg.HLTPsk = tc["hltpsk"]
    elif tc["source"] == "FILE":
        hltPrescaleCondAlg.Filename = getHLTPrescalesSetFileName(flags)
    else:
        raise RuntimeError(
            "trigger configuration flag 'trigConfig' starts with %s, which is not understood"
            % tc["source"])
    acc.addCondAlgo(hltPrescaleCondAlg)
    return acc
예제 #4
0
def TrigLiveFractionCondAlgCfg(configFlags):
    name = 'TrigLiveFractionCondAlg'
    result = ComponentAccumulator()

    kwargs = {}
    if configFlags.IOVDb.DatabaseInstance == 'COMP200':
        folder = '/TRIGGER/LUMI/PerBcidDeadtime'

        # Mistakenly created as multi-version folder, must specify HEAD
        result.merge(
            addFolders(configFlags,
                       folder,
                       'TRIGGER',
                       tag='HEAD',
                       className='AthenaAttributeList'))

        kwargs['DeadtimeFolderInputKey'] = folder
        kwargs['LuminosityInputKey'] = 'LuminosityCondData'

        from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg
        result.merge(LuminosityCondAlgCfg(configFlags))

    else:
        kwargs['DeadtimeFolderInputKey'] = ''
        kwargs['LuminosityInputKey'] = ''

    TrigLiveFractionCondAlg = CompFactory.TrigLiveFractionCondAlg
    alg = TrigLiveFractionCondAlg(
        name, TrigLiveFractionOutputKey='TrigLiveFractionCondData', **kwargs)
    result.addCondAlgo(alg)
    return result
예제 #5
0
def RpcCondDbAlgCfg(flags, **kwargs):
    result = ComponentAccumulator()
    folders = []
    if flags.Common.isOnline:
        return result  ## avoid adding algo to the component accumulator
        kwargs["isOnline"] = True
    else:
        kwargs["isOnline"] = False
        if flags.Input.isMC:
            kwargs['isData'] = False
            kwargs['ReadKey_DA_DP'] = ''
            kwargs['ReadKey_DA_OP'] = ''
        else:
            kwargs['isData'] = True
            kwargs['isRun1'] = flags.IOVDb.DatabaseInstance == 'COMP200'
            folders = ["/RPC/DCS/DeadRopanels", "/RPC/DCS/OffRopanels"]
    alg = RpcCondDbAlg(**kwargs)
    result.merge(
        addFolders(flags,
                   folders,
                   detDb="DCS_OFL",
                   className='CondAttrListCollection'))
    result.merge(
        addFolders(flags, ["/RPC/DQMF/ELEMENT_STATUS"],
                   detDb="RPC_OFL",
                   className='CondAttrListCollection'))
    result.addCondAlgo(alg)
    return result
예제 #6
0
def SCT_MonitorConditionsToolCfg(flags,
                                 name="InDetSCT_MonitorConditionsTool",
                                 cond_kwargs={},
                                 **kwargs):
    cond_kwargs.setdefault("Folder", "/SCT/Derived/Monitoring")
    cond_kwargs.setdefault("dbInstance", "SCT_OFL")
    cond_kwargs.setdefault("MonitorCondAlgName", "SCT_MonitorCondAlg")

    result = ComponentAccumulator()

    if "FolderDb" not in cond_kwargs:
        cond_kwargs["FolderDb"] = cond_kwargs["Folder"]
    result.merge(
        addFolders(flags,
                   cond_kwargs["FolderDb"],
                   cond_kwargs["dbInstance"],
                   className="CondAttrListCollection"))

    result.addCondAlgo(
        CompFactory.SCT_MonitorCondAlg(name=cond_kwargs["MonitorCondAlgName"],
                                       ReadKey=cond_kwargs["Folder"]))

    tool = CompFactory.SCT_MonitorConditionsTool(name, **kwargs)
    result.setPrivateTools(tool)

    return result
예제 #7
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
예제 #8
0
def _larCablingCfg(configFlags, algo, folder):
    result = ComponentAccumulator()

    result.merge(IOVDbSvcCfg(configFlags))

    #MC folder-tag hack (See also ATCONDDB-49)
    tagsperFolder = {
        "/LAR/Identifier/OnOffIdMap": "LARIdentifierOnOffIdMap-012",
        "/LAR/Identifier/FebRodMap": "LARIdentifierFebRodMap-005",
        "/LAR/Identifier/CalibIdMap": "LARIdentifierCalibIdMap-012",
        "/LAR/IdentifierOfl/OnOffIdMap_SC": "LARIdentifierOflOnOffIdMap_SC-000"
    }

    if configFlags.Input.isMC:
        db = 'LAR_OFL'
        if folder in tagsperFolder:
            ft = tagsperFolder[folder]
            folderwithtag = folder + "<tag>" + ft + "</tag>"
    else:
        db = 'LAR_ONL'
        folderwithtag = folder

    result.addCondAlgo(algo(ReadKey=folder), primary=True)
    result.merge(
        addFolders(configFlags,
                   folderwithtag,
                   className="AthenaAttributeList",
                   detDb=db))
    #print (result)
    return result
예제 #9
0
def LArKnownBadFebCfg(configFlags, tag=""):
    result = ComponentAccumulator()

    if configFlags.GeoModel.Run == "RUN1":
        foldername = ""
    else:
        if configFlags.Common.isOnline or configFlags.Input.isMC:
            foldername = "/LAR/BadChannels/KnownBADFEBs"
        else:
            foldername = "/LAR/BadChannelsOfl/KnownBADFEBs"
        pass

        if configFlags.Common.isOnline:
            dbname = "LAR"
        else:
            dbname = "LAR_OFL"
        pass
    pass

    result.merge(
        addFolders(configFlags,
                   foldername + tag,
                   detDb=dbname,
                   className="AthenaAttributeList"))
    result.addCondAlgo(
        LArBadFebCondAlg("LArKonwnBadFebCondAlg",
                         ReadKey=foldername,
                         WriteKey="LArKnownBadFEBs"))
    return result
예제 #10
0
def ToolConstantsCondAlgCfg(flags, key, DetStoreKey='', COOLFolder=''):
    """Configure a conditions algorithm to convert inline COOL data or detector store data to ToolConstants.
    KEY is also the key of the output conditions object.
    For reading from COOL inline data, COOLFOLDER gives the name
    of the COOL folder; the dta are given by KEY within the folder.
    The caller should register the folder with IOVDbSvc.
    For copying a ToolConstants object from the detector store,
    set DETSTOREKEY to the key of the object to copy."""

    if ((DetStoreKey == '' and COOLFolder == '')
            or (DetStoreKey != '' and COOLFolder != '')):
        raise RuntimeError(
            "ToolConstantsCondAlgCfg: For key " + key +
            ", exactly one of DetStoreKey or COOLFolder must be specified")

    result = ComponentAccumulator()

    name = 'ToolConstantsCondAlg_' + key

    ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg  # CaloRec
    alg = ToolConstantsCondAlg(name,
                               COOLFolderKey=COOLFolder,
                               ToolConstantsKey=key,
                               DetStoreKey=DetStoreKey)
    result.addCondAlgo(alg)

    return result
예제 #11
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
예제 #12
0
def regSelToolCfg(flags, detector, CondAlg, CablingConfigCfg=0):
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    ca = ComponentAccumulator()
    if (CablingConfigCfg != 0):
        ca.merge(CablingConfigCfg(flags))
    ca.setPrivateTools(_createRegSelTool(detector, True))
    ca.addCondAlgo(_createRegSelCondAlg(detector, CondAlg))
    return ca
예제 #13
0
def SCT_CablingCondAlgCfg(configFlags):
    cfg=ComponentAccumulator()
    foldersCfg,path=SCT_CablingFoldersCfg(configFlags)
    cfg.merge(foldersCfg)
    SCT_CablingCondAlgFromCoraCool=CompFactory.SCT_CablingCondAlgFromCoraCool
    cfg.addCondAlgo(SCT_CablingCondAlgFromCoraCool(ReadKeyRod=path+"ROD",
                                                   ReadKeyRodMur=path+"RODMUR",
                                                   ReadKeyMur=path+"MUR",
                                                   ReadKeyGeo=path+"Geog"))
    return cfg
예제 #14
0
def SCT_SiPropertiesCfg(flags, name="SCTSiPropertiesCondAlg", **kwargs):
    """Return configured ComponentAccumulator and tool for SCT_SiProperties

    SiConditionsTool and/or SiPropertiesTool may be provided in kwargs
    """
    acc = ComponentAccumulator()
    tool = kwargs.get("SiPropertiesTool", SCT_SiPropertiesToolCfg(flags))
    alg = SCTSiPropertiesCondAlg(name, **kwargs)
    acc.addCondAlgo(alg)
    acc.setPrivateTools(tool)
    return acc
예제 #15
0
def TRTStrawCondAlgCfg(flags, name="TRTStrawCondAlg"):
    """Return a ComponentAccumulator for TRTStrawCondAlg algorithm"""
    acc = ComponentAccumulator()
    trtStrawStatusSummaryTool = acc.popToolsAndMerge(
        TRT_StrawStatusSummaryToolCfg(flags))
    # Alive straws algorithm
    TRTStrawCondAlg = CompFactory.TRTStrawCondAlg
    acc.addCondAlgo(
        TRTStrawCondAlg(name="TRTStrawCondAlg",
                        TRTStrawStatusSummaryTool=trtStrawStatusSummaryTool,
                        isGEANT4=flags.Detector.Simulate))
    return acc
예제 #16
0
def BeamSpotCondAlgCfg(flags, name="BeamSpotCondAlg", **kwargs):
    """Configure the BeamSpotCondAlg."""
    acc = ComponentAccumulator()

    from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
    acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Beampos",
                                    "/Indet/Beampos", className="AthenaAttributeList"))

    BeamSpotCondAlg = CompFactory.BeamSpotCondAlg
    acc.addCondAlgo(BeamSpotCondAlg(name, **kwargs))

    return acc
예제 #17
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
예제 #18
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
예제 #19
0
def ActsAlignmentCondAlgCfg(configFlags,
                            name="ActsAlignmentCondAlg",
                            **kwargs):
    result = ComponentAccumulator()

    acc = ActsTrackingGeometrySvcCfg(configFlags)
    result.merge(acc)

    Acts_ActsAlignmentCondAlg = CompFactory.ActsAlignmentCondAlg
    actsAlignmentCondAlg = Acts_ActsAlignmentCondAlg(name, **kwargs)
    result.addCondAlgo(actsAlignmentCondAlg)

    return result
예제 #20
0
def LumiBlockMuWriterCfg(configFlags, name='LumiBlockMuWriter'):
    result = ComponentAccumulator()

    if configFlags.Beam.Type == 'cosmics':
        condkey = ''
    else:
        from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg
        result.merge(LuminosityCondAlgCfg(configFlags))
        condkey = result.getCondAlgo('LuminosityCondAlg').LuminosityOutputKey

    LumiBlockMuWriter = CompFactory.LumiBlockMuWriter  # LumiBlockComps
    alg = LumiBlockMuWriter(name, LumiDataKey=condkey)
    result.addCondAlgo(alg)
    return result
예제 #21
0
def PixelSiPropertiesCfg(flags, name="PixelSiPropertiesCondAlg", **kwargs):
    """Return configured ComponentAccumulator and tool for PixelSiPropertiesCondAlg

    SiPropertiesTool may be provided in kwargs
    """
    acc = ComponentAccumulator()
    acc.merge(PixelDCSCondHVAlgCfg(flags))
    acc.merge(PixelDCSCondTempAlgCfg(flags))
    acc.merge(PixelDCSCondStateAlgCfg(flags))
    acc.merge(PixelDCSCondStatusAlgCfg(flags))
    tool = kwargs.get("SiPropertiesTool", PixelSiPropertiesToolCfg(flags))
    acc.addCondAlgo(PixelSiPropertiesCondAlg(name, **kwargs))
    acc.setPrivateTools(tool)
    return acc
예제 #22
0
def LArHVDBCfg(configFlags):

   result=ComponentAccumulator()
   result.merge(IOVDbSvcCfg(configFlags))

   isMC=configFlags.Input.isMC
   isOnline=configFlags.Common.isOnline

   if not isMC and not isOnline:
      result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREl/I16","/LAR/DCS/HV/BARREL/I8"],detDb="DCS_OFL",className="CondAttrListCollection"))
      result.merge(addFolders(configFlags,["/LAR/IdentifierOfl/HVLineToElectrodeMap","/LAR/HVPathologiesOfl/Pathologies"],detDb="LAR_OFL",className="AthenaAttributeList"))
 
      from LArRecUtils.LArRecUtilsConf import LArHVIdMappingAlg
      result.addCondAlgo(LArHVIdMappingAlg(ReadKey="/LAR/IdentifierOfl/HVLineToElectrodeMap",WriteKey="LArHVIdMap"))
 
      from LArRecUtils.LArRecUtilsConf import LArHVPathologyDbCondAlg
      result.addCondAlgo(LArHVPathologyDbCondAlg(PathologyFolder="/LAR/HVPathologiesOfl/Pathologies",HVMappingKey="LArHVIdMap", HVPAthologyKey="LArHVPathology"))
 
      from LArRecUtils.LArRecUtilsConf import LArHVCondAlg
      result.addCondAlgo(LArHVCondAlg(HVPathologies="LArHVPathology",OutputHVData="LArHVData"))
 
      from LArRecUtils.LArRecUtilsConf import LArHVScaleCorrCondAlg
      hvscale = LArHVScaleCorrCondAlg(keyHVdata="LArHVData",keyOutputCorr="LArHVScaleCorrRecomputed")
      hvscale.UndoOnlineHVCorr=True
      result.addCondAlgo(hvscale)

   if isMC:
      result.merge(addFolders(configFlags,detDb="LAR_OFL",folders=["/LAR/Identifier/HVLineToElectrodeMap<tag>LARHVLineToElectrodeMap-001</tag>"],className="AthenaAttributeList"))

   return result
예제 #23
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
예제 #24
0
def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs):
    """Return a ComponentAccumulator configured for SiliconConditions DB

    DCSConditionsTool may be provided in kwargs
    """
    acc = ComponentAccumulator()
    CondArgs = {}
    DCSConditionsTool = kwargs.get("DCSConditionsTool")
    if DCSConditionsTool:
        CondArgs["UseState"] = DCSConditionsTool.ReadAllDBFolders
        CondArgs["DCSConditionsTool"] = DCSConditionsTool
    acc.addCondAlgo(SCT_SiliconHVCondAlg(name=name + "HVCondAlg", **CondArgs))
    acc.addCondAlgo(
        SCT_SiliconTempCondAlg(name=name + "TempCondAlg", **CondArgs))
    return acc
예제 #25
0
def MDTCablingConfigCfg(flags):
    acc = ComponentAccumulator()

    acc.merge(MuonGeoModelCfg(flags))

    MuonMDT_CablingAlg = CompFactory.MuonMDT_CablingAlg
    MDTCablingAlg = MuonMDT_CablingAlg("MuonMDT_CablingAlg")

    MuonMDT_CablingSvc = CompFactory.MuonMDT_CablingSvc
    mdtCablingSvc = MuonMDT_CablingSvc()
    mdtCablingSvc.UseOldCabling = False
    mdtCablingSvc.ForcedUse = True

    MDTCablingDbTool = CompFactory.MDTCablingDbTool
    MDTCablingDbTool = MDTCablingDbTool()

    from IOVDbSvc.IOVDbSvcConfig import addFolders
    if flags.Input.isMC is True:
        MDTCablingDbTool.MapFolders = "/MDT/Ofl/CABLING/MAP_SCHEMA"
        MDTCablingDbTool.MezzanineFolders = "/MDT/Ofl/CABLING/MEZZANINE_SCHEMA"
        MDTCablingAlg.MapFolders = "/MDT/Ofl/CABLING/MAP_SCHEMA"
        MDTCablingAlg.MezzanineFolders = "/MDT/Ofl/CABLING/MEZZANINE_SCHEMA"
        acc.merge(
            addFolders(flags, [
                "/MDT/Ofl/CABLING/MAP_SCHEMA",
                "/MDT/Ofl/CABLING/MEZZANINE_SCHEMA"
            ],
                       'MDT_OFL',
                       className="CondAttrListCollection"))
    else:
        MDTCablingDbTool.MapFolders = "/MDT/CABLING/MAP_SCHEMA"
        MDTCablingDbTool.MezzanineFolders = "/MDT/CABLING/MEZZANINE_SCHEMA"
        MDTCablingAlg.MapFolders = "/MDT/CABLING/MAP_SCHEMA"
        MDTCablingAlg.MezzanineFolders = "/MDT/CABLING/MEZZANINE_SCHEMA"
        acc.merge(
            addFolders(
                flags,
                ["/MDT/CABLING/MAP_SCHEMA", "/MDT/CABLING/MEZZANINE_SCHEMA"],
                'MDT',
                className="CondAttrListCollection"))

    acc.addCondAlgo(MDTCablingAlg)
    acc.addPublicTool(MDTCablingDbTool)
    mdtCablingSvc.DBTool = MDTCablingDbTool

    acc.addService(mdtCablingSvc, primary=True)

    return acc
예제 #26
0
def LBDurationCondAlgCfg (configFlags):
    name = 'LBDurationCondAlg'
    result = ComponentAccumulator()

    from IOVDbSvc.CondDB import conddb   # noqa: F401
    folder = "/TRIGGER/LUMI/LBLB"
    result.merge (addFolders (configFlags, folder, 'TRIGGER',
                              className = 'AthenaAttributeList'))

    LBDurationCondAlg=CompFactory.LBDurationCondAlg
    alg = LBDurationCondAlg (name,
                             LBLBFolderInputKey = folder,
                             LBDurationOutputKey = 'LBDurationCondData')

    result.addCondAlgo (alg)
    return result
예제 #27
0
def SCT_ReadCalibChipDataCfg(flags, name="SCT_ReadCalibChip", **kwargs):
    """Return configured ComponentAccumulator with SCT_ReadCalibChipDataCfg tool

    Accepts optional noiseFolder and gainFolder keyword arguments
    """
    acc = ComponentAccumulator()
    # folders
    noiseFolder = kwargs.get("noiseFolder", "/SCT/DAQ/Calibration/ChipNoise")
    gainFolder = kwargs.get("gainFolder", "/SCT/DAQ/Calibration/ChipGain")
    if flags.Overlay.DataOverlay:
        forceDb = "OFLP200"
        noiseTag = "SctDaqCalibrationChipNoise-Apr10-01"
        gainTag = "SctDaqCalibrationChipGain-Apr10-01"
    else:
        forceDb = None
        noiseTag = None
        gainTag = None

    acc.merge(
        addFoldersSplitOnline(flags,
                              "SCT",
                              noiseFolder,
                              noiseFolder,
                              "CondAttrListCollection",
                              forceDb=forceDb,
                              tag=noiseTag))
    acc.merge(
        addFoldersSplitOnline(flags,
                              "SCT",
                              gainFolder,
                              gainFolder,
                              "CondAttrListCollection",
                              forceDb=forceDb,
                              tag=gainTag))

    # Algorithms
    noiseAlg = SCT_ReadCalibChipNoiseCondAlg(name=name + "NoiseCondAlg",
                                             ReadKey=noiseFolder)
    acc.addCondAlgo(noiseAlg)
    gainAlg = SCT_ReadCalibChipGainCondAlg(name=name + "GainCondAlg",
                                           ReadKey=gainFolder)
    acc.addCondAlgo(gainAlg)
    tool = kwargs.get("ReadCalibChipDataTool",
                      SCT_ReadCalibChipDataToolCfg(flags))
    acc.setPrivateTools(tool)
    return acc
예제 #28
0
def RPCCablingConfigCfg(flags):
    acc = ComponentAccumulator()

    # TODO check if we actually need this here?
    acc.merge(MuonGeoModelCfg(flags))

    RpcCablingCondAlg = CompFactory.RpcCablingCondAlg
    RpcCablingAlg = RpcCablingCondAlg("RpcCablingCondAlg")
    acc.addCondAlgo(RpcCablingAlg)

    RPCcablingServerSvc = CompFactory.RPCcablingServerSvc
    RPCCablingSvc = RPCcablingServerSvc()
    RPCCablingSvc.Atlas = True
    RPCCablingSvc.forcedUse = True
    RPCCablingSvc.useMuonRPC_CablingSvc = True  #Needed to switch to new cabling
    acc.addService(RPCCablingSvc)

    MuonRPC_CablingSvc = CompFactory.MuonRPC_CablingSvc
    rpcCablingSvc = MuonRPC_CablingSvc()
    rpcCablingSvc.ConfFileName = 'LVL1confAtlas.data'  # this should come from config flag maybe ???
    rpcCablingSvc.CorrFileName = 'LVL1confAtlas.corr'
    rpcCablingSvc.ConfFilePath = 'MuonRPC_Cabling/'
    rpcCablingSvc.RPCTriggerRoadsfromCool = True
    rpcCablingSvc.CosmicConfiguration = 'HLT' in flags.IOVDb.GlobalTag  # this was set to true by the modifier openThresholdRPCCabling in runHLT_standalone.py

    from IOVDbSvc.IOVDbSvcConfig import addFolders
    dbName = 'RPC_OFL' if flags.Input.isMC else 'RPC'
    acc.merge(
        addFolders(flags, [
            '/RPC/TRIGGER/CM_THR_ETA', '/RPC/TRIGGER/CM_THR_PHI',
            '/RPC/CABLING/MAP_SCHEMA', '/RPC/CABLING/MAP_SCHEMA_CORR'
        ],
                   dbName,
                   className='CondAttrListCollection'))

    RPCCablingDbTool = CompFactory.RPCCablingDbTool
    RPCCablingDbTool = RPCCablingDbTool()
    RPCCablingDbTool.MapConfigurationFolder = '/RPC/CABLING/MAP_SCHEMA'
    RPCCablingDbTool.MapCorrectionFolder = '/RPC/CABLING/MAP_SCHEMA_CORR'

    acc.addPublicTool(RPCCablingDbTool)
    rpcCablingSvc.TheRpcCablingDbTool = RPCCablingDbTool

    acc.addService(rpcCablingSvc, primary=True)

    return acc
예제 #29
0
def LuminosityCondAlgCfg(configFlags, useOnlineLumi=None, suffix=None):
    # This function, without the useOnlineLumi and suffix arguments,  will set up a default configuration
    # appropriate to the job; the conditions object will be called LuminosityCondData
    # Can override whether it sets up the online lumi (but then you are strongly urged to use the suffix
    # argument!)
    # Suffix will allow you to make an object with a different name, e.g. LuminosityCondDataOnline
    log = logging.getLogger('LuminosityCondAlgCfg')
    name = 'LuminosityCondAlg'
    result = ComponentAccumulator()

    if suffix is None: suffix = ''
    if useOnlineLumi is not None and suffix is None:
        log.warning(
            'useOnlineLumi argument is provided but not a suffix for the lumi object name. Is this really intended?'
        )

    if configFlags.Input.isMC:
        log.info("LuminosityCondAlgCfg called for MC!")
        kwargs = luminosityCondAlgMCCfg(configFlags, name, result)
    elif configFlags.Beam.Type != 'collisions':
        kwargs = luminosityCondAlgCosmicsCfg(configFlags, name, result)
    elif ((useOnlineLumi is None and configFlags.Common.useOnlineLumi)
          or (useOnlineLumi is not None and useOnlineLumi)):
        kwargs = luminosityCondAlgOnlineCfg(configFlags, name, result)
    elif configFlags.IOVDb.DatabaseInstance == 'COMP200':
        kwargs = luminosityCondAlgRun1Cfg(configFlags, name, result)
    elif configFlags.IOVDb.DatabaseInstance == 'CONDBR2':
        kwargs = luminosityCondAlgRun2Cfg(configFlags, name, result)

    else:
        log.warning(
            "LuminosityCondAlgCfg can't resolve database instance = %s, assume Run2!"
            % configFlags.IOVDb.DatabaseInstance)
        kwargs = luminosityCondAlgRun2Cfg(configFlags, name, result)

    LuminosityCondAlg = CompFactory.LuminosityCondAlg

    alg = LuminosityCondAlg(name,
                            LuminosityOutputKey='LuminosityCondData' + suffix,
                            **kwargs)

    result.addCondAlgo(alg)
    return result
예제 #30
0
def CscCondDbAlgCfg(flags, **kwargs):
    result = ComponentAccumulator()
    folders = [
        "/CSC/FTHOLD", "/CSC/NOISE", "/CSC/PED", "/CSC/PSLOPE", "/CSC/RMS",
        "/CSC/STAT", "/CSC/T0BASE", "/CSC/T0PHASE"
    ]
    scheme = "CSC_OFL"
    kwargs['ReadKey_HV'] = ''  # Never used at present
    if flags.Common.isOnline:
        kwargs["isOnline"] = True
        kwargs['isData'] = True
        kwargs[
            'ReadKey_FT'] = '/CSC/FTHOLD'  # 'ConditionsStore+' prefix not necessarily needed in ReadKey
        kwargs['ReadKey_NO'] = '/CSC/NOISE'
        kwargs['ReadKey_PD'] = '/CSC/PED'
        kwargs['ReadKey_PS'] = '/CSC/PSLOPE'
        kwargs['ReadKey_RM'] = '/CSC/RMS'
        kwargs['ReadKey_ST'] = '/CSC/STAT'
        kwargs['ReadKey_TB'] = ''
        kwargs['ReadKey_TP'] = ''
        folders = [
            "/CSC/ONL/FTHOLD", "/CSC/ONL/NOISE", "/CSC/ONL/PED",
            "/CSC/ONL/PSLOPE", "/CSC/ONL/RMS", "/CSC/ONL/STAT"
        ]
        scheme = "CSC_ONL"
    else:
        kwargs["isOnline"] = False
        if flags.Input.isMC:
            kwargs['isData'] = False
            kwargs['ReadKey_HV'] = ''
        else:
            kwargs['isData'] = True
            kwargs['isRun1'] = flags.IOVDb.DatabaseInstance == 'COMP200'
            kwargs[
                'ReadKey_HV'] = ''  # TODO: probably this should be removed once this folder is available
    alg = CscCondDbAlg(**kwargs)
    result.merge(
        addFolders(flags,
                   folders,
                   detDb=scheme,
                   className='CondAttrListCollection'))
    result.addCondAlgo(alg)
    return result