Пример #1
0
def TileMuonFitterCfg(flags, **kwargs):

    acc = ComponentAccumulator()

    kwargs.setdefault('DoHoughTransform', True)
    kwargs.setdefault('EThreshold', 250.0)
    kwargs.setdefault('BeamType', flags.Beam.Type)
    kwargs.setdefault('CaloCellContainer', 'AllCalo')

    if kwargs['DoHoughTransform']:
        kwargs.setdefault('name', 'TileMuonFitter')
        kwargs.setdefault('ComTimeKey', 'ComTimeTileMuon')
        kwargs.setdefault('TileCosmicMuonKey', 'TileCosmicMuonHT')
    else:
        kwargs.setdefault('name', 'TileMuonFitterMF')
        kwargs.setdefault('ComTimeKey', 'ComTimeTileMuonMF')
        kwargs.setdefault('TileCosmicMuonKey', 'TileCosmicMuonMF')

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    TileMuonFitter = CompFactory.TileMuonFitter
    acc.addEventAlgo(TileMuonFitter(**kwargs), primary=True)

    return acc
Пример #2
0
def TileL2BuilderCfg(flags, **kwargs):
    """Return component accumulator with configured private Tile L2 builder tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    kwargs.setdefault('name', 'TileL2Builder')
    kwargs.setdefault('TileRawChannelContainer', 'TileRawChannelCnt')

    acc = ComponentAccumulator()

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

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

    if 'TileBadChanTool' not in kwargs:
        from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
        badChannelsTool = acc.popToolsAndMerge(TileBadChanToolCfg(flags))
        kwargs['TileBadChanTool'] = badChannelsTool

    if 'TileCondToolEmscale' not in kwargs:
        from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
        emScaleTool = acc.popToolsAndMerge(TileCondToolEmscaleCfg(flags))
        kwargs['TileCondToolEmscale'] = emScaleTool

    TileL2Builder = CompFactory.TileL2Builder
    acc.setPrivateTools(TileL2Builder(**kwargs))

    return acc
Пример #3
0
def TileBadChanToolCfg(flags, **kwargs):
    """Return component accumulator with configured private Tile bad channel tool
        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()

    kwargs.setdefault('Source', 'COOL')
    kwargs.setdefault('TileBadChannels', 'TileBadChannels')

    badChannels = kwargs['TileBadChannels']
    name = 'TileBadChanTool'

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge( TileGMCfg(flags) )
    
    from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
    acc.merge( TileBadChannelsCondAlgCfg(flags, **kwargs) )

    TileBadChanTool=CompFactory.TileBadChanTool
    acc.setPrivateTools( TileBadChanTool(name, TileBadChannels = badChannels) )

    return acc
Пример #4
0
def TileTowerBuilderAlgCfg(flags, **kwargs):

    acc = ComponentAccumulator()

    kwargs.setdefault('name', 'TileTowerBldrAlg')
    kwargs.setdefault('TowerContainerName', 'TileTower')
    kwargs.setdefault('NumberOfPhiTowers', 64)
    kwargs.setdefault('NumberOfEtaTowers', 34)
    kwargs.setdefault('EtaMin', -1.7)
    kwargs.setdefault('EtaMax', 1.7)

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    TileTowerBuilderTool = CompFactory.TileTowerBuilderTool
    tileCmbTwrBldr = TileTowerBuilderTool(name='TileCmbTwrBldr',
                                          CellContainerName='AllCalo',
                                          IncludedCalos=['TILE'])

    kwargs['TowerBuilderTools'] = [tileCmbTwrBldr]

    CaloTowerAlgorithm = CompFactory.CaloTowerAlgorithm
    acc.addEventAlgo(CaloTowerAlgorithm(**kwargs), primary=True)

    return acc
Пример #5
0
def CaloCellMakerCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg

    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    larCellBuilder = LArCellBuilderCfg(configFlags)

    larCellCorrectors = LArCellCorrectorCfg(configFlags)
    theTileCellBuilder = TileCellBuilderCfg(configFlags)

    caloCellCorrections = []
    #Corrections tools that are not LAr or Tile specific:
    if configFlags.Calo.Cell.doPileupOffsetBCIDCorr or configFlags.Cell.doPedestalCorr:
        theCaloCellPedestalCorr = CaloCellPedestalCorrCfg(configFlags)
        caloCellCorrections.append(
            result.popToolsAndMerge(theCaloCellPedestalCorr))

    #LAr HV scale corr must come after pedestal corr
    if configFlags.LAr.doHVCorr:
        from LArCellRec.LArCellBuilderConfig import LArHVCellContCorrCfg
        theLArHVCellContCorr = LArHVCellContCorrCfg(configFlags)
        caloCellCorrections.append(
            result.popToolsAndMerge(theLArHVCellContCorr))

    if configFlags.Calo.Cell.doDeadCellCorr:
        theCaloCellNeighborAvg = CaloCellNeighborsAverageCorrCfg(configFlags)
        caloCellCorrections.append(
            result.popToolsAndMerge(theCaloCellNeighborAvg))

    if configFlags.Calo.Cell.doEnergyCorr:
        theCaloCellEnergyRescaler = CaloEnergyRescalerCfg(configFlags)
        caloCellCorrections.append(
            result.popToolsAndMerge(theCaloCellEnergyRescaler))

    if configFlags.Calo.Cell.doTimeCorr:
        theCaloTimeCorr = CaloCellTimeCorrCfg(configFlags)
        caloCellCorrections.append(result.popToolsAndMerge(theCaloTimeCorr))

    #Old Config:
    #CaloCellMakerToolNames': PrivateToolHandleArray(['LArCellBuilderFromLArRawChannelTool/LArCellBuilderFromLArRawChannelTool','TileCellBuilder/TileCellBuilder','CaloCellContainerFinalizerTool/CaloCellContainerFinalizerTool','LArCellNoiseMaskingTool/LArCellNoiseMaskingTool','CaloCellPedestalCorr/CaloCellPedestalCorr','CaloCellNeighborsAverageCorr/CaloCellNeighborsAverageCorr','CaloCellContainerCheckerTool/CaloCellContainerCheckerTool']),

    cellAlgo = CaloCellMaker(CaloCellMakerToolNames=[
        larCellBuilder.popPrivateTools(),
        theTileCellBuilder.popPrivateTools(),
        CaloCellContainerFinalizerTool()
    ] + larCellCorrectors.popPrivateTools() + caloCellCorrections,
                             CaloCellsOutputName="AllCalo")

    result.merge(larCellBuilder)
    result.merge(larCellCorrectors)
    result.merge(theTileCellBuilder)

    result.addEventAlgo(cellAlgo, primary=True)
    return result
Пример #6
0
def LArCellMonConfig(inputFlags):
    from AthenaCommon.Logging import logging
    mlog = logging.getLogger( 'LArCellMonConfig' )

    from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags,'LArCellMonAlgCfg')

    if not inputFlags.DQ.enableLumiAccess:
       mlog.warning('This algo needs Lumi access, returning empty config')
       from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
       cfg=ComponentAccumulator()
       cfg.merge(helper.result())
       return cfg

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    cfg = LArGMCfg(inputFlags)
    from TileGeoModel.TileGMConfig import TileGMCfg
    cfg.merge(TileGMCfg(inputFlags))

    from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
    cfg.merge(DetDescrCnvSvcCfg(inputFlags))

    from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
    cfg.merge(LArCollisionTimeCfg(inputFlags))

    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    cfg.merge(CaloNoiseCondAlgCfg(inputFlags))

    if inputFlags.Input.isMC is False:
      from LumiBlockComps.LuminosityCondAlgConfig import  LuminosityCondAlgCfg
      cfg.merge(LuminosityCondAlgCfg(inputFlags))
      from LumiBlockComps.LBDurationCondAlgConfig import  LBDurationCondAlgCfg
      cfg.merge(LBDurationCondAlgCfg(inputFlags))

    from AthenaConfiguration.ComponentFactory import CompFactory
    lArCellMonAlg=CompFactory.LArCellMonAlg

    algname='LArCellMonAlg'
    if inputFlags.Beam.Type == 'cosmics':
        algname=algname+'Cosmics'

    isCosmics = ( inputFlags.Beam.Type == 'cosmics' )
    LArCellMonConfigCore(helper, lArCellMonAlg,inputFlags, isCosmics, inputFlags.Input.isMC, algname)

    acc=helper.result()

    from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
    acc.getEventAlgo(algname).ReadyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))

    if not inputFlags.Input.isMC:
       from AthenaMonitoring.BadLBFilterToolConfig import LArBadLBFilterToolCfg
       acc.getEventAlgo(algname).BadLBTool=cfg.popToolsAndMerge(LArBadLBFilterToolCfg(inputFlags))

    cfg.merge(acc)

    return cfg
Пример #7
0
def TileGeoDetectorToolCfg(ConfigFlags, name='Tile', **kwargs):
    #set up geometry
    result=TileGMCfg(ConfigFlags)
    kwargs.setdefault("DetectorName", "Tile")
    #add the GeometryNotifierSvc
    result.addService(G4GeometryNotifierSvcCfg(ConfigFlags))
    kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc"))
    result.setPrivateTools(GeoDetectorTool(name, **kwargs))
    return result
Пример #8
0
def CaloGeoAndNoiseCfg(inputFlags):
    result = ComponentAccumulator()
    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg

    result.merge(LArGMCfg(inputFlags))
    result.merge(TileGMCfg(inputFlags))

    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    # Schedule total noise cond alg
    result.merge(CaloNoiseCondAlgCfg(inputFlags, "totalNoise"))

    return result
Пример #9
0
def testCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from CaloTools.CaloEstimatedGainToolConfig import CaloEstimatedGainToolCfg
    acc = CaloEstimatedGainToolCfg(configFlags)
    acc.popPrivateTools()
    result.merge(acc)

    result.addEventAlgo(TestAlg('TestAlg'))
    return result
Пример #10
0
def testCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from FastCaloSim.AddNoiseCellBuilderToolConfig import AddNoiseCellBuilderToolCfg
    acc = AddNoiseCellBuilderToolCfg(configFlags)
    acc.popPrivateTools()
    result.merge(acc)

    result.addEventAlgo(TestAlg('TestAlg'))
    return result
Пример #11
0
def TileCablingSvcCfg(flags):
    """Return component accumulator with configured Tile cabling service

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    from AthenaCommon.Logging import logging
    msg = logging.getLogger('TileCablingSvc')

    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    tileCablingSvc = CompFactory.TileCablingSvc()

    geometry = flags.GeoModel.AtlasVersion
    runNumber = flags.Input.RunNumber[0]
    run = flags.GeoModel.Run
    if run == 'RUN1':
        if runNumber > 219651:
            # Choose RUN2 cabling for old geometry tags starting from 26-MAR-2013
            tileCablingSvc.CablingType = 4
            msg.warning("Forcing RUN2 cabling for run %s with geometry %s",
                        runNumber, geometry)

    elif run == 'RUN2':
        if (flags.Input.isMC and
                runNumber >= 310000) or runNumber >= 343000 or runNumber < 1:
            # Choose RUN2a cabling for R2 geometry tags starting from 31-Jan-2018
            tileCablingSvc.CablingType = 5
            msg.info(
                "Forcing RUN2a (2018) cabling for run %s with geometry %s",
                runNumber, geometry)

        else:
            tileCablingSvc.CablingType = 4
            msg.info(
                "Forcing RUN2 (2014-2017) cabling for run %s with geometry %s",
                runNumber, geometry)

    acc.addService(tileCablingSvc, primary=True)

    return acc
Пример #12
0
def CaloEstimatedGainToolCfg(configFlags):
    result = ComponentAccumulator()

    from AtlasGeoModel.GeoModelConfig import GeoModelCfg
    result.merge(GeoModelCfg(configFlags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg

    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg
    result.merge(LArFebRodMappingCfg(configFlags))
    result.merge(LArCalibIdMappingCfg(configFlags))

    from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
    result.merge(TileInfoLoaderCfg(configFlags))

    from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
    acc = TileCondToolEmscaleCfg(configFlags)
    emscaleTool = acc.popPrivateTools()
    result.merge(acc)

    from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
    acc = TileCondToolNoiseSampleCfg(configFlags)
    noiseSampleTool = acc.popPrivateTools()
    result.merge(acc)

    from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
    result.merge(LArADC2MeVCondAlgCfg(configFlags))
    adc2mev = result.getCondAlgo('LArADC2MeVCondAlg')

    TileCondIdTransforms = CompFactory.TileCondIdTransforms

    CaloEstimatedGainTool = CompFactory.CaloEstimatedGainTool
    tool = CaloEstimatedGainTool('CaloEstimatedGainTool',
                                 ADC2MeVKey=adc2mev.LArADC2MeVKey,
                                 TileCondIdTransforms=TileCondIdTransforms(),
                                 TileCondToolEmscale=emscaleTool,
                                 TileCondToolNoiseSample=noiseSampleTool)

    result.setPrivateTools(tool)

    return result
Пример #13
0
def AtlasGeometryCfg(flags):
    acc = ComponentAccumulator()

    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
    acc.merge(InDetGeometryCfg(flags))
    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))
    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))
    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    acc.merge(MuonGeoModelCfg(flags))
    #from AtlasGeoModel.ForDetGeoModelConfig import ForDetGeometryCfg
    #acc.merge(ForDetGeometryCfg(flags))
    from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg
    acc.merge(BeamPipeGeometryCfg(flags))
    from AtlasGeoModel.CavernGMConfig import CavernGeometryCfg
    acc.merge(CavernGeometryCfg(flags))
    return acc
Пример #14
0
def LArHVCorrMonConfig(inputFlags):

    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'LArHVCorrMonAlgCfg')

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc = LArGMCfg(inputFlags)
    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(inputFlags))
    from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg
    acc.merge(LArHVScaleCfg(inputFlags))

    from AthenaConfiguration.ComponentFactory import CompFactory
    LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg,
                           inputFlags)

    acc.merge(helper.result())
    return acc
Пример #15
0
def CaloCellContainerCheckerToolCfg(flags):
    """Return component accumulator with configured private Calo cell container checker tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    acc = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    CaloCellContainerCheckerTool = CompFactory.CaloCellContainerCheckerTool
    acc.setPrivateTools(CaloCellContainerCheckerTool())

    return acc
Пример #16
0
def CaloCellNeighborsAverageCorrCfg(flags):
    """Return component accumulator with configured private Calo cell neighbors average correction tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """
    acc = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    CaloCellNeighborsAverageCorr = CompFactory.CaloCellNeighborsAverageCorr
    caloCellNeighborsAverageCorrection = CaloCellNeighborsAverageCorr(
        testMode=False)

    acc.setPrivateTools(caloCellNeighborsAverageCorrection)
    return acc
Пример #17
0
def ActsTrackingGeometrySvcCfg(configFlags, name="ActsTrackingGeometrySvc"):
    result = ComponentAccumulator()

    Acts_ActsTrackingGeometrySvc = CompFactory.ActsTrackingGeometrySvc
    subDetectors = []
    if configFlags.Detector.GeometryPixel:
        subDetectors += ["Pixel"]
    if configFlags.Detector.GeometrySCT:
        subDetectors += ["SCT"]
    if configFlags.Detector.GeometryTRT:
        subDetectors += ["TRT"]
    if configFlags.Detector.GeometryCalo:
        subDetectors += ["Calo"]

        # need to configure calo geometry, otherwise we get a crash
        from LArGeoAlgsNV.LArGMConfig import LArGMCfg
        result.merge(LArGMCfg(configFlags))
        from TileGeoModel.TileGMConfig import TileGMCfg
        result.merge(TileGMCfg(configFlags))

    idSub = [sd in subDetectors for sd in ("Pixel", "SCT", "TRT")]
    if any(idSub):
        # ANY of the ID subdetectors are on => we require GM sources
        # In principle we could require only what is enabled, but the group
        # does extra config that I don't want to duplicate here
        from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
        result.merge(InDetGeometryCfg(configFlags))

        if not all(idSub):
            from AthenaCommon.Logging import log
            log.warning(
                "ConfigFlags indicate %s should be built. Not all ID subdetectors are set, but I'll set all of them up to capture the extra setup happening here.",
                ", ".join(subDetectors))

    actsTrackingGeometrySvc = Acts_ActsTrackingGeometrySvc(
        name, BuildSubDetectors=subDetectors)

    from AthenaCommon.Constants import VERBOSE
    actsTrackingGeometrySvc.OutputLevel = VERBOSE
    result.addService(actsTrackingGeometrySvc)
    return result
Пример #18
0
def testCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    result.merge(LArOnOffIdMappingCfg(configFlags))

    result.addEventAlgo(CreateDataAlg('CreateDataAlg'))

    CaloThinCellsBySamplingAlg = CompFactory.CaloThinCellsBySamplingAlg
    result.addEventAlgo(
        CaloThinCellsBySamplingAlg('thinAlg',
                                   StreamName='StreamAOD',
                                   SamplingCellsName=['EMB3', 'TileGap3']))

    result.addEventAlgo(CheckThinningAlg('CheckThinningAlg'))
    return result
Пример #19
0
def testCfg(configFlags):
    result = ComponentAccumulator()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(LArGMCfg(configFlags))
    result.merge(TileGMCfg(configFlags))

    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    result.merge(LArOnOffIdMappingCfg(configFlags))

    result.addEventAlgo(CreateDataAlg('CreateDataAlg'))

    CaloCellContainerAliasAlg = CompFactory.CaloCellContainerAliasAlg
    result.addEventAlgo(
        CaloCellContainerAliasAlg('aliasAlg',
                                  Cells='AllCalo',
                                  Alias='CellAlias'))

    result.addEventAlgo(CheckAliasAlg('CheckAliasAlg'))
    return result
Пример #20
0
def TileCellNoiseFilterCfg(flags, **kwargs):
    """Return component accumulator with configured private Tile cell noise filter tool

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
        UseCaloNoise -- use Calo noise conditions object. Defaults to False.
    """

    acc = ComponentAccumulator()

    useCaloNoise = kwargs.get('UseCaloNoise', False)

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    TileCellNoiseFilter = CompFactory.TileCellNoiseFilter
    tileCellNoiseFilter = TileCellNoiseFilter()

    from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
    emScaleTool = acc.popToolsAndMerge(TileCondToolEmscaleCfg(flags))
    tileCellNoiseFilter.TileCondToolEmscale = emScaleTool

    if useCaloNoise:
        from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
        acc.merge(CaloNoiseCondAlgCfg(flags, 'electronicNoise'))
        tileCellNoiseFilter.CaloNoise = 'electronicNoise'
    else:
        from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
        sampleNoiseTool = acc.popToolsAndMerge(
            TileCondToolNoiseSampleCfg(flags))
        tileCellNoiseFilter.TileCondToolNoiseSample = sampleNoiseTool

        from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
        badChanTool = acc.popToolsAndMerge(TileBadChanToolCfg(flags))
        tileCellNoiseFilter.TileBadChanTool = badChanTool

    acc.setPrivateTools(tileCellNoiseFilter)

    return acc
Пример #21
0
def MBTSTimeDiffEventInfoAlgCfg(flags, **kwargs):
    """Return component accumulator with configured MBTS time difference algorithm

    Arguments:
        flags  -- Athena configuration flags (ConfigFlags)
    """

    acc = ComponentAccumulator()

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

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    MBTSTimeDiffEventInfoAlg=CompFactory.MBTSTimeDiffEventInfoAlg
    acc.addEventAlgo(MBTSTimeDiffEventInfoAlg(**kwargs), primary = True)

    return acc
Пример #22
0
def TileMBTSMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileMBTSMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
    result.merge(TileDQstatusAlgCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    result.merge(LArGMCfg(flags))

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

    if flags.Input.Format.lower() == 'pool':
        kwargs.setdefault('TileDigitsContainer', 'TileDigitsFlt')

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileMBTSMonAlgCfg')

    runNumber = flags.Input.RunNumber[0]
    from AthenaConfiguration.ComponentFactory import CompFactory
    _TileMBTSMonitoringConfigCore(helper, CompFactory.TileMBTSMonitorAlgorithm,
                                  runNumber, **kwargs)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Пример #23
0
def TileTopoClusterCfg(flags, **kwargs):

    acc = ComponentAccumulator()

    kwargs.setdefault('name', 'TileTopoClusterAlg')
    kwargs.setdefault('ClustersOutputName', 'TileTopoCluster')

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    # Schedule total noise cond alg
    acc.merge(CaloNoiseCondAlgCfg(flags, 'totalNoise'))

    # Configure Tile topo cluster maker
    from AthenaConfiguration.ComponentFactory import CompFactory
    topoClusterMaker = CompFactory.CaloTopoClusterMaker()
    topoClusterMaker.CellsName = 'AllCalo'
    topoClusterMaker.CalorimeterNames = ['TILE']
    # Cells from the following samplings will be able to form seeds.
    # By default no sampling is excluded
    topoClusterMaker.SeedSamplingNames = [
        'TileBar0', 'TileBar1', 'TileBar2', 'TileExt0', 'TileExt1', 'TileExt2',
        'TileGap1', 'TileGap2', 'TileGap3'
    ]

    topoClusterMaker.NeighborOption = 'super3D'
    topoClusterMaker.RestrictHECIWandFCalNeighbors = False
    topoClusterMaker.CellThresholdOnEorAbsEinSigma = 0.0
    topoClusterMaker.NeighborThresholdOnEorAbsEinSigma = 2.0
    topoClusterMaker.SeedThresholdOnEorAbsEinSigma = 4.0

    topoClusterMaker.SeedCutsInAbsE = True
    topoClusterMaker.ClusterEtorAbsEtCut = 0.0 * MeV
    topoClusterMaker.TwoGaussianNoise = flags.Calo.TopoCluster.doTwoGaussianNoise

    kwargs['ClusterMakerTools'] = [topoClusterMaker]

    # Configure Tile topo cluster splitter
    topoClusterSpliter = CompFactory.CaloTopoClusterSplitter()
    topoClusterSpliter.SamplingNames = [
        'TileBar0', 'TileBar1', 'TileBar2', 'TileExt0', 'TileExt1', 'TileExt2',
        'TileGap1', 'TileGap2', 'TileGap3'
    ]

    topoClusterSpliter.ShareBorderCells = True
    topoClusterSpliter.RestrictHECIWandFCalNeighbors = False

    kwargs['ClusterMakerTools'] += [topoClusterSpliter]

    # Configure Tile topo cluster moments maker
    clsuterMomentsMaker = CompFactory.CaloClusterMomentsMaker()
    clsuterMomentsMaker.MaxAxisAngle = 30 * deg
    clsuterMomentsMaker.MomentsNames = [
        'FIRST_PHI', 'FIRST_ETA', 'SECOND_R', 'SECOND_LAMBDA', 'DELTA_PHI',
        'DELTA_THETA', 'DELTA_ALPHA', 'CENTER_X', 'CENTER_Y', 'CENTER_Z',
        'CENTER_MAG', 'CENTER_LAMBDA', 'LATERAL', 'LONGITUDINAL',
        'FIRST_ENG_DENS', 'ENG_FRAC_EM', 'ENG_FRAC_MAX', 'ENG_FRAC_CORE',
        'FIRST_ENG_DENS', 'SECOND_ENG_DENS', 'ISOLATION', 'ENG_BAD_CELLS',
        'N_BAD_CELLS', 'N_BAD_CELLS_CORR', 'BAD_CELLS_CORR_E', 'BADLARQ_FRAC',
        'ENG_POS', 'SIGNIFICANCE', 'CELL_SIGNIFICANCE', 'CELL_SIG_SAMPLING',
        'AVG_LAR_Q', 'AVG_TILE_Q', 'PTD', 'MASS'
    ]

    kwargs['ClusterCorrectionTools'] = [clsuterMomentsMaker]

    acc.addEventAlgo(CompFactory.CaloClusterMaker(**kwargs), primary=True)

    return acc
Пример #24
0
def CaloBaselineMonConfig(inputFlags, isTopLevel=True):

    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags,'CaloBaselineMonCfg')

    if not inputFlags.DQ.enableLumiAccess:
       print('This algo needs Lumi access, returning empty config')
       if isTopLevel:
          from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
          cfg=ComponentAccumulator()
          cfg.merge(helper.result())
          return cfg
       else:   
          return helper.result()

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    cfg = LArGMCfg(inputFlags)
    from TileGeoModel.TileGMConfig import TileGMCfg
    cfg.merge(TileGMCfg(inputFlags))
    from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
    cfg.merge(LArCollisionTimeCfg(inputFlags))
    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    cfg.merge(CaloNoiseCondAlgCfg(inputFlags))

    caloBaselineMonAlg = helper.addAlgorithm(CompFactory.CaloBaselineMonAlg,'caloBaselineMonAlg')

    GroupName="CaloBaseLineMon"
    caloBaselineMonAlg.MonGroupName = GroupName

    caloBaselineMonAlg.EnableLumi = True
    
    partList = ["EM","HEC+FCal"]
    caloBaselineMonAlg.partionList = partList
    etaBins = [16,19]
    caloBaselineMonAlg.nbOfEtaBins = etaBins
    minEta = [0.,1.2]
    caloBaselineMonAlg.minimumEta = minEta
    maxEta = [3.2,5.]
    caloBaselineMonAlg.maximumEta = maxEta

    # config settings based on flags
    tmp_CaloBaselineMon = {"useBadLBTool":False,
                        "useReadyFilterTool":False,
                        "useLArNoisyAlg":False,
                        "useBeamBackgroundRemoval":False,
                        "useLArCollisionFilter":False,
                        "pedestalMon_BCIDmin":0,
                        "bcidtoolMon_BCIDmax":0}
    binlabels=["TotalEvents","ATLAS Ready","with Good LAr LB","with No LAr Collision","with No Beam Background", "with No Trigger Filter","with No LArError"] 
    if not (inputFlags.Common.isOnline == 'online' or inputFlags.Input.isMC ):
      tmp_CaloBaselineMon["useBadLBTool"]=True
      tmp_CaloBaselineMon["useReadyFilterTool"]=True
      tmp_CaloBaselineMon["useLArNoisyAlg"] = True
    
    # FIXME when trigger stream flag is added:
    #if rec.triggerStream()=='CosmicCalo':
    #  tmp_CaloBaselineMon["useLArCollisionFilter"] = True
    #  tmp_CaloBaselineMon["pedestalMon_BCIDmin"] = 40
    #  tmp_CaloBaselineMon["TriggerChain"] = "HLT_noalg_cosmiccalo_L1RD1_EMPTY"
    
    #if rec.triggerStream()=='ZeroBias':
    tmp_CaloBaselineMon["bcidtoolMon_BCIDmax"] = 144
    #tmp_CaloBaselineMon["TriggerChain"] = "HLT_noalg_zb_L1ZB"
    tmp_CaloBaselineMon["TriggerChain"] = ""

    from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
    from AthenaMonitoring.BadLBFilterToolConfig import LArBadLBFilterToolCfg

    caloBaselineMonAlg.useBadLBTool = tmp_CaloBaselineMon["useBadLBTool"]
    caloBaselineMonAlg.BadLBTool = cfg.popToolsAndMerge(LArBadLBFilterToolCfg(inputFlags))
    # FIXME Do not have yet new config for BunchCrossingTool, shoulkd be put back once available
    #caloBaselineMonAlg.BunchCrossingTool = BunchCrossingTool("TrigConf" if not inputFlags.Input.isMC else "MC")
    caloBaselineMonAlg.useReadyFilterTool = tmp_CaloBaselineMon["useReadyFilterTool"]
    caloBaselineMonAlg.ReadyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))
    caloBaselineMonAlg.useLArCollisionFilterTool = tmp_CaloBaselineMon["useLArCollisionFilter"]
    caloBaselineMonAlg.useLArNoisyAlg = tmp_CaloBaselineMon["useLArNoisyAlg"]
    caloBaselineMonAlg.useBeamBackgroundRemoval = tmp_CaloBaselineMon["useBeamBackgroundRemoval"]
    caloBaselineMonAlg.pedestalMon_BCIDmin = tmp_CaloBaselineMon["pedestalMon_BCIDmin"]
    caloBaselineMonAlg.bcidtoolMon_BCIDmax = tmp_CaloBaselineMon["bcidtoolMon_BCIDmax"]
    caloBaselineMonAlg.TriggerChain = tmp_CaloBaselineMon["TriggerChain"]
    if not caloBaselineMonAlg.useReadyFilterTool:
       binlabels[1] = "ATLAS Ready-OFF"
    if not caloBaselineMonAlg.useBadLBTool:
       binlabels[2] = "Good LAr LB-OFF"
    if not caloBaselineMonAlg.useLArCollisionFilterTool:
       binlabels[3] = "LAr collision-OFF"
    if not caloBaselineMonAlg.useBeamBackgroundRemoval:
       binlabels[4] = "Beam backgr.-OFF"
    if not caloBaselineMonAlg.useLArNoisyAlg:
       binlabels[5] = "LAr Error Veto-OFF"   

    # eta bins computation (should be tha same as in C++ code
    etaBinWidth = [None] * len(partList)
    for i in range(0,len(partList)):
        etaBinWidth[i] = (maxEta[i] - minEta[i]) / etaBins[i]
    # bool to decide which monitoring to do
    if caloBaselineMonAlg.pedestalMon_BCIDmin > 0:
      doPedestalMon = True
    else:  
      doPedestalMon = False
    if caloBaselineMonAlg.bcidtoolMon_BCIDmax > 0:
      doBcidtoolMon = True
    else:  
      doBcidtoolMon = False

    baselineGroup = helper.addGroup(
        caloBaselineMonAlg,
        GroupName,
        '/CaloMonitoring/'+GroupName+'/'
    )

    gen_hist_path='General/'

    from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
    CaloBaseHistConfig(baselineGroup,gen_hist_path,binlabels)  

    BCID0_nbins=3563
    LB_nbins=3000

    baselineGroup.defineHistogram('BCID;h1BCID_pedestalMon',
                                  title='BCID used for baseline monitoring;BCID;Nb of events / BCID',
                                  type='TH1I', path=gen_hist_path,
                                  xbins=BCID0_nbins+1, xmin=-0.5, xmax=BCID0_nbins+0.5)

    baselineGroup.defineHistogram('BCID;h1BCID_BCIDToolMon',
                                  title='BCID used for BCIDTool monitoring;BCID;Nb of events / BCID',
                                  type='TH1I', path=gen_hist_path,
                                  xbins=BCID0_nbins+1, xmin=-0.5, xmax=BCID0_nbins+0.5)

    part_hist_path='AllCalo'+tmp_CaloBaselineMon["TriggerChain"]+'/'
    idx=0
    for part in partList:
       if doPedestalMon:
         str_auxTitle = " Empty BCID > "+str(tmp_CaloBaselineMon["pedestalMon_BCIDmin"])+"BCID away from last train"
 
         baselineGroup.defineHistogram('pedEta_'+part+',sumPedEta_'+part+';hprof1d_pedestalMon_'+part+'_AllEta',
                           title='Pedestal baseline ( '+str_auxTitle+');Eta;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=etaBins[idx], xmin=minEta[idx], xmax=maxEta[idx])
 
         baselineGroup.defineHistogram('LB_'+part+',sumPedEta_'+part+';hprof1d_pedestalMon_'+part+'_LB',
                           title='Pedestal baseline ( '+str_auxTitle+');Luminosity block;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=LB_nbins, xmin=0, xmax=LB_nbins)
       if doBcidtoolMon:
         str_auxTitle = " BCID in bunch train  "
         baselineGroup.defineHistogram('bcidEta_'+part+',sumBCIDEta_'+part+';hprof1d_bcidtoolMon_'+part+'_AllEta',
                           title='BCIDTool baseline ( '+str_auxTitle+');Eta;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=etaBins[idx], xmin=minEta[idx], xmax=maxEta[idx])
 
         baselineGroup.defineHistogram('LB_'+part+',sumBCIDEta_'+part+';hprof1d_bcidtoolMon_'+part+'_LB',
                           title='BCIDTool baseline ( '+str_auxTitle+');Luminosity block;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=LB_nbins, xmin=0, xmax=LB_nbins)

    part_hist_path='/CaloMonitoring/'+GroupName+'/AllCalo'+tmp_CaloBaselineMon["TriggerChain"]+'/'
    idx=0
    for part in partList:
       darray = helper.addArray([etaBins[idx]],caloBaselineMonAlg,part)
       if doPedestalMon:
         str_auxTitle = " Empty BCID > "+str(tmp_CaloBaselineMon["pedestalMon_BCIDmin"])+"BCID away from last train"

         darray.defineHistogram('etaBCID_'+part+',sumPedEta_'+part+';hprof_pedestalMon_'+part,
                           title='Pedestal baseline ( '+str_auxTitle+');Luminosity block;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=BCID0_nbins+1, xmin=-0.5, xmax=BCID0_nbins+0.5)
       if doBcidtoolMon:
         str_auxTitle = " BCID in bunch train  "

         darray.defineHistogram('etaBCID_'+part+',sumBCIDEta_'+part+';hprof_bcidtoolMon_'+part,
                           title='BCIDTool baseline ( '+str_auxTitle+');Luminosity block;E_T/(#Delta#eta.#Delta#phi.#mu)[MeV]',
                           type='TProfile', path=part_hist_path,
                           xbins=BCID0_nbins+1, xmin=-0.5, xmax=BCID0_nbins+0.5)
       idx=idx+1


    #if isTopLevel:
    cfg.merge(helper.result())
    return cfg
Пример #25
0
def trigCaloDataAccessSvcCfg(flags):

    acc = ComponentAccumulator()
    svc = CompFactory.TrigCaloDataAccessSvc()

    # since the svc depends on calo geometry configure it here
    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from RegionSelector.RegSelConfig import regSelCfg
    acc.merge(regSelCfg(flags))

    acc.merge(createLArRoI_Map(flags))

    # Needed by bad channel maskers, refrerenced from LArCellCont.
    from IOVDbSvc.IOVDbSvcConfig import addFolders
    acc.merge(addFolders(flags, ['/LAR/BadChannels/BadChannels'], 'LAR'))
    acc.merge(addFolders(flags, ['/LAR/BadChannels/MissingFEBs'], 'LAR'))

    from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
    acc.merge(TileEMScaleCondAlgCfg(flags))

    from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
    acc.merge(TileBadChannelsCondAlgCfg(flags))

    from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
    import math
    mon = GenericMonitoringTool("TrigCaloDataAccessSvcMon")
    mon.defineHistogram("TIME_locking_LAr_RoI",
                        path="EXPERT",
                        title="Time spent in unlocking the LAr collection",
                        xbins=100,
                        xmin=0,
                        xmax=100),
    mon.defineHistogram("roiROBs_LAr",
                        path="EXPERT",
                        title="Number of ROBs unpacked in RoI requests",
                        xbins=20,
                        xmin=0,
                        xmax=20),
    mon.defineHistogram("TIME_locking_LAr_FullDet",
                        path="EXPERT",
                        title="Time spent in unlocking the LAr collection",
                        xbins=100,
                        xmin=0,
                        xmax=100),
    mon.defineHistogram("roiEta_LAr,roiPhi_LAr",
                        type="TH2F",
                        path="EXPERT",
                        title="Geometric usage",
                        xbins=50,
                        xmin=-5,
                        xmax=5,
                        ybins=64,
                        ymin=-math.pi,
                        ymax=math.pi)
    svc.MonTool = mon
    acc.addService(svc)
    return acc
Пример #26
0
def TileCellMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileCellMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
    result.merge(TileDQstatusAlgCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    result.merge(LArGMCfg(flags))

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

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileMonitoring')

    # Adding an TileCellMonitorAlgorithm algorithm to the helper
    from AthenaConfiguration.ComponentFactory import CompFactory
    tileCellMonAlg = helper.addAlgorithm(CompFactory.TileCellMonitorAlgorithm,
                                         'TileCellMonAlg')

    tileCellMonAlg.TriggerChain = ''

    from AthenaCommon.SystemOfUnits import MeV, GeV, ns
    kwargs.setdefault('EnergyThreshold', 300.0 * MeV)
    kwargs.setdefault('NegativeEnergyThreshold', -2000.0 * MeV)
    kwargs.setdefault('EnergyBalanceThreshold', 3)
    kwargs.setdefault('TimeBalanceThreshold', 25 * ns)
    kwargs.setdefault('fillTimeAndEnergyDiffHistograms', False)

    if flags.Beam.Type in ('cosmics', 'singlebeam'):
        kwargs.setdefault('fillTimeHistograms', True)
        kwargs.setdefault('EnergyThresholdForTime', 150.0 * MeV)
    else:
        kwargs.setdefault('fillTimeHistograms', False)
        kwargs.setdefault('EnergyThresholdForTime', 500.0 * MeV)

    # L1Trigger Type Bits:
    #     bit0_RNDM, bit1_ZeroBias, bit2_L1Cal, bit3_Muon,
    #     bit4_RPC, bit5_FTK, bit6_CTP, bit7_Calib, AnyPhysTrig
    kwargs.setdefault('fillHistogramsForL1Triggers',
                      ['AnyPhysTrig', 'bit7_Calib'])
    l1Triggers = kwargs['fillHistogramsForL1Triggers']

    for k, v in kwargs.items():
        setattr(tileCellMonAlg, k, v)

    run = str(flags.Input.RunNumber[0])

    # 1) Configure histogram with TileCellMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileCellMonAlg,
                                       'TileCellMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='Cell',
        type='TH1F',
        title='Time for execute TileCellMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=100000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName

    # 2) Configure histogram with average number of Tile bad cells in partition
    labelsPartitions = [
        getPartitionName(ros) for ros in range(1, Tile.MAX_ROS)
    ]
    badCellGroup = helper.addGroup(tileCellMonAlg, 'TileBadCell', 'Tile/')
    badCellGroup.defineHistogram(
        'Partition,nBadCells;TileBadCell',
        path='Cell',
        type='TProfile',
        xlabels=labelsPartitions,
        title=('Run %s: Average number of Bad Tile Cells' % run),
        xbins=Tile.MAX_ROS - 1,
        xmin=-0.5,
        xmax=Tile.MAX_ROS - 1.5)

    from TileMonitoring.TileMonitoringCfgHelper import addTileModulePartitionMapsArray

    # 3) Configure histograms with energy ratio > threshold vs module and partion
    eneBalModPartTitle = ('Tile Cell Energy Ratio > %s' %
                          kwargs['EnergyBalanceThreshold'])
    addTileModulePartitionMapsArray(helper,
                                    tileCellMonAlg,
                                    name='TileCellEneBalModPart',
                                    title=eneBalModPartTitle,
                                    path='Tile/Cell',
                                    type='TH2D',
                                    run=run,
                                    triggers=l1Triggers,
                                    separator='_')

    # 4) Configure histograms with Tile cell time difference over threshold vs module and partition
    timeBalModPartTitle = (
        'Tile Cell Time difference > %s ns. E_{ch} > %s [MeV]')
    timeBalModPartTitle = (
        timeBalModPartTitle %
        (kwargs['TimeBalanceThreshold'], kwargs['EnergyThresholdForTime']))
    addTileModulePartitionMapsArray(helper,
                                    tileCellMonAlg,
                                    name='TileCellTimeBalModPart',
                                    title=timeBalModPartTitle,
                                    path='Tile/Cell',
                                    type='TH2D',
                                    run=run,
                                    triggers=l1Triggers,
                                    separator='_')

    from TileMonitoring.TileMonitoringCfgHelper import addTileModuleChannelMapsArray, addTileModuleDigitizerMapsArray

    # 5) Configure histograms with everagy Tile channel time per partition
    chanTimeTitle = ('TileCal Average Channel Time [ns].  E_{ch} > %s MeV' %
                     kwargs['EnergyThresholdForTime'])
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileChanPartTime',
                                  type='TProfile2D',
                                  value='time',
                                  title=chanTimeTitle,
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  separator='_')

    # 6) Configure histograms with everagy Tile digitizer time per partition
    digiTimeTitle = ('TileCal Average Digitizer Time [ns].  E_{ch} > %s MeV' %
                     kwargs['EnergyThresholdForTime'])
    addTileModuleDigitizerMapsArray(helper,
                                    tileCellMonAlg,
                                    name='TileDigiPartTime',
                                    type='TProfile2D',
                                    value='time',
                                    title=digiTimeTitle,
                                    path='Tile/Cell',
                                    subDirectory=True,
                                    run=run,
                                    triggers=l1Triggers,
                                    separator='_')

    # 7) Configure histograms with everagy energy maps per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailOccMap',
                                  type='TProfile2D',
                                  value='energy',
                                  title='Occupancy Map [MeV]',
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  separator='_')

    # 8) Configure histograms with occupancy maps over threshold per partition
    titleMapOvThr = ('Occupancy Map Over Threshod %s MeV' %
                     kwargs['EnergyThreshold'])
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailOccMapOvThr',
                                  weight='weight',
                                  title=titleMapOvThr,
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  separator='_')

    # 9) Configure histograms with occupancy maps over threshold 30GeV per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailOccMapOvThr30GeV',
                                  title='Occupancy Map Over Threshod 30 GeV',
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  separator='_')

    # 10) Configure histograms with occupancy maps over threshold 300GeV per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailOccMapOvThr300GeV',
                                  title='Occupancy Map Over Threshod 300 GeV',
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  separator='_')

    # 11) Configure histograms with occupancy maps over threshold per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailOccMapOvThrGain',
                                  weight='weight',
                                  title=titleMapOvThr,
                                  path='Tile/Cell',
                                  subDirectory=True,
                                  run=run,
                                  triggers=l1Triggers,
                                  perGain=True,
                                  separator='_')

    # 12) Configure histograms with status of Tile channels in DB per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellStatusInDB',
                                  title='Cell channel status in DB',
                                  path='Tile/Cell',
                                  run=run,
                                  perGain=True,
                                  separator='_')

    # 13) Configure histograms with Tile channels masked on the fly per partition
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellStatusOnFly',
                                  title='Channels masked on the fly',
                                  path='Tile/Cell',
                                  run=run,
                                  perGain=False,
                                  separator='_')

    # 14) Configure histograms with occupancy map below negative threshold per partition
    titleNegOcc = 'Occupancy Map Below %s GeV' % (
        kwargs['NegativeEnergyThreshold'] / GeV)
    addTileModuleChannelMapsArray(helper,
                                  tileCellMonAlg,
                                  name='TileCellDetailNegOccMap',
                                  title=titleNegOcc,
                                  path='Tile/Cell',
                                  run=run,
                                  separator='_')

    # 15) Configure histograms with Tile module correlation per partition
    from TileMonitoring.TileMonitoringCfgHelper import addTileModuleCorrelionMapsArray
    addTileModuleCorrelionMapsArray(helper,
                                    tileCellMonAlg,
                                    name='TileCellModuleCorrelation',
                                    title='Tile Cell Module correlation',
                                    path='Tile/Cell',
                                    weight='weight',
                                    subDirectory=True,
                                    run=run,
                                    triggers=l1Triggers,
                                    allPartitions=True,
                                    separator='_')

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # 16) Configure histograms with number of masked Tile channels on the fly vs lumi block per partition
    titleMaskOnFlyLB = 'Number of masked channels on the fly'
    titleMaskOnFlyLB += ';LumiBlock;Number of masked channels'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileMaskChannelOnFlyLB',
                             path='Tile/Cell',
                             xvalue='lumiBlock',
                             value='nMaskedChannelsOnFly',
                             title=titleMaskOnFlyLB,
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             type='TProfile',
                             run=run,
                             triggers=[],
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             opt='kAddBinsDynamically')

    # 17) Configure histograms with number of masked Tile cells on the fly vs lumi block per partition
    titleMaskCellLB = 'Number of masked cells on the fly'
    titleMaskCellLB += ';LumiBlock;Number of masked cells'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileMaskCellLB',
                             path='Tile/Cell',
                             xvalue='lumiBlock',
                             value='nMaskedCells',
                             title=titleMaskCellLB,
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             type='TProfile',
                             run=run,
                             triggers=[],
                             subDirectory=False,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             opt='kAddBinsDynamically')

    # 18) Configure histograms with number of masked Tile channels on the fly due to bad DQ status vs lumi block per partition
    titleMaskDueDQ = 'Number of masked channels on the fly due to bad DQ status'
    titleMaskDueDQ += ';LumiBlock;Number of masked channels'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileMaskChannelDueDQvsLB',
                             path='Tile/Cell',
                             xvalue='lumiBlock',
                             value='nMaskedChannelsDueDQ',
                             title=titleMaskDueDQ,
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             type='TProfile',
                             run=run,
                             triggers=[],
                             subDirectory=False,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             opt='kAddBinsDynamically')

    # 19) Configure histograms with number of masked Tile cells on the fly due to bad DQ status vs lumi block per partition
    titleMaskCellDueDQ = 'Number of masked cells on the fly due to bad DQ status'
    titleMaskCellDueDQ += ';LumiBlock;Number of masked cells'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileMaskedCellDueDQvsLB',
                             path='Tile/Cell',
                             xvalue='lumiBlock',
                             value='nMaskedCellsDueDQ',
                             title=titleMaskCellDueDQ,
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             type='TProfile',
                             run=run,
                             triggers=[],
                             subDirectory=False,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             opt='kAddBinsDynamically')

    # 20) Configure histograms with energy difference between Tile cells' PMTs per partition and sample
    addTile1DHistogramsArray(
        helper,
        tileCellMonAlg,
        name='TileCellEneDiff',
        xvalue='energyDiff',
        title='Energy difference [MeV] between PMTs;Energy difference [MeV]',
        path='Tile/Cell',
        xbins=50,
        xmin=-1000.,
        xmax=1000.,
        type='TH1D',
        run=run,
        triggers=l1Triggers,
        subDirectory=True,
        perPartition=True,
        perSample=True,
        perGain=False)

    # 21) Configure histograms with time difference between Tile cells' PMTs per partition and sample
    titleTimeDiffSamp = 'Time difference [ns] between PMTs with '
    titleTimeDiffSamp += 'E_{ch} > %s MeV' % (
        kwargs['EnergyThresholdForTime'] / MeV)
    titleTimeDiffSamp += ';time [ns]'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileCellTimeDiff',
                             xvalue='timeDiff',
                             title=titleTimeDiffSamp,
                             path='Tile/Cell',
                             xbins=50,
                             xmin=-10.,
                             xmax=10.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             subDirectory=True,
                             perPartition=True,
                             perSample=True,
                             perGain=False)

    # Configure histograms with number of Tile cells vs lumiBlock per partition
    titleCellsNumber = 'Tile Cells number per luminosity block;LumiBlock;Number of reconstructed cells'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileCellsNumberLB',
                             xvalue='lumiBlock',
                             value='nCells',
                             title=titleCellsNumber,
                             path='Tile/Cell',
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             subDirectory=True,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             allPartitions=True)

    # 22) Configure histograms with number of Tile cells over threshold vs BCID per partition
    titleCellsOvThrBCID = 'Tile Cell Occupancy over Threshold %s MeV' % (
        kwargs['EnergyThresholdForTime'] / MeV)
    titleCellsOvThrBCID += ';BCID;Average number of cells over threshold'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileCellOccOvThrBCID',
                             xvalue='BCID',
                             value='nCells',
                             title=titleCellsOvThrBCID,
                             path='Tile/Cell',
                             xbins=3565,
                             xmin=0.,
                             xmax=3565.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             subDirectory=True,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             allPartitions=True)

    # 23) Configure histograms with number of Tile E cell's energy  per partition
    titleEvEnergy = 'Tile Event SampE Energy;Event Energy [MeV]'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileCellEventEnergySampE',
                             xvalue='energy',
                             title=titleEvEnergy,
                             path='Tile/Cell',
                             xbins=120,
                             xmin=-2000.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             subDirectory=True,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             allPartitions=True)

    # 24) Configure histograms with number of Tile E cell's energy
    titleSynch = 'Tile Time of Flight - Tile measured;Time of Flight - Tile measured [ns]'
    addTile1DHistogramsArray(helper,
                             tileCellMonAlg,
                             name='TileCellSynch',
                             xvalue='timeDifference',
                             title=titleSynch,
                             path='Tile/Cell',
                             xbins=50,
                             xmin=-100.,
                             xmax=100.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             subDirectory=False,
                             perPartition=False,
                             perSample=False,
                             perGain=False)

    from TileMonitoring.TileMonitoringCfgHelper import addTileEtaPhiMapsArray

    # 25) Configure histograms with everage Tile cell energy vs eta and phy per sample
    addTileEtaPhiMapsArray(helper,
                           tileCellMonAlg,
                           name='TileCellEneEtaPhi',
                           type='TProfile2D',
                           value='energy',
                           title='Energy Average depostion [MeV]',
                           path='Tile/Cell',
                           run=run,
                           triggers=l1Triggers,
                           perSample=True)

    # 26) Configure histograms with number of Tile cells over threshold vs eta and phy per sample
    titleEtaPhiOvThr = ('Position of cells over threshold %s MeV' %
                        kwargs['EnergyThreshold'])
    addTileEtaPhiMapsArray(helper,
                           tileCellMonAlg,
                           name='TileCellEtaPhiOvThr',
                           type='TH2D',
                           title=titleEtaPhiOvThr,
                           path='Tile/Cell',
                           run=run,
                           triggers=l1Triggers,
                           perSample=True)

    from TileMonitoring.TileMonitoringCfgHelper import addTileModuleArray

    # 27) Configure histograms with energy difference between Tile cell's PMTs vs module per partition
    titleEnergyBal = "Cell's PMTs Energy Balance"
    titleEnergyBal += ";;Energy balance between cell's PMTs (u-d)/(u+d)"
    addTileModuleArray(helper,
                       tileCellMonAlg,
                       name='TileCellEnergyBalance',
                       type='TProfile',
                       title=titleEnergyBal,
                       path='Tile/Cell',
                       value='energyBalance',
                       run=run)

    # 28) Configure histograms with time difference between Tile cell's PMTs vs module per partition
    titleTimeBal = "Cell's PMTs Time Difference with "
    titleTimeBal += 'E_{ch} > %s MeV' % (kwargs['EnergyThresholdForTime'] /
                                         MeV)
    titleTimeBal += ";;Time balance between cell's PMTs [ns]"
    addTileModuleArray(helper,
                       tileCellMonAlg,
                       name='TileCellTimeBalance',
                       type='TProfile',
                       title=titleTimeBal,
                       path='Tile/Cell',
                       value='timeBalance',
                       run=run)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Пример #27
0
def TileJetMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileJetMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    result.merge(LArGMCfg(flags))

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

    from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
    badChanTool = result.popToolsAndMerge(TileBadChanToolCfg(flags))

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileMonitoring')

    # Adding an TileJetMonitorAlgorithm algorithm to the helper
    from AthenaConfiguration.ComponentFactory import CompFactory
    tileJetMonAlg = helper.addAlgorithm(CompFactory.TileJetMonitorAlgorithm,
                                        'TileJetMonAlg')

    tileJetMonAlg.TileBadChanTool = badChanTool
    tileJetMonAlg.TriggerChain = ''

    for k, v in kwargs.items():
        setattr(tileJetMonAlg, k, v)

    DoEnergyProfiles = kwargs.get(
        'DoEnergyProfiles',
        tileJetMonAlg._descriptors['DoEnergyProfiles'].default)

    Do1DHistograms = kwargs.get(
        'Do1DHistograms', tileJetMonAlg._descriptors['Do1DHistograms'].default)
    DoEnergyDiffHistograms = kwargs.get(
        'DoEnergyDiffHistograms',
        tileJetMonAlg._descriptors['DoEnergyDiffHistograms'].default)

    if flags.DQ.DataType not in ('heavyioncollisions', 'cosmics'):

        jvtTool = CompFactory.JetVertexTaggerTool()
        jetContainer = kwargs.get(
            'JetContainer', tileJetMonAlg._descriptors['JetContainer'].default)
        jvtTool.JetContainer = jetContainer
        tileJetMonAlg.JVT = jvtTool

        jetCleaningTool = CompFactory.JetCleaningTool()
        jetCleaningTool.CutLevel = "LooseBad"
        jetCleaningTool.DoUgly = False

        tileJetMonAlg.JetCleaningTool = jetCleaningTool
        result.addPublicTool(jetCleaningTool)

        jetPtMin = 20000
        jetTrackingEtaLimit = 2.4
        eventCleaningTool = CompFactory.ECUtils.EventCleaningTool()
        eventCleaningTool.JetCleaningTool = jetCleaningTool
        eventCleaningTool.PtCut = jetPtMin
        eventCleaningTool.EtaCut = jetTrackingEtaLimit
        eventCleaningTool.JvtDecorator = "passJvt"
        eventCleaningTool.OrDecorator = "passOR"
        eventCleaningTool.CleaningLevel = jetCleaningTool.CutLevel

        tileJetMonAlg.EventCleaningTool = eventCleaningTool
        tileJetMonAlg.JetTrackingEtaLimit = jetTrackingEtaLimit
        tileJetMonAlg.JetPtMin = jetPtMin

        tileJetMonAlg.DoEventCleaning = True
        tileJetMonAlg.DoJetCleaning = True

    else:

        tileJetMonAlg.DoEventCleaning = False
        tileJetMonAlg.DoJetCleaning = False

    # 1) Configure histogram with TileJetMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetMonExecuteTime',
                                       'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='Jet',
        type='TH1F',
        title='Time for execute TileJetMonAlg algorithm;time [#mus]',
        xbins=300,
        xmin=0,
        xmax=300000)

    from TileMonitoring.TileMonitoringCfgHelper import addValueVsModuleAndChannelMaps, getPartitionName
    runNumber = flags.Input.RunNumber[0]

    # 2) Configure 2D histograms (profiles/maps) with Tile channel time vs module and channel per partion (DQ summary)
    channelTimeDQGroup = helper.addGroup(tileJetMonAlg, 'TileJetChanTimeDQ',
                                         'Tile/Jet/')
    addValueVsModuleAndChannelMaps(channelTimeDQGroup,
                                   name='tileJetChanTime',
                                   title='Average time with jets',
                                   path='DQ',
                                   type='TProfile2D',
                                   value='time',
                                   run=str(runNumber))

    gains = ['LG', 'HG']
    partitions = ['LBA', 'LBC', 'EBA', 'EBC']

    # 3a) Configure 1D histograms with Tile channel time per partition
    channelTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetChanTime',
                                       'Tile/Jet/ChanTime/')
    for partition in partitions:
        title = 'Partition ' + partition + ': Tile Channel Time;time [ns];N'
        name = 'channelTime' + partition
        path = partition
        channelTimeGroup.defineHistogram(name,
                                         title=title,
                                         path=path,
                                         type='TH1F',
                                         xbins=600,
                                         xmin=-30.0,
                                         xmax=30.0)

    # 3b) Configure 1D histograms with Tile channel time per partition for extended barrels without scintillators
    for partition in ['EBA', 'EBC']:
        title = 'Partition ' + partition + ': Tile Channel Time (without scintillators);time [ns];N'
        name = 'channelTime' + partition + '_NoScint'
        path = partition
        channelTimeGroup.defineHistogram(name,
                                         title=title,
                                         path=path,
                                         type='TH1F',
                                         xbins=600,
                                         xmin=-30.0,
                                         xmax=30.0)

    # Energy upper limits of the cell-time histograms
    energiesHG = [
        500, 1000, 2000, 4000, 6000, 8000, 10000, 13000, 16000, 20000
    ]
    energiesLG = [25000, 30000, 40000, 50000, 65000, 80000]
    energiesALL = {'LG': energiesLG, 'HG': energiesHG}
    tileJetMonAlg.CellEnergyUpperLimitsHG = energiesHG
    tileJetMonAlg.CellEnergyUpperLimitsLG = energiesLG

    # 4) Configure histograms with Tile cell time in energy slices per partition and gain
    cellTimeGroup = helper.addGroup(tileJetMonAlg, 'TileJetCellTime',
                                    'Tile/Jet/CellTime/')
    for partition in partitions:
        for gain in gains:
            index = 0
            energies = energiesALL[gain]
            for index in range(0, len(energies) + 1):
                toEnergy = energies[index] if index < len(energies) else None
                fromEnergy = energies[index - 1] if index > 0 else None
                name = 'Cell_time_' + partition + '_' + gain + '_slice_' + str(
                    index)
                title = 'Partition ' + partition + ': ' + gain + ' Tile Cell time in energy range'
                if not toEnergy:
                    title += ' > ' + str(fromEnergy) + ' MeV; time [ns]'
                elif not fromEnergy:
                    title += ' < ' + str(toEnergy) + ' MeV; time [ns]'
                else:
                    title += ' [' + str(fromEnergy) + ' .. ' + str(
                        toEnergy) + ') MeV; time [ns]'
                cellTimeGroup.defineHistogram(name,
                                              title=title,
                                              path=partition,
                                              type='TH1F',
                                              xbins=600,
                                              xmin=-30.0,
                                              xmax=30.0)

    if DoEnergyProfiles:

        # 5) Configure 1D histograms (profiles) with Tile cell energy profile in energy slices per partition and gain
        cellEnergyProfileGroup = helper.addGroup(tileJetMonAlg,
                                                 'TileJetCellEnergyProfile',
                                                 'Tile/Jet/CellTime/')
        for partition in partitions:
            for gain in gains:
                name = 'index_' + partition + '_' + gain
                name += ',energy_' + partition + '_' + gain
                name += ';Cell_ene_' + partition + '_' + gain + '_prof'
                title = 'Partition ' + partition + ': ' + gain + ' Tile Cell energy profile;Slice;Energy [MeV]'
                xmax = len(energiesALL[gain]) + 0.5
                nbins = len(energiesALL[gain]) + 1
                cellEnergyProfileGroup.defineHistogram(name,
                                                       title=title,
                                                       path=partition,
                                                       type='TProfile',
                                                       xbins=nbins,
                                                       xmin=-0.5,
                                                       xmax=xmax)

    else:

        # 6) Configure 1D histograms with Tile cell energy in energy slices per partition, gain and slice
        cellEnergyGroup = helper.addGroup(tileJetMonAlg, 'TileJetCellEnergy',
                                          'Tile/Jet/CellTime/')
        for partition in partitions:
            for gain in gains:
                energies = energiesALL[gain]
                for index in range(0, len(energies) + 1):
                    toEnergy = energies[index] if index < len(
                        energies) else 2 * energies[index - 1]
                    fromEnergy = energies[index - 1] if index > 0 else -1000
                    name = 'Cell_ene_' + partition + '_' + gain + '_slice_' + str(
                        index)
                    title = 'Partition ' + partition + ': ' + gain + ' Tile Cell Energy'
                    title += ' in energy range [' + str(
                        fromEnergy) + ' .. ' + str(
                            toEnergy) + ') MeV;Energy [MeV]'
                    cellEnergyGroup.defineHistogram(name,
                                                    title=title,
                                                    path=partition,
                                                    type='TH1F',
                                                    xbins=100,
                                                    xmin=fromEnergy,
                                                    xmax=toEnergy)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    if Do1DHistograms:

        # 7) Configure 1D histograms with Tile channel time per channel
        channelTime1DGroup = helper.addGroup(tileJetMonAlg,
                                             'TileJetChanTime1D',
                                             'Tile/Jet/ChanTime/')

        for ros in range(1, Tile.MAX_ROS):
            for module in range(0, Tile.MAX_DRAWER):
                for channel in range(0, Tile.MAX_CHAN):
                    moduleName = Tile.getDrawerString(ros, module)
                    title = 'Time in ' + moduleName + ' channel ' + str(
                        channel) + ';time [ns];N'
                    name = moduleName + '_ch_' + str(channel) + '_1d'
                    path = getPartitionName(ros) + '/' + moduleName
                    channelTime1DGroup.defineHistogram(name,
                                                       title=title,
                                                       path=path,
                                                       type='TH1F',
                                                       xbins=600,
                                                       xmin=-30.0,
                                                       xmax=30.0)

    if DoEnergyDiffHistograms:

        # 7) Configure 1D histograms with Tile cell relative energy difference between two channels per even channel
        energyDiffGroup = helper.addGroup(tileJetMonAlg, 'TileJetEnergyDiff',
                                          'Tile/Jet/EnergyDiff/')

        for ros in range(1, Tile.MAX_ROS):
            for module in range(0, Tile.MAX_DRAWER):
                for channel in range(0, Tile.MAX_CHAN):
                    if not channel % 2:
                        for gain in gains:
                            moduleName = Tile.getDrawerString(ros, module)
                            title = 'Tile Cell Energy difference in ' + moduleName + ' channel ' + str(
                                channel) + ' ' + gain
                            title += ';#frac{ene1 - ene2}{ene1 + ene2}'
                            name = moduleName + '_enediff_' + gain + '_ch1_' + str(
                                channel)
                            path = getPartitionName(ros) + '/' + moduleName
                            energyDiffGroup.defineHistogram(name,
                                                            title=title,
                                                            path=path,
                                                            type='TH1F',
                                                            xbins=100,
                                                            xmin=-1.0,
                                                            xmax=1.0)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Пример #28
0
def TileLookForMuAlgCfg(flags, **kwargs):

    acc = ComponentAccumulator()

    from TileGeoModel.TileGMConfig import TileGMCfg
    acc.merge(TileGMCfg(flags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    acc.merge(LArGMCfg(flags))

    kwargs.setdefault('name', 'TileLookForMuAlg')
    kwargs.setdefault('TileMuTagsOutputName', 'TileMuObj')

    kwargs.setdefault('CellsNames', 'AllCalo')

    kwargs.setdefault('LowerTresh0MeV', 80.0)
    kwargs.setdefault('LowerTresh1MeV', 80.0)
    kwargs.setdefault('LowerTresh2MeV', 80.0)
    kwargs.setdefault('LowerTreshScinMeV', 160.0)

    # Configure energy thresholds in Tile D cells to look for muons
    nCellsD = 13
    UpperTresh2MeV = [
        2370.0, 2100.0, 900.0, 1050.0, 1050.0, 1110.0, 1590.0, 1110.0, 1050.0,
        1050.0, 900.0, 2100.0, 2370.0
    ]

    kwargs.setdefault('UpperTresh2MeV', UpperTresh2MeV)
    if len(kwargs['UpperTresh2MeV']) != nCellsD:
        raise RuntimeError('Energy thresholds for %s Tile D cells are needed' %
                           nCellsD)

    # Configure energy thresholds in Tile BC cells to look for muons
    nCellsBC = 30
    UpperTresh1MeV = [
        1680.0, 1500.0, 1440.0, 1380.0, 1050.0, 390.0, 1110.0, 1860.0, 1890.0,
        1800.0, 1860.0, 1890.0, 1770.0, 1980.0, 2550.0, 2550.0, 1980.0, 1770.0,
        1890.0, 1860.0, 1800.0, 1890.0, 1860.0, 1110.0, 390.0, 1050.0, 1380.0,
        1440.0, 1500.0, 1680.0
    ]

    kwargs.setdefault('UpperTresh1MeV', UpperTresh1MeV)
    if len(kwargs['UpperTresh1MeV']) != nCellsBC:
        raise RuntimeError(
            'Energy thresholds for %s Tile BC cells are needed' % nCellsBC)

    # Configure energy thresholds in Tile A cells to look for muons
    nCellsA = 30
    UpperTresh0MeV = [
        1680.0, 1380.0, 1230.0, 1140.0, 210.0, 900.0, 960.0, 840.0, 930.0,
        840.0, 840.0, 750.0, 870.0, 960.0, 1350.0, 1350.0, 960.0, 870.0, 750.0,
        840.0, 840.0, 930.0, 840.0, 960.0, 900.0, 210.0, 1140.0, 1230.0,
        1380.0, 1680.0
    ]

    kwargs.setdefault('UpperTresh0MeV', UpperTresh0MeV)
    if len(kwargs['UpperTresh0MeV']) != nCellsA:
        raise RuntimeError('Energy thresholds for %s Tile A cells are needed' %
                           nCellsA)

    # Configure which Tile BC cells should be checked when looking for muons, starting from Tile D cells
    # Numbers are splitted by 6 [number of cells to be checked, followed by Tile BC cells to be checked]
    # For instance:  starting from the 7th cell in the 3rd (D) layer
    #                check 2 Tile BC cells: the 16th  and 17th in the 2nd (BC) layer etc.
    From3to2 = [
        5, 0, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 2, 6, 7, 0, 0, 0, 3, 7, 8, 9, 0, 0,
        3, 9, 10, 11, 0, 0, 2, 12, 13, 0, 0, 0, 2, 14, 15, 0, 0, 0, 2, 16, 17,
        0, 0, 0, 3, 18, 19, 20, 0, 0, 3, 20, 21, 22, 0, 0, 2, 22, 23, 0, 0, 0,
        5, 23, 24, 25, 26, 27, 5, 25, 26, 27, 28, 29
    ]

    kwargs.setdefault('From3to2', From3to2)
    if len(kwargs['From3to2']) != (nCellsD * 6):
        raise RuntimeError(
            '6x%s numbers required for Tile D -> BC cells mapping' % nCellsD)

    # Configure which Tile A cells should be checked when looking for muons, starting from Tile BC cells
    # Numbers are splitted by 6 [number of cells to be checked, followed by Tile A cells to be checked]
    From2to1 = [
        2, 1, 2, 0, 0, 0, 3, 1, 2, 3, 0, 0, 3, 2, 3, 4, 0, 0, 3, 3, 4, 5, 0, 0,
        2, 4, 5, 0, 0, 0, 1, 5, 0, 0, 0, 0, 1, 6, 0, 0, 0, 0, 1, 7, 0, 0, 0, 0,
        1, 8, 0, 0, 0, 0, 1, 9, 0, 0, 0, 0, 1, 10, 0, 0, 0, 0, 1, 11, 0, 0, 0,
        0, 1, 12, 0, 0, 0, 0, 1, 13, 0, 0, 0, 0, 1, 14, 0, 0, 0, 0, 1, 15, 0,
        0, 0, 0, 1, 16, 0, 0, 0, 0, 1, 17, 0, 0, 0, 0, 1, 18, 0, 0, 0, 0, 1,
        19, 0, 0, 0, 0, 1, 20, 0, 0, 0, 0, 1, 21, 0, 0, 0, 0, 1, 22, 0, 0, 0,
        0, 1, 23, 0, 0, 0, 0, 1, 24, 0, 0, 0, 0, 2, 24, 25, 0, 0, 0, 3, 24, 25,
        26, 0, 0, 3, 25, 26, 27, 0, 0, 3, 26, 27, 28, 0, 0, 2, 27, 28, 0, 0, 0
    ]

    kwargs.setdefault('From2to1', From2to1)
    if len(kwargs['From2to1']) != (nCellsBC * 6):
        raise RuntimeError(
            '6x%s numbers required for Tile BC -> A cells mapping' % nCellsBC)

    TileLookForMuAlg = CompFactory.TileLookForMuAlg
    acc.addEventAlgo(TileLookForMuAlg(**kwargs), primary=True)

    return acc
Пример #29
0
def TileRawChannelTimeMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileRawChannelTimeMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
    result.merge(TileDQstatusAlgCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

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

    from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
    result.merge(TileBadChannelsCondAlgCfg(flags, **kwargs))

    kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
    if kwargs['CheckDCS']:
        from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
        result.merge(TileDCSCondAlgCfg(flags))

    kwargs.setdefault('TriggerChain', '')

    # Partition pairs to monitor average time difference between partitions (ROS - 1)
    partitionPairs = [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]
    kwargs.setdefault('PartitionTimeDiffferncePairs', partitionPairs)

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileRawChannelTimeMonitoring')

    # Adding an TileCellMonitorAlgorithm algorithm to the helper
    from AthenaConfiguration.ComponentFactory import CompFactory
    TileRawChannelTimeMonitorAlgorithm = CompFactory.TileRawChannelTimeMonitorAlgorithm
    tileRawChanTimeMonAlg = helper.addAlgorithm(
        TileRawChannelTimeMonitorAlgorithm, 'TileRawChanTimeMonAlg')

    for k, v in kwargs.items():
        setattr(tileRawChanTimeMonAlg, k, v)

    run = str(flags.Input.RunNumber[0])

    # 1) Configure histogram with TileRawChannelTimeMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileRawChanTimeMonAlg,
                                       'TileRawChanTimeMonExecuteTime',
                                       'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='RawChannelTime',
        type='TH1F',
        title='Time for execute TileRawChanTimeMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=100000)

    from TileMonitoring.TileMonitoringCfgHelper import addTileModuleChannelMapsArray

    # 2) Configure histograms with status of Tile channel time per partition
    addTileModuleChannelMapsArray(helper,
                                  tileRawChanTimeMonAlg,
                                  name='TileAverageTime',
                                  title='Tile average time',
                                  path='Tile/RawChannelTime/Summary',
                                  type='TProfile2D',
                                  value='time',
                                  run=run)

    from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray

    # 3) Configure histograms with Tile partition average time vs luminosity block per partition
    addTile2DHistogramsArray(
        helper,
        tileRawChanTimeMonAlg,
        name='TileAverageTimeLB',
        xvalue='lumiBlock',
        yvalue='time',
        type='TH2D',
        title='Tile Average time vs LumiBlock;LumiBlock;t [ns]',
        path='Tile/RawChannelTime/Summary',
        run=run,
        perPartition=True,
        xbins=3000,
        xmin=-0.5,
        xmax=2999.5,
        ybins=149,
        ymin=-74.5,
        ymax=74.5)

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName

    # 4) Configure histograms with Tile partition average time difference vs luminosity block
    partitionPairs = kwargs['PartitionTimeDiffferncePairs']
    partTimeDiffVsLBArray = helper.addArray([len(partitionPairs)],
                                            tileRawChanTimeMonAlg,
                                            'TileAverageTimeDifferenceLB',
                                            topPath='Tile/RawChannelTime')
    for postfix, tool in partTimeDiffVsLBArray.Tools.items():
        pairIdx = int(postfix.split('_').pop())
        partitionName1, partitionName2 = [
            getPartitionName(ros + 1) for ros in partitionPairs[pairIdx]
        ]

        title = 'Run %s: Average time between %s and %s' % (
            run, partitionName1, partitionName2)
        title += ' vs luminosity block;LumiBlock;t [ns]'
        name = 'lumiBlock,time;TileAverageTimeDifferenceLB_%s-%s' % (
            partitionName1, partitionName2)

        tool.defineHistogram(name,
                             title=title,
                             path='Summary',
                             type='TProfile',
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             opt='kAddBinsDynamically')

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    # 5) Configure histograms with Tile digitizer time vs luminosity block per digitizer
    maxDigitizer = 8
    digiTimeVsLBArray = helper.addArray(
        [int(Tile.MAX_ROS - 1),
         int(Tile.MAX_DRAWER), maxDigitizer],
        tileRawChanTimeMonAlg,
        'TileDigitizerTimeLB',
        topPath='Tile/RawChannelTime')
    for postfix, tool in digiTimeVsLBArray.Tools.items():
        ros, module, digitizer = [int(x) for x in postfix.split('_')[1:]]

        moduleName = Tile.getDrawerString(ros + 1, module)
        title = 'Run ' + run + ' ' + moduleName + ' Digitizer ' + str(
            digitizer)
        title += ': Time vs luminosity block;LumiBlock;t [ns]'
        name = 'lumiBlock,time;TileDigitizerTimeLB_' + moduleName + '_DIGI_' + str(
            digitizer)
        path = getPartitionName(ros + 1) + '/' + moduleName

        tool.defineHistogram(name,
                             title=title,
                             path=path,
                             type='TProfile',
                             xbins=1000,
                             xmin=-0.5,
                             xmax=999.5,
                             opt='kAddBinsDynamically')

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Пример #30
0
def TileRawChannelNoiseMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileRawChannelNoiseMonitorAlgorithm algorithm in the monitoring system.'''

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
    result.merge(TileDQstatusAlgCfg(flags))

    from TileGeoModel.TileGMConfig import TileGMCfg
    result.merge(TileGMCfg(flags))

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

    from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
    result.merge(TileBadChannelsCondAlgCfg(flags, **kwargs))

    if 'TileCondToolEmscale' not in kwargs:
        from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
        emScaleTool = result.popToolsAndMerge(TileCondToolEmscaleCfg(flags))
        kwargs['TileCondToolEmscale'] = emScaleTool

    kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
    if kwargs['CheckDCS']:
        from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
        result.merge(TileDCSCondAlgCfg(flags))

    #kwargs.setdefault('TriggerChain', 'HLT_noalg_cosmiccalo_L1RD1_EMPTY') #FIXME
    kwargs.setdefault('TriggerTypes', [0x82])
    kwargs.setdefault('Gain', 1)
    kwargs.setdefault('TileRawChannelContainer',
                      flags.Tile.RawChannelContainer)

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, 'TileRawChanNoiseMonitoring')

    # Adding an TileCellMonitorAlgorithm algorithm to the helper
    from AthenaConfiguration.ComponentFactory import CompFactory
    TileRawChannelNoiseMonitorAlgorithm = CompFactory.TileRawChannelNoiseMonitorAlgorithm
    tileRawChanNoiseMonAlg = helper.addAlgorithm(
        TileRawChannelNoiseMonitorAlgorithm, 'TileRawChanNoiseMonAlg')

    for k, v in kwargs.items():
        setattr(tileRawChanNoiseMonAlg, k, v)

    run = str(flags.Input.RunNumber[0])

    # 1) Configure histogram with TileRawChanNoiseMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileRawChanNoiseMonAlg,
                                       'TileRawChanNoiseMonExecuteTime',
                                       'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='RawChannelNoise',
        type='TH1F',
        title='Time for execute TileRawChanNoiseMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=100000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName, getCellName, getGainName

    # 2) Configure histograms with Tile raw channel amplitude per channel
    gainName = getGainName(kwargs['Gain'])
    dimensions = [
        int(Tile.MAX_ROS) - 1,
        int(Tile.MAX_DRAWER),
        int(Tile.MAX_CHAN)
    ]
    chanAmpArray = helper.addArray(dimensions,
                                   tileRawChanNoiseMonAlg,
                                   'TileRawChannelNoise',
                                   topPath='Tile/RawChannelNoise')
    for postfix, tool in chanAmpArray.Tools.items():
        ros, module, channel = [int(x) for x in postfix.split('_')[1:]]

        partition = getPartitionName(ros + 1)
        moduleName = Tile.getDrawerString(ros + 1, module)
        cellName = getCellName(partition, channel)

        title = 'Run %s %s: Tile cell %s / channel %s amplitude (%s);Amplitude [ADC]'
        title = title % (run, moduleName, cellName, str(channel), gainName)
        name = 'amplitude;TileRawChannelNoise_%s_%s_ch_%s_%s' % (
            moduleName, cellName, str(channel), gainName)

        tool.defineHistogram(name,
                             title=title,
                             path=partition,
                             type='TH1F',
                             xbins=81,
                             xmin=-20.25,
                             xmax=20.25)

    accumalator = helper.result()
    result.merge(accumalator)
    return result