Esempio n. 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
Esempio n. 2
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
Esempio n. 3
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
Esempio n. 4
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
Esempio n. 5
0
def LArMgrGeoDetectorToolCfg(ConfigFlags, name='LArMgr', **kwargs):
    #set up geometry
    result=LArGMCfg(ConfigFlags)
    kwargs.setdefault("DetectorName", "LArMgr")
    #add the GeometryNotifierSvc
    result.addService(G4GeometryNotifierSvcCfg(ConfigFlags))
    kwargs.setdefault("GeometryNotifierSvc", result.getService("G4GeometryNotifierSvc"))
    result.setPrivateTools(GeoDetectorTool(name, **kwargs))
    return result
Esempio n. 6
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
Esempio n. 7
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
Esempio n. 8
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
Esempio n. 9
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
Esempio n. 10
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
Esempio n. 11
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
Esempio n. 12
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
Esempio n. 13
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
Esempio n. 14
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
Esempio n. 15
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
Esempio n. 16
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
Esempio n. 17
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
Esempio n. 18
0
def LArADC2MeVCondAlgCfg(configFlags):
    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDbCfg
    from LArGeoAlgsNV.LArGMConfig import LArGMCfg

    result = ComponentAccumulator()
    result.merge(LArOnOffIdMappingCfg(configFlags))
    result.merge(LArGMCfg(configFlags))  #Needed for identifier helpers

    theADC2MeVCondAlg = CompFactory.LArADC2MeVCondAlg(
        LArADC2MeVKey='LArADC2MeV')

    isMC = configFlags.Input.isMC

    if isMC:
        requiredConditions = [
            "Ramp", "DAC2uA", "uA2MeV", "MphysOverMcal", "HVScaleCorr"
        ]
        theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym"
        theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym"
        theADC2MeVCondAlg.LArRampKey = "LArRampSym"
        theADC2MeVCondAlg.LArMphysOverMcalKey = "LArMphysOverMcalSym"
        theADC2MeVCondAlg.LArHVScaleCorrKey = "LArHVScaleCorr"
        theADC2MeVCondAlg.UseFEBGainTresholds = False
    else:  # not MC:
        requiredConditions = [
            "Ramp", "DAC2uA", "uA2MeV", "MphysOverMcal", "HVScaleCorr"
        ]
        from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg
        if 'COMP200' in configFlags.IOVDb.DatabaseInstance:  # Run1 case
            theADC2MeVCondAlg.LAruA2MeVKey = "LAruA2MeVSym"
            theADC2MeVCondAlg.LArDAC2uAKey = "LArDAC2uASym"
        result.merge(LArFebConfigCondAlgCfg(configFlags))

    result.merge(LArElecCalibDbCfg(configFlags, requiredConditions))
    result.addCondAlgo(theADC2MeVCondAlg, primary=True)
    return result
Esempio n. 19
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
Esempio n. 20
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
Esempio n. 21
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
Esempio n. 22
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
Esempio n. 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
Esempio n. 24
0
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior = 1

    from AthenaConfiguration.AllConfigFlags import ConfigFlags

    ConfigFlags.Input.Files = [
        "myRDO.pool.root",
    ]
    ConfigFlags.lock()

    from AthenaConfiguration.MainServicesConfig import MainServicesCfg
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg

    cfg = MainServicesCfg(ConfigFlags)
    cfg.merge(PoolReadCfg(ConfigFlags))

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    cfg.merge(LArGMCfg(ConfigFlags))
    from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
    cfg.merge(LArOnOffIdMappingCfg(ConfigFlags))
    cfg.addEventAlgo(
        CompFactory.DumpLArRawChannels(NtupStream="LARRC",
                                       OutputFileName="",
                                       ToLog=False))

    cfg.addService(
        CompFactory.THistSvc(
            Output=["LARRC DATAFILE='LARRC.root', OPT='RECREATE'"]))

    cfg.run(-1)
Esempio n. 25
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
Esempio n. 26
0
def CaloTopoClusterCfg(configFlags,cellsname="AllCalo",clustersname="",doLCCalib=None,sequenceName='AthAlgSeq'):
    result=ComponentAccumulator()
    if (sequenceName != 'AthAlgSeq'):
        from AthenaCommon.CFElements import seqAND
        #result.mainSeq( seqAND( sequenceName ) )
        result.addSequence( seqAND(sequenceName) )

    if not clustersname:
        clustersname = "CaloTopoClusters"

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    from TileGeoModel.TileGMConfig import TileGMCfg
    from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg
    # Schedule total noise cond alg
    result.merge(CaloNoiseCondAlgCfg(configFlags,"totalNoise"))
    # Schedule electronic noise cond alg (needed for LC weights)
    result.merge(CaloNoiseCondAlgCfg(configFlags,"electronicNoise"))
    
    CaloTopoClusterMaker, CaloTopoClusterSplitter, CaloClusterMaker, CaloClusterSnapshot=CompFactory.getComps("CaloTopoClusterMaker","CaloTopoClusterSplitter","CaloClusterMaker","CaloClusterSnapshot",)

    result.merge(LArGMCfg(configFlags))

    from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg
    result.merge(LArHVScaleCfg(configFlags))

    result.merge(TileGMCfg(configFlags))

    if not doLCCalib:
        theCaloClusterSnapshot=CaloClusterSnapshot(OutputName=clustersname+"snapshot",SetCrossLinks=True)
    else:
        theCaloClusterSnapshot=CaloClusterSnapshot(OutputName=clustersname,SetCrossLinks=True)
         
    # maker tools
    TopoMaker = CaloTopoClusterMaker("TopoMaker")
        
    TopoMaker.CellsName = cellsname
    TopoMaker.CalorimeterNames=["LAREM",
                                "LARHEC",
                                "LARFCAL",
                                "TILE"]
    # cells from the following samplings will be able to form
    # seeds. By default no sampling is excluded
    TopoMaker.SeedSamplingNames = ["PreSamplerB", "EMB1", "EMB2", "EMB3",
                                   "PreSamplerE", "EME1", "EME2", "EME3",
                                   "HEC0", "HEC1","HEC2", "HEC3",
                                   "TileBar0", "TileBar1", "TileBar2",
                                   "TileExt0", "TileExt1", "TileExt2",
                                   "TileGap1", "TileGap2", "TileGap3",
                                   "FCAL0", "FCAL1", "FCAL2"] 
    TopoMaker.NeighborOption = "super3D"
    TopoMaker.RestrictHECIWandFCalNeighbors  = False
    TopoMaker.RestrictPSNeighbors  = True
    TopoMaker.CellThresholdOnEorAbsEinSigma     =    0.0
    TopoMaker.NeighborThresholdOnEorAbsEinSigma =    2.0
    TopoMaker.SeedThresholdOnEorAbsEinSigma     =    4.0
    
    # note E or AbsE 
    #
    # the following property must be set to TRUE in order to make double
    # sided cuts on the seed and the cluster level 
    #
    TopoMaker.SeedCutsInAbsE                 = True
    TopoMaker.ClusterEtorAbsEtCut            = 0.0*MeV
    # use 2-gaussian or single gaussian noise for TileCal
    TopoMaker.TwoGaussianNoise = configFlags.Calo.TopoCluster.doTwoGaussianNoise
        
    TopoSplitter = CaloTopoClusterSplitter("TopoSplitter")
    # cells from the following samplings will be able to form local
    # maxima. The excluded samplings are PreSamplerB, EMB1,
    # PreSamplerE, EME1, all Tile samplings, all HEC samplings and the
    # two rear FCal samplings.
    #
    TopoSplitter.SamplingNames = ["EMB2", "EMB3",
                                  "EME2", "EME3",
                                  "FCAL0"]
    # cells from the following samplings will also be able to form
    # local maxima but only if they are not overlapping in eta and phi
    # with local maxima in previous samplings from the primary list.
    #
    TopoSplitter.SecondarySamplingNames = ["EMB1","EME1",
                                           "TileBar0","TileBar1","TileBar2",
                                           "TileExt0","TileExt1","TileExt2",
                                           "HEC0","HEC1","HEC2","HEC3",
                                           "FCAL1","FCAL2"]
    TopoSplitter.ShareBorderCells = True
    TopoSplitter.RestrictHECIWandFCalNeighbors  = False
    TopoSplitter.WeightingOfNegClusters = configFlags.Calo.TopoCluster.doTreatEnergyCutAsAbsolute
    #
    # the following options are not set, since these are the default
    # values
    #
    # NeighborOption                = "super3D",
    # NumberOfCellsCut              = 4,
    # EnergyCut                     = 500*MeV,
        

    CaloTopoCluster=CaloClusterMaker(clustersname)
    CaloTopoCluster.ClustersOutputName=clustersname

    CaloTopoCluster.ClusterMakerTools = [TopoMaker, TopoSplitter]
    
    from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg
    caloBadChanTool = result.popToolsAndMerge( CaloBadChanToolCfg(configFlags) )
    CaloClusterBadChannelList=CompFactory.CaloClusterBadChannelList
    BadChannelListCorr = CaloClusterBadChannelList(badChannelTool = caloBadChanTool)
    CaloTopoCluster.ClusterCorrectionTools += [BadChannelListCorr]

    CaloTopoCluster.ClusterCorrectionTools += [getTopoMoments(configFlags)]

    if doLCCalib is None:
        doLCCalib = configFlags.Calo.TopoCluster.doTopoClusterLocalCalib
    if doLCCalib:
        CaloTopoCluster.ClusterCorrectionTools += [theCaloClusterSnapshot]
        #if not clustersname:
        CaloTopoCluster.ClustersOutputName="CaloCalTopoClusters"
        CaloTopoCluster.ClusterCorrectionTools += getTopoClusterLocalCalibTools(configFlags)

        from CaloRec.CaloTopoClusterConfig import caloTopoCoolFolderCfg
        result.merge(caloTopoCoolFolderCfg(configFlags))

    result.addEventAlgo(CaloTopoCluster,primary=True,sequenceName=sequenceName)
    return result
Esempio n. 27
0
def TileCalCellMonAlgConfig(inputFlags, **kwargs):
    ''' Function to configure TileCalCellMonAlg algorithm in the monitoring system.'''

    kwargs.setdefault('MonGroupName', 'TileEventFiter')
    kwargs.setdefault('useBeamBackgroundRemoval', False)
    kwargs.setdefault('useLArNoisyAlg', False)
    kwargs.setdefault('useLArCollisionFilterTool', False)

    if not (inputFlags.Common.isOnline == 'online' or inputFlags.Input.isMC):
        kwargs.setdefault('useReadyFilterTool', True)
        kwargs.setdefault(
            'useBadLBTool',
            False)  # FIXME: when new LArBadLBFilterTool config is ready
    else:
        kwargs.setdefault('useReadyFilterTool', False)
        kwargs.setdefault('useBadLBTool', False)

    from AthenaCommon.SystemOfUnits import MeV
    kwargs.setdefault('EnergyThreshold', 300.0 * MeV)

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

    from LArGeoAlgsNV.LArGMConfig import LArGMCfg
    cfg = LArGMCfg(inputFlags)

    from TileGeoModel.TileGMConfig import TileGMCfg
    cfg.merge(TileGMCfg(inputFlags))

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

    if kwargs['useLArCollisionFilterTool']:
        from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
        cfg.merge(LArCollisionTimeCfg(inputFlags))

    if kwargs['useReadyFilterTool'] and 'ReadyFilterTool' not in kwargs:
        from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
        readyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))
        kwargs['ReadyFilterTool'] = readyFilterTool

    from AthenaConfiguration.ComponentFactory import CompFactory
    tileCalCellMonAlg = helper.addAlgorithm(CompFactory.TileCalCellMonAlg,
                                            'TileCalCellMonAlg')

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

    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 tileCalCellMonAlg.useReadyFilterTool:
        binLabels[1] = "ATLAS Ready-OFF"
    if not tileCalCellMonAlg.useBadLBTool:
        binLabels[2] = "Good LAr LB-OFF"
    if not tileCalCellMonAlg.useLArCollisionFilterTool:
        binLabels[3] = "LAr collision-OFF"
    if not tileCalCellMonAlg.useBeamBackgroundRemoval:
        binLabels[4] = "Beam backgr.-OFF"
    if not tileCalCellMonAlg.useLArNoisyAlg:
        binLabels[5] = "LAr Error Veto-OFF"

    topPath = '/CaloMonitoring/TileCellMon_NoTrigSel/General/'
    tileFilterGroup = helper.addGroup(tileCalCellMonAlg,
                                      tileCalCellMonAlg.MonGroupName, topPath)

    from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
    CaloBaseHistConfig(tileFilterGroup, 'Summary/', binLabels)

    # 1) Configure histogram with TileCalCellMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileCalCellMonAlg,
                                       'TileCalCellMonExecuteTime', topPath)
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='Summary',
        type='TH1F',
        title='Time for execute TileCalCellMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=100000)

    # 2) Configure histograms with occupancy maps over threshold (4 noise sigma) per Tile sample
    samplesWithoutE = ['A', 'BC', 'D', '']
    noiseEtaPhiArray = helper.addArray([len(samplesWithoutE)],
                                       tileCalCellMonAlg,
                                       'CellsNoiseXEtaVSPhi',
                                       topPath=topPath)
    for postfix, tool in noiseEtaPhiArray.Tools.items():
        sample = samplesWithoutE[int(postfix.split('_')[1])]
        title = ('Number of Tile Cells %s' %
                 sample) + ' with E > 4 sigma (DB);#eta;#phi'
        name = 'eta,phi;CellsNoiseXEtaVSPhi' + (sample +
                                                'cells' if sample else '')
        tool.defineHistogram(name,
                             title=title,
                             type='TH2F',
                             xbins=17,
                             xmin=-1.7,
                             xmax=1.7,
                             ybins=64,
                             ymin=-3.14,
                             ymax=3.14)

    # 3) Configure histogram with number of 4 sigma seeds per Tile hash ID
    noiseHashGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXNoiseXHash',
                                     topPath)
    noiseHashGroup.defineHistogram(
        'hash;CellsXNoiseXHash',
        path='',
        type='TH1F',
        title='Number of 4 sigma seeds per hash;Tile Cell Hash ID;Events',
        xbins=5184,
        xmin=-0.5,
        xmax=5183.5)

    # 4) Configure histogram with Tile cell energy/noise (DB) ratio
    noiseHashGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseTile',
                                     topPath)
    noiseHashGroup.defineHistogram(
        'noise;CellsNoiseTile',
        path='',
        type='TH1F',
        title='Energy/Noise (DB) of TileCal;Cell Energy / sigma (DB);Events',
        xbins=200,
        xmin=-10.0,
        xmax=10.0)

    # 5) Configure histogram with mean Tile cell noise (DB) vs eta
    noiseEtaGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseXEta',
                                    topPath)
    noiseEtaGroup.defineHistogram(
        'eta,noise;CellsNoiseXEta',
        path='',
        type='TProfile',
        title=
        'Tile Cell noise #sigma (DB) vs #eta;#eta;Mean Cell noise (DB) [MeV]',
        xbins=17,
        xmin=-1.7,
        xmax=1.7)

    # 6) Configure histogram with mean Tile cell noise (DB) vs phi
    noisePhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsNoiseXPhi',
                                    topPath)
    noisePhiGroup.defineHistogram(
        'phi,noise;CellsNoiseXPhi',
        path='',
        type='TProfile',
        title=
        'Tile Cell noise #sigma (DB) vs #phi;#phi;Mean Cell noise (DB) [MeV]',
        xbins=64,
        xmin=-3.14,
        xmax=3.14)

    # 7) Configure histogram with number of Tile cell over threshold
    nCellsGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXN', topPath)
    nCellsGroup.defineHistogram(
        'nCells;CellsXN',
        path='',
        type='TH1F',
        title=
        'Number of Tile Cells over threshold;Number of Tile Cells; Events',
        xbins=250,
        xmin=0,
        xmax=500)

    # 8) Configure histogram with Tile cell energy in GeV
    energyGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXE', topPath)
    energyGroup.defineHistogram(
        'energy;CellsXE',
        path='',
        type='TH1F',
        title='Energy of Tile Cells;Tile Cell Energy [GeV]; Events',
        xbins=50,
        xmin=0,
        xmax=20)

    # 9) Configure histogram with mean Tile cell energy in GeV vs eta
    energyEtaGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXEta', topPath)
    energyEtaGroup.defineHistogram(
        'eta,energy;CellsXEta',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs #eta;#eta;Mean Cell Energy [GeV]',
        xbins=17,
        xmin=-1.7,
        xmax=1.7)

    # 10) Configure histogram with mean Tile cell energy in GeV vs phi
    energyPhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXPhi', topPath)
    energyPhiGroup.defineHistogram(
        'phi,energy;CellsXPhi',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs #phi;#phi;Mean Cell Energy [GeV]',
        xbins=64,
        xmin=-3.14,
        xmax=3.14)

    # 11) Configure histogram with mean Tile cell energy in GeV vs tower
    energyTowerGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXTower',
                                       topPath)
    energyTowerGroup.defineHistogram(
        'tower,energy;CellsXTower',
        path='',
        type='TProfile',
        title='Tile Cell Energy vs tower;Tower;Mean Cell Energy [GeV]',
        xbins=18,
        xmin=0,
        xmax=18)

    # 12) Configure histogram with occupancy map over threshold vs eta and phi
    occupEtaPhiGroup = helper.addGroup(tileCalCellMonAlg, 'CellsXEtaVSPhi',
                                       topPath)
    occupEtaPhiTitle = (
        'Number of Tile Cell above threshold %s MeV;#eta;#phi' %
        kwargs['EnergyThreshold'])
    occupEtaPhiGroup.defineHistogram('eta,phi;CellsXEtaVSPhi',
                                     path='',
                                     type='TH2F',
                                     title=occupEtaPhiTitle,
                                     xbins=17,
                                     xmin=-1.7,
                                     xmax=1.7,
                                     ybins=64,
                                     ymin=-3.14,
                                     ymax=3.14)

    # 13) Configure histograms with mean Tile cell energy vs module per sample
    samples = ['A', 'BC', 'D', 'E']
    energyModuleArray = helper.addArray([len(samples)],
                                        tileCalCellMonAlg,
                                        'CellsXModule',
                                        topPath=topPath)
    for postfix, tool in energyModuleArray.Tools.items():
        sampleIdx = int(postfix.split('_')[1])
        sample = samples[sampleIdx]
        title = ('Tile Sampling %s' %
                 sample) + ';Module;Mean Cell Energy [GeV]'
        name = 'module,energy;CellsXModuleS' + str(sampleIdx + 1)
        tool.defineHistogram(name,
                             title=title,
                             type='TProfile',
                             xbins=64,
                             xmin=1,
                             xmax=65)

    accumalator = helper.result()
    cfg.merge(accumalator)
    return cfg
Esempio n. 28
0
def LArPileUpToolCfg(flags, name="LArPileUpTool", **kwargs):
    """Return ComponentAccumulator with configured LArPileUpTool"""
    acc = LArGMCfg(flags)

    #The LArPileupTool needs: Noise, fSampl, Pedestal,Shape ADC2MeV
    # AutoCorrNoise, the list of bad FEBs and the cabling
    acc.merge(LArADC2MeVCondAlgCfg(flags))
    acc.merge(LArBadFebCfg(flags))
    if flags.Overlay.DataOverlay:
        kwargs.setdefault("ShapeKey", "LArShape")
    if not flags.Digitization.DoCaloNoise:
        requiredConditons = ["fSampl", "Pedestal", "Shape"]
    else:
        requiredConditons = ["Noise", "fSampl", "Pedestal", "Shape"]
    acc.merge(LArElecCalibDbCfg(flags, requiredConditons))

    if not flags.Detector.OverlayLAr:
        acc.merge(LArAutoCorrNoiseCondAlgCfg(flags))
    if "MaskingTool" not in kwargs:
        maskerTool = acc.popToolsAndMerge(
            LArBadChannelMaskerCfg(flags, ["deadReadout", "deadPhys"],
                                   ToolName="LArRCBMasker"))
        kwargs["MaskingTool"] = maskerTool
    # defaults
    kwargs.setdefault("NoiseOnOff", flags.Digitization.DoCaloNoise)
    kwargs.setdefault("DoDigiTruthReconstruction",
                      flags.Digitization.DoDigiTruth)
    if flags.Digitization.DoXingByXingPileUp:
        kwargs.setdefault("FirstXing", -751)
        kwargs.setdefault("LastXing", 101)
    if (not flags.Digitization.HighGainFCal) and (
            not flags.Detector.OverlayLAr):
        kwargs.setdefault("HighGainThreshFCAL", 0)
    if (not flags.Digitization.HighGainEMECIW) and (
            not flags.Detector.OverlayLAr):
        kwargs.setdefault("HighGainThreshEMECIW", 0)
    kwargs.setdefault("RndmEvtOverlay", flags.Detector.OverlayLAr)
    if flags.Digitization.PileUpPremixing:
        kwargs.setdefault("DigitContainer",
                          flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
    else:
        kwargs.setdefault(
            "DigitContainer",
            "LArDigitContainer_MC")  # FIXME - should not be hard-coded
    # if doing MC+MC overlay
    if flags.Input.isMC and flags.Detector.OverlayLAr:
        kwargs.setdefault("isMcOverlay", True)
    kwargs.setdefault("Nsamples", flags.LAr.ROD.nSamples)
    kwargs.setdefault("firstSample", flags.LAr.ROD.FirstSample)
    # cosmics digitization
    if flags.Beam.Type == "cosmics":
        kwargs.setdefault("UseTriggerTime", True)
        CosmicTriggerTimeTool = CompFactory.CosmicTriggerTimeTool
        kwargs.setdefault("TriggerTimeToolName", CosmicTriggerTimeTool())
    # pileup configuration "algorithm" way
    if not flags.Digitization.DoXingByXingPileUp:
        if flags.Digitization.Pileup or flags.Detector.OverlayLAr:
            kwargs.setdefault("PileUp", True)
    kwargs.setdefault("useLArFloat", useLArFloat(flags))
    if useLArFloat(flags):
        maps = [
            "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB",
            "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC",
            "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC",
            "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"
        ]
        AddressRemappingSvc, ProxyProviderSvc = CompFactory.getComps(
            "AddressRemappingSvc",
            "ProxyProviderSvc",
        )
        acc.addService(
            AddressRemappingSvc(TypeKeyOverwriteMaps=maps,
                                ProxyDict="ActiveStoreSvc"))
        acc.addService(ProxyProviderSvc(ProviderNames=["AddressRemappingSvc"]))
        kwargs.setdefault("LArHitContainers", [])
    else:
        kwargs.setdefault("LArHitFloatContainers", [])
    if flags.Detector.OverlayLAr:
        kwargs.setdefault("OnlyUseContainerName", False)
        if flags.Overlay.DataOverlay:
            kwargs.setdefault("InputDigitContainer",
                              flags.Overlay.BkgPrefix + "FREE")
        else:
            kwargs.setdefault("InputDigitContainer",
                              flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
    LArPileUpTool = CompFactory.LArPileUpTool
    acc.setPrivateTools(LArPileUpTool(name, **kwargs))
    return acc
Esempio n. 29
0
def regSelCfg(flags):
    """ Configures Region Selector Svc according to the detector flags """
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    RegSelSvc = CompFactory.RegSelSvc
    from AthenaCommon.SystemOfUnits import mm
    acc = ComponentAccumulator()

    regSel = RegSelSvc()
    regSel.DeltaZ = 225 * mm

    if flags.Detector.GeometryLAr:
        regSel.enableCalo = True

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

        LArRegionSelectorTable = CompFactory.LArRegionSelectorTable
        regSel.LArRegionSelectorTable = LArRegionSelectorTable(
            name="LArRegionSelectorTable")

        from IOVDbSvc.IOVDbSvcConfig import addFolders
        acc.merge(addFolders(flags, ['/LAR/Identifier/FebRodMap'], 'LAR'))

    if flags.Detector.GeometryTile:
        regSel.enableCalo = True

        from TileGeoModel.TileGMConfig import TileGMCfg
        acc.merge(TileGMCfg(flags))
        acc.getService('GeoModelSvc').DetectorTools[
            'TileDetectorTool'].GeometryConfig = 'RECO'

        TileRegionSelectorTable = CompFactory.TileRegionSelectorTable
        regSel.TileRegionSelectorTable = TileRegionSelectorTable(
            name="TileRegionSelectorTable")

    if flags.Detector.GeometryPixel:
        regSel.enableID = True
        regSel.enablePixel = True
        SiRegionSelectorTable = CompFactory.SiRegionSelectorTable
        regSel.PixelRegionLUT_CreatorTool = SiRegionSelectorTable(
            name="PixelRegionSelectorTable",
            ManagerName="Pixel",
            OutputFile="RoITablePixel.txt",
            PrintHashId=True,
            PrintTable=False)

    if flags.Detector.GeometrySCT:
        regSel.enableID = True
        regSel.enableSCT = True
        SiRegionSelectorTable = CompFactory.SiRegionSelectorTable
        regSel.SCT_RegionLUT_CreatorTool = SiRegionSelectorTable(
            name="SCT_RegionSelectorTable",
            ManagerName="SCT",
            OutputFile="RoITableSCT.txt",
            PrintHashId=True,
            PrintTable=False)

    if flags.Detector.GeometryTRT:
        regSel.enableID = True
        regSel.enableTRT = True
        TRT_RegionSelectorTable = CompFactory.TRT_RegionSelectorTable
        regSel.TRT_RegionLUT_CreatorTool = TRT_RegionSelectorTable(
            name="TRT_RegionSelectorTable",
            ManagerName="TRT",
            OutputFile="RoITableTRT.txt",
            PrintHashId=True,
            PrintTable=False)

    # by default, all 'enableX' flags of RegSelSvc are set to True, so turn them off if not needed
    if not flags.Detector.GeometryRPC:
        regSel.enableRPC = False
    else:
        regSel.enableMuon = True
        RPC_RegionSelectorTable = CompFactory.RPC_RegionSelectorTable
        regSel.RPCRegionSelectorTable = RPC_RegionSelectorTable(
            name="RPC_RegionSelectorTable")

    if not flags.Detector.GeometryMDT:
        regSel.enableMDT = False
    else:
        regSel.enableMuon = True
        MDT_RegionSelectorTable = CompFactory.MDT_RegionSelectorTable
        regSel.MDTRegionSelectorTable = MDT_RegionSelectorTable(
            name="MDT_RegionSelectorTable")

    if not flags.Detector.GeometryTGC:
        regSel.enableTGC = False
    else:
        regSel.enableMuon = True
        TGC_RegionSelectorTable = CompFactory.TGC_RegionSelectorTable
        regSel.TGCRegionSelectorTable = TGC_RegionSelectorTable(
            name="TGC_RegionSelectorTable")

    if not flags.Detector.GeometryCSC:
        regSel.enableCSC = False
    else:
        regSel.enableMuon = True
        CSC_RegionSelectorTable = CompFactory.CSC_RegionSelectorTable
        regSel.CSCRegionSelectorTable = CSC_RegionSelectorTable(
            name="CSC_RegionSelectorTable")

    if not flags.Detector.GeometryMM:
        regSel.enableMM = False

    if not flags.Detector.GeometrysTGC:
        regSel.enablesTGC = False

    acc.addService(regSel)

    return acc
Esempio n. 30
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