Пример #1
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
Пример #2
0
def TileClusterMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileClusterMonitorAlgorithm 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 TileMonitoring.TileTopoClusterConfig import TileTopoClusterCfg
    result.merge(TileTopoClusterCfg(flags))

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

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

    tileClusterMonAlg.TriggerChain = ''

    #    from AthenaCommon.SystemOfUnits import MeV
    #kwargs.setdefault('EnergyThreshold', 50.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']

    kwargs.setdefault('fillTimingHistograms', flags.Common.isOnline)
    fillTimingHistograms = kwargs['fillTimingHistograms']

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

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

    # 1) Configure histogram with TileClusterMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileClusterMonAlg,
                                       'TileClusterMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='Cluster',
        type='TH1F',
        title='Time for execute TileClusterMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=1000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    from TileMonitoring.TileMonitoringCfgHelper import addTileEtaPhiMapsArray

    # ) Configure histograms with most energetic Tile tower position
    addTileEtaPhiMapsArray(helper,
                           tileClusterMonAlg,
                           name='TileClusterEtaPhi',
                           type='TH2D',
                           title='Most energetic Tile Cluster position',
                           path='Tile/Cluster',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # ) Configure histograms with most energetic Tile tower position
    addTileEtaPhiMapsArray(helper,
                           tileClusterMonAlg,
                           name='TileAllClusterEtaPhi',
                           type='TH2D',
                           title='All Tile Cluster position',
                           path='Tile/Cluster',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # ) Configure histograms with most energetic Tile tower position
    addTileEtaPhiMapsArray(helper,
                           tileClusterMonAlg,
                           name='TileAllClusterEneEtaPhi',
                           type='TProfile2D',
                           value='energy',
                           title='All Tile Cluster everage energy [MeV]',
                           path='Tile/Cluster',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # ) Configure histograms with position correlation of Tile cluster opposite to most energetic cluster
    addTileEtaPhiMapsArray(
        helper,
        tileClusterMonAlg,
        name='TileClusterEtaPhiDiff',
        type='TH2D',
        title=
        'Position correlation of Tile Cluster opposite to most energetic cluster',
        path='Tile/Cluster',
        run=run,
        triggers=l1Triggers,
        perSample=False,
        etaTitle='#Delta #eta',
        etabins=21,
        etamin=-2.025,
        etamax=2.025,
        phiTitle='#Delta #phi',
        phibins=Tile.MAX_DRAWER,
        phimin=0.0,
        phimax=6.4)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(
        helper,
        tileClusterMonAlg,
        name='TileClusterEnergy',
        xvalue='energy',
        title='Energy in most energetic Tile Cluster [MeV]',
        path='Tile/Cluster',
        xbins=80,
        xmin=0.,
        xmax=20000.,
        type='TH1D',
        run=run,
        triggers=l1Triggers,
        perPartition=True,
        perSample=False,
        perGain=False,
        subDirectory=True,
        allPartitions=True)

    # ) Configure histograms with Et in most energetic Tile tower per partition
    addTile1DHistogramsArray(
        helper,
        tileClusterMonAlg,
        name='TileClusterEt',
        xvalue='Et',
        title='E_{T} [MeV] in most energetic Tile Cluster',
        path='Tile/Cluster',
        xbins=80,
        xmin=0.,
        xmax=20000.,
        type='TH1D',
        run=run,
        triggers=l1Triggers,
        perPartition=False,
        perSample=False,
        perGain=False,
        subDirectory=False,
        allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(
        helper,
        tileClusterMonAlg,
        name='TileClusterNCells',
        xvalue='nCells',
        title='Number of cells in most energetic Tile Cluster',
        path='Tile/Cluster',
        xbins=100,
        xmin=0.,
        xmax=100.,
        type='TH1D',
        run=run,
        triggers=l1Triggers,
        perPartition=False,
        perSample=False,
        perGain=False,
        subDirectory=False,
        allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileAllClusterEnergy',
                             xvalue='energy',
                             title='All Tile Cluster Energy [MeV]',
                             path='Tile/Cluster',
                             xbins=80,
                             xmin=0.,
                             xmax=20000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileNClusters',
                             xvalue='nClusters',
                             title='Number of Tile Clusters',
                             path='Tile/Cluster',
                             xbins=200,
                             xmin=0.,
                             xmax=200.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileClusterSumPx',
                             xvalue='sumPx',
                             title='Tile Clusters SumPx [MeV]',
                             path='Tile/Cluster',
                             xbins=101,
                             xmin=-10000.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileClusterSumPy',
                             xvalue='sumPy',
                             title='Tile Clusters SumPy [MeV]',
                             path='Tile/Cluster',
                             xbins=101,
                             xmin=-10000.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileClusterSumEt',
                             xvalue='sumEt',
                             title='Tile Clusters SumEt [MeV]',
                             path='Tile/Cluster',
                             xbins=100,
                             xmin=0.,
                             xmax=20000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    timeDiffTitle = 'Tile time correlation of cluster opposite to most energetic cluster; Time difference [ns]'
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileClusterTimeDiff',
                             xvalue='timeDiff',
                             title=timeDiffTitle,
                             path='Tile/Cluster',
                             xbins=200,
                             xmin=-100.,
                             xmax=100.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # ) Configure histograms with all Tile towers energy per partition
    eneDiffTitle = 'Tile energy correlation of cluster opposite to most energetic cluster; Time energy [MeV]'
    addTile1DHistogramsArray(helper,
                             tileClusterMonAlg,
                             name='TileClusterEneDiff',
                             xvalue='energyDiff',
                             title=eneDiffTitle,
                             path='Tile/Cluster',
                             xbins=200,
                             xmin=-10000.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    if fillTimingHistograms:
        # ) Configure histograms with Tile partition time vs lumiBlock per partition
        titlePartitionTime = 'Tile partition time vs luminosity block;LumiBlock;t[ns]'
        addTile1DHistogramsArray(helper,
                                 tileClusterMonAlg,
                                 name='TilePartitionTimeLB',
                                 xvalue='lumiBlock',
                                 value='time',
                                 title=titlePartitionTime,
                                 path='Tile/Cluster',
                                 xbins=1000,
                                 xmin=-0.5,
                                 xmax=999.5,
                                 type='TProfile',
                                 run=run,
                                 triggers=[],
                                 subDirectory=False,
                                 perPartition=True,
                                 perSample=False,
                                 perGain=False,
                                 allPartitions=True)

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Пример #3
0
def TileMuIdMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileMuIdMonitorAlgorithm 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()

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

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

    tileMuIdMonAlg.TriggerChain = ''

    # 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(tileMuIdMonAlg, k, v)

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

    # 1) Configure histogram with TileMuIdMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileMuIdMonAlg,
                                       'TileMuIdMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='MuId',
        type='TH1F',
        title='Time for execute TileMuIdMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=1000)

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    from TileMonitoring.TileMonitoringCfgHelper import addTileEtaPhiMapsArray

    # 2) Configure histograms with most energetic Tile MuId muon position
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuIdEtaPhi',
                           type='TH2D',
                           title='Tile MuId muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # 3) Configure histograms with most energetic Tile MuId muon position when Tags=1
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuId1TagEtaPhi',
                           type='TH2D',
                           title='Tile MuId Tags=1 muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # 4) Configure histograms with most energetic Tile MuId muon position when Tags=2
    addTileEtaPhiMapsArray(helper,
                           tileMuIdMonAlg,
                           name='TileMuId2TagEtaPhi',
                           type='TH2D',
                           title='Tile MuId Tags=2 muon position',
                           path='Tile/MuId',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray

    # 5) Configure histograms with Tile MuId muon quality vs energy
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuIdEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title='Tile MuId muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    # 6) Configure histograms with Tile  MuId muon quality vs energy when Tags=1
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuId1TagEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title=
        'Tile MuId Tags=1 muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    # 7) Configure histograms with Tile  MuId muon quality vs energy when Tags=2
    addTile2DHistogramsArray(
        helper,
        tileMuIdMonAlg,
        name='TileMuId2TagEneQuality',
        xvalue='energy',
        yvalue='quality',
        type='TH2D',
        title=
        'Tile MuId Tags=2 muon quality vs energy [MeV];Energy [MeV];Quality',
        path='Tile/MuId',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        ybins=4,
        ymin=-0.5,
        ymax=1.5,
        run=run,
        triggers=l1Triggers)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # 8) Configure histograms with Tile MuId number of tags
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdTags',
                             xvalue='nTags',
                             title='Tile MuId number of tags',
                             path='Tile/MuId',
                             xbins=5,
                             xmin=-0.5,
                             xmax=4.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 9) Configure histograms with all Tile MuId energy
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEnergy',
                             xvalue='energy',
                             title='Tile MuId Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 10) Configure histograms with all Tile MuId muon quality
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdQuality',
                             xvalue='quality',
                             title='Tile MuId muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 11) Configure histograms with all Tile MuId muon eta position
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEta',
                             xvalue='eta',
                             title='Tile MuId muon #eta position;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 12) Configure histograms with all Tile MuId muon phi position
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdPhi',
                             xvalue='phi',
                             title='Tile MuId muon #phi position;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 13) Configure histograms with all Tile MuId muon average energy vs eta
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 14) Configure histograms with all Tile MuId muon average energy vs phi
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuIdEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 15) Configure histograms with all Tile MuId energy when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEnergy',
                             xvalue='energy',
                             title='Tile MuId Tags=1 Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 16) Configure histograms with all Tile MuId muon quality when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagQuality',
                             xvalue='quality',
                             title='Tile MuId Tags=1 muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 17) Configure histograms with all Tile MuId muon average energy vs eta when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId Tags=1 muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 18) Configure histograms with all Tile MuId muon average energy vs phi when Tags=1
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId1TagEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId Tags=1 muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 19) Configure histograms with all Tile MuId energy when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEnergy',
                             xvalue='energy',
                             title='Tile MuId Tags=2 Energy [MeV]',
                             path='Tile/MuId',
                             xbins=100,
                             xmin=0.,
                             xmax=10000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 20) Configure histograms with all Tile MuId muon quality when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagQuality',
                             xvalue='quality',
                             title='Tile MuId Tags=2 muon quality',
                             path='Tile/MuId',
                             xbins=4,
                             xmin=-0.5,
                             xmax=1.5,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 21) Configure histograms with all Tile MuId muon average energy vs eta when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEneEta',
                             xvalue='eta',
                             value='energy',
                             title='Tile MuId Tags=2 muon average energy;#eta',
                             path='Tile/MuId',
                             xbins=40,
                             xmin=-2.,
                             xmax=2.,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

    # 22) Configure histograms with all Tile MuId muon average energy vs phi when Tags=2
    addTile1DHistogramsArray(helper,
                             tileMuIdMonAlg,
                             name='TileMuId2TagEnePhi',
                             xvalue='phi',
                             value='energy',
                             title='Tile MuId Tags=2 muon everage energy;#phi',
                             path='Tile/MuId',
                             xbins=Tile.MAX_DRAWER,
                             xmin=-3.15,
                             xmax=3.15,
                             type='TProfile',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False,
                             perSample=False,
                             perGain=False,
                             subDirectory=False,
                             allPartitions=False)

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

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.

    result = ComponentAccumulator()

    from TileMonitoring.TileTowerBuilderConfig import TileTowerBuilderAlgCfg
    result.merge(TileTowerBuilderAlgCfg(flags))

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

    # Adding an TileTowerMonitorAlgorithm algorithm to the helper
    TileTowerMonitorAlgorithm = CompFactory.TileTowerMonitorAlgorithm
    tileTowerMonAlg = helper.addAlgorithm(TileTowerMonitorAlgorithm,
                                          'TileTowerMonAlg')

    tileTowerMonAlg.TriggerChain = ''

    # 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(tileTowerMonAlg, k, v)

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

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

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

    # ) Configure histograms with most energetic Tile tower position
    addTileEtaPhiMapsArray(helper,
                           tileTowerMonAlg,
                           name='TileTowerEtaPhi',
                           type='TH2D',
                           title='Most energetic Tile Tower position',
                           path='Tile/Tower',
                           run=run,
                           triggers=l1Triggers,
                           perSample=False)

    # ) Configure histograms with position correlation of Tile tower opposite to most energetic tower
    addTileEtaPhiMapsArray(
        helper,
        tileTowerMonAlg,
        name='TileTowerEtaPhiDiff',
        type='TH2D',
        title=
        'Position correlation of Tile Tower opposite to most energetic tower',
        path='Tile/Tower',
        run=run,
        triggers=l1Triggers,
        perSample=False,
        etaTitle='#Delta #eta',
        etabins=41,
        etamin=-2.05,
        etamax=2.05,
        phiTitle='#Delta #phi',
        phibins=Tile.MAX_DRAWER + 1,
        phimin=-0.05,
        phimax=6.45)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # ) Configure histograms with Et in most energetic Tile tower per partition
    addTile1DHistogramsArray(helper,
                             tileTowerMonAlg,
                             name='TileTowerEt',
                             xvalue='Et',
                             title='E_{T} [MeV] in most energetic Tile Tower',
                             path='Tile/Tower',
                             xbins=80,
                             xmin=0.,
                             xmax=20000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             subDirectory=True,
                             allPartitions=True)

    # ) Configure histograms with all Tile towers energy per partition
    addTile1DHistogramsArray(helper,
                             tileTowerMonAlg,
                             name='TileAllTowerEnergy',
                             xvalue='energy',
                             title='All Tile Towers Energy [MeV]',
                             path='Tile/Tower',
                             xbins=80,
                             xmin=0.,
                             xmax=20000.,
                             type='TH1D',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=True,
                             perSample=False,
                             perGain=False,
                             subDirectory=True,
                             allPartitions=True)

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

    # Define one top-level monitoring algorithm. The new configuration
    # framework uses a component accumulator.

    result = ComponentAccumulator()

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

    # Adding an TileMuonFitMonitorAlgorithm algorithm to the helper
    TileMuonFitMonitorAlgorithm = CompFactory.TileMuonFitMonitorAlgorithm
    tileMuonFitMonAlg = helper.addAlgorithm(TileMuonFitMonitorAlgorithm,
                                            'TileMuonFitMonAlg')

    tileMuonFitMonAlg.TriggerChain = ''

    # 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(tileMuonFitMonAlg, k, v)

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

    # 1) Configure histogram with TileMuonFitMonAlg algorithm execution time
    executeTimeGroup = helper.addGroup(tileMuonFitMonAlg,
                                       'TileMuonFitMonExecuteTime', 'Tile/')
    executeTimeGroup.defineHistogram(
        'TIME_execute',
        path='MuonFit',
        type='TH1F',
        title='Time for execute TileMuonFitMonAlg algorithm;time [#mus]',
        xbins=100,
        xmin=0,
        xmax=10000)

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

    # 2) Configure histograms with Tile MuonFit position at y=0
    addTile2DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPosition',
        xvalue='zPosition',
        yvalue='xPosition',
        title='Tile MuonFit position at y=0;z [mm];x [mm]',
        path='Tile/MuonFit',
        xbins=69,
        xmin=-6900,
        xmax=6900.,
        ybins=44,
        ymin=-4400.,
        ymax=4400.,
        type='TH2D',
        run=run,
        triggers=l1Triggers)

    # 3) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane vs position
    addTile2DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPosDirectionTheta',
        xvalue='zPosition',
        yvalue='theta',
        path='Tile/MuonFit',
        title='Tile MuonFit vertical axis component;z [mm];sin(#theta)',
        xbins=49,
        xmin=-4900,
        xmax=4900.,
        ybins=50,
        ymin=-0.,
        ymax=1.,
        type='TH2D',
        run=run,
        triggers=l1Triggers)

    from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray

    # 4) Configure histograms with number of Tile MuonFits reconstructed
    addTile1DHistogramsArray(helper,
                             tileMuonFitMonAlg,
                             name='TileMuonFitNum',
                             xvalue='nMuons',
                             title='Number of Tile MuonFit reconstructed',
                             path='Tile/MuonFit',
                             xbins=10,
                             xmin=-0.5,
                             xmax=9.5,
                             type='TH1F',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False)

    # 5) Configure histograms with number of Tile cells per MuonFit track
    addTile1DHistogramsArray(helper,
                             tileMuonFitMonAlg,
                             name='TileMuonFitNCells',
                             xvalue='nCells',
                             title='Number of Tile cells per MuonFit track',
                             path='Tile/MuonFit',
                             xbins=10,
                             xmin=-0.5,
                             xmax=9.5,
                             type='TH1F',
                             run=run,
                             triggers=l1Triggers,
                             perPartition=False)

    # 6) Configure histograms with Tile MuonFit total energy
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitEnergy',
        xvalue='energy',
        title='Tile MuonFit total energy;Muon energy [MeV]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 7) Configure histograms with Tile MuonFit time at y=0 plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitTime',
        xvalue='time',
        title='Tile MuonFit time at y=0 plane;Muon time [ns]',
        path='Tile/MuonFit',
        xbins=49,
        xmin=-73.5,
        xmax=73.5,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 8) Configure histograms with Tile MuonFit path
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPath',
        xvalue='path',
        title='Tile MuonFit total path length;Muon path length [mm]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10000.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 9) Configure histograms with Tile MuonFit energy density
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitEneDensity',
        xvalue='eneDensity',
        title='Tile MuonFit energy density;Muon energy loss [MeV/mm]',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=10.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 10) Configure histograms with Tile MuonFit sinus of the angle in the x-y plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitDirectionPhi',
        xvalue='phi',
        title='Tile MuonFit sinus of the angle in the x-y plane;sin(#phi)',
        path='Tile/MuonFit',
        xbins=100,
        xmin=-1.,
        xmax=1.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 11) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitDirectionTheta',
        xvalue='theta',
        title='Tile MuonFit sinus of the angle in the y-z plane;sin(#theta)',
        path='Tile/MuonFit',
        xbins=50,
        xmin=0.,
        xmax=1.,
        type='TH1F',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    # 12) Configure histograms with Tile MuonFit sinus of the angle in the y-z plane
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPositionTime',
        xvalue='zPosition',
        value='time',
        title=
        'Tile MuonFit average time vs z position at y=0 plane;z [mm]; t [ns]',
        path='Tile/MuonFit',
        xbins=79,
        xmin=-7900.,
        xmax=7900.,
        type='TProfile',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName

    # 13) Configure histograms with Tile MuonFit partition time
    partitionLabels = [getPartitionName(ros) for ros in range(1, Tile.MAX_ROS)]
    addTile1DHistogramsArray(
        helper,
        tileMuonFitMonAlg,
        name='TileMuonFitPartitionTime',
        xvalue='partition',
        value='time',
        title='Tile MuonFit average time vs partition at y=0 plane;; t [ns]',
        path='Tile/MuonFit',
        xbins=Tile.MAX_ROS - 1,
        xmin=-0.5,
        xmax=Tile.MAX_ROS - 1.5,
        xlabels=partitionLabels,
        type='TProfile',
        run=run,
        triggers=l1Triggers,
        perPartition=False)

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