예제 #1
0
def LArCalibPedMonConfig(inputFlags,
                         gain="",
                         doAccDigit=False,
                         doCalibDigit=False,
                         doAccCalibDigit=False):

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

    from LArMonitoring.GlobalVariables import lArDQGlobals

    from AthenaConfiguration.ComponentFactory import CompFactory
    larPedMonAlg = helper.addAlgorithm(CompFactory.LArCalibPedMonAlg,
                                       'larCalibPedMonAlg')
    if gain != "":
        if doAccDigit:
            larPedMonAlg.LArAccumulatedDigitContainerKey = gain
        elif doAccCalibDigit:
            larPedMonAlg.LArAccumulatedCalibDigitContainerKey = gain
        elif doCalibDigit:
            larPedMonAlg.LArCalibDigitContainerKey = gain

    GroupName = "PedMonGroup"

    larPedMonAlg.LArPedGroupName = GroupName

    Group = helper.addGroup(larPedMonAlg, GroupName, '/LAr/' + GroupName + '/')

    #Summary histos
    summary_hist_path = 'Summary/'

    Group.defineHistogram(
        'nbChan;NbOfReadoutChannelsGlobal',
        title='# of readout channels',
        type='TH1I',
        path=summary_hist_path,
        xbins=lArDQGlobals.N_FEB * lArDQGlobals.FEB_N_channels + 5,
        xmin=-0.5,
        xmax=lArDQGlobals.N_FEB * lArDQGlobals.FEB_N_channels + 4.5)

    return helper.result()
예제 #2
0
def PixelMonitoringConfig(flags):
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()

    # run on RAW only
    if flags.DQ.Environment in ('online', 'tier0', 'tier0Raw'):
        kwargsHitMonAlg = { 'doOnline'        : flags.Common.isOnline,      #Histograms for online (athenaPT) running
                            'doModules'       : flags.Common.isOnline, #Turn on/off the sets of 1744 module histograms (for dqmf)
                            'doLumiBlock'     : not flags.Common.isOnline,       #Turn on/off histograms stored for each lumi block
                            'doLowOccupancy'  : False,      #Turn on/off histograms with binning for cosmics/single beam                    
                            'doHighOccupancy' : True,       #Turn on/off histograms with binning for collisions
                            #'doHeavyIonMon'   : InDetFlags.doHeavyIon(),   # Histogram modification for heavy ion monitoring
                            #'RDOName'         : InDetKeys.PixelRDOs()
                            'doHeavyIonMon'   : False,      #Until new config ready
                            'RDOName'         : 'PixelRDOs',#Until new config ready
        }

        kwargsClusMonAlg = { 'doOnline'        : flags.Common.isOnline,      #Histograms for online (athenaPT) running
                             'doModules'       : flags.Common.isOnline, #Turn on/off the sets of 1744 module histograms (for dqmf)
                             'doLumiBlock'     : not flags.Common.isOnline,       #Turn on/off histograms stored for each lumi block
                             'doLowOccupancy'  : False,      #Turn on/off histograms with binning for cosmics/single beam
                             'doHighOccupancy' : True,       #Turn on/off histograms with binning for collisions
                             #'doHeavyIonMon'   : InDetFlags.doHeavyIon(),   # Histogram modification for heavy ion monitoring
                             'doHeavyIonMon'   : False,   #Until new config ready
                             #                  'doStatus'        : True,       #Turn on/off histograms with Module Status information
                             #'ClusterName'     : InDetKeys.PixelClusters(),
                             'ClusterName'     : 'PixelClusters', #Until new config ready
                             #'TrackName'       : InDetKeys.Tracks()
                             'TrackName'       : 'Tracks', #Until new config ready
        }

        kwargsErrMonAlg = { 'doOnline'        : flags.Common.isOnline,      #Histograms for online (athenaPT) running
                            'doModules'       : flags.Common.isOnline, #Turn on/off the sets of 1744 module histograms (for dqmf)
                            'doLumiBlock'     : not flags.Common.isOnline,       #Turn on/off histograms stored for each lumi block
                            'doLowOccupancy'  : False,      #Turn on/off histograms with binning for cosmics/single beam                    
                            'doHighOccupancy' : True,       #Turn on/off histograms with binning for collisions
                            #'doHeavyIonMon'   : InDetFlags.doHeavyIon()
                            'doHeavyIonMon'   : False, #Until new config is ready
        }
        
        from AthenaMonitoring import AthMonitorCfgHelper
        helper = AthMonitorCfgHelper(flags, "NewPixelMonitoring")

        from AthenaConfiguration.ComponentFactory import CompFactory
        from PixelMonitoring.PixelAthHitMonAlgCfg import PixelAthHitMonAlgCfg        
        pixelAthHitMonAlg = helper.addAlgorithm(CompFactory.PixelAthHitMonAlg, 'PixelAthHitMonAlg')
        for k, v in kwargsHitMonAlg.items():
            setattr(pixelAthHitMonAlg, k, v)
        PixelAthHitMonAlgCfg(helper, pixelAthHitMonAlg, **kwargsHitMonAlg)

        from PixelMonitoring.PixelAthClusterMonAlgCfg import PixelAthClusterMonAlgCfg 
        pixelAthClusterMonAlg = helper.addAlgorithm(CompFactory.PixelAthClusterMonAlg, 'PixelAthClusterMonAlg')
        for k, v in kwargsClusMonAlg.items():
            setattr(pixelAthClusterMonAlg, k, v)
        pixelAthClusterMonAlg.TrackSelectionTool.UseTrkTrackTools = True
        pixelAthClusterMonAlg.TrackSelectionTool.CutLevel         = "TightPrimary"
        pixelAthClusterMonAlg.TrackSelectionTool.maxNPixelHoles   = 1
        pixelAthClusterMonAlg.TrackSelectionTool.maxD0            = 2
        pixelAthClusterMonAlg.TrackSelectionTool.maxZ0            = 150

        # Run 3 configs - stolen from SCT
        from SCT_Monitoring.TrackSummaryToolWorkaround import TrackSummaryToolWorkaround
        pixelAthClusterMonAlg.TrackSelectionTool.TrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags))
        pixelAthClusterMonAlg.TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        
        
        PixelAthClusterMonAlgCfg(helper, pixelAthClusterMonAlg, **kwargsClusMonAlg)

        from PixelMonitoring.PixelMonitoringConf import PixelAthErrorMonAlg
        from PixelMonitoring.PixelAthErrorMonAlgCfg import PixelAthErrorMonAlgCfg
        pixelAthMonAlgErrorMonAlg = helper.addAlgorithm(PixelAthErrorMonAlg, 'PixelAthErrorMonAlg')
        for k, v in kwargsErrMonAlg.items():
            setattr(pixelAthMonAlgErrorMonAlg, k, v)
        from PixelConditionsTools.PixelConditionsToolsConf import PixelByteStreamErrorsTool
        pixelAthMonAlgErrorMonAlg.PixelByteStreamErrorsTool = PixelByteStreamErrorsTool(ReadingESD = (flags.DQ.Environment == 'tier0ESD'))
        PixelAthErrorMonAlgCfg(helper, pixelAthMonAlgErrorMonAlg, **kwargsErrMonAlg)
        acc.merge(helper.result())

    return acc
예제 #3
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
예제 #4
0
def TileRawChannelNoiseMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileRawChannelNoiseMonitorAlgorithm algorithm in the monitoring system.'''

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

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

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

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

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

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

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

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

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

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

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

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

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

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName, getCellName, getGainName

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

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

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

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

    accumalator = helper.result()
    result.merge(accumalator)
    return result
예제 #5
0
def METMonitoringConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###
    # If you need to set up special tools, etc., you will need your own ComponentAccumulator;
    # uncomment the following 2 lines and use the last three lines of this function instead of the ones
    # just before
    # 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(inputFlags,'ExampleAthMonitorCfg')


    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example 
    # algorithm in the AthenaMonitoring package. Just pass the type to the 
    # helper. Then, the helper will instantiate an instance and set up the 
    # base class configuration following the inputFlags. The returned object 
    # is the algorithm.
    from AthenaMonitoring.AthenaMonitoringConf import ExampleMonitorAlgorithm
    exampleMonAlg = helper.addAlgorithm(ExampleMonitorAlgorithm,'ExampleMonAlg')

#    metMonTool = METMonTool(name = "METMonTool_")
#    exampleMonAlg = helper.addAlgorithm(metMonTool,'ExampleMonAlg')
     
    # You can actually make multiple instances of the same algorithm and give 
    # them different configurations
    anotherExampleMonAlg = helper.addAlgorithm(ExampleMonitorAlgorithm,'AnotherExampleMonAlg')

    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base 
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)


    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # exampleMonAlg.RandomHist = True
    # to enable a trigger filter, for example:
    exampleMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # # First, add a tool that's set up by a different configuration function. 
    # # In this case, CaloNoiseToolCfg returns its own component accumulator, 
    # # which must be merged with the one from this function.
    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
    # result.merge(caloNoiseAcc)
    # exampleMonAlg.CaloNoiseTool = caloNoiseTool

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # exampleMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned 
    # object here is the standard GenericMonitoringTool.
    myGroup = helper.addGroup(
        exampleMonAlg,
        'ExampleMonitor',
        'OneRing/'
    )

    # Add a GMT for the other example monitor algorithm
    anotherGroup = helper.addGroup(anotherExampleMonAlg,'ExampleMonitor')


    ### STEP 5 ###
    # Configure histograms
#    myGroup.defineHistogram( "Et;Et_" + src, title="Et Distribution (%s);MET Et (GeV);Events"  % src, xbins = nEtBins, xmin = 0.0, xmax = etRange ), 
 
    myGroup.defineHistogram('lumiPerBCID',title='Luminosity,WithCommaInTitle;L/BCID;Events',
                            path='ToRuleThemAll',xbins=10,xmin=0.0,xmax=10.0)
    myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events',
                            path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight')
#    myGroup.defineHistogram('random', title='LB;x;Events',
#                            path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10')
#    myGroup.defineHistogram('random', title='title;x;y',path='ToBringThemAll',
#                            xbins=[0,.1,.2,.4,.8,1.6])
#    myGroup.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll',
#                            xbins=[0,.1,.2,.4,.8,1.6],ybins=[0,10,30,40,60,70,90])
    # myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',
    #                         path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0)

    anotherGroup.defineHistogram('lbWithFilter',title='Lumi;lb;Events',
                                 path='top',xbins=1000,xmin=-0.5,xmax=999.5)
 #   anotherGroup.defineHistogram('run',title='Run Number;run;Events',
 #                                path='top',xbins=1000000,xmin=-0.5,xmax=999999.5)

    # Example defining an array of histograms. This is useful if one seeks to create a
    # number of histograms in an organized manner. (For instance, one plot for each ASIC
    # in the subdetector, and these components are mapped in eta, phi, and layer.) Thus,
    # one might have an array of TH1's such as quantity[etaIndex][phiIndex][layerIndex].

    for alg in [exampleMonAlg,anotherExampleMonAlg]:
        # Using an array of groups
        array = helper.addArray([2],alg,'ExampleMonitor')
        array.defineHistogram('a,b',title='AB',type='TH2F',path='Eta',
                              xbins=10,xmin=0.0,xmax=10.0,
                              ybins=10,ymin=0.0,ymax=10.0)
        array.defineHistogram('c',title='C',path='Eta',
                              xbins=10,xmin=0.0,xmax=10.0)
        array = helper.addArray([4,2],alg,'ExampleMonitor')
        array.defineHistogram('a',title='A',path='EtaPhi',
                              xbins=10,xmin=0.0,xmax=10.0)
        # Using a map of groups
        layerList = ['layer1','layer2']
        clusterList = ['clusterX','clusterB']
        array = helper.addArray([layerList],alg,'ExampleMonitor')
        array.defineHistogram('c',title='C',path='Layer',
                              xbins=10,xmin=0,xmax=10.0)
        array = helper.addArray([layerList,clusterList],alg,'ExampleMonitor')
        array.defineHistogram('c',title='C',path='LayerCluster',
                              xbins=10,xmin=0,xmax=10.0)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can 
    # just return directly (and not create "result" above)
    return helper.result()
예제 #6
0
def CscMonitoringConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###
    # If you need to set up special tools, etc., you will need your own ComponentAccumulator;
    # uncomment the following 2 lines and use the last three lines of this function instead of the ones
    # just before
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    # Make sure muon geometry is configured
    from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
    result.merge(MuonGeoModelCfg(inputFlags))

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

    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example
    # algorithm in the AthenaMonitoring package. Just pass the type to the
    # helper. Then, the helper will instantiate an instance and set up the
    # base class configuration following the inputFlags. The returned object
    # is the algorithm.
    # This uses the new Configurables object system.
    cscClusMonAlg = helper.addAlgorithm(CompFactory.CscClusterValMonAlg,
                                        'CscClusMonAlg')
    cscPrdMonAlg = helper.addAlgorithm(CompFactory.CscPrdValMonAlg,
                                       'CscPrdMonAlg')
    # cscSegmMonAlg = helper.addAlgorithm(CompFactory.CscSegmValMonAlg,'CscSegmValMonAlg')

    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # exampleMonAlg.RandomHist = True
    cscClusMonAlg.CSCQmaxCutADC = 100
    cscPrdMonAlg.NoiseCutADC = 50
    cscPrdMonAlg.MapYXandRZ = False

    # to enable a trigger filter, for example:
    #exampleMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # exampleMonAlg.MyDomainTool = MyDomainTool()
    from MuonConfig.MuonCalibConfig import CscCalibToolCfg
    calibtool = result.popToolsAndMerge(CscCalibToolCfg(inputFlags))
    cscClusMonAlg.CscCalibTool = calibtool

    from MuonConfig.MuonSegmentFindingConfig import CalibCscStripFitterCfg
    stripfitter = result.popToolsAndMerge(CalibCscStripFitterCfg(inputFlags))
    cscClusMonAlg.CSCStripFitter = stripfitter
    cscPrdMonAlg.CSCStripFitter = stripfitter

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.
    cscClusGroup = helper.addGroup(cscClusMonAlg, 'CscClusMonitor',
                                   'Muon/MuonRawDataMonitoring/CSC/')
    cscPrdGroup = helper.addGroup(cscPrdMonAlg, 'CscPrdMonitor',
                                  'Muon/MuonRawDataMonitoring/CSC/')
    #  cscSegmGroup = helper.addGroup(cscSegmMonAlg,'CscSegmMonitor','Muon/MuonRawDataMonitoring/CSC/')

    ### STEP 5 ###
    # Configure histograms

    qmaxCut = str(cscClusMonAlg.CSCQmaxCutADC)
    #Cluster
    cscClusGroup.defineHistogram('z,r;h2csc_clus_r_vs_z_hitmap',
                                 type='TH2F',
                                 title='R vs. Z Cluster hitmap;z(mm);R(mm)',
                                 path='Clusters/Shift',
                                 xbins=200,
                                 xmin=-10000.,
                                 xmax=10000.,
                                 ybins=40,
                                 ymin=0.,
                                 ymax=4000.)

    cscClusGroup.defineHistogram('y,x;h2csc_clus_y_vs_x_hitmap',
                                 type='TH2F',
                                 title='X vs. Y Cluster hitmap;y(mm);x(mm)',
                                 path='Clusters/Shift',
                                 xbins=100,
                                 xmin=-5000.,
                                 xmax=5000.,
                                 ybins=100,
                                 ymin=-5000,
                                 ymax=5000)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_phicluswidth',
        type='TH2F',
        cutmask='clus_phi',
        title='Phi-Cluster width;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=48,
        xmin=0,
        xmax=48,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_etacluswidth',
        type='TH2F',
        cutmask='clus_eta',
        title='Eta-Cluster width;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=192,
        xmin=0,
        xmax=192,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'stripid,secLayer;h2csc_clus_hitmap',
        type='TH2F',
        title='Cluster occupancy;channel;[sector]+[0.2 #times layer]',
        path='Clusters/Expert',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'fStripIDs_col,secLayer;h2csc_clus_hitmap_signal',
        cutmask='signal_mon',
        type='TH2F',
        title='Cluster occupancy, Qmax > ' + qmaxCut +
        ' counts;channel;[sector] + [0.2 #times layer]',
        path='Clusters/Shift',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_phicluswidth_signal',
        type='TH2F',
        cutmask='clus_phiSig',
        title='#phi-cluster width, Qmax > ' + qmaxCut +
        ' counts;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=48,
        xmin=0,
        xmax=48,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_etacluswidth_signal',
        type='TH2F',
        cutmask='clus_etaSig',
        title='#eta-cluster width, Qmax > ' + qmaxCut +
        ' counts;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=192,
        xmin=0,
        xmax=192,
        ybins=175,
        ymin=-17,
        ymax=18)

    thisLabelx = getCSCLabelx("labels_clus_occupancy_signal_EA")
    cscClusGroup.defineHistogram('secLayer;h1csc_clus_occupancy_signal_EA',
                                 type='TH1F',
                                 cutmask='sideA',
                                 title='EndCap A: Layer occupancy, Qmax > ' +
                                 qmaxCut + ' counts;;entries/layer',
                                 path='Overview/CSCEA/Cluster',
                                 xbins=90,
                                 xmin=0,
                                 xmax=18,
                                 xlabels=thisLabelx)

    thisLabelx = getCSCLabelx("labels_clus_occupancy_signal_EC")
    cscClusGroup.defineHistogram('secLayer;h1csc_clus_occupancy_signal_EC',
                                 type='TH1F',
                                 cutmask='sideC',
                                 title='EndCap C: Layer occupancy, Qmax > ' +
                                 qmaxCut + ' counts;;entries/layer',
                                 path='Overview/CSCEC/Cluster',
                                 xbins=85,
                                 xmin=-17.,
                                 xmax=0.,
                                 xlabels=thisLabelx)

    cscClusGroup.defineHistogram(
        'fStripIDs_col,secLayer;h2csc_clus_hitmap_noise',
        cutmask='noise_mon',
        type='TH2F',
        title='Cluster occupancy, Qmax #leq ' + qmaxCut +
        ' counts;channel;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_phicluswidth_noise',
        type='TH2F',
        cutmask='clus_phiNoise',
        title='#phi-cluster width, Qmax #leq ' + qmaxCut +
        ' counts;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=48,
        xmin=0,
        xmax=48,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'noStrips,secLayer;h2csc_clus_etacluswidth_noise',
        type='TH2F',
        cutmask='clus_etaNoise',
        title='#eta-cluster width, Qmax #leq ' + qmaxCut +
        ' counts;# strips;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=192,
        xmin=0,
        xmax=192,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC,secLayer;h2csc_clus_qmax',
        type='TH2F',
        title=
        'Cluster peak-strip charge, Qmax;counts;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC,secLayer;h2csc_clus_qmax_signal',
        cutmask='signal_mon',
        type='TH2F',
        title='Cluster peak-strip charge, Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Clusters/Shift',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC,secLayer;h2csc_clus_qmax_noise',
        cutmask='noise_mon',
        type='TH2F',
        title='Cluster peak-strip charge, Qmax #leq ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC,secLayer;h2csc_clus_qmax_signal_EA',
        cutmask='sideA',
        type='TH2F',
        title='EndCap A: Cluster peak-strip charge, Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Overview/CSCEA/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=90,
        ymin=0,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC;h1csc_clus_qmax_signal_EA_count',
        cutmask='sideA',
        type='TH1F',
        title='EndCap A: Cluster peak-strip charge, Qmax > ' + qmaxCut +
        ' counts;counts;entries/20 counts;',
        path='Overview/CSCEA/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'QmaxADC,secLayer;h2csc_clus_qmax_signal_EC',
        cutmask='sideC',
        type='TH2F',
        title='EndCap C: Cluster peak-strip charge, Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Overview/CSCEC/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=90,
        ymin=0,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QmaxADC;h1csc_clus_qmax_signal_EC_count',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: Cluster peak-strip charge, Qmax > ' + qmaxCut +
        ' counts;counts;entries/20 counts;',
        path='Overview/CSCEC/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'QsumADC,secLayer;h2csc_clus_qsum',
        type='TH2F',
        title='Cluster charge (Qsum);counts;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QsumADC,secLayer;h2csc_clus_qsum_signal',
        cutmask='signal_mon',
        type='TH2F',
        title='Cluster charge(Qsum), Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Clusters/Shift',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QsumADC,secLayer;h2csc_clus_qsum_signal_EA',
        cutmask='sideA',
        type='TH2F',
        title='EndCap A: Cluster charge(Qsum), Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Overview/CSCEA/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=90,
        ymin=0,
        ymax=18)

    cscClusGroup.defineHistogram(
        'QsumADC;h1csc_clus_qsum_signal_EA_count',
        cutmask='sideA',
        type='TH1F',
        title='EndCap A: Cluster charge(Qsum), Qmax > ' + qmaxCut +
        ' counts;counts;entries/20 counts;',
        path='Overview/CSCEA/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'QsumADC;h2csc_clus_qsum_signal_EC',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: Cluster charge(Qsum), Qmax > ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Overview/CSCEC/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'QsumADC;h1csc_clus_qsum_signal_EC_count',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: Cluster charge(Qsum), Qmax > ' + qmaxCut +
        ' counts;counts;entries/20 counts;',
        path='Overview/CSCEC/Cluster',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'QsumADC,secLayer;h2csc_clus_qsum_noise',
        cutmask='noise_mon',
        type='TH2F',
        title='Cluster charge(Qsum), Qmax #leq ' + qmaxCut +
        ' counts;counts;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000,
        ybins=175,
        ymin=-17,
        ymax=18)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_transverse_time',
        cutmask='clus_phi',
        type='TH1F',
        title='#phi-cluster sampling time;ns;entries/ns',
        path='Clusters/Expert',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_transverse_charge',
        cutmask='clus_phi',
        type='TH1F',
        title='#phi-cluster charge;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram('clu_time;h1csc_clus_transverse_time_signal',
                                 cutmask='clus_phiSig',
                                 type='TH1F',
                                 title='#phi-cluster sampling time, Qmax > ' +
                                 qmaxCut + ' counts;ns;entries/ns',
                                 path='Clusters/Expert',
                                 xbins=260,
                                 xmin=-60,
                                 xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_transverse_charge_signal',
        cutmask='clus_phiSig',
        type='TH1F',
        title='#phi-cluster charge, Qmax > ' + qmaxCut +
        ' counts;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_transverse_time_noise',
        cutmask='clus_phiNoise',
        type='TH1F',
        title='#phi-cluster sampling time, Qmax #leq ' + qmaxCut +
        ' counts;ns;entries/ns',
        path='Clusters/Expert',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_transverse_charge_noise',
        cutmask='clus_phiNoise',
        type='TH1F',
        title='#phi-cluster charge, Qmax #leq ' + qmaxCut +
        ' counts;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_precision_time',
        cutmask='clus_eta',
        type='TH1F',
        title='#eta-cluster sampling time;ns;entries/ns',
        path='Clusters/Expert',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_precision_charge',
        cutmask='clus_eta',
        type='TH1F',
        title='eta-cluster charge;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram('clu_time;h1csc_clus_precision_time_signal',
                                 cutmask='clus_etaSig',
                                 type='TH1F',
                                 title='#eta-cluster sampling time, Qmax > ' +
                                 qmaxCut + ' counts;ns;entries/ns',
                                 path='Clusters/Shift',
                                 xbins=260,
                                 xmin=-60,
                                 xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_precision_charge_signal',
        cutmask='clus_etaSig',
        type='TH1F',
        title='#eta-cluster charge, Qmax > ' + qmaxCut +
        ' counts;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_precision_time_signal_EA',
        cutmask='sideA',
        type='TH1F',
        title='EndCap A: #eta-cluster sampling time, Qmax > ' + qmaxCut +
        ' counts;ns;entries/ns',
        path='Overview/CSCEA/Cluster',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_precision_time_signal_EC',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: #eta-cluster sampling time, Qmax > ' + qmaxCut +
        ' counts;ns;entries/ns',
        path='Overview/CSCEC/Cluster',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_time;h1csc_clus_precision_time_noise',
        cutmask='clus_etaNoise',
        type='TH1F',
        title='#eta-cluster sampling time, Qmax #leq ' + qmaxCut +
        ' counts;ns;entries/ns',
        path='Clusters/Expert',
        xbins=260,
        xmin=-60,
        xmax=200)

    cscClusGroup.defineHistogram(
        'clu_charge_kiloele;h1csc_clus_precision_charge_noise',
        cutmask='clus_etaNoise',
        type='TH1F',
        title='#eta-cluster charge, Qmax #leq ' + qmaxCut +
        ' counts;counts;entries/count',
        path='Clusters/Expert',
        xbins=400,
        xmin=0,
        xmax=8000)

    cscClusGroup.defineHistogram(
        'stripsSum_EA_mon;h1csc_clus_totalWidth_EA',
        type='TH1F',
        title=
        'EndCap A: Cluster hits in all EA eta(#eta) & phi(#phi) strips;strips;cluster hits',
        path='Overview/CSCEA/Cluster',
        xbins=15360,
        xmin=1.,
        xmax=15361.)

    cscClusGroup.defineHistogram(
        'stripsSum_EC_mon;h1csc_clus_totalWidth_EC',
        type='TH1F',
        title=
        'EndCap C: Cluster hits in all EC eta(#eta) & phi(#phi) strips;strips;cluster hits',
        path='Overview/CSCEC/Cluster',
        xbins=15360,
        xmin=1.,
        xmax=15361.)

    cscClusGroup.defineHistogram(
        'nPhiClusWidthCnt_mon,nEtaClusWidthCnt_mon;h2csc_clus_eta_vs_phi_cluswidth',
        type='TH2F',
        title=
        'Eta vs. Phi Cluster width correlation;#varphi-cluster width;#eta-cluster width',
        path='Clusters/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscClusGroup.defineHistogram(
        'count_mon,secLayer;h2csc_clus_phicluscount',
        cutmask='mphi_true',
        type='TH2F',
        title='#phi-cluster count;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'scount_mon,secLayer;h2csc_clus_phicluscount_signal',
        cutmask='scount_phi_true',
        type='TH2F',
        title='#phi-cluster count;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'count_diff,secLayer;h2csc_clus_phicluscount_noise',
        cutmask='scount_phi_false',
        type='TH2F',
        title='#phi-cluster count, Qmax #leq ' + qmaxCut +
        ' counts;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'count_mon,secLayer;h2csc_clus_etacluscount',
        cutmask='mphi_false',
        type='TH2F',
        title='#eta-cluster count;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'scount_mon,secLayer;h2csc_clus_etacluscount_signal',
        cutmask='scount_eta_true',
        type='TH2F',
        title='#eta-cluster count;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'count_diff,secLayer;h2csc_clus_etacluscount_noise',
        cutmask='scount_eta_false',
        type='TH2F',
        title='#eta-cluster count, Qmax #leq ' + qmaxCut +
        ' counts;# clusters;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=20,
        xmin=0,
        xmax=20,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'segNum_mon,sec_mon;h2csc_clus_segmap_signal',
        type='TH2F',
        title='Segment occupancy, Qmax > ' + qmaxCut +
        ' counts;segment;[sector] + [0.2 #times layer]',
        path='Clusters/Expert',
        xbins=16,
        xmin=-0.5,
        xmax=15.5,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscClusGroup.defineHistogram(
        'numphi_numeta_mon;h1csc_clus_count',
        type='TH1F',
        title='Clusters per event;no.of clusters;entries',
        path='Clusters/Expert',
        xbins=26,
        xmin=-1,
        xmax=25)

    cscClusGroup.defineHistogram(
        'numphi_numeta_sig_mon;h1csc_clus_count_signal',
        type='TH1F',
        title='Clusters per event, Qmax > ' + qmaxCut +
        ' counts;no.of clusters;entries',
        path='Clusters/Expert',
        xbins=26,
        xmin=-1,
        xmax=25)

    cscClusGroup.defineHistogram('num_num_noise_mon;h1csc_clus_count_noise',
                                 type='TH1F',
                                 title='Clusters per event, Qmax #leq ' +
                                 qmaxCut + ' counts;no.of clusters;entries',
                                 path='Clusters/Expert',
                                 xbins=26,
                                 xmin=-1,
                                 xmax=25)

    cscClusGroup.defineHistogram(
        'numphi_mon,numeta_mon;h2csc_clus_eta_vs_phi_cluscount',
        type='TH2F',
        title=
        'Eta vs. Phi Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='Clusters/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscClusGroup.defineHistogram(
        'numphi_sig_mon,numeta_sig_mon;h2csc_clus_eta_vs_phi_cluscount_signal',
        type='TH2F',
        title=
        'Eta vs. Phi Signal-Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='Clusters/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscClusGroup.defineHistogram(
        'numphi_diff_mon,numeta_diff_mon;h2csc_clus_eta_vs_phi_cluscount_noise',
        type='TH2F',
        title=
        'Eta vs. Phi Noise-Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='Clusters/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    #PRD
    cscPrdGroup.defineHistogram(
        'spid, secLayer;h2csc_prd_hitmap',
        type='TH2F',
        title='Hit Occupancy; channel; [sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_phicluswidth',
        type='TH2F',
        cutmask='measphi',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=48,
        xmin=0,
        xmax=48,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_etacluswidth',
        type='TH2F',
        cutmask='measeta',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=192,
        xmin=0,
        xmax=192,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram('z,r;h2csc_prd_r_vs_z_hitmap',
                                type='TH2F',
                                title='R vs. Z Cluster hitmap;z(mm);R(mm)',
                                path='PRD/Shift',
                                xbins=200,
                                xmin=-10000.,
                                xmax=10000.,
                                ybins=40,
                                ymin=0.,
                                ymax=4000.)

    cscPrdGroup.defineHistogram('y,x;h2csc_prd_y_vs_x_hitmap',
                                type='TH2F',
                                title='Y vs. X Cluster hitmap;x(mm);y(mm)',
                                path='PRD/Shift',
                                xbins=100,
                                xmin=-5000.,
                                xmax=5000.,
                                ybins=100,
                                ymin=-5000.,
                                ymax=5000.)

    cscPrdGroup.defineHistogram(
        'spid,secLayer;h2csc_prd_hitmap_signal',
        cutmask='signal_mon',
        type='TH2F',
        title='Signal Occupancy;channel;[sector] + [0.2 #times layer]',
        path='PRD/Shift',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'spid,secLayer;h2csc_prd_hitmap_signal_EC',
        cutmask='sideC',
        type='TH2F',
        title=
        'EndCap C: Signal Occupancy;channel;[sector] + [0.2 #times layer]',
        path='Overview/CSCEC/PRD',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=85,
        ymin=-17.,
        ymax=0.)

    cscPrdGroup.defineHistogram(
        'spid;h1csc_prd_hitmap_signal_EC_count',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: Signal Occupancy;channel;entries/channel;',
        path='Overview/CSCEC/PRD',
        xbins=242,
        xmin=-49.,
        xmax=193.)

    thisLabelx = getCSCLabelx("labels_clus_occupancy_signal_EC")
    cscPrdGroup.defineHistogram(
        'secLayer;h1csc_prd_hitmap_signal_EC_occupancy',
        cutmask='sideC',
        type='TH1F',
        title='EndCap C: Signal Occupancy;;entries/layer',
        path='Overview/CSCEC/PRD',
        xbins=85,
        xmin=-17.,
        xmax=0.,
        xlabels=thisLabelx)  #labels

    cscPrdGroup.defineHistogram(
        'lumiblock_mon,secLayer;h2csc_prd_occvslb_EC',
        cutmask='sideC',
        type='TH2F',
        title=
        'EndCap C: Layer Signal Occupancy Per LB;LB;[sector] + [0.2 #times layer]',
        path='Overview/CSCEC/PRD',
        xbins=2510,
        xmin=-10.,
        xmax=2500.,
        ybins=85,
        ymin=-17.,
        ymax=0.)

    cscPrdGroup.defineHistogram(
        'spid,secLayer;h2csc_prd_hitmap_signal_EA',
        cutmask='sideA',
        type='TH2F',
        title=
        'EndCap A: Signal Occupancy;channel;[sector] + [0.2 #times layer]',
        path='Overview/CSCEA/PRD',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=90,
        ymin=0.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'spid;h1csc_prd_hitmap_signal_EA_count',
        cutmask='sideA',
        type='TH1F',
        title='EndCap A: Signal Occupancy;channel;entries/channel;',
        path='Overview/CSCEA/PRD',
        xbins=242,
        xmin=-49.,
        xmax=193.)

    thisLabelx = getCSCLabelx("labels_clus_occupancy_signal_EA")
    cscPrdGroup.defineHistogram(
        'secLayer;h1csc_prd_hitmap_signal_EA_occupancy',
        cutmask='sideA',
        type='TH1F',
        title='EndCap A: Signal Occupancy;;entries/layer',
        path='Overview/CSCEA/PRD',
        xbins=90,
        xmin=0.,
        xmax=18.,
        xlabels=thisLabelx)  #labels

    cscPrdGroup.defineHistogram(
        'lumiblock_mon,secLayer;h2csc_prd_occvslb_EA',
        cutmask='sideA',
        type='TH2F',
        title=
        'EndCap A: Layer Signal Occupancy Per LB;LB;[sector] + [0.2 #times layer]',
        path='Overview/CSCEA/PRD',
        xbins=2510,
        xmin=-10.,
        xmax=2500.,
        ybins=90,
        ymin=0.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_etacluswidth_signal',
        cutmask='clus_etaSig',
        type='TH2F',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=192,
        xmin=0.,
        xmax=192.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_phicluswidth_signal',
        cutmask='clus_phiSig',
        type='TH2F',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=48,
        xmin=0.,
        xmax=48.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'spid,secLayer;h2csc_prd_hitmap_noise',
        cutmask='noise_mon',
        type='TH2F',
        title='Noise Occupancy;channel;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=242,
        xmin=-49.,
        xmax=193.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_etacluswidth_noise',
        cutmask='clus_etaNoise',
        type='TH2F',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=192,
        xmin=0.,
        xmax=192.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'noStrips,secLayer;h2csc_prd_phicluswidth_noise',
        cutmask='clus_phiNoise',
        type='TH2F',
        title=
        'PRD precision-cluster width;no.of strips;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=48,
        xmin=0.,
        xmax=48.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'count_mon,secLayer;h2csc_prd_phicluscount',
        cutmask='mphi_true',
        type='TH2F',
        title=
        'PRD transverse-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'scount_mon,secLayer;h2csc_prd_phicluscount_signal',
        cutmask='scount_phi_true',
        type='TH2F',
        title=
        'PRD transverse-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Shift',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'tmp_val_mon,secLayer;h2csc_prd_phicluscount_noise',
        cutmask='mphi_true',
        type='TH2F',
        title=
        'PRD transverse-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'count_mon,secLayer;h2csc_prd_etacluscount',
        cutmask='mphi_false',
        type='TH2F',
        title=
        'PRD precision-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'scount_mon,secLayer;h2csc_prd_etacluscount_signal',
        cutmask='scount_eta_true',
        type='TH2F',
        title=
        'PRD precision-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Shift',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'tmp_val_mon,secLayer;h2csc_prd_etacluscount_noise',
        cutmask='mphi_false',
        type='TH2F',
        title=
        'PRD precision-cluster count;no.of clusters;[sector] + [0.2 #times layer]',
        path='PRD/Expert',
        xbins=20,
        xmin=0.,
        xmax=20.,
        ybins=175,
        ymin=-17.,
        ymax=18.)

    cscPrdGroup.defineHistogram(
        'numphi_mon,numeta_mon;h2csc_prd_eta_vs_phi_cluscount',
        type='TH2F',
        title=
        'Eta vs. Phi Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='PRD/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscPrdGroup.defineHistogram(
        'numphi_sig_mon,numeta_sig_mon;h2csc_prd_eta_vs_phi_cluscount_signal',
        type='TH2F',
        title=
        'Eta vs. Phi Signal-Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='PRD/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscPrdGroup.defineHistogram(
        'numphi_diff_mon,numeta_diff_mon;h2csc_prd_eta_vs_phi_cluscount_noise',
        type='TH2F',
        title=
        'Eta vs. Phi Noise-Cluster count correlation;#varphi-cluster count;#eta-cluster count',
        path='PRD/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    cscClusGroup.defineHistogram(
        'nPhiClusWidthCnt_mon,nEtaClusWidthCnt_mon;h2csc_prd_eta_vs_phi_cluswidth',
        type='TH2F',
        title=
        'Eta vs. Phi Cluster width correlation;#varphi-cluster width;#eta-cluster width',
        path='PRD/Expert',
        xbins=100,
        xmin=0,
        xmax=100,
        ybins=100,
        ymin=0,
        ymax=100)

    #myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events',
    #                       path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5,weight='testweight')
    #myGroup.defineHistogram('random', title='LB;x;Events',
    #                        path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10')
    #myGroup.defineHistogram('random', title='title;x;y',path='ToBringThemAll',
    #                        xbins=[0,.1,.2,.4,.8,1.6])
    ##myGroup.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll',
    #                       xbins=[0,.1,.2,.4,.8,1.6],ybins=[0,10,30,40,60,70,90])
    # TEfficiencies
    ##myGroup.defineHistogram('pT_passed,pT', type='TEfficiency', title='Test TEfficiency;x;Eff',
    #                        path='AndInTheDarkness', xbins=100, xmin=0.0, xmax=50.0)
    #myGroup.defineHistogram('pT_passed,pT,random', type='TEfficiency', title='Test TEfficiency 2D;x;y;Eff',
    #                        path='AndInTheDarkness', xbins=100, xmin=0.0, xmax=50.0,
    #                        ybins=10, ymin=0.0, ymax=2.0)
    # # use a cutmask to only fill certain events
    #myGroup.defineHistogram('pT;pT_with_cut', title='p_{T};p_{T};Events', path='AndInTheDarkness',
    #                         xbins=50, xmin=0, xmax=50, cutmask='pT_passed')
    # make a TTree
    #myGroup.defineTree('pT,lb,pT_vec,strvec,str;testtree', path='BindThem',
    #                    treedef='pT/F:lb/i:pT_vec/vector<float>:strvec/vector<string>:str/string')

    #anotherGroup.defineHistogram('lbWithFilter',title='Lumi;lb;Events',
    #                             path='top',xbins=1000,xmin=-0.5,xmax=999.5)
    #anotherGroup.defineHistogram('run',title='Run Number;run;Events',
    #                             path='top',xbins=1000000,xmin=-0.5,xmax=999999.5)

    # Example defining an array of histograms. This is useful if one seeks to create a
    # number of histograms in an organized manner. (For instance, one plot for each ASIC
    # in the subdetector, and these components are mapped in eta, phi, and layer.) Thus,
    # one might have an array of TH1's such as quantity[etaIndex][phiIndex][layerIndex].
    # for alg in [exampleMonAlg,anotherExampleMonAlg]:
    # Using an array of groups
    #    topPath = 'OneRing' if alg == exampleMonAlg else ''
    #    array = helper.addArray([2],alg,'ExampleMonitor', topPath=topPath)
    #    array.defineHistogram('a,b',title='AB',type='TH2F',path='Eta',
    #                          xbins=10,xmin=0.0,xmax=10.0,
    #                          ybins=10,ymin=0.0,ymax=10.0)
    #    array.defineHistogram('c',title='C',path='Eta',
    #                         xbins=10,xmin=0.0,xmax=10.0)
    #    array = helper.addArray([4,2],alg,'ExampleMonitor', topPath=topPath)
    #    array.defineHistogram('a',title='A',path='EtaPhi',
    #                         xbins=10,xmin=0.0,xmax=10.0)
    # Using a map of groups
    #    layerList = ['layer1','layer2']
    #    clusterList = ['clusterX','clusterB']
    #    array = helper.addArray([layerList],alg,'ExampleMonitor', topPath=topPath)
    #    array.defineHistogram('c',title='C',path='Layer',
    #                         xbins=10,xmin=0,xmax=10.0)
    #    array = helper.addArray([layerList,clusterList],alg,'ExampleMonitor', topPath=topPath)
    #    array.defineHistogram('c',title='C',path='LayerCluster',
    #                         xbins=10,xmin=0,xmax=10.0)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can
    # just return directly (and not create "result" above)
    #return helper.result()

    # # Otherwise, merge with result object and return
    acc = helper.result()
    result.merge(acc)
    return result
예제 #7
0
def TRTMonitoringRun3ESD_AlgConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    from TrkConfig.TrackCollectionReadConfig import TrackCollectionReadCfg
    result.merge (TrackCollectionReadCfg (inputFlags, 'CombinedInDetTracks'))
    result.merge (TrackCollectionReadCfg (inputFlags, 'Tracks'))

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

    from AthenaConfiguration.ComponentFactory import CompFactory
    algTRTMonitoringRun3ESD = helper.addAlgorithm(CompFactory.TRTMonitoringRun3ESD_Alg,
                                               'AlgTRTMonitoringRun3')

    from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg
    result.merge(AtlasGeometryCfg(inputFlags))

    from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/errors2d","/TRT/Calib/errors2d",className="TRTCond::RtRelationMultChanContainer"))
    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/slopes","/TRT/Calib/slopes",className="TRTCond::RtRelationMultChanContainer"))
    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/RT","/TRT/Calib/RT",className="TRTCond::RtRelationMultChanContainer"))
    result.merge(addFoldersSplitOnline(inputFlags, "TRT","/TRT/Onl/Calib/T0","/TRT/Calib/T0",className="TRTCond::StrawT0MultChanContainer"))

    ############################## WORKAROUND (START) ##########################
    from SCT_Monitoring.TrackSummaryToolWorkaround import TrackSummaryToolWorkaround
    algTRTMonitoringRun3ESD.TrackSummaryTool = result.popToolsAndMerge(TrackSummaryToolWorkaround(inputFlags))
    ############################## WORKAROUND (END) ############################

    barrelOrEndcap     = ('Barrel', 'EndCap')
    beId                 = ('B', 'E')
    sideId               = ('A', 'C')
    strawMax             = (1642, 3840)
    iChipMax             = (104, 240)
    numberOfStacks       = (32, 32)
    distToStraw          = 0.4
    nPhiBins             = 360
    minTRTHits           = 10

    for ibe in range(2):
        oss_distance = distToStraw
        distance     = str(oss_distance)
        regionTag    = ' (' + barrelOrEndcap[ibe] + ')'

        for i in range(numberOfStacks[ibe]*2):
            trackGroup = helper.addGroup(algTRTMonitoringRun3ESD,'TRTTrackHistograms{0}{1}'.format(ibe,i))

            nBarrelModules = 0

            if ibe == 0:
                if i < numberOfStacks[ibe]:
                    nBarrelModules = i + 1
                    oss = 'TRT/Barrel/Stack{0}A'.format(nBarrelModules)
                elif i >= numberOfStacks[ibe]:
                    nBarrelModules = i + 1 - 32
                    oss = 'TRT/Barrel/Stack{0}C'.format(nBarrelModules)
            elif ibe == 1:
                if i < numberOfStacks[ibe]:
                    nBarrelModules = i + 1
                    oss = 'TRT/EndcapA/Sector{0}'.format(nBarrelModules)
                elif i >= numberOfStacks[ibe]:
                    nBarrelModules = i + 1 - 32
                    oss = 'TRT/EndcapC/Sector{0}'.format(nBarrelModules)      

            trackGroup.defineHistogram('HitTronTMapS_x,HitTronTMapS_y;hHitTronTMapS',type='TProfile',title='Mean Trailing Edge on Track: Straws;Straw Number in Stack;Time (ns)',path=oss,xbins=strawMax[ibe],xmin=0,xmax=strawMax[ibe],duration='run')
            trackGroup.defineHistogram('HitToTonTMapS_x,HitToTonTMapS_y;hHitToTonTMapS',type='TProfile',title='Mean ToT on Track: Straws;Straw Number in Stack;Time (ns)',path=oss,xbins=strawMax[ibe],xmin=0,xmax=strawMax[ibe],duration='run')
            trackGroup.defineHistogram('ValidRawDriftTimeonTrkS_x,ValidRawDriftTimeonTrkS_y;hValidRawDriftTimeonTrk',type='TProfile',title='Valid Raw Drift Time on Track: Straws;Straw Number in Stack;Time (ns)',path=oss,xbins=strawMax[ibe],xmin=0,xmax=strawMax[ibe],duration='run')
            trackGroup.defineHistogram('HitTronTwEPCMapS_x,HitTronTwEPCMapS_y;hHitTronTwEPCMapS',type='TProfile',title='Mean Trailing Edge on Track (with Event Phase Correction): Straws;Straw Number in Stack;Time (ns)',path=oss,xbins=strawMax[ibe],xmin=0,xmax=strawMax[ibe],duration='run')

            trackGroup.defineHistogram('HitTronTMapC_x,HitTronTMapC_y;hHitTronTMapC',type='TProfile',title='Mean Trailing Edge on Track: Chips;Chip Number in Stack;Time (ns)',path=oss,xbins=iChipMax[ibe],xmin=0,xmax=iChipMax[ibe],duration='run')
            trackGroup.defineHistogram('HitToTonTMapC_x,HitToTonTMapC_y;hHitToTonTMapC',type='TProfile',title='Chip Number in Stack;Time (ns);Chip Number in Stack;Time (ns)',path=oss,xbins=iChipMax[ibe],xmin=0,xmax=iChipMax[ibe],duration='run')
            trackGroup.defineHistogram('ValidRawDriftTimeonTrkC_x,ValidRawDriftTimeonTrkC_y;hValidRawDriftTimeonTrkC',type='TProfile',title='Valid Raw Drift Time on Track: Chips;Chip Number in Stack;Time (ns)',path=oss,xbins=iChipMax[ibe],xmin=0,xmax=iChipMax[ibe],duration='run')
            trackGroup.defineHistogram('HitTronTwEPCMapC_x,HitTronTwEPCMapC_y;hHitTronTwEPCMapC',type='TProfile',title='Mean Trailing Edge on Track (with Event Phase Correction): Chips;Chip Number in Stack;Time (ns)',path=oss,xbins=iChipMax[ibe],xmin=0,xmax=iChipMax[ibe],duration='run')

    # Arrays for Aging
    gas = ('in_A', 'in_B', 'out_A', 'out_B')
    Mod = ('1', '2', '3', 'shortP', 'shortN')

    for ibe in range(2):
        shiftTrackGroup = helper.addGroup(algTRTMonitoringRun3ESD,'ShiftTRTTrackHistograms{0}'.format(ibe))
        regionTag = ' (' + barrelOrEndcap[ibe] + ')'

        if ibe == 0:
            shiftTrackGroup.defineHistogram('EvtPhase;hEvtPhase',type='TH1F',title='Event Phase Correction Factor;Event Phase (ns);Entries',path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-50,xmax=50)
            shiftTrackGroup.defineHistogram('EvtPhaseVsTrig_x,EvtPhaseVsTrig_y;hEvtPhaseVsTrig',type='TH2F',title='Event Phase vs L1 Trigger Item;Event Phase (ns);L1 Trigger Item',path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=300,xmin=-200,xmax=100,ybins=256,ymin=-0.5,ymax=255.5,duration='run')
            shiftTrackGroup.defineHistogram('EvtPhaseDetPhi_B_x,EvtPhaseDetPhi_B_y;hEvtPhaseDetPhi',type='TProfile',title='Event Phase vs #phi (2D){0};#phi (deg);Event Phase from Tracks per Event'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0.,xmax=360.,duration='run')
            shiftTrackGroup.defineHistogram('RtRelation_B_x,RtRelation_B_y;hrtRelation',type='TH2F',title='R(t) Relation for Xenon Straws{0};Measured Leading Edge (ns);Track-to-Wire Distance (mm)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-12.5,xmax=81.25,ybins=50,ymin=0.,ymax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('NumHoTDetPhi_B_x,NumHoTDetPhi_B_y;hNumHoTDetPhi',type='TProfile',title='Number of Hits per Track with {0} mm Cut vs #phi{1};#phi (deg);Hits per Track, TRT Hits >= {2}'.format(distance,regionTag,minTRTHits),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0.,xmax=360.,duration='run')
            shiftTrackGroup.defineHistogram('TronTDist_B;hTronTDist',type='TH1F',title='Trailing Edge Distribution on Track for Xenon Straws{0};Trailing Edge (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=26,xmin=-0.5,xmax=80.75,duration='run')
            shiftTrackGroup.defineHistogram('DriftTimeonTrkDist_B;hDriftTimeonTrkDist',type='TH1F',title='Drift Time Distribution on Track for Xenon Straws{0};Drift Time (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=32,xmin=0,xmax=100,duration='run')
            shiftTrackGroup.defineHistogram('NumTrksDetPhi_B;hNumTrksDetPhi_B',type='TH1F',title='Number of Reconstructed Tracks vs #phi (2D){0};#phi (deg);Number of Tracks'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=60,xmin=0,xmax=360,duration='run')

            shiftTrackGroup.defineHistogram('DriftTimeonTrkDist_B_Ar;hDriftTimeonTrkDist_Ar',type='TH1F',title='Drift Time Distribution on Track for Argon Straws{0};Drift Time (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=32,xmin=0,xmax=100,duration='run')
            shiftTrackGroup.defineHistogram('TronTDist_B_Ar;hTronTDist_Ar',type='TH1F',title='Trailing Edge Distribution on Track for Argon Straws{0};Trailing Edge (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=26,xmin=-0.5,xmax=80.75,duration='run')
            shiftTrackGroup.defineHistogram('RtRelation_B_Ar_x,RtRelation_B_Ar_y;hrtRelation_Ar',type='TH2F',title='R(t) Relation for Argon Straws{0};Measured Leading Edge (ns);Track-to-Wire Distance (mm)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-12.5,xmax=81.25,ybins=50,ymin=0,ymax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('Pull_Biased_Barrel;hPull_Biased_Barrel',type='TH1F',title='Biased Track Pulls for Barrel Hits;Pulls;Entries',path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('Residual_B_Ar;hResidual_Ar',type='TH1F',title='Residuals for Argon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='lowStat')
            shiftTrackGroup.defineHistogram('Residual_B_Ar;hResidual_Ar',type='TH1F',title='Residuals for Argon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('Residual_B_Ar_20GeV;hResidual_Ar_20GeV',type='TH1F',title='Residuals for Argon Straws{0} (After 20GeV pT cut);Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('AvgTroTDetPhi_B_Ar_x,AvgTroTDetPhi_B_Ar_y;hAvgTroTDetPhi_Ar',type='TProfile',title='Avg. Trailing Edge on Track vs #phi (2D) for Argon{0};#phi (deg);Trailing Edge (ns)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')
            shiftTrackGroup.defineHistogram('TimeResidual_B_Ar;hTimeResidual_Ar',type='TH1F',title='Time Residuals for Argon Straws{0};Time Residual (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-20,xmax=20,duration='run')
            shiftTrackGroup.defineHistogram('WireToTrkPosition_B_Ar;hWireToTrkPosition_Ar',type='TH1F',title='Track-to-Wire Distance for Argon{0};Track-to-Wire Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=100,xmin=-5,xmax=5,duration='run')
            
            shiftTrackGroup.defineHistogram('Residual_B;hResidual_Xe',type='TH1F',title='Residuals for Xenon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='lowStat')
            shiftTrackGroup.defineHistogram('Residual_B;hResidual_Xe',type='TH1F',title='Residuals for Xenon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('Residual_B_20GeV;hResidual_Xe_20GeV',type='TH1F',title='Residuals for Xenon Straws{0} (After 20GeV pT cut);Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
            shiftTrackGroup.defineHistogram('TimeResidual_B;hTimeResidual',type='TH1F',title='Time Residuals for Xenon Straws{0};Time Residual (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-20,xmax=20,duration='run')
            shiftTrackGroup.defineHistogram('WireToTrkPosition_B;hWireToTrkPosition',type='TH1F',title='Track-to-Wire Distance for Xenon{0};Track-to-Wire Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=100,xmin=-5,xmax=5,duration='run')
            shiftTrackGroup.defineHistogram('AvgTroTDetPhi_B_x,AvgTroTDetPhi_B_y;hAvgTroTDetPhi',type='TProfile',title='Avg. Trailing Edge on Track vs #phi (2D) for Xenon{0};#phi (deg);Trailing Edge (ns)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')
        elif ibe == 1:
            shiftTrackGroup.defineHistogram('Pull_Biased_EndCap;hPull_Biased_EndCap',type='TH1F',title='Biased Track Pulls for EndCap Hits;Pulls;Entries',path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')

            for iside in range(2):
                regionTag = ' (' + beId[ibe] + sideId[iside] + ')'
                shiftTrackEndcapGroup = helper.addGroup(algTRTMonitoringRun3ESD,'ShiftTRTTrackHistograms{0}{1}'.format(ibe,iside))
                shiftTrackEndcapGroup.defineHistogram('EvtPhaseDetPhi_E_x,EvtPhaseDetPhi_E_y;hEvtPhaseDetPhi_{0}'.format(sideId[iside]),type='TProfile',title='Event Phase vs #phi (2D){0};#phi (deg);Event Phase from Tracks per Event'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')
                shiftTrackEndcapGroup.defineHistogram('RtRelation_E_x,RtRelation_E_y;hrtRelation_{0}'.format(sideId[iside]),type='TH2F',title='R(t) Relation for Xenon Straws{0};Measured Leading Edge (ns);Track-to-Wire Distance (mm)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-12.5,xmax=81.25,ybins=50,ymin=0,ymax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('NumHoTDetPhi_E_x,NumHoTDetPhi_E_y;hNumHoTDetPhi_{0}'.format(sideId[iside]),type='TProfile',title='Number of Hits per Track with {0} mm Cut vs #phi{1};#phi (deg);Hits per Track, TRT Hits> = {2}'.format(distance,regionTag,minTRTHits),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')
                shiftTrackEndcapGroup.defineHistogram('TronTDist_E;hTronTDist_{0}'.format(sideId[iside]),type='TH1F',title='Trailing Edge Distribution on Track for Xenon Straws{0};Trailing Edge (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=26,xmin=-0.5,xmax=80.75,duration='run')
                shiftTrackEndcapGroup.defineHistogram('DriftTimeonTrkDist_E;hDriftTimeonTrkDist_{0}'.format(sideId[iside]),type='TH1F',title='Drift Time Distribution on Track for Xenon Straws{0};Drift Time (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=32,xmin=0,xmax=100,duration='run')
                shiftTrackEndcapGroup.defineHistogram('NumTrksDetPhi_E;hNumTrksDetPhi_{0}'.format(sideId[iside]),type='TH1F',title='Number of Reconstructed Tracks vs #phi (2D){0};#phi (deg);Number of Tracks'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=60,xmin=0,xmax=360,duration='run')
                shiftTrackEndcapGroup.defineHistogram('Residual_E;hResidual_Xe_{0}'.format(sideId[iside]),type='TH1F',title='Residuals for Xenon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='lowStat')
                shiftTrackEndcapGroup.defineHistogram('Residual_E;hResidual_Xe_{0}'.format(sideId[iside]),type='TH1F',title='Residuals for Xenon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('Residual_E_20GeV;hResidual_Xe_{0}_20GeV'.format(sideId[iside]),type='TH1F',title='Residuals for Xenon Straws{0} (After 20GeV pT cut);Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('TimeResidual_E;hTimeResidual_{0}'.format(sideId[iside]),type='TH1F',title='Time Residuals for Xenon Straws{0};Time Residual (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-20,xmax=20,duration='run')

                shiftTrackEndcapGroup.defineHistogram('TronTDist_E_Ar;hTronTDist_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Trailing Edge Distribution on Track for Argon Straws{0};Trailing Edge (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=26,xmin=-0.5,xmax=80.75,duration='run')
                shiftTrackEndcapGroup.defineHistogram('AvgTroTDetPhi_E_Ar_x,AvgTroTDetPhi_E_Ar_y;hAvgTroTDetPhi_Ar_{0}'.format(sideId[iside]),type='TProfile',title='Avg. Trailing Edge on Track vs #phi (2D) for Argon{0};#phi (deg);Trailing Edge (ns)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')
                shiftTrackEndcapGroup.defineHistogram('RtRelation_E_Ar_x,RtRelation_E_Ar_y;hrtRelation_Ar_{0}'.format(sideId[iside]),type='TH2F',title='R(t) Relation for Argon Straws{0};Measured Leading Edge (ns);Track-to-Wire Distance (mm)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-12.5,xmax=81.25,ybins=50,ymin=0,ymax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('DriftTimeonTrkDist_E_Ar;hDriftTimeonTrkDist_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Drift Time Distribution on Track for Argon Straws{0};Drift Time (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=32,xmin=0,xmax=100,duration='run')
                shiftTrackEndcapGroup.defineHistogram('Residual_E_Ar;hResidual_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Residuals for Argon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='lowStat')
                shiftTrackEndcapGroup.defineHistogram('Residual_E_Ar;hResidual_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Residuals for Argon Straws{0};Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('Residual_E_Ar_20GeV;hResidual_Ar_{0}_20GeV'.format(sideId[iside]),type='TH1F',title='Residuals for Argon Straws{0} (After 20GeV pT cut);Hit-to-Track Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-2.5,xmax=2.5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('TimeResidual_E_Ar;hTimeResidual_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Time Residuals for Argon Straws{0};Time Residual (ns);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=200,xmin=-20,xmax=20,duration='run')
                shiftTrackEndcapGroup.defineHistogram('WireToTrkPosition_E_Ar;hWireToTrkPosition_Ar_{0}'.format(sideId[iside]),type='TH1F',title='Track-to-Wire Distance for Argon{0};Track-to-Wire Distance (mm);Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=100,xmin=-5,xmax=5,duration='run')
                
                shiftTrackEndcapGroup.defineHistogram('WireToTrkPosition_E;hWireToTrkPosition_{0}'.format(sideId[iside]),type='TH1F',title='Track-to-Wire Distance for Xenon{0};Track-to-Wire Distance (mm);Norm. Entries'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=100,xmin=-5,xmax=5,duration='run')
                shiftTrackEndcapGroup.defineHistogram('AvgTroTDetPhi_E_x,AvgTroTDetPhi_E_y;hAvgTroTDetPhi_{0}'.format(sideId[iside]),type='TProfile',title='Avg. Trailing Edge on Track vs #phi (2D) for Xenon{0};#phi (deg);Trailing Edge (ns)'.format(regionTag),path='TRT/Shift/{0}'.format(barrelOrEndcap[ibe]),xbins=nPhiBins,xmin=0,xmax=360,duration='run')

        #Initialize Aging plots
        for iL in range(5):
            for iSide in range(2): 
                if ibe == 0: 
                    if iL < 3:
                        agingGroup = helper.addGroup(algTRTMonitoringRun3ESD,'TRTAgingHistograms0{0}{1}'.format(iL,iSide))
                        agingGroup.defineHistogram('Trackz_All;trackz_m{0}_{1}_All'.format(Mod[iL],sideId[iSide]),type='TH1F',title='Number All Hits side {0} Layer {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-750.,xmax=750.,duration='run')
                        agingGroup.defineHistogram('Trackz_All;trackz_m{0}_{1}_All'.format(Mod[iL],sideId[iSide]),type='TH1F',title='Number All Hits side {0} Layer {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-750.,xmax=750.,duration='lowStat')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m{0}_{1}_HT'.format(Mod[iL],sideId[iSide]),type='TH1F',title='Number HT Hits side {0} Layer {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-750.,xmax=750.,duration='run')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m{0}_{1}_HT'.format(Mod[iL],sideId[iSide]),type='TH1F',title='Number HT Hits side {0} Layer {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-750.,xmax=750.,duration='lowStat')
                    if iL == 3:
                        agingGroup = helper.addGroup(algTRTMonitoringRun3ESD,'TRTAgingHistograms03{0}'.format(iSide))
                        agingGroup.defineHistogram('Trackz_All;trackz_m1_{0}_All_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number All Hits side {0} Layer 1 {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=0.,xmax=725.,duration='run')
                        agingGroup.defineHistogram('Trackz_All;trackz_m1_{0}_All_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number All Hits side {0} Layer 1 {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=0.,xmax=725.,duration='lowStat')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m1_{0}_HT_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number HT Hits side {0} Layer 1 {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=0.,xmax=725.,duration='run')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m1_{0}_HT_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number HT Hits side {0} Layer 1 {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=0.,xmax=725.,duration='lowStat')
                    if iL == 4:
                        agingGroup = helper.addGroup(algTRTMonitoringRun3ESD,'TRTAgingHistograms04{0}'.format(iSide))
                        agingGroup.defineHistogram('Trackz_All;trackz_m1_{0}_All_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number All Hits side {0} Layer 1 {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-725.,xmax=0.,duration='run')
                        agingGroup.defineHistogram('Trackz_All;trackz_m1_{0}_All_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number All Hits side {0} Layer 1 {1};z [mm];Number of Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-725.,xmax=0.,duration='lowStat')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m1_{0}_HT_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number HT Hits side {0} Layer 1 {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-725.,xmax=0.,duration='run')
                        agingGroup.defineHistogram('Trackz_HT;trackz_m1_{0}_HT_{1}'.format(sideId[iSide],Mod[iL]),type='TH1F',title='Number HT Hits side {0} Layer 1 {1};z [mm];Number of HT Hits'.format(sideId[iSide],Mod[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=-725.,xmax=0.,duration='lowStat')
                elif ibe == 1:
                    # prevent double booking of histograms here
                    if iL < 4: 
                        agingGroup = helper.addGroup(algTRTMonitoringRun3ESD,'TRTAgingHistograms1{0}{1}'.format(iL,iSide))
                        agingGroup.defineHistogram('Trackr_All;trackr_E{0}_{1}_All'.format(sideId[iSide],gas[iL]),type='TH1F',title='Number All Hits E{0} {1};r [mm];Number of Hits'.format(sideId[iSide],gas[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=644.,xmax=1004.,duration='run')
                        agingGroup.defineHistogram('Trackr_All;trackr_E{0}_{1}_All'.format(sideId[iSide],gas[iL]),type='TH1F',title='Number All Hits E{0} {1};r [mm];Number of Hits'.format(sideId[iSide],gas[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=644.,xmax=1004.,duration='lowStat')
                        agingGroup.defineHistogram('Trackr_HT;trackr_E{0}_{1}_HT'.format(sideId[iSide],gas[iL]),type='TH1F',title='Number HT Hits E{0} {1};r [mm];Number of HT Hits'.format(sideId[iSide],gas[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=644.,xmax=1004.,duration='run')
                        agingGroup.defineHistogram('Trackr_HT;trackr_E{0}_{1}_HT'.format(sideId[iSide],gas[iL]),type='TH1F',title='Number HT Hits E{0} {1};r [mm];Number of HT Hits'.format(sideId[iSide],gas[iL]),path='TRT/Aging/{0}'.format(barrelOrEndcap[ibe]),xbins=30,xmin=644.,xmax=1004.,duration='lowStat')

    acc = helper.result()
    result.merge(acc)
    return result
예제 #8
0
def Run3AFPExampleMonitoringConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

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

    from AthenaConfiguration.ComponentFactory import CompFactory

    #from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm
    afpSiLayerAlgorithmFac = CompFactory.AFPSiLayerAlgorithm
    afpSiLayerAlgorithm = helper.addAlgorithm(afpSiLayerAlgorithmFac,
                                              'AFPSiLayerAlg')

    #from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPToFAlgorithm
    afpToFAlgorithmFac = CompFactory.AFPToFAlgorithm
    afpToFAlgorithm = helper.addAlgorithm(afpToFAlgorithmFac, 'AFPToFAlg')

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.
    AFPSiGroup = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayerTool', 'AFP/')
    AFPToFGroup = helper.addGroup(afpToFAlgorithm, 'AFPToFTool', 'AFP/')

    AFPSiGroup.defineHistogram(
        'lb,nSiHits',
        title='Luminosity Block;lb;total number of Hits',
        type='TProfile',
        path='SiT/',
        xbins=1000,
        xmin=-0.5,
        xmax=999.5)
    AFPToFGroup.defineHistogram(
        'lb,nTofHits',
        title='Luminosity Block;lb;total number of Hits',
        type='TProfile',
        path='ToF/',
        xbins=1000,
        xmin=-0.5,
        xmax=999.5)

    AFPToFGroup.defineHistogram(
        'numberOfHit_S0',
        title='Number of hit per bar station 0;total number of Hits',
        path='ToF/',
        xbins=4,
        xmin=-0.5,
        xmax=3.5)
    AFPToFGroup.defineHistogram(
        'numberOfHit_S3',
        title='Number of hit per bar station 3;total number of Hits',
        path='ToF/',
        xbins=4,
        xmin=-0.5,
        xmax=3.5)

    # Using a map of groups
    layerList = ['P0', 'P1', 'P2',
                 'P3']  ## TODO XXX adapt to the enum/xAOD namespace names
    combinedList = ['farAside', 'nearAside', 'nearCside', 'farCside']

    array = helper.addArray([combinedList, layerList],
                            afpSiLayerAlgorithm,
                            'AFPSiLayerTool',
                            topPath='AFP/SiT/')
    array.defineHistogram('pixelColIDChip',
                          title='1D hitmap for {0} Layer {1};pixelColIDChip',
                          path='PixelColIDChip',
                          xbins=80,
                          xmin=0.5,
                          xmax=80.5)
    array.defineHistogram('pixelRowIDChip',
                          title='1D hitmap for {0} Layer {1};pixelRowIDChip',
                          path='PixelRowIDChip',
                          xbins=336,
                          xmin=0.5,
                          xmax=336.5)
    array.defineHistogram(
        'pixelColIDChip,pixelRowIDChip',
        title='hitmap for {0} Layer {1};pixelColIDChip;pixelRowIDChip',
        type='TH2F',
        path='pixelColRow2D',
        xbins=80,
        xmin=0.5,
        xmax=80.5,
        ybins=336,
        ymin=0.5,
        ymax=336.5)
    array.defineHistogram(
        'timeOverThreshold',
        type='TH1F',
        title='1D Time over threshold for {0} Layer {1};timeOverThreshold',
        path='SiTimeOverThreshold',
        xbins=60,
        xmin=0,
        xmax=20)
    array.defineHistogram(
        'clusterX,clusterY',
        title='Cluster position in station {0} Layer {1};clusterX;clusterY',
        type='TH2F',
        path='Cluster',
        xbins=80,
        xmin=0.5,
        xmax=80.5,
        ybins=336,
        ymin=0.5,
        ymax=336.5)

    array = helper.addArray([combinedList],
                            afpSiLayerAlgorithm,
                            'AFPSiLayerTool',
                            topPath='AFP/Track/')
    array.defineHistogram(
        'trackX,trackY',
        title='Track posistion position in station {0};trackX;trackY',
        type='TH2F',
        path='Track',
        xbins=80,
        xmin=0.5,
        xmax=80.5,
        ybins=336,
        ymin=0.5,
        ymax=336.5)

    arrayOneList = helper.addArray([combinedList],
                                   afpToFAlgorithm,
                                   'AFPToFTool',
                                   topPath='AFP/ToF/')
    arrayOneList.defineHistogram(
        'trainID,barInTrainID',
        title='ToF hit bar vs train {0};trainID;barInTrainID',
        type='TH2F',
        path='HitBarvsTrain/',
        xbins=4,
        xmin=-0.5,
        xmax=3.5,
        ybins=4,
        ymin=-0.5,
        ymax=3.5)

    # Finalize. The return value should be a tuple of the ComponentAccumulator
    return helper.result()
예제 #9
0
def tauMonitoringConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###

    # The following class will make a sequence, configure algorithms, and link
    # them to GenericMonitoringTools
    from AthenaMonitoring import AthMonitorCfgHelper
    cfgHelper = AthMonitorCfgHelper(inputFlags, monName='tauMonitorAlgFamily')

    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example
    # algorithm in the AthenaMonitoring package. Just pass the type to the
    # helper. Then, the helper will instantiate an instance and set up the
    # base class configuration following the inputFlags. The returned object
    # is the algorithm.
    from AthenaConfiguration.ComponentFactory import CompFactory
    tauMonitorAlgorithm = CompFactory.tauMonitorAlgorithm
    tauMonAlgBA = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                         name='tauMonAlgBA')
    tauMonAlgCR = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                         name='tauMonAlgCR')
    tauMonAlgEC = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                         name='tauMonAlgEC')
    tauMonAlgGlobal = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                             name='tauMonAlgGlobal')
    tauMonAlgTauTrig = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                              name='tauMonAlgTauTrig')
    tauMonAlgEleTrig = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                              name='tauMonAlgEleTrig')
    tauMonAlgJetTrig = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                              name='tauMonAlgJetTrig')
    tauMonAlgHighPt = cfgHelper.addAlgorithm(tauMonitorAlgorithm,
                                             name='tauMonAlgHighPt')
    tauMonAlgHighPtBDTLoose = cfgHelper.addAlgorithm(
        tauMonitorAlgorithm, name='tauMonAlgHighPtBDTLoose')

    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # exampleMonAlg.RandomHist = True
    # to enable a trigger filter, for example:
    #exampleMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'

    tauMonAlgBA.etaMin = -1.
    tauMonAlgBA.etaMax = 1.3
    tauMonAlgCR.etaMin = 1.3
    tauMonAlgCR.etaMax = 1.7
    tauMonAlgEC.etaMin = 1.7
    tauMonAlgEC.etaMax = 3.5
    tauMonAlgGlobal.etaMin = -100
    tauMonAlgGlobal.etaMax = 100
    tauMonAlgTauTrig.etaMin = -100
    tauMonAlgTauTrig.etaMax = 100
    tauMonAlgEleTrig.etaMin = -100
    tauMonAlgEleTrig.etaMax = 100
    tauMonAlgJetTrig.etaMin = -100
    tauMonAlgJetTrig.etaMax = 100
    tauMonAlgHighPt.etaMin = -100
    tauMonAlgHighPt.etaMax = 100
    tauMonAlgHighPtBDTLoose.etaMin = -100
    tauMonAlgHighPtBDTLoose.etaMax = 100

    tauMonAlgBA.kinGroupName = 'tauMonKinGroupBA'
    tauMonAlgCR.kinGroupName = 'tauMonKinGroupCR'
    tauMonAlgEC.kinGroupName = 'tauMonKinGroupEC'
    tauMonAlgGlobal.kinGroupName = 'tauMonKinGroupGlobal'
    tauMonAlgTauTrig.kinGroupName = 'tauMonKinGroupTauTrig'
    tauMonAlgEleTrig.kinGroupName = 'tauMonKinGroupEleTrig'
    tauMonAlgJetTrig.kinGroupName = 'tauMonKinGroupJetTrig'
    tauMonAlgHighPt.kinGroupName = 'tauMonKinGroupHighPt'
    tauMonAlgHighPtBDTLoose.kinGroupName = 'tauMonKinGroupHighPtBDTLoose'

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.
    myKinGroupBA = cfgHelper.addGroup(alg=tauMonAlgBA,
                                      name='tauMonKinGroupBA',
                                      topPath='Tau/TauB/')
    myKinGroupCR = cfgHelper.addGroup(alg=tauMonAlgCR,
                                      name='tauMonKinGroupCR',
                                      topPath='Tau/TauCR/')
    myKinGroupEC = cfgHelper.addGroup(alg=tauMonAlgEC,
                                      name='tauMonKinGroupEC',
                                      topPath='Tau/TauE/')
    myKinGroupGlobal = cfgHelper.addGroup(alg=tauMonAlgGlobal,
                                          name='tauMonKinGroupGlobal',
                                          topPath='Tau/')
    myKinGroupTauTrig = cfgHelper.addGroup(alg=tauMonAlgTauTrig,
                                           name='tauMonKinGroupTauTrig',
                                           topPath='Tau/Trigger/TauTrig')
    myKinGroupEleTrig = cfgHelper.addGroup(alg=tauMonAlgEleTrig,
                                           name='tauMonKinGroupEleTrig',
                                           topPath='Tau/Trigger/EleTrig')
    myKinGroupJetTrig = cfgHelper.addGroup(alg=tauMonAlgJetTrig,
                                           name='tauMonKinGroupJetTrig',
                                           topPath='Tau/Trigger/JetTrig')

    myKinGroupHighPt = cfgHelper.addGroup(alg=tauMonAlgHighPt,
                                          name='tauMonKinGroupHighPt',
                                          topPath='Tau/')
    myKinGroupHighPtBDTLoose = cfgHelper.addGroup(
        alg=tauMonAlgHighPtBDTLoose,
        name='tauMonKinGroupHighPtBDTLoose',
        topPath='Tau/')

    naming = {
        'BA': "Tau_TauB_",
        'CR': "Tau_TauCR_",
        'EC': "Tau_TauE_",
        'Global': "",
        'HighPt': "",
        'HighPtBDTLoose': "",
        'EleTrig': "emTriggered_",
        'JetTrig': "jetTriggered_",
        'TauTrig': "tauTriggered_",
    }

    def namer(variables, histogramName, folder, algorithm):
        if folder != "":
            #This wouldn't have been necessary except the calo folder in the naming convention:
            #This adds the Tau prefix to the histograms in the calo folder
            if postfix == "Global" and (folder == "Calo" or folder == "Track"):
                return variables + ";" + "Tau_" + naming[
                    algorithm] + folder + "_" + histogramName
            else:
                return variables + ";" + naming[
                    algorithm] + folder + "_" + histogramName
        else:
            return variables + ";" + naming[algorithm] + folder + histogramName

    # Add a GMT for the other example monitor algorithm
    # anotherGroup = cfgHelper.addGroup(anotherTauMonAlg,'tauMonitor')

    ### STEP 5 ###
    # Configure histograms
    for itup in [(myKinGroupBA, 'BA'), (myKinGroupCR, 'CR'),
                 (myKinGroupEC, 'EC'), (myKinGroupGlobal, 'Global'),
                 (myKinGroupHighPt, 'HighPt'),
                 (myKinGroupHighPtBDTLoose, 'HighPtBDTLoose'),
                 (myKinGroupEleTrig, 'EleTrig'),
                 (myKinGroupJetTrig, 'JetTrig'),
                 (myKinGroupTauTrig, 'TauTrig')]:

        (igroup, postfix) = itup

        PHIMIN = -pi
        PHIMAX = pi

        folder = ""

        if (postfix == "BA" or postfix == "CR" or postfix == "EC"
                or postfix == "Global" or postfix == "TauTrig"
                or postfix == "EleTrig" or postfix == "JetTrig"):

            igroup.defineHistogram(
                namer('nTauCandidates', 'nTauCandidates', "", postfix),
                title='Number of tau candidates;Number of Taus per Event',
                xbins=30,
                xmin=-0.5,
                xmax=30.5,
                path=folder)

            igroup.defineHistogram(
                namer('tauCharge', 'tauCharge', '', postfix),
                title='Charge of tau candidates;Charge;Number of Candidates',
                xbins=11,
                xmin=-5.5,
                xmax=5.5,
                path=folder)

            igroup.defineHistogram(
                namer('tauEt', 'tauEt', '', postfix),
                title=
                'Et of tau candidates;Transverse Energy (GeV);Number of Candidates',
                xbins=60,
                xmin=0.,
                xmax=300.,
                path=folder)

            igroup.defineHistogram(
                namer('tauEta', 'tauEta', '', postfix),
                title='Eta of tau candidates;Eta;Number of Candidates',
                xbins=51,
                xmin=-2.55,
                xmax=2.55,
                path=folder)

            igroup.defineHistogram(namer('LB,tauEta', 'tauEtaVsLB', '',
                                         postfix),
                                   type='TH2F',
                                   title='Tau Eta Vs Lumiblock;Lumiblock;eta',
                                   xbins=1200,
                                   xmin=0,
                                   xmax=1200,
                                   ybins=51,
                                   ymin=-2.55,
                                   ymax=2.55,
                                   path=folder)

            igroup.defineHistogram(
                namer('tauPhi', 'tauPhi', '', postfix),
                title='Phi of tau candidates;Phi;Number of Candidates',
                xbins=65,
                xmin=PHIMIN - 0.098174 / 2.,
                xmax=PHIMAX + 0.098174 / 2.,
                path=folder)

            igroup.defineHistogram(namer('tauEta,tauPhi', 'tauPhiVsEta', '',
                                         postfix),
                                   type='TH2F',
                                   title='PhiVsEtaTitle;Eta;Phi',
                                   xbins=30,
                                   xmin=-2.55,
                                   xmax=2.55,
                                   ybins=32,
                                   ymin=PHIMIN,
                                   ymax=PHIMAX,
                                   path=folder)

            igroup.defineHistogram(namer('LB,tauPhi', 'tauPhiVsLB', '',
                                         postfix),
                                   type='TH2F',
                                   title='Tau Phi vs Lumiblock;Lumiblock;Phi',
                                   xbins=1200,
                                   xmin=0,
                                   xmax=1200,
                                   ybins=80,
                                   ymin=PHIMIN,
                                   ymax=PHIMAX,
                                   path=folder)

        if (postfix == "BA" or postfix == "CR" or postfix == "EC"
                or postfix == "TauTrig"):

            igroup.defineHistogram(
                namer('tauPhiBDTLoose', 'phi', 'Identification_BDTLoose',
                      postfix),
                title=
                'Phi of tau candidates ( BDTLoose) ;Phi;Number of Candidates',
                xbins=65,
                xmin=PHIMIN - 0.098174 / 2.,
                xmax=PHIMAX + 0.098174 / 2.,
                path=folder + "Identification/BDTLoose")

            igroup.defineHistogram(
                namer('tauEtaBDTLoose', 'eta', 'Identification_BDTLoose',
                      postfix),
                title=
                'Eta of tau candidates ( BDTLoose) ;Eta;Number of Candidates',
                xbins=51,
                xmin=-2.55,
                xmax=2.55,
                path=folder + "Identification/BDTLoose")

            igroup.defineHistogram(
                namer('tauEtBDTLoose', 'et', 'Identification_BDTLoose',
                      postfix),
                title=
                'Et of tau candidates;Transverse Energy (GeV);Number of Candidates',
                xbins=60,
                xmin=0.,
                xmax=300.,
                path=folder + "Identification/BDTLoose")

            igroup.defineHistogram(
                namer('NumTracksBDTLoose', 'NumTracks',
                      'Identification_BDTLoose', postfix),
                title=
                'Number Of Tracks for Tau Candidates (BDTLoose);Number Of Tracks;Number Of Candidates',
                xbins=21,
                xmin=-0.5,
                xmax=20.5,
                path=folder + "Identification/BDTLoose")

            igroup.defineHistogram(
                namer('tauPhiBDTMedium', 'phi', 'Identification_BDTMedium',
                      postfix),
                title=
                'Phi of tau candidates ( BDTMedium) ;Phi;Number of Candidates',
                xbins=65,
                xmin=PHIMIN - 0.098174 / 2.,
                xmax=PHIMAX + 0.098174 / 2.,
                path=folder + "Identification/BDTMedium")

            igroup.defineHistogram(
                namer('tauEtaBDTMedium', 'eta', 'Identification_BDTMedium',
                      postfix),
                title=
                'Eta of tau candidates ( BDTMedium) ;Eta;Number of Candidates',
                xbins=51,
                xmin=-2.55,
                xmax=2.55,
                path=folder + "Identification/BDTMedium")

            igroup.defineHistogram(
                namer('tauEtBDTMedium', 'et', 'Identification_BDTMedium',
                      postfix),
                title=
                'Et of tau candidates;Transverse Energy (GeV);Number of Candidates',
                xbins=60,
                xmin=0.,
                xmax=300.,
                path=folder + "Identification/BDTMedium")

            igroup.defineHistogram(
                namer('NumTracksBDTMedium', 'NumTracks',
                      'Identification_BDTMedium', postfix),
                title=
                'Number Of Tracks for Tau Candidates (BDTMedium);Number Of Tracks;Number Of Candidates',
                xbins=21,
                xmin=-0.5,
                xmax=20.5,
                path=folder + "Identification/BDTMedium")
            igroup.defineHistogram(
                namer('tauPhiEt15BDTLoose', 'phi',
                      'Identification_BDTLoose15GeV', postfix),
                title=
                'Phi of tau candidates (Et>15, BDTLoose) ;Phi;Number of Candidates',
                xbins=65,
                xmin=PHIMIN - 0.098174 / 2.,
                xmax=PHIMAX + 0.098174 / 2.,
                path=folder + "Identification/BDTLoose15GeV")

            igroup.defineHistogram(
                namer('tauEtaEt15BDTLoose', 'eta',
                      'Identification_BDTLoose15GeV', postfix),
                title=
                'Eta of tau candidates (Et>15, BDTLoose) ;Eta;Number of Candidates',
                xbins=51,
                xmin=-2.55,
                xmax=2.55,
                path=folder + "Identification/BDTLoose15GeV")

            igroup.defineHistogram(
                namer('nClustersEt15BDTLoose', 'nCluster',
                      'Identification_BDTLoose15GeV', postfix),
                title=
                'Number Of CaloTopoClusters (Et>15,BDTLoose);Number Of Clusters;Number Of Candidates',
                xbins=40,
                xmin=0.,
                xmax=40.,
                path=folder + "Identification/BDTLoose15GeV")

            igroup.defineHistogram(
                namer('NumTracksEt15BDTLoose', 'NumTracks',
                      'Identification_BDTLoose15GeV', postfix),
                title=
                'Number Of Tracks for Tau Candidates (Et>15,BDTLoose);Number Of Tracks;Number Of Candidates',
                xbins=21,
                xmin=-0.5,
                xmax=20.5,
                path=folder + "Identification/BDTLoose15GeV")

            igroup.defineHistogram(
                namer('tauEtEt15BDTLoose', 'et',
                      'Identification_BDTLoose15GeV', postfix),
                title=
                'Et of tau candidates;Transverse Energy (GeV);Number of Candidates',
                xbins=60,
                xmin=0.,
                xmax=300.,
                path=folder + "Identification/BDTLoose15GeV")

            igroup.defineHistogram(
                namer('panModeEt15BDTLoose', 'panMode',
                      'Identification_BDTLoose15GeV', postfix),
                title='tau decay mode from panTau upon JetBDTSigMedium;mode',
                xbins=5,
                xmin=0.,
                xmax=5.,
                path=folder + "Identification/BDTLoose15GeV",
                xlabels=["1p0n", "1p1n", "1pXn", "3p0n", "3pXn"])

            igroup.defineHistogram(
                namer('jetSeedEta', 'jetSeedEta', 'Calo', postfix),
                title=
                'Calorimeter eta of tau candidates;Eta;Numbers of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=-2.5,
                xmax=2.5)

            igroup.defineHistogram(
                namer('jetSeedPhi', 'jetSeedPhi', 'Calo', postfix),
                title=
                'Calorimeter phi of tau candidates;Phi;Numbers of Candidates',
                path=folder + "Calo",
                xbins=64,
                xmin=PHIMIN,
                xmax=PHIMAX)

            igroup.defineHistogram(
                namer('jetSeedPt', 'jetSeedPt', 'Calo', postfix),
                title=
                'Calorimeter pt of tau candidates;Et;Numbers of Candidates',
                path=folder + "Calo",
                xbins=100,
                xmin=0.,
                xmax=300)

            igroup.defineHistogram(
                namer('EMRadius', 'EMRadius', 'Calo', postfix),
                title='Uncalibrated EM Radius;EM Radius;Number Of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=1.2)

            igroup.defineHistogram(
                namer('hadRadius', 'hadRadius', 'Calo', postfix),
                title=
                'Hadronic Radius of tau candidates;Hadronic Radius; Number Of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=1.)

            igroup.defineHistogram(
                namer('stripWidth2', 'stripWidth2', 'Calo', postfix),
                title=
                'Strip Width of tau candidates;Strip Width;Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=-0.1,
                xmax=0.12)

            igroup.defineHistogram(
                namer('isolFrac', 'isolFrac', 'Calo', postfix),
                title=
                'Isolation Fraction;Et Isolation Fraction;Number of Candidates',
                path=folder + "Calo",
                xbins=51,
                xmin=0.0,
                xmax=1.02)

            igroup.defineHistogram(
                namer('nStrip', 'nStrip', 'Calo', postfix),
                title=
                'Number of strip cells of tau candidates;Number of Strip Cells;Number of Candidates',
                path=folder + "Calo",
                xbins=56,
                xmin=-0.5,
                xmax=55.5)

            igroup.defineHistogram(
                namer('etEMAtEMScale', 'etEMAtEMScale', 'Calo', postfix),
                title=
                'EM energy at the EM scale;EM Et (GeV) );Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=200.)

            igroup.defineHistogram(
                namer('etHadAtEMScale', 'etHadAtEMScale', 'Calo', postfix),
                title=
                'Hadronic Energy at the EM Scale;Had Et (GeV) );Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=200.)

            igroup.defineHistogram(
                namer('centFrac,LB', 'CentFracVsLB', 'Calo', postfix),
                type='TH2F',
                title=
                'Centrality Fraction vs Lumiblock;Centrality Fraction;Lumiblock',
                path=folder + "Calo",
                xbins=51,
                xmin=0,
                xmax=1.02,
                ybins=1200,
                ymin=0.,
                ymax=1200.)

            igroup.defineHistogram(
                'centFrac,LB',
                type='TH2F',
                title=
                'Centrality Fraction vs Lumiblock;Centrality Fraction;Lumiblock',
                path=folder + "Calo",
                xbins=51,
                xmin=0,
                xmax=1.02,
                ybins=1200,
                ymin=0.,
                ymax=1200.)

            igroup.defineHistogram(
                'isolFrac,LB',
                type='TH2F',
                title=
                'Isolation Fraction vs Lumiblock;Isolation Fraction;Lumiblock',
                path=folder + "Calo",
                xbins=51,
                xmin=0,
                xmax=1.02,
                ybins=1200,
                ymin=0.,
                ymax=1200.)

            igroup.defineHistogram(
                namer('BDTJetScore', 'BDTJetScore', 'Identification', postfix),
                title='BDT Score for Jet Rejection;Boosted Decision Tree Score',
                path=folder + "Identification",
                xbins=48,
                xmin=-1.1,
                xmax=1.1)

            igroup.defineHistogram(namer('JetBDTBkgMedium', 'JetBDTBkgMedium',
                                         'Identification', postfix),
                                   title='Loose EleBDT',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(
                namer('BDTEleScoreSigTrans', 'BDTEleScoreSigTrans',
                      'Identification', postfix),
                title=
                ' Flattened Signal Transformed BDT  for Ele Rejection;Boosted Decision Tree Score',
                path=folder + "Identification",
                xbins=24,
                xmin=-0.1,
                xmax=1.1)

            igroup.defineHistogram(
                namer('BDTJetScoreSigTrans', 'BDTJetScoreSigTrans',
                      'Identification', postfix),
                title=
                'Flattened signal Transformed BDT Score for Jet Rejection;Boosted Decision Tree Score',
                path=folder + "Identification",
                xbins=48,
                xmin=0,
                xmax=1.1)

            igroup.defineHistogram(namer('eleBDTMedium', 'eleBDTMedium',
                                         'Identification', postfix),
                                   title='Medium EleBDT',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(namer('eleBDTTight', 'eleBDTTight',
                                         'Identification', postfix),
                                   title='Tight EleBDT',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(namer('muonVeto', 'muonVeto',
                                         'Identification', postfix),
                                   title='Muon Veto',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(namer('tauBDTLoose', 'tauBDTLoose',
                                         'Identification', postfix),
                                   title='Identification Flag: tauBDTLoose',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(namer('tauBDTMedium', 'tauBDTMedium',
                                         'Identification', postfix),
                                   title='Identification Flag: tauBDTMedium',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            igroup.defineHistogram(namer('tauBDTTight', 'tauBDTTight',
                                         'Identification', postfix),
                                   title='Identification Flag: tauBDTTight',
                                   path=folder + "Identification",
                                   xbins=2,
                                   xmin=-0.5,
                                   xmax=1.5,
                                   xlabels=["False", "True"])

            #Substructure Histograms
            igroup.defineHistogram(
                namer('panModeSubstructure', 'panMode', 'SubStructure',
                      postfix),
                title='tau decay mode from PanTau upon JetBDTSigMedium;mode',
                xbins=8,
                xmin=0.,
                xmax=8.,
                path=folder + "SubStructure")

            igroup.defineHistogram(
                namer('BDTScoreAsP0', 'BDTScoreAsP0', 'SubStructure', postfix),
                title='BDT score indentifying pion zero ; BDT score',
                path=folder + "SubStructure",
                xbins=15,
                xmin=-0,
                xmax=1.2)

            igroup.defineHistogram(
                namer('EMFracTrk', 'EMFracTrk', 'SubStructure', postfix),
                title=
                'Ratio of pt to shot electromagnetic energy for associated tracks; track pt ratio in EM',
                path=folder + "SubStructure",
                xbins=15,
                xmin=0,
                xmax=1.5)

            igroup.defineHistogram(
                namer('EfracL2EffCluster', 'EfracL2EffCluster', 'SubStructure',
                      postfix),
                title=
                'Energy fraction of leading two effective clusters in shot; energy fraction',
                path=folder + "SubStructure",
                xbins=15,
                xmin=0,
                xmax=1.5)

            igroup.defineHistogram(
                namer('EisoEffCluster', 'EisoEffCluster', 'SubStructure',
                      postfix),
                title=
                'Isolation Energy after correction in effective clusters ; isolation energy (GeV)',
                path=folder + "SubStructure",
                xbins=10,
                xmin=0,
                xmax=50.)

            igroup.defineHistogram(
                namer('InvMassEffClusters', 'InvMassEffClusters',
                      'SubStructure', postfix),
                title=
                'Invariant mass of effective clusters in shot; invariant mass (GeV)',
                path=folder + "SubStructure",
                xbins=40,
                xmin=0,
                xmax=8.)

            igroup.defineHistogram(
                namer('nNeutPFO', 'nNeutPFO', 'SubStructure', postfix),
                title=
                '_NumNeutPFO;Number of neutral ParticleFlow objects ; PFO number',
                path=folder + "SubStructure",
                xbins=20,
                xmin=0,
                xmax=20.)

            igroup.defineHistogram(namer('nShot', 'nShot', 'SubStructure',
                                         postfix),
                                   title='number of shots ; shot number ',
                                   path=folder + "SubStructure",
                                   xbins=20,
                                   xmin=0,
                                   xmax=20.)

            igroup.defineHistogram(
                namer('panEta', 'panEta', 'SubStructure', postfix),
                title='tau Eta from PanTau ; substructure Eta',
                path=folder + "SubStructure",
                xbins=16,
                xmin=-3.2,
                xmax=3.2)

            igroup.defineHistogram(
                namer('panPhi', 'panPhi', 'SubStructure', postfix),
                title='tau Phi from PanTau ; substructure Phi',
                path=folder + "SubStructure",
                xbins=16,
                xmin=PHIMIN,
                xmax=PHIMAX)

            igroup.defineHistogram(
                namer('panPt', 'panPt', 'SubStructure', postfix),
                title='tau Pt from PanTau ; substructure pt (GeV)',
                path=folder + "SubStructure",
                xbins=20,
                xmin=0,
                xmax=200)

            igroup.defineHistogram(
                namer('pt3', 'shots_pt3', 'SubStructure', postfix),
                title='weighted cell pt in 3x3 window in shots; pt3 (GeV) ',
                path=folder + "SubStructure",
                xbins=24,
                xmin=0,
                xmax=12)

            igroup.defineHistogram(
                namer('PSSFrac', 'PSSFracEffCluster', 'SubStructure', postfix),
                title=
                'Energy fraction for PreSampling and sampling layers in effective clusters in shot;Sampling Energy Fraction',
                path=folder + "SubStructure",
                xbins=10,
                xmin=0,
                xmax=1.)

            igroup.defineHistogram(
                namer('ptRatioEflowApprox', 'ptRatioApprox', 'SubStructure',
                      postfix),
                title=
                'Ratio of pt to shot total energy for associated tracks; track pt ratio',
                xbins=20,
                xmin=0.,
                xmax=2.,
                path=folder + "SubStructure")

        if (postfix == "BA" or postfix == "CR" or postfix == "EC"
                or postfix == "TauTrig" or postfix == "Global"):
            #Calo Histograms
            igroup.defineHistogram(
                namer('EMRadius', 'EMRadius', 'Calo', postfix),
                title='Uncalibrated EM Radius;EM Radius;Number Of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=1.2)

            igroup.defineHistogram(
                namer('hadRadius', 'hadRadius', 'Calo', postfix),
                title=
                'Hadronic Radius of tau candidates;Hadronic Radius; Number Of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=1.)

            igroup.defineHistogram(
                namer('stripWidth2', 'stripWidth2', 'Calo', postfix),
                title=
                'Strip Width of tau candidates;Strip Width;Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=-0.1,
                xmax=0.12)

            igroup.defineHistogram(
                namer('isolFrac', 'isolFrac', 'Calo', postfix),
                title=
                'Isolation Fraction;Et Isolation Fraction;Number of Candidates',
                path=folder + "Calo",
                xbins=51,
                xmin=0.0,
                xmax=1.02)

            igroup.defineHistogram(
                namer('nStrip', 'nStrip', 'Calo', postfix),
                title=
                'Number of strip cells of tau candidates;Number of Strip Cells;Number of Candidates',
                path=folder + "Calo",
                xbins=56,
                xmin=-0.5,
                xmax=55.5)

            igroup.defineHistogram(
                namer('etEMAtEMScale', 'etEMAtEMScale', 'Calo', postfix),
                title=
                'EM energy at the EM scale;EM Et (GeV) );Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=200.)

            igroup.defineHistogram(
                namer('etHadAtEMScale', 'etHadAtEMScale', 'Calo', postfix),
                title=
                'Hadronic Energy at the EM Scale;Had Et (GeV) );Number of Candidates',
                path=folder + "Calo",
                xbins=50,
                xmin=0.,
                xmax=200.)

            igroup.defineHistogram(
                namer('centFrac,LB', 'centFracVsLB', 'Calo', postfix),
                type='TH2F',
                title=
                'Centrality Fraction vs Lumiblock;Centrality Fraction;Lumiblock',
                path=folder + "Calo",
                xbins=51,
                xmin=0,
                xmax=1.02,
                ybins=1200,
                ymin=0.,
                ymax=1200.)

            igroup.defineHistogram(
                namer('isolFrac,LB', 'isolFracVsLB', 'Calo', postfix),
                type='TH2F',
                title=
                'Isolation Fraction vs Lumiblock;Isolation Fraction;Lumiblock',
                path=folder + "Calo",
                xbins=51,
                xmin=0,
                xmax=1.02,
                ybins=1200,
                ymin=0.,
                ymax=1200.)

            igroup.defineHistogram(
                namer('centFrac', "centralityFraction", "Calo", postfix),
                title=
                'Centrality Fraction;Centrality Fraction;Number Of Candidates',
                xbins=70,
                xmin=0.,
                xmax=1.4,
                path=folder + "Calo")

            igroup.defineHistogram(
                namer('dRmax', "dRmax", "Calo", postfix),
                title='Maximum delta R;delta R;Number of Candidates',
                xbins=42,
                xmin=0.,
                xmax=0.21,
                path=folder + "Calo")

            igroup.defineHistogram(
                namer('tauEta', 'eta', 'Calo', postfix),
                title='Eta of tau candidates;Eta;Number of Candidates',
                xbins=51,
                xmin=-2.55,
                xmax=2.55,
                path=folder + "Calo")

            igroup.defineHistogram(
                namer('tauPhi', 'phi', 'Calo', postfix),
                title='Phi of tau candidates;Phi;Number of Candidates',
                xbins=65,
                xmin=PHIMIN,
                xmax=PHIMAX,
                path=folder + "Calo")

            igroup.defineHistogram(
                namer('trkAvgDist', 'trkAvgDist', 'Calo', postfix),
                title=
                'Average Track Distance from Calorimeter Seed;Distance (mm);Number of Candidates',
                xbins=20,
                xmin=0.,
                xmax=1.,
                path=folder + "Calo")

            #Track Histograms!
            igroup.defineHistogram(
                namer('d0', 'd0', 'Track', postfix),
                title='Track d0;Transverse Impact Parameter (mm)',
                path=folder + "Track",
                xbins=50,
                xmin=-5.0,
                xmax=5.0)

            igroup.defineHistogram(
                namer('z0PriVtx', 'z0PriVtx', 'Track', postfix),
                title=' z0 respected to primary vertex ; Z0 SinTheta (mm)',
                path=folder + "Track",
                xbins=50,
                xmin=-35.0,
                xmax=35.0)

            igroup.defineHistogram(namer('etaTrack', 'eta', 'Track', postfix),
                                   title='Track Eta;Eta',
                                   path=folder + "Track",
                                   xbins=51,
                                   xmin=-2.55,
                                   xmax=2.55)

            igroup.defineHistogram(
                namer('leadTrkPt', 'leadTrkPt', 'Track', postfix),
                title='Pt of Leading track;Transverse Momentum (GeV)',
                path=folder + "Track",
                xbins=50,
                xmin=0.,
                xmax=200.)

            igroup.defineHistogram(
                namer('nHighPtTaus', 'nHighPtTaus', 'Track', postfix),
                title=
                'Number of High Pt tau candidates;Number of Taus per Event',
                xbins=15,
                xmin=-0.5,
                xmax=14.5,
                path=folder + "Track")

            igroup.defineHistogram(
                namer('numberOfTRTHighThresholdHits',
                      'numberOfTRTHighThresholdHits', 'Track', postfix),
                title=
                'Number of TRT High Threshold Hits;Number of High Threshold TRT Hits',
                path=folder + "Track",
                xbins=15,
                xmin=-0.5,
                xmax=14.5)

            igroup.defineHistogram(
                namer('numberOfTRTHighThresholdOutliers',
                      'numberOfTRTHighThresholdOutliers', 'Track', postfix),
                title=
                "Number of TRT High Threshold Outliers;Number of TRT High Threshold Outliers",
                path=folder + "Track",
                xbins=26,
                xmin=-0.5,
                xmax=25.5)

            igroup.defineHistogram(
                namer('numberOfTRTHits', 'numberOfTRTHits', 'Track', postfix),
                title=
                'Number of TRT Low Threshold Hits;Number of Low Threshold TRT Hits',
                path=folder + "Track",
                xbins=101,
                xmin=-0.5,
                xmax=100.5)

            igroup.defineHistogram(
                namer('numberOfTRTOutliers', 'numberOfTRTOutliers', 'Track',
                      postfix),
                title=
                "Number of TRT Low Threshold Outliers;Number of TRT Low Threshold Outliers",
                path=folder + "Track",
                xbins=31,
                xmin=-0.5,
                xmax=25.5)

            igroup.defineHistogram(namer('ptTrack', 'pT', 'Track', postfix),
                                   title='Track pT;Transverse Momentum (GeV)',
                                   path=folder + "Track",
                                   xbins=60,
                                   xmin=0,
                                   xmax=300)

            igroup.defineHistogram(namer('phiTrack', 'phi', 'Track', postfix),
                                   title='Track Phi;Phi',
                                   path=folder + "Track",
                                   xbins=64,
                                   xmin=PHIMIN,
                                   xmax=PHIMAX)

            igroup.defineHistogram(
                namer('trkWidth2', 'trkWidth2', 'Track', postfix),
                title=
                'Weighted Track Width;Momentum-Weighted Width of Track System',
                path=folder + "Track",
                xbins=50,
                xmin=0.0,
                xmax=0.1)

            igroup.defineHistogram(
                namer('ipZ0SinThetaSigLeadTrk', 'ipZ0SinThetaSigLeadTrk',
                      'Track', postfix),
                title=
                'Impact Parameter z0 Sine Theta Significance of Leading Track;Z0SinTheta Significance',
                path=folder + "Track",
                xbins=50,
                xmin=-10.0,
                xmax=10.0)

            igroup.defineHistogram(
                namer('numberOfPixelHits', 'numberOfPixelHits', 'Track',
                      postfix),
                title='Number of Pixel Hits;Number of Pixel Hits',
                path=folder + "Track",
                xbins=25,
                xmin=-0.5,
                xmax=25.5)

            igroup.defineHistogram(
                namer('numberOfSCTHits', 'numberOfSCTHits', 'Track', postfix),
                title='Number of SCT Hits;Number of SCT Hits',
                path=folder + "Track",
                xbins=26,
                xmin=0,
                xmax=26)

            igroup.defineHistogram(
                namer('etOverPtLeadTrack', 'etOverPtLeadTrack', 'Track',
                      postfix),
                title=
                'Et over Pt of lead track of tau candidates;Et/Pt;Number of Candidates',
                xbins=50,
                xmin=0.,
                xmax=12.,
                path=folder + "Track")

            igroup.defineHistogram(
                namer('ipSigLeadTrk', 'ipSigLeadTrk', 'Track', postfix),
                title=
                'Impact Parameter Significance of Leading Track;Transverse Impact Parameter Significance',
                xbins=100,
                xmin=-5.,
                xmax=5.,
                path=folder + "Track")

            igroup.defineHistogram(
                namer('massTrkSys', 'massTrkSys', 'Track', postfix),
                title='Mass of the Track System;Invariant Mass (GeV)',
                xbins=30,
                xmin=-1.,
                xmax=5.,
                path=folder + "Track")

            igroup.defineHistogram(
                namer('trFlightPathSig', 'trFlightPathSig', 'Track', postfix),
                title=
                'Track Transverse Flight Path Significance;Transverse Flight Path Significance',
                xbins=125,
                xmin=-4.5,
                xmax=8.,
                path=folder + "Track")

            igroup.defineHistogram(
                namer('z0', 'z0', 'Track', postfix),
                title='Track z0;Longitudinal Impact Parameter (mm)',
                path=folder + "Track",
                xbins=50,
                xmin=-35.0,
                xmax=35.0)

        if postfix == 'Global' or postfix == "TauTrig" or postfix == "EleTrig" or postfix == "JetTrig":
            igroup.defineHistogram(
                namer('LB', 'nTauPerLB', '', postfix),
                title=
                'Total number of tau candidates per LB);Luminosity Block);Number of Candidates',
                xbins=1000,
                xmin=0.,
                xmax=1000.,
                path=folder)

            igroup.defineHistogram(
                namer('nHighPtTauCandidates', 'nHightPtTauCandidates', '',
                      postfix),
                title=
                'Number of High Pt tau candidates;Number of Taus per Event',
                xbins=15,
                xmin=-0.5,
                xmax=14.5,
                path=folder)

            igroup.defineHistogram(
                namer('NumTracks', 'tauNumTracks', '', postfix),
                title=
                'Number Of Tracks for Tau Candidates;Number Of Tracks;Number Of Candidates',
                xbins=21,
                xmin=-0.5,
                xmax=20.5,
                path=folder)

            igroup.defineHistogram(
                namer('nClusters', 'nCluster', '', postfix),
                title=
                'Number Of CaloTopoClusters;Number Of Clusters;Number Of Candidates',
                xbins=40,
                xmin=0.,
                xmax=40.,
                path=folder)

            igroup.defineHistogram(
                namer('tauEta,tauEt', 'tauEtVsEta', '', postfix),
                type='TH2F',
                title='Tau Et Vs Eta;#eta;Transverse Energy (Gev)',
                xbins=40,
                xmin=-2.55,
                xmax=2.55,
                ybins=300,
                ymin=0,
                ymax=300,
                path=folder)

            igroup.defineHistogram(
                namer('tauPhi,tauEt', 'tauEtVsPhi', '', postfix),
                type='TH2F',
                title='EtVsPhi;Phi;Transverse Energy (GeV);',
                xbins=80,
                xmin=PHIMIN,
                xmax=PHIMAX,
                ybins=300,
                ymin=-0.,
                ymax=300.,
                path=folder)

            if postfix == 'Global':
                #Physics Histograms - I suspect these should be doing some kind of selection, not obvious in the old code.
                igroup.defineHistogram(
                    namer('tauEta', 'tau_eta', '', postfix),
                    title='Eta of tau candidates;Eta;Number of Candidates',
                    xbins=51,
                    xmin=-2.55,
                    xmax=2.55,
                    path=folder + "Physics/Z")

                igroup.defineHistogram(
                    namer('tauEta,tauEt', 'tau_pTVsEta', '', postfix),
                    type='TH2F',
                    title='Tau Et Vs Eta;#eta;Transverse Energy (Gev)',
                    xbins=40,
                    xmin=-2.55,
                    xmax=2.55,
                    ybins=300,
                    ymin=0,
                    ymax=300,
                    path=folder + "Physics/Z")

                #will use different variable when not a placeholder
                igroup.defineHistogram(
                    namer('tauEta', 'lepton_pTVsEta', '', postfix),
                    title=
                    'Placeholder for empty histogram;Eta;Number of Candidates',
                    xbins=51,
                    xmin=-2.55,
                    xmax=2.55,
                    path=folder + "Physics/Z")

                igroup.defineHistogram(
                    namer('tauEta,tauEt', 'tau_pTVsEta', '', postfix),
                    type='TH2F',
                    title='Tau Et Vs Eta;#eta;Transverse Energy (Gev)',
                    xbins=40,
                    xmin=-2.55,
                    xmax=2.55,
                    ybins=300,
                    ymin=0,
                    ymax=300,
                    path=folder + "Physics/W")

        if postfix == 'HighPt':
            igroup.defineHistogram(namer('tauEtaEt15,tauPhiEt15',
                                         'tauPhiVsEta_et15', '', postfix),
                                   type='TH2F',
                                   title='EtaVsEtTitle;Eta;Phi',
                                   xbins=30,
                                   xmin=-2.55,
                                   xmax=2.55,
                                   ybins=32,
                                   ymin=PHIMIN,
                                   ymax=PHIMAX)

        if postfix == 'HighPtBDTLoose':

            igroup.defineHistogram(
                namer('tauEtaEt15BDTLoose,tauPhiEt15BDTLoose',
                      'tauPhiVsEta_et15_BDTLoose', '', postfix),
                type='TH2F',
                title='Phi vs Eta (Et>15, BDTLoose) ;Eta;Phi',
                xbins=30,
                xmin=-2.55,
                xmax=2.55,
                ybins=32,
                ymin=PHIMIN,
                ymax=PHIMAX)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can
    # just return directly (and not create "result" above)

    return cfgHelper.result()
예제 #10
0
def JetTagMonitorConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###
    # 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(inputFlags, 'JetTagAthMonitorCfg')

    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the jetTagging
    # algorithm in the AthenaMonitoring package. Just pass the type to the
    # helper. Then, the helper will instantiate an instance and set up the
    # base class configuration following the inputFlags. The returned object
    # is the algorithm.
    # You can actually make multiple instances of the same algorithm and give
    # them different configurations
    from AthenaConfiguration.ComponentFactory import CompFactory
    #jetTagGeneral = helper.addAlgorithm(JetTagMonitorAlgorithm,'JetTagGeneral')
    jetTagMonAlg = helper.addAlgorithm(CompFactory.JetTagMonitorAlgorithm,
                                       'JetTagMonAlg')
    #anotherJetTagMonAlg = helper.addAlgorithm(JetTagMonitorAlgorithm,'AnotherJetTagMonAlg')

    # If for some really obscure reason you need to instantiate an algorithm
    # yourself, the AddAlgorithm method will still configure the base
    # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)

    ### STEP 3 ###
    # Edit properties of an algorithm
    # Declare properties
    jetTagMonAlg.ElectronTrigger_201X = "HLT_e[2-9][0-9]_.*"  # electrons 20-99 GeV
    jetTagMonAlg.MuonTrigger_201X = "HLT_mu[2-9][0-9].*"  # muons 20-99 GeV

    jetTagMonAlg.TriggerChain = ''
    #jetTagMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
    #jetTagMonAlg.TriggerChain = 'HLT_e24_lhtight_nod0'
    #jetTagMonAlg.RandomHist = True

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decision tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # First, add a tool that's set up by a different configuration function.
    # In this case, CaloNoiseToolCfg returns its own component accumulator,
    # which must be merged with the one from this function.
    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
    # result.merge(caloNoiseAcc)
    # jetTagMonAlg.CaloNoiseTool = caloNoiseTool

    # Then, add a tool that doesn't have its own configuration function. In
    # this jetTagging, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # jetTagMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.
    #GeneralGroup = helper.addGroup(jetTagGeneral,'JetTagMonitor')
    GeneralGroup = helper.addGroup(jetTagMonAlg, 'JetTagMonitor', 'JetTagging')
    #JetGroup = helper.addGroup(jetTagMonAlg,'JetTagMonitor')
    #AnotherGroup = helper.addGroup(anotherJetTagMonAlg,'JetTagMonitor')

    # Add a GMT for the other jetTagging monitor algorithm
    #shifterGroup = helper.addGroup(shifterTrigEgammaMonAlg,'TrigEgammaMonitor','HLT/EgammaMon/Shifter/')

    ### STEP 5 ###
    #title is for plot, x-axis, y-axis
    #type is type of plot?
    #path is for folder structure of root output file

    ### General histograms <-----
    GeneralGroup.defineHistogram(
        'Event_CutFlow',
        title='Event CutFlow;Pass Event CutFlow;Events',
        path='Cutflow_plots',
        xbins=10,
        xmin=-0.5,
        xmax=9.5)
    GeneralGroup.defineHistogram(
        'Trigger_CutFlow',
        title='Trigger CutFlow;Pass Trigger CutFlow;Events',
        path='Cutflow_plots',
        xbins=10,
        xmin=-0.5,
        xmax=9.5)
    GeneralGroup.defineHistogram('Jet_CutFlow',
                                 title='Jet CutFlow;Pass Jet CutFlow;Jets',
                                 path='Cutflow_plots',
                                 xbins=10,
                                 xmin=-0.5,
                                 xmax=9.5)

    GeneralGroup.defineHistogram('run',
                                 title='Run number;Run;Event',
                                 path='Run_plots',
                                 xbins=500000,
                                 xmin=-0.5,
                                 xmax=499999.5)
    GeneralGroup.defineHistogram('lb',
                                 title='Lumi Block;LB;Events',
                                 path='Run_plots',
                                 xbins=1000,
                                 xmin=-0.5,
                                 xmax=999.5)
    GeneralGroup.defineHistogram('mu',
                                 title='Mu;<mu>;Events',
                                 path='Run_plots',
                                 xbins=100,
                                 xmin=0,
                                 xmax=100.0)
    GeneralGroup.defineHistogram('nPrimVtx',
                                 title='Primary vertices;PV;Events',
                                 path='Run_plots',
                                 xbins=100,
                                 xmin=0,
                                 xmax=100.0)
    GeneralGroup.defineHistogram('xPrimVtx',
                                 title='Primary vertices X position;X;Events',
                                 path='Run_plots',
                                 xbins=40,
                                 xmin=-2.0,
                                 xmax=2.0)
    GeneralGroup.defineHistogram('yPrimVtx',
                                 title='Primary vertices Y position;Y;Events',
                                 path='Run_plots',
                                 xbins=40,
                                 xmin=-2.0,
                                 xmax=2.0)
    GeneralGroup.defineHistogram('zPrimVtx',
                                 title='Primary vertices Z position;Z;Events',
                                 path='Run_plots',
                                 xbins=100,
                                 xmin=-250,
                                 xmax=250.0)
    GeneralGroup.defineHistogram(
        'nTracks_PV',
        title='Number of tracks in PV;Tracks in PV;Number of tracks',
        path='Run_plots',
        xbins=150,
        xmin=-0.5,
        xmax=149.5)

    GeneralGroup.defineHistogram(
        'nTracks',
        title='Track multiplicity;Tracks per event;Number of events',
        path='Run_plots',
        xbins=100,
        xmin=0,
        xmax=1000)
    GeneralGroup.defineHistogram(
        'nHitsBLayer',
        title='Number of IBL hits;Hits on track;Number of IBL hits on track',
        path='Run_plots',
        xbins=5,
        xmin=0,
        xmax=5)
    GeneralGroup.defineHistogram(
        'nHitsPixel',
        title=
        'Number of Pixel hits;Hits on track;Number of Pixel hits on track',
        path='Run_plots',
        xbins=10,
        xmin=0,
        xmax=10)
    GeneralGroup.defineHistogram(
        'nHitsSCT',
        title='Number of SCT hits;Hits on track;Number of SCT hits on track',
        path='Run_plots',
        xbins=15,
        xmin=0,
        xmax=15)
    GeneralGroup.defineHistogram(
        'nHitsSi',
        title=
        'Number of PIX+SCT hits;Hits on track;Number of PIX+SCT hits on track',
        path='Run_plots',
        xbins=25,
        xmin=0,
        xmax=25)
    GeneralGroup.defineHistogram(
        'nHitsTRT',
        title='Number of TRT hits;Hits on track;Number of TRT hits on track',
        path='Run_plots',
        xbins=100,
        xmin=0,
        xmax=100)
    GeneralGroup.defineHistogram(
        'nHitsID',
        title='Number of ID hits;Hits on track;Number of ID hits on track',
        path='Run_plots',
        xbins=150,
        xmin=0,
        xmax=150)

    GeneralGroup.defineHistogram(
        'JetTracks_n',
        title='Track multiplicity in jet;Tracks;Number of tracks per jet',
        path='Run_plots',
        xbins=50,
        xmin=0,
        xmax=50)
    GeneralGroup.defineHistogram('JetTracks_pt',
                                 title='pT of tracks in jet;pT;Tracks in jets',
                                 path='Run_plots',
                                 xbins=100,
                                 xmin=0,
                                 xmax=100)
    GeneralGroup.defineHistogram(
        'JetTracks_eta',
        title='#eta of tracks in jet;#eta;Tracks in jets',
        path='Run_plots',
        xbins=100,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'JetTracks_phi',
        title='#phi of tracks in jet;#phi;Tracks in jets',
        path='Run_plots',
        xbins=100,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'JetTracks_d0',
        title='d_0 of tracks in jet;d_0;Tracks in jets',
        path='Run_plots',
        xbins=100,
        xmin=-5,
        xmax=5)
    GeneralGroup.defineHistogram(
        'JetTracks_z0',
        title='z_0 of tracks in jet;z_0;Tracks in jets',
        path='Run_plots',
        xbins=100,
        xmin=-300,
        xmax=300)
    GeneralGroup.defineHistogram(
        'JetTracks_nHitsBLayer',
        title=
        'Number of IBL hits on tracks in jets;Hits on track;Number of IBL hits on track',
        path='Run_plots',
        xbins=5,
        xmin=0,
        xmax=5)
    GeneralGroup.defineHistogram(
        'JetTracks_nHitsPixel',
        title=
        'Number of Pixel hits on tracks in jets;Hits on track;Number of Pixel hits on track',
        path='Run_plots',
        xbins=10,
        xmin=0,
        xmax=10)
    GeneralGroup.defineHistogram(
        'JetTracks_nHitsSCT',
        title=
        'Number of SCT hits on tracks in jets;Hits on track;Number of SCT hits on track',
        path='Run_plots',
        xbins=15,
        xmin=0,
        xmax=15)

    ### is ttbar histograms <-----
    #registerHist(*m_monGr_shift, m_jet_mv_w_top = TH1F_LW::create("jet_MV_top",(m_mv_algorithmName+" Tag Weight of Jets in Top Events; "+m_mv_algorithmName+" tag weight").c_str(),int(m_mv_nBins/2),m_mv_rangeStart,m_mv_rangeStop));
    #registerHist(*m_monGr_shift, m_jet_top_eff = TH1F_LW::create("jet_top_eff","Fraction of b-tagged Jets in Top Events",1,-0.5,0.5));
    #registerHist(*m_monGr_shift, m_jet_pt_top_eff = TH1F_LW::create("jet_pt_top_eff","Fraction of b-tagged Jets in Top Events vs pT; pT [GeV]",10,0.,200.));

    GeneralGroup.defineHistogram('muon_PT',
                                 title='Muon pT;Muon pT;Events',
                                 path='TTbar_plots',
                                 xbins=100,
                                 xmin=0.0,
                                 xmax=200000.0)
    GeneralGroup.defineHistogram('electron_PT',
                                 title='Electron pT;Electron pT;Events',
                                 path='TTbar_plots',
                                 xbins=100,
                                 xmin=0.0,
                                 xmax=200000.0)

    GeneralGroup.defineHistogram(
        'nIsoMuons',
        title='Number of isolated Muons;Isolated muons;Number of events',
        path='TTbar_plots',
        xbins=3,
        xmin=-0.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'nIsoElectrons',
        title=
        'Number of isolated Electrons;Isolated electrons;Number of events',
        path='TTbar_plots',
        xbins=3,
        xmin=-0.5,
        xmax=2.5)

    GeneralGroup.defineHistogram(
        'nTTbarGoodJets',
        title=
        'Number of good jets in ttbar events;Good jets per event;Number of events',
        path='TTbar_plots',
        xbins=10,
        xmin=-0.5,
        xmax=9.5)
    GeneralGroup.defineHistogram(
        'mvTTbarJets',
        title='MV of jets in ttbar events;Jet MV;Number of jets',
        path='TTbar_plots',
        xbins=50,
        xmin=-1,
        xmax=1)

    GeneralGroup.defineHistogram(
        'nTTbarJets',
        title='Total number of ttbar jets;Number of jets;Number of events',
        path='TTbar_plots',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'nTTbarJets_60tag',
        title=
        'Number of ttbar jets passing 60 tag WP; Jets passing 60 tag WP;Number of ttbar jets',
        path='TTbar_plots',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'nTTbarJets_70tag',
        title=
        'Number of ttbar jets passing 70 tag WP; Jets passing 70 tag WP;Number of ttbar jets',
        path='TTbar_plots',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'nTTbarJets_77tag',
        title=
        'Number of ttbar jets passing 77 tag WP; Jets passing 77 tag WP;Number of ttbar jets',
        path='TTbar_plots',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'nTTbarJets_85tag',
        title=
        'Number of ttbar jets passing 85 tag WP; Jets passing 60 tag WP;Number of ttbar jets',
        path='TTbar_plots',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'pass60n,nTTbarJets',
        type='TEfficiency',
        title='TTbar jets 60 tag WP Efficiency;ttbar jets;60 tag WP Efficiency',
        path='Jet_Eff',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'pass70n,nTTbarJets',
        type='TEfficiency',
        title='TTbar jets 70 tag WP Efficiency;ttbar jets;70 tag WP Efficiency',
        path='Jet_Eff',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'pass77n,nTTbarJets',
        type='TEfficiency',
        title='TTbar jets 77 tag WP Efficiency;ttbar jets;77 tag WP Efficiency',
        path='Jet_Eff',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)
    GeneralGroup.defineHistogram(
        'pass85n,nTTbarJets',
        type='TEfficiency',
        title='TTbar jets 85 tag WP Efficiency;ttbar jets;85 tag WP Efficiency',
        path='Jet_Eff',
        xbins=1,
        xmin=-0.5,
        xmax=0.5)

    GeneralGroup.defineHistogram(
        'ptTTbarJets',
        title='Number of ttbar jets vs pT;ttbar jet pT;Number of ttbar jets',
        path='TTbar_plots',
        xbins=40,
        xmin=0,
        xmax=200)
    GeneralGroup.defineHistogram(
        'ptTTbarJets_60tag',
        title=
        'Number of ttbar jets passing 60 tag WP vs pT;ttbar jet pT;Number of ttbar jets',
        path='TTbar_plots',
        xbins=40,
        xmin=0,
        xmax=200)
    GeneralGroup.defineHistogram(
        'ptTTbarJets_70tag',
        title=
        'Number of ttbar jets passing 70 tag WP vs pT;ttbar jet pT;Number of ttbar jets',
        path='TTbar_plots',
        xbins=40,
        xmin=0,
        xmax=200)
    GeneralGroup.defineHistogram(
        'ptTTbarJets_77tag',
        title=
        'Number of ttbar jets passing 77 tag WP vs pT;ttbar jet pT;Number of ttbar jets',
        path='TTbar_plots',
        xbins=40,
        xmin=0,
        xmax=200)
    GeneralGroup.defineHistogram(
        'ptTTbarJets_85tag',
        title=
        'Number of ttbar jets passing 85 tag WP vs pT;ttbar jet pT;Number of ttbar jets',
        path='TTbar_plots',
        xbins=40,
        xmin=0,
        xmax=200)
    GeneralGroup.defineHistogram(
        'pass60p,ptTTbarJets',
        type='TEfficiency',
        title=
        'TTbar jets 60 tag WP Efficiency vs pT;ttbar jet pT;60 tag WP Efficiency',
        path='Jet_Eff',
        xbins=40,
        xmin=0.0,
        xmax=200.0)
    GeneralGroup.defineHistogram(
        'pass70p,ptTTbarJets',
        type='TEfficiency',
        title=
        'TTbar jets 70 tag WP Efficiency vs pT;ttbar jet pT;70 tag WP Efficiency',
        path='Jet_Eff',
        xbins=40,
        xmin=0.0,
        xmax=200.0)
    GeneralGroup.defineHistogram(
        'pass77p,ptTTbarJets',
        type='TEfficiency',
        title=
        'TTbar jets 77 tag WP Efficiency vs pT;ttbar jet pT;77 tag WP Efficiency',
        path='Jet_Eff',
        xbins=40,
        xmin=0.0,
        xmax=200.0)
    GeneralGroup.defineHistogram(
        'pass85p,ptTTbarJets',
        type='TEfficiency',
        title=
        'TTbar jets 85 tag WP Efficiency vs pT;ttbar jet pT;85 tag WP Efficiency',
        path='Jet_Eff',
        xbins=40,
        xmin=0.0,
        xmax=200.0)

    ### is SMT jet histograms <-----
    GeneralGroup.defineHistogram(
        'nSoftMuons',
        title='Number of Soft Muons;Muons per event;Number of muons',
        path='SMT_plots',
        xbins=3,
        xmin=-0.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'nSMTJets',
        title='Number of SMT Jets;Jets per event;Number of jets',
        path='SMT_plots',
        xbins=3,
        xmin=-0.5,
        xmax=2.5)

    GeneralGroup.defineHistogram(
        'drSMT',
        title='DeltaR between jet and soft muon;DR;Number of SMT candidates',
        path='SMT_plots',
        xbins=40,
        xmin=0,
        xmax=0.4)
    GeneralGroup.defineHistogram(
        'ptSMT_mu',
        title='pT of SMT Muons;Muon pT [GeV];Number of muons',
        path='SMT_plots',
        xbins=50,
        xmin=0,
        xmax=100)
    GeneralGroup.defineHistogram(
        'ptSMT_jet',
        title='pT of SMT Jets;Jet pT [GeV];Number of jets',
        path='SMT_plots',
        xbins=100,
        xmin=0,
        xmax=300)
    GeneralGroup.defineHistogram(
        'ptSMT_ratio',
        title='pT ratio of SMT Jets (mu/jet);pT ratio;Number of SMT jets',
        path='SMT_plots',
        xbins=50,
        xmin=0,
        xmax=1)
    GeneralGroup.defineHistogram(
        'pTrelSMT',
        title='pTrel of SMT Jets;pTrel;Number of jets',
        path='SMT_plots',
        xbins=50,
        xmin=0,
        xmax=5)
    GeneralGroup.defineHistogram('mvSMT',
                                 title='MV of SMT Jets;MV;Number of jets',
                                 path='SMT_plots',
                                 xbins=50,
                                 xmin=-1,
                                 xmax=1)

    ### jet quality cutflow histograms <-----

    #Distributions before selection (all jets from selected events)
    GeneralGroup.defineHistogram(
        'nJets',
        title='Jet multiplicity;Number of jets;Events',
        path='Jet_quality',
        xbins=50,
        xmin=0,
        xmax=50)
    GeneralGroup.defineHistogram('jet_PT',
                                 title='Jet pT;Jet pT [GeV];Jets',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=0.0,
                                 xmax=200.0)
    GeneralGroup.defineHistogram('jet_ETA',
                                 title='Jet eta;Jet #eta;Jets',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5)
    GeneralGroup.defineHistogram('jet_PHI',
                                 title='Jet phi;Jet #phi;Jets',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-1 * math.pi,
                                 xmax=math.pi)
    GeneralGroup.defineHistogram('jet_MV',
                                 title='Jet MV;Jet MV;Jets',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-1.0,
                                 xmax=1.0)

    #2D maps during selection
    GeneralGroup.defineHistogram('jet_eta_all,jet_phi_all;jet_MAP_all',
                                 title='2D MAP of all jets;Jet #eta;Jet #phi',
                                 type='TH2F',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5,
                                 ybins=200,
                                 ymin=-1 * math.pi,
                                 ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_quality,jet_phi_quality;jet_MAP_quality',
        title='2D MAP of quality jets;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_quality',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_kin,jet_phi_kin;jet_MAP_kin',
        title='2D MAP of jets passing kinematic selection;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_quality',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_jvt,jet_phi_jvt;jet_MAP_jvt',
        title='2D MAP of jets passing JVT;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_quality',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_overlap,jet_phi_overlap;jet_MAP_overlap',
        title='2D MAP of not overlapping jets;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_quality',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram('jet_eta_good,jet_phi_good;jet_MAP_good',
                                 title='2D MAP of good jets;Jet #eta;Jet #phi',
                                 type='TH2F',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5,
                                 ybins=200,
                                 ymin=-1 * math.pi,
                                 ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_suspect,jet_phi_suspect;jet_MAP_suspect',
        title='2D MAP of suspect jets;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_quality',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram('jet_eta_bad,jet_phi_bad;jet_MAP_bad',
                                 title='2D MAP of bad jets;Jet #eta;Jet #phi',
                                 type='TH2F',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5,
                                 ybins=200,
                                 ymin=-1 * math.pi,
                                 ymax=math.pi)
    GeneralGroup.defineHistogram('jet_eta_smt,jet_phi_smt;jet_MAP_smt',
                                 title='2D MAP of SMT jets;Jet #eta;Jet #phi',
                                 type='TH2F',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5,
                                 ybins=200,
                                 ymin=-1 * math.pi,
                                 ymax=math.pi)

    #GeneralGroup.defineHistogram('jet_MV_JVT_bef',title='Jet MV before JVT;Jet MV;Jets',path='Jet_quality',xbins=100,xmin=-1.0,xmax=1.0)
    #GeneralGroup.defineHistogram('jet_MV_JVT_aft',title='Jet MV after JVT;Jet MV;Jets',path='Jet_quality',xbins=100,xmin=-1.0,xmax=1.0)

    ###Distributions for good jets (passing Good/Suspect/Bad selection)
    GeneralGroup.defineHistogram('jet_pT_good',
                                 title='Good jets pT;Good Jet pT [GeV];Jets',
                                 path='Jet_MV',
                                 xbins=100,
                                 xmin=0.0,
                                 xmax=200.0)
    GeneralGroup.defineHistogram('jet_eta_good',
                                 title='Good jets #eta;Good Jet #eta;Jets',
                                 path='Jet_MV',
                                 xbins=100,
                                 xmin=-2.5,
                                 xmax=2.5)
    GeneralGroup.defineHistogram('jet_phi_good',
                                 title='Good jets #phi;Good Jet #phi;Jets',
                                 path='Jet_MV',
                                 xbins=100,
                                 xmin=-1 * math.pi,
                                 xmax=math.pi)
    GeneralGroup.defineHistogram('jet_MV_good',
                                 title='Good jets MV;Good Jet MV;Jets',
                                 path='Jet_MV',
                                 xbins=100,
                                 xmin=-1.0,
                                 xmax=1.0)

    ### tag weight histograms <-----

    GeneralGroup.defineHistogram(
        'jet_MV_mu_0_30',
        title='Jet MV in mu bin 1 : <mu> = [0,30];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_mu_30_50',
        title='Jet MV in mu bin 2 : <mu> = [30,50];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_mu_50_100',
        title='Jet MV in mu bin 3 : <mu> = [50,100];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'jet_MV_pt_0_20',
        title='Jet MV in pT bin 1 : pT = [0,20];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_20_40',
        title='Jet MV in pT bin 2 : pT = [20,40];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_40_70',
        title='Jet MV in pT bin 3 : pT = [40,70];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_70_100',
        title='Jet MV in pT bin 4 : pT = [70,100];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_100_150',
        title='Jet MV in pT bin 5 : pT = [100,150];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_150_200',
        title='Jet MV in pT bin 6 : pT = [150,200];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_pt_200_1000',
        title='Jet MV in pT bin 7 : pT = [200,1000];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'jet_MV_eta_00_05',
        title='Jet MV in #eta bin 1 : #eta = [0.0,0.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_eta_05_10',
        title='Jet MV in #eta bin 2 : #eta = [0.5,1.0];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_eta_10_15',
        title='Jet MV in #eta bin 3 : #eta = [1.0,1.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_eta_15_20',
        title='Jet MV in #eta bin 4 : #eta = [1.5,2.0];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_eta_20_25',
        title='Jet MV in #eta bin 5 : #eta = [2.0,2.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'jet_MV_phi_00_05',
        title='Jet MV in #phi bin 1 : #phi = [0.0,0.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_phi_05_10',
        title='Jet MV in #phi bin 2 : #phi = [0.5,1.0];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_phi_10_15',
        title='Jet MV in #phi bin 3 : #phi = [1.0,1.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_phi_15_20',
        title='Jet MV in #phi bin 4 : #phi = [1.5,2.0];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_phi_20_25',
        title='Jet MV in #phi bin 5 : #phi = [2.0,2.5];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'jet_MV_phi_25_31',
        title='Jet MV in #phi bin 6 : #phi = [2.5,3.1];Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    #jets passing WPs in eta and phi bins, 2D map and efficiency
    GeneralGroup.defineHistogram(
        'jet_eta_60tag',
        title=
        'Number of jets passing 60 tag WP vs #eta;Jet #eta;Number of jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'jet_eta_70tag',
        title=
        'Number of jets passing 70 tag WP vs #eta;Jet #eta;Number of jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'jet_eta_77tag',
        title=
        'Number of jets passing 77 tag WP vs #eta;Jet #eta;Number of jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'jet_eta_85tag',
        title=
        'Number of jets passing 85 tag WP vs #eta;Jet #eta;Number of jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'jet_phi_60tag',
        title=
        'Number of jets passing 60 tag WP vs #phi;Jet #phi;Number of jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_phi_70tag',
        title=
        'Number of jets passing 70 tag WP vs #phi;Jet #phi;Number of jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_phi_77tag',
        title=
        'Number of jets passing 77 tag WP vs #phi;Jet #phi;Number of jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_phi_85tag',
        title=
        'Number of jets passing 85 tag WP vs #phi;Jet #phi;Number of jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_60tag,jet_phi_60tag;jet_MAP_60tag',
        title='2D MAP of jets passing 60 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_70tag,jet_phi_70tag;jet_MAP_70tag',
        title='2D MAP of jets passing 70 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_77tag,jet_phi_77tag;jet_MAP_77tag',
        title='2D MAP of jets passing 77 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'jet_eta_85tag,jet_phi_85tag;jet_MAP_85tag',
        title='2D MAP of jets passing 85 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)

    GeneralGroup.defineHistogram(
        'jet_eta',
        title=
        'Number of jets before passing tag vs #eta;Jet #eta;Number of jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'pass60e,jet_eta',
        type='TEfficiency',
        title='Jets 60 tag WP Efficiency vs #eta;Jet #eta;60 tag WP Efficiency',
        path='Jet_Eff',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'pass70e,jet_eta',
        type='TEfficiency',
        title='Jets 70 tag WP Efficiency vs #eta;Jet #eta;70 tag WP Efficiency',
        path='Jet_Eff',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'pass77e,jet_eta',
        type='TEfficiency',
        title='Jets 77 tag WP Efficiency vs #eta;Jet #eta;77 tag WP Efficiency',
        path='Jet_Eff',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'pass85e,jet_eta',
        type='TEfficiency',
        title='Jets 85 tag WP Efficiency vs #eta;Jet #eta;85 tag WP Efficiency',
        path='Jet_Eff',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)

    GeneralGroup.defineHistogram(
        'jet_phi',
        title=
        'Number of jets before passing tag vs #phi;Jet #phi;Number of jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'pass60f,jet_phi',
        type='TEfficiency',
        title='Jets 60 tag WP Efficiency vs #phi;Jet #phi;60 tag WP Efficiency',
        path='Jet_Eff',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'pass70f,jet_phi',
        type='TEfficiency',
        title='Jets 70 tag WP Efficiency vs #phi;Jet #phi;70 tag WP Efficiency',
        path='Jet_Eff',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'pass77f,jet_phi',
        type='TEfficiency',
        title='Jets 77 tag WP Efficiency vs #phi;Jet #phi;77 tag WP Efficiency',
        path='Jet_Eff',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'pass85f,jet_phi',
        type='TEfficiency',
        title='Jets 85 tag WP Efficiency vs #phi;Jet #phi;85 tag WP Efficiency',
        path='Jet_Eff',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)

    #2D TEfficiency for 2D MAP of fraction of good jets
    GeneralGroup.defineHistogram(
        'passGood,jet_eta_all,jet_phi_all',
        type='TEfficiency',
        title='TEfficiency in 2D;Jet #eta;Jet #phi;Good Jet Efficiency',
        path='Jet_Eff',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)

    ### the same but with suspect jets
    GeneralGroup.defineHistogram('sus_jet_MV',
                                 title='Suspect Jet MV;Suspect Jet MV;Jets',
                                 path='Jet_quality',
                                 xbins=100,
                                 xmin=-1.0,
                                 xmax=1.0)

    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_0_20',
        title='Suspect Jet MV in pT bin 1 : pT = [0,20];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_20_40',
        title='Suspect Jet MV in pT bin 2 : pT = [20,40];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_40_80',
        title='Suspect Jet MV in pT bin 3 : pT = [40,80];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_80_100',
        title='Suspect Jet MV in pT bin 4 : pT = [80,100];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_100_150',
        title='Suspect Jet MV in pT bin 5 : pT = [100,150];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_150_200',
        title='Suspect Jet MV in pT bin 6 : pT = [150,200];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_pt_200_1000',
        title=
        'Suspect Jet MV in pT bin 7 : pT = [200,1000];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'sus_jet_MV_eta_0_05',
        title=
        'Suspect Jet MV in #eta bin 1 : #eta = [0,0.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_eta_05_10',
        title=
        'Suspect Jet MV in #eta bin 2 : #eta = [0.5,1.0];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_eta_10_15',
        title=
        'Suspect Jet MV in #eta bin 3 : #eta = [1.0,1.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_eta_15_20',
        title=
        'Suspect Jet MV in #eta bin 4 : #eta = [1.5,2.0];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_eta_20_25',
        title=
        'Suspect Jet MV in #eta bin 5 : #eta = [2.0,2.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_0_05',
        title=
        'Suspect Jet MV in #phi bin 1 : #phi = [0,0.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_05_10',
        title=
        'Suspect Jet MV in #phi bin 2 : #phi = [0.5,1.0];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_10_15',
        title=
        'Suspect Jet MV in #phi bin 3 : #phi = [1.0,1.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_15_20',
        title=
        'Suspect Jet MV in #phi bin 4 : #phi = [1.5,2.0];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_20_25',
        title=
        'Suspect Jet MV in #phi bin 5 : #phi = [2.0,2.5];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)
    GeneralGroup.defineHistogram(
        'sus_jet_MV_phi_25_31',
        title=
        'Suspect Jet MV in #phi bin 6 : #phi = [2.5,3.1];Suspect Jet MV;Jets',
        path='Jet_MV',
        xbins=100,
        xmin=-1.0,
        xmax=1.0)

    GeneralGroup.defineHistogram(
        'sus_jet_eta_pretag',
        title=
        'Number of suspect jets before passing tag vs #eta;Suspect Jet #eta;Number of suspect jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_60tag',
        title=
        'Number of suspect jets passing 60 tag WP vs #eta;Suspect Jet #eta;Number of suspect jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_70tag',
        title=
        'Number of suspect jets passing 70 tag WP vs #eta;Suspect Jet #eta;Number of suspect jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_77tag',
        title=
        'Number of suspect jets passing 77 tag WP vs #eta;Suspect Jet #eta;Number of suspect jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_85tag',
        title=
        'Number of suspect jets passing 85 tag WP vs #eta;Suspect Jet #eta;Number of suspect jets',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_60tag,sus_jet_eta_pretag',
        type='TEfficiency',
        title=
        'Jets 60 tag WP Efficiency vs #eta;Suspect Jet #eta;60 tag WP Efficiency',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_70tag,sus_jet_eta_pretag',
        type='TEfficiency',
        title=
        'Jets 70 tag WP Efficiency vs #eta;Suspect Jet #eta;70 tag WP Efficiency',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_77tag,sus_jet_eta_pretag',
        type='TEfficiency',
        title=
        'Jets 77 tag WP Efficiency vs #eta;Suspect Jet #eta;77 tag WP Efficiency',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_85tag,sus_jet_eta_pretag',
        type='TEfficiency',
        title=
        'Jets 85 tag WP Efficiency vs #eta;Suspect Jet #eta;85 tag WP Efficiency',
        path='Jet_MV',
        xbins=10,
        xmin=-2.5,
        xmax=2.5)

    GeneralGroup.defineHistogram(
        'sus_jet_phi_pretag',
        title=
        'Number of suspect jets before passing tag vs #phi;Suspect Jet #phi;Number of suspect jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_60tag',
        title=
        'Number of suspect jets passing 60 tag WP vs #phi;Suspect Jet #phi;Number of suspect jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_70tag',
        title=
        'Number of suspect jets passing 70 tag WP vs #phi;Suspect Jet #phi;Number of suspect jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_77tag',
        title=
        'Number of suspect jets passing 77 tag WP vs #phi;Suspect Jet #phi;Number of suspect jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_85tag',
        title=
        'Number of suspect jets passing 85 tag WP vs #phi;Suspect Jet #phi;Number of suspect jets',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_60tag,sus_jet_phi_pretag',
        type='TEfficiency',
        title=
        'Jets 60 tag WP Efficiency vs #phi;Suspect Jet #phi;60 tag WP Efficiency',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_70tag,sus_jet_phi_pretag',
        type='TEfficiency',
        title=
        'Jets 70 tag WP Efficiency vs #phi;Suspect Jet #phi;70 tag WP Efficiency',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_77tag,sus_jet_phi_pretag',
        type='TEfficiency',
        title=
        'Jets 77 tag WP Efficiency vs #phi;Suspect Jet #phi;77 tag WPEfficiency',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_phi_85tag,sus_jet_phi_pretag',
        type='TEfficiency',
        title=
        'Jets 85 tag WP Efficiency vs #phi;Suspect Jet #phi;85 tag WP Efficiency',
        path='Jet_MV',
        xbins=12,
        xmin=-1 * math.pi,
        xmax=math.pi)

    GeneralGroup.defineHistogram(
        'sus_jet_eta_60tag,sus_jet_phi_60tag;sus_jet_MAP_60tag',
        title='2D MAP of jets passing 60 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_70tag,sus_jet_phi_70tag;sus_jet_MAP_70tag',
        title='2D MAP of jets passing 70 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_77tag,sus_jet_phi_77tag;sus_jet_MAP_77tag',
        title='2D MAP of jets passing 77 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)
    GeneralGroup.defineHistogram(
        'sus_jet_eta_85tag,sus_jet_phi_85tag;sus_jet_MAP_85tag',
        title='2D MAP of jets passing 85 tag WP;Jet #eta;Jet #phi',
        type='TH2F',
        path='Jet_MV',
        xbins=100,
        xmin=-2.5,
        xmax=2.5,
        ybins=200,
        ymin=-1 * math.pi,
        ymax=math.pi)

    #1D and 2D Tefficiency examples
    #aGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff',path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0)
    #aGroup.defineHistogram('pT_passed,pT,random',type='TEfficiency',title='Test TEfficiency 2D;x;y;Eff',path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0,ybins=10, ymin=0.0, ymax=2.0)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can
    # just return directly (and not create "result" above)
    return helper.result()
예제 #11
0
def TrigCaloMonConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''
    import math

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

    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can 
    # just return directly (and not create "result" above)

    # Get BunchCrossingCondAlg
    from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
    result=BunchCrossingCondAlgCfg(inputFlags)


    ################################
    #     HLT_FastCaloEMClusters     #
    ################################



    # Add monitor algorithm
    from AthenaConfiguration.ComponentFactory import CompFactory
    L2CaloEMClustersMonAlg = helper.addAlgorithm(CompFactory.HLTCalo_L2CaloEMClustersMonitor, 'HLT_FastCaloEMClustersMonAlg')

    # Set properties
    L2CaloEMClustersMonAlg.HLTContainer = 'HLT_FastCaloEMClusters'
    L2CaloEMClustersMonAlg.OFFContainer = 'egammaClusters'
    L2CaloEMClustersMonAlg.MonGroupName = 'TrigCaloMonitor'
    L2CaloEMClustersMonAlg.OFFTypes = []
    L2CaloEMClustersMonAlg.HLThighET= 10000.0
    L2CaloEMClustersMonAlg.HLTMinET = -1.0
    L2CaloEMClustersMonAlg.OFFMinET = -1.0
    L2CaloEMClustersMonAlg.MaxDeltaR = 0.04

    # Add group
    L2CaloEMClustersMonGroup = helper.addGroup(L2CaloEMClustersMonAlg,'TrigCaloMonitor','HLT/HLTCalo')

    ########################
    #     HLT_Clusters     #
    ########################

    # Declare HLT histograms
    hist_path='HLT_FastCaloEMClusters/HLT_Clusters'
    L2CaloEMClustersMonGroup.defineHistogram('HLT_num',title='Number of HLT Clusters; Num Clusters; Entries',
                                path=hist_path,xbins=51,xmin=-0.5,xmax=50.5)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi',title='Number of HLT Clusters; #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et',title='HLT Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta',title='HLT Clusters #eta; #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_phi',title='HLT Cluster #phi; #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_size',title='HLT Cluster Size; Number of Cells; Entries',
                                path=hist_path,xbins=91,xmin=-10.0,xmax=1810.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,HLT_et;HLT_et_vs_BC',title='HLT Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    # Declare high-ET HLT histograms
    L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_num',title='Number of high-E_{T} HLT Clusters; Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-0.5,xmax=100.5)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi;HLT_barrel_high_et_phi_vs_HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='Number of high-E_{T} HLT Clusters; #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-2.6,xmax=2.6,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et;HLT_barrel_high_et_et',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta;HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters #eta; #eta; Entries',
                                path=hist_path,xbins=50,xmin=-2.6,xmax=2.6)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_phi;HLT_barrel_high_et_phi',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster #phi; #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_size;HLT_barrel_high_et_size',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster Size; Number of Cells; Entries',
                                path=hist_path,xbins=91,xmin=-10.0,xmax=1810.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,HLT_et;HLT_barrel_high_et_vs_BC',cutmask="HLT_barrel_high_et",title='hight-E_{T} HLT Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    ########################
    #     OFF_Clusters     #
    ########################

    # Declare OFF histograms
    hist_path='HLT_FastCaloEMClusters/OFF_Clusters'
    L2CaloEMClustersMonGroup.defineHistogram('OFF_num',title='Number of OFF Clusters; Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-1.0,xmax=201.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_phi',title='Number of OFF Clusters; #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_et',title='OFF Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta',title='OFF Clusters #eta; #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_phi',title='OFF Cluster #phi; #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_type',title='OFF Cluster Type; Size Enum; Entries',
                                path=hist_path,xbins=16,xmin=0.5,xmax=16.5)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,OFF_et;OFF_et_vs_BC',title='OFF Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    ########################
    #  HLT matched to OFF  #
    ########################

    # Declare HLT matched HLT vs. OFF cluster histograms
    hist_path='HLT_FastCaloEMClusters/HLT_Matched_to_OFF'
    L2CaloEMClustersMonGroup.defineHistogram('HLT_matched_fraction',title='Fraction of HLT clusters matched to HLT clusters; Matched fraction; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=1.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_vs_OFF_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries',
                                path=hist_path,xbins=50,xmin=0.0,xmax=0.1)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_vs_OFF_minimum_delta_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} -  #eta_{_{HLT}}; Entries',
                                path=hist_path,xbins=50,xmin=-0.2,xmax=0.2)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_vs_OFF_minimum_delta_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} -  #phi_{_{HLT}}; Entries',
                                path=hist_path,xbins=50,xmin=-0.01,xmax=0.09)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et,OFF_match_et;HLT_with_OFF_match_et_vs_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_vs_OFF_resolution',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries',
                                path=hist_path,xbins=100,xmin=-40.0,xmax=40.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,OFF} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=20,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=16,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)

    # Declare OFF histograms with HLT matches
    L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_num',title='Number of HLT Clusters (With OFF Matches); Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-1.0,xmax=201.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi;HLT_with_OFF_match_eta_vs_HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='Number of HLT Clusters (With OFF Matches); #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et;HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT Clusters E_{T} (With OFF Matches); E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta;HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT Clusters #eta (With OFF Matches); #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_phi;HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT Cluster #phi (With OFF Matches); #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,HLT_et;HLT_with_OFF_match_et_vs_BC',cutmask='HLT_with_OFF_match',title='HLT Clusters E_{T} (With OFF Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    # Declare OFF histograms without HLT matches
    L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_num',title='Number of HLT Clusters (No OFF Matches); Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-1.0,xmax=201.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi;HLT_no_OFF_match_eta_vs_HLT_no_OFF_match_phi',cutmask='HLT_no_OFF_match',title='Number of HLT Clusters (No OFF Matches); #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_et;HLT_no_OFF_match_et',cutmask='HLT_no_OFF_match',title='HLT Clusters E_{T} (No OFF Matches); E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_eta;HLT_no_OFF_match_eta',cutmask='HLT_no_OFF_match',title='HLT Clusters #eta (No OFF Matches); #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_phi;HLT_no_OFF_match_phi',cutmask='HLT_no_OFF_match',title='HLT Cluster #phi (No OFF Matches); #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,HLT_et;HLT_no_OFF_match_et_vs_BC',cutmask='HLT_no_OFF_match',title='HLT Clusters E_{T} (No OFF Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    ########################
    #  OFF matched to HLT  #
    ########################

    # Declare OFF matched HLT vs. OFF cluster histograms
    hist_path='HLT_FastCaloEMClusters/OFF_Matched_to_HLT'
    L2CaloEMClustersMonGroup.defineHistogram('OFF_matched_fraction',title='Fraction of OFF clusters matched to HLT clusters; Matched fraction; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=1.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_vs_HLT_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries',
                                path=hist_path,xbins=50,xmin=0.0,xmax=0.1)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_vs_HLT_minimum_delta_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} -  #eta_{_{HLT}}; Entries',
                                path=hist_path,xbins=50,xmin=-0.2,xmax=0.2)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_vs_HLT_minimum_delta_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} -  #phi_{_{HLT}}; Entries',
                                path=hist_path,xbins=50,xmin=-0.01,xmax=0.09)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_et,HLT_match_et;HLT_match_et_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_vs_HLT_resolution',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries',
                                path=hist_path,xbins=100,xmin=-40.0,xmax=40.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_et,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,OFF} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=20,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=hist_path,xbins=16,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)

    # Declare OFF histograms with HLT matches
    L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_num',title='Number of OFF Clusters (With HLT Matches); Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-1.0,xmax=201.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_phi;OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='Number of OFF Clusters (With HLT Matches); #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_et;OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='OFF Clusters E_{T} (With HLT Matches); E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta;OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='OFF Clusters #eta (With HLT Matches); #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_phi;OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='OFF Cluster #phi (With HLT Matches); #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_type;OFF_with_HLT_match_type',cutmask='OFF_with_HLT_match',title='OFF Cluster Type (With HLT Matches); Size Enum; Entries',
                                path=hist_path,xbins=16,xmin=0.5,xmax=16.5)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,OFF_et;OFF_with_HLT_match_et_vs_BC',cutmask='OFF_with_HLT_match',title='OFF Clusters E_{T} (With HLT Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)

    # Declare OFF histograms without HLT matches
    L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_num',title='Number of OFF Clusters (No HLT Matches); Num Clusters; Entries',
                                path=hist_path,xbins=101,xmin=-1.0,xmax=201.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_phi;OFF_no_HLT_match_phi_vs_OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='Number of OFF Clusters (No HLT Matches); #eta; #phi; ', type='TH2F',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_et;OFF_no_HLT_match_et',cutmask='OFF_no_HLT_match',title='OFF Clusters E_{T} (No HLT Matches); E_{T} [GeV]; Entries',
                                path=hist_path,xbins=100,xmin=0.0,xmax=100.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_eta;OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='OFF Clusters #eta (No HLT Matches); #eta; Entries',
                                path=hist_path,xbins=50,xmin=-5.0,xmax=5.0)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_phi;OFF_no_HLT_match_phi',cutmask='OFF_no_HLT_match',title='OFF Cluster #phi (No HLT Matches); #phi; Entries',
                                path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi)
    L2CaloEMClustersMonGroup.defineHistogram('OFF_type;OFF_no_HLT_match_type',cutmask='OFF_no_HLT_match',title='OFF Cluster Type (No HLT Matches); Size Enum; Entries',
                                path=hist_path,xbins=16,xmin=0.5,xmax=16.5)
    L2CaloEMClustersMonGroup.defineHistogram('HLT_bc,OFF_et;OFF_no_HLT_match_et_vs_BC',cutmask='OFF_no_HLT_match',title='OFF Clusters E_{T} (No HLT Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=hist_path,xbins=21,xmin=-0.5,xmax=20.5)



    ################################
    #     HLT_TopoCaloClusters     #
    ################################



    # Add monitor algorithm
    TopoCaloClustersFSMonAlg = helper.addAlgorithm(CompFactory.HLTCalo_TopoCaloClustersMonitor, 'HLT_TopoCaloClustersFSMonAlg')
    TopoCaloClustersRoIMonAlg = helper.addAlgorithm(CompFactory.HLTCalo_TopoCaloClustersMonitor, 'HLT_TopoCaloClustersRoIMonAlg')
    TopoCaloClustersLCMonAlg = helper.addAlgorithm(CompFactory.HLTCalo_TopoCaloClustersMonitor, 'HLT_TopoCaloClustersLCMonAlg')
    TopoCaloClustersFSMonAlg.HLTContainer = 'HLT_TopoCaloClustersFS'
    TopoCaloClustersRoIMonAlg.HLTContainer = 'HLT_TopoCaloClustersRoI'
    TopoCaloClustersLCMonAlg.HLTContainer = 'HLT_TopoCaloClustersLC'

    # Loop over all three monitoring algorithms
    algs = [TopoCaloClustersFSMonAlg, TopoCaloClustersRoIMonAlg, TopoCaloClustersLCMonAlg]
    path_names = ['HLT_TopoCaloClustersFS', 'HLT_TopoCaloClustersRoI', 'HLT_TopoCaloClustersLC']
    TopoCaloClustersMonGroup = []

    for i in range(len(algs)):

        # Set properties
        algs[i].OFFContainer = 'CaloCalTopoClusters'
        algs[i].MonGroupName = 'TrigCaloMonitor'
        algs[i].HLTTypes = []
        algs[i].OFFTypes = []
        algs[i].HLThighET= 5000.0
        algs[i].HLTMinET = 500.0
        algs[i].OFFMinET = 500.0
        algs[i].MatchType = False
        algs[i].MaxDeltaR = 0.04

        # Add group
        TopoCaloClustersMonGroup.append(helper.addGroup(algs[i], 'TrigCaloMonitor','HLT/HLTCalo'))

        ########################
        #     HLT_Clusters     #
        ########################

        # Declare HLT histograms
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_num',title='Number of HLT Clusters; Num Clusters; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi',title='Number of HLT Clusters; #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et',title='HLT Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta',title='HLT Clusters #eta; #eta; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi',title='HLT Cluster #phi; #phi; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_type',title='HLT Cluster Type; Size Enum; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_time',title='HLT Cluster time; time; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=60,xmin=-10.0,xmax=10.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time',title='Number of HLT Clusters; E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_size',title='HLT Cluster Size; Number of Cells; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=91,xmin=-10.0,xmax=1810.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,HLT_et;HLT_et_vs_BC',title='HLT Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/HLT_Clusters',xbins=21,xmin=-0.5,xmax=20.5)

        # Declare high-ET HLT histograms
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_num',title='Number of high-E_{T} HLT Clusters; Num Clusters; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=101,xmin=-0.5,xmax=100.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_barrel_high_et_phi_vs_HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='Number of high-E_{T} HLT Clusters; #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-2.6,xmax=2.6,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_barrel_high_et_et',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters #eta; #eta; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-2.6,xmax=2.6)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_barrel_high_et_phi',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster #phi; #phi; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_barrel_high_et_type',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster Type; Size Enum; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_barrel_high_et_time',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster time; time; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=60,xmin=-10.0,xmax=10.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_barrel_high_et_time_vs_HLT_barrel_high_et_et',cutmask="HLT_barrel_high_et",title='Number of high-E_{T} HLT Clusters; E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_size;HLT_barrel_high_et_size',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster Size; Number of Cells; Entries',
                                path=path_names[i]+'/HLT_Clusters',xbins=91,xmin=-10.0,xmax=1810.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,HLT_et;HLT_barrel_high_et_vs_BC',cutmask="HLT_barrel_high_et",title='hight-E_{T} HLT Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/HLT_Clusters',xbins=21,xmin=-0.5,xmax=20.5)

        ########################
        #     OFF_Clusters     #
        ########################

        # Declare OFF histograms
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_num',title='Number of OFF Clusters; Num Clusters; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi',title='Number of OFF Clusters; #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et',title='OFF Clusters E_{T}; E_{T} [GeV]; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta',title='OFF Clusters #eta; #eta; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi',title='OFF Cluster #phi; #phi; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_time',title='OFF Cluster time; time; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=75,xmin=-25.0,xmax=25.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time',title='Number of OFF Clusters; E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_type',title='HLT Cluster Type; Size Enum; Entries',
                                path=path_names[i]+'/OFF_Clusters',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,OFF_et;OFF_et_vs_BC',title='OFF Clusters E_{T} vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/OFF_Clusters',xbins=21,xmin=-0.5,xmax=20.5)

        ########################
        #  HLT matched to OFF  #
        ########################

        # Declare HLT matched HLT vs. OFF cluster histograms
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_matched_fraction',title='Fraction of HLT clusters matched to OFF clusters; Matched fraction; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=1.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=0.1)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} -  #eta_{_{HLT}}; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-0.2,xmax=0.2)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} -  #phi_{_{HLT}}; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=0.02)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_time',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster time; Time; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=80,xmin=-20.0,xmax=20.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,OFF_match_et;OFF_match_et_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_resolution',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=-60.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,HLT} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=20,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)

        # Declare HLT histograms with OFF matches
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_num',title='Number of HLT Clusters (With OFF Matches); Num Clusters; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_with_OFF_match_phi_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='Number of HLT Clusters (With OFF Matches); #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT Clusters E_{T} (With OFF Matches); E_{T} [GeV]; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT Clusters #eta (With OFF Matches); #eta; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT Cluster #phi (With OFF Matches); #phi; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_with_OFF_match_time',cutmask='HLT_with_OFF_match',title='HLT Cluster time (With OFF Matches); time; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=75,xmin=-25.0,xmax=25.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_with_OFF_match_time_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='Number of HLT Clusters (With OFF Matches); E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_with_OFF_match_type',cutmask='HLT_with_OFF_match',title='HLT Cluster Type (With OFF Matches); Size Enum; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,HLT_et;HLT_with_OFF_match_et_vs_BC',cutmask='HLT_with_OFF_match',title='HLT Clusters E_{T} (With OFF Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=21,xmin=-0.5,xmax=20.5)

        # Declare HLT histograms without OFF matches
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_num',title='Number of HLT Clusters (No OFF Matches); Num Clusters; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_no_OFF_match_phi_vs_HLT_no_OFF_match_eta',cutmask='HLT_no_OFF_match',title='Number of HLT Clusters (No OFF Matches); #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_no_OFF_match_et',cutmask='HLT_no_OFF_match',title='HLT Clusters E_{T} (No OFF Matches); E_{T} [GeV]; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_no_OFF_match_eta',cutmask='HLT_no_OFF_match',title='HLT Clusters #eta (No OFF Matches); #eta; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_no_OFF_match_phi',cutmask='HLT_no_OFF_match',title='HLT Cluster #phi (No OFF Matches); #phi; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_no_OFF_match_time',cutmask='HLT_no_OFF_match',title='HLT Cluster time (No OFF Matches); time; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=75,xmin=-25.0,xmax=25.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_no_OFF_match_time_vs_HLT_no_OFF_match_et',cutmask='HLT_no_OFF_match',title='Number of HLT Clusters (No OFF Matches); E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_no_OFF_match_type',cutmask='HLT_no_OFF_match',title='HLT Cluster Type (No OFF Matches); Size Enum; Entries',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,HLT_et;HLT_no_OFF_match_et_vs_BC',cutmask='HLT_no_OFF_match',title='HLT Clusters E_{T} (No OFF Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/HLT_Matched_to_OFF',xbins=21,xmin=-0.5,xmax=20.5)

        ########################
        #  OFF matched to HLT  #
        ########################

        # Declare OFF matched HLT vs. OFF cluster histograms
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_matched_fraction',title='Fraction of OFF clusters matched to HLT clusters; Matched fraction; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=1.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=0.1)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} -  #eta_{_{HLT}}; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-0.2,xmax=0.2)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} -  #phi_{_{HLT}}; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=0.02)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_time',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster time; Time; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=80,xmin=-20.0,xmax=20.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,HLT_match_et;HLT_match_et_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_resolution',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=-60.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,OFF} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=20,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)

        # Declare OFF histograms with HLT matches
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_num',title='Number of OFF Clusters (With HLT Matches); Num Clusters; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi;OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='Number of OFF Clusters (With HLT Matches); #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et;OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='OFF Clusters E_{T} (With HLT Matches); E_{T} [GeV]; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta;OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='OFF Clusters #eta (With HLT Matches); #eta; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi;OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='OFF Cluster #phi (With HLT Matches); #phi; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_time;OFF_with_HLT_match_time',cutmask='OFF_with_HLT_match',title='OFF Cluster time (With HLT Matches); time; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=75,xmin=-25.0,xmax=25.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time;OFF_with_HLT_match_time_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='Number of OFF Clusters (With HLT Matches); E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_type;OFF_with_HLT_match_type',cutmask='OFF_with_HLT_match',title='OFF Cluster Type (With HLT Matches); Size Enum; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,OFF_et;OFF_with_HLT_match_et_vs_BC',cutmask='OFF_with_HLT_match',title='OFF Clusters E_{T} (With HLT Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=21,xmin=-0.5,xmax=20.5)

        # Declare OFF histograms without HLT matches
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_num',title='Number of OFF Clusters (No HLT Matches); Num Clusters; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=101,xmin=-10.0,xmax=2010.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi;OFF_no_HLT_match_phi_vs_OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='Number of OFF Clusters (No HLT Matches); #eta; #phi; ', type='TH2F',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et;OFF_no_HLT_match_et',cutmask='OFF_no_HLT_match',title='OFF Clusters E_{T} (No HLT Matches); E_{T} [GeV]; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta;OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='OFF Clusters #eta (No HLT Matches); #eta; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi;OFF_no_HLT_match_phi',cutmask='OFF_no_HLT_match',title='OFF Cluster #phi (No HLT Matches); #phi; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-math.pi,xmax=math.pi)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_time;OFF_no_HLT_match_time',cutmask='OFF_no_HLT_match',title='OFF Cluster time (No HLT Matches); time; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=75,xmin=-25.0,xmax=25.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time;OFF_no_HLT_match_time_vs_OFF_no_HLT_match_et',cutmask='OFF_no_HLT_match',title='Number of OFF Clusters (No HLT Matches); E_{T} [GeV]; Time', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=100.0)
        TopoCaloClustersMonGroup[i].defineHistogram('OFF_type;OFF_no_HLT_match_type',cutmask='OFF_no_HLT_match',title='OFF Cluster Type (No HLT Matches); Size Enum; Entries',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=0.5,xmax=16.5)
        TopoCaloClustersMonGroup[i].defineHistogram('HLT_bc,OFF_et;OFF_no_HLT_match_et_vs_BC',cutmask='OFF_no_HLT_match',title='OFF Clusters E_{T} (No HLT Matches) vs BC; BCs from front of bunch train; <E_{T}> [GeV]', type='TProfile',
                                path=path_names[i]+'/OFF_Matched_to_HLT',xbins=21,xmin=-0.5,xmax=20.5)

    result.merge(helper.result())
    return result
예제 #12
0
def TrigMinBias(configFlags):

    from AthenaMonitoring import AthMonitorCfgHelper
    monConfig = AthMonitorCfgHelper(configFlags, 'HLTMinBiasMonAlgMTAcc')

    from AthenaConfiguration.ComponentFactory import CompFactory
    alg = monConfig.addAlgorithm(CompFactory.HLTMinBiasMonAlgMT,
                                 'HLTMinBiasMonAlgMT')
    mbEffAllGroup = monConfig.addGroup(alg, 'EffAll', 'HLT/MinBiasMon/')
    length = len(alg.triggerList)
    mbEffAllGroup.defineHistogram("PurityPassed,whichTrigger",
                                  type='TEfficiency',
                                  title="PurityPassed;whichTrigger",
                                  xbins=length,
                                  xmin=0,
                                  xmax=length,
                                  xlabels=list(alg.triggerList))
    mbEffAllGroup.defineHistogram("whichTrigger",
                                  title="count of triggers;HLT",
                                  xbins=length,
                                  xmin=0,
                                  xmax=length,
                                  xlabels=list(alg.triggerList))
    mbEffAllGroup.defineHistogram("whichTrigger;No. of events",
                                  type='TH1I',
                                  title='Event per Trigger;HLT',
                                  xbins=length,
                                  xmin=0,
                                  xmax=length,
                                  xlabels=list(alg.triggerList))
    mbEffAllGroup.defineHistogram(
        "decision,whichTrigger",
        type='TEfficiency',
        title='Efficiency of selecting Events with One Good Trk;TriggerName',
        xbins=length,
        xmin=0,
        xmax=length,
        xlabels=list(alg.triggerList))

    for chain in alg.triggerList:
        mbGroup = monConfig.addGroup(alg, chain,
                                     'HLT/MinBiasMon/IDMinbias/' + chain + '/')
        mbEffGroup = monConfig.addGroup(
            alg, chain + '_Eff',
            'HLT/MinBiasMon/Purities&Efficiencies/' + chain + '/')

        # correct the titles of following histograms
        mbGroup.defineHistogram(
            "PixelSPLow",
            title=
            "Number of SP in whole Pixels detector for all events in low range",
            xbins=100,
            xmin=0,
            xmax=100)
        mbGroup.defineHistogram(
            "PixelSPHigh",
            title=
            "Number of SP in whole Pixels detector for all events in high range",
            xbins=100,
            xmin=0,
            xmax=30000)
        mbGroup.defineHistogram("PixBarr_SP",
                                title="Number of SP for all events in Barrel",
                                xbins=100,
                                xmin=0,
                                xmax=30000)
        mbGroup.defineHistogram("PixECA_SP",
                                title="Number of SP for all events in ECA",
                                xbins=100,
                                xmin=0,
                                xmax=30000)
        mbGroup.defineHistogram("PixECC_SP",
                                title="Number of SP for all events in ECC",
                                xbins=100,
                                xmin=0,
                                xmax=30000)
        mbGroup.defineHistogram(
            "SctTot",
            title="Number of SP in whole SCT detector for all events",
            xbins=100,
            xmin=0,
            xmax=120000)
        mbGroup.defineHistogram(
            "SctBarr_SP",
            title="Number of SCT_SP for all events in Barrel",
            xbins=100,
            xmin=0,
            xmax=50000)
        mbGroup.defineHistogram("SctECA_SP",
                                title="Number of SCT_SP for all events in ECA",
                                xbins=100,
                                xmin=0,
                                xmax=50000)
        mbGroup.defineHistogram("SctECC_SP",
                                title="Number of SCT_SP for all events in ECC",
                                xbins=100,
                                xmin=0,
                                xmax=50000)
        mbGroup.defineHistogram(
            "nTrk",
            title="Number of offline reconstructed Trk for all events",
            xbins=100,
            xmin=0,
            xmax=30000)
        mbGroup.defineHistogram(
            "xaodnTrk",
            title="Number of offline reconstructed xaod Trk for all events",
            xbins=100,
            xmin=0,
            xmax=30000)
        mbGroup.defineHistogram("nTrk,xaodnTrk",
                                type='TH2F',
                                title="nTrk;xaodnTrk",
                                xbins=100,
                                xmin=0,
                                xmax=2000,
                                ybins=100,
                                ymin=0,
                                ymax=2000)
        mbGroup.defineHistogram("SctECA_SP,SctECC_SP",
                                type='TH2F',
                                title="SctECA_SP;SctECC_SP",
                                xbins=100,
                                xmin=0,
                                xmax=30000,
                                ybins=100,
                                ymin=0,
                                ymax=30000)
        mbGroup.defineHistogram("PixECA_SP,PixECC_SP",
                                type='TH2F',
                                title="PixECA_SP;PixECC_SP",
                                xbins=100,
                                xmin=0,
                                xmax=30000,
                                ybins=100,
                                ymin=0,
                                ymax=30000)
        mbGroup.defineHistogram("SctBarr_SP,PixBarr_SP",
                                type='TH2F',
                                title="SctBarr_SP;PixBarr_SP",
                                xbins=100,
                                xmin=0,
                                xmax=120000,
                                ybins=100,
                                ymin=0,
                                ymax=30000)
        mbEffGroup.defineHistogram("NumGoodOnlineTracks",
                                   title="NumGoodOnlineTracks",
                                   xbins=100,
                                   xmin=0,
                                   xmax=2000)
        mbEffGroup.defineHistogram("NumGoodOfflineTracks",
                                   title="NumGoodOfflineTracks",
                                   xbins=100,
                                   xmin=0,
                                   xmax=2000)
        mbEffGroup.defineHistogram(
            "NumGoodOnlineTracks,NumGoodOfflineTracks",
            type='TH2F',
            title="NumGoodOnlineTracks;NumGoodOfflineTracks",
            xbins=100,
            xmin=0,
            xmax=2000,
            ybins=100,
            ymin=0,
            ymax=2000)
        mbEffGroup.defineHistogram("decision,NumGoodOfflineTracks",
                                   type='TEfficiency',
                                   title='Efficiency;Offline Good nTrk',
                                   xbins=1000,
                                   xmin=0,
                                   xmax=1000)
        mbEffGroup.defineHistogram("decision,nTrk",
                                   type='TEfficiency',
                                   title="Efficiency;nTrk",
                                   xbins=1000,
                                   xmin=0,
                                   xmax=1000)

    return monConfig.result()
예제 #13
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
예제 #14
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
예제 #15
0
def TileRawChannelTimeMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileRawChannelTimeMonitorAlgorithm algorithm in the monitoring system.'''

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

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

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

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

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

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

    kwargs.setdefault('TriggerChain', '')

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

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

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

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

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

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

    from TileMonitoring.TileMonitoringCfgHelper import addTileModuleChannelMapsArray

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

    from TileMonitoring.TileMonitoringCfgHelper import addTile2DHistogramsArray

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

    from TileMonitoring.TileMonitoringCfgHelper import getPartitionName

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

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

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

    from TileCalibBlobObjs.Classes import TileCalibUtils as Tile

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

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

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

    accumalator = helper.result()
    result.merge(accumalator)
    return result
예제 #16
0
def TrigBjetMonConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###
    # Define one top-level monitoring algorithm. The new configuration 
    # framework uses a component accumulator.
    # EN: not needed here now
    # 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(inputFlags,'TrigBjetAthMonitorCfg')


    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example 
    # algorithm in the AthenaMonitoring package. Just pass the type to the 
    # helper. Then, the helper will instantiate an instance and set up the 
    # base class configuration following the inputFlags. The returned object 
    # is the algorithm.
    #The added algorithm must exist as a .h file 

    from TrigBjetMonitoring.TrigBjetMonitoringConf import TrigBjetMonitorAlgorithm
    trigBjetMonAlg = helper.addAlgorithm(TrigBjetMonitorAlgorithm,'TrigBjetMonAlg')

    # You can actually make multiple instances of the same algorithm and give 
    # them different configurations
    shifterTrigBjetMonAlg = helper.addAlgorithm(TrigBjetMonitorAlgorithm,'ShifterTrigBjetMonAlg')

    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base 
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)


    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # trigBjetMonAlg.RandomHist = True
    # to enable a trigger filter, for example:
    #trigBjetMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
    #trigBjetMonAlg.TriggerChain = 'HLT_e24_lhtight_nod0'
    trigBjetMonAlg.TriggerChain = ''

    ### STEP 4 ###
    # Read in the Bjet trigger chain names

    # Directly from TrigBjetMonitCategory
    #from TrigBjetMonitoring import TrigBjetMonitCategory
    #bjet_triglist = TrigBjetMonitCategory.monitoring_bjet

    # From the hltmonList where TrigHLTMonitoring filtered the run type
    from TrigHLTMonitoring.HLTMonTriggerList import hltmonList
    bjet_triglist = hltmonList.monitoring_bjet
    bjet_triglist += hltmonList.monitoring_mujet
    # print " ==> bjet_triglist: ", bjet_triglist

    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # # First, add a tool that's set up by a different configuration function. 
    # # In this case, CaloNoiseToolCfg returns its own component accumulator, 
    # # which must be merged with the one from this function.
    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
    # result.merge(caloNoiseAcc)
    # trigBjetMonAlg.CaloNoiseTool = caloNoiseTool

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # trigBjetMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned 
    # object here is the standard GenericMonitoringTool.
    myGroup = helper.addGroup(
        trigBjetMonAlg,
        'TrigBjetMonitor',
        'HLT/BjetMon/Expert/'
    )

    # Add a GMT for the other example monitor algorithm
    shifterGroup = helper.addGroup(shifterTrigBjetMonAlg,'TrigBjetMonitor','HLT/BjetMon/Shifter/')

    ### STEP 5 ###
    # Configure histograms
    #NB! The histograms defined here must match the ones in the cxx file exactly

    # Offline PV histograms - common for all trigger chains

    shifterGroup.defineHistogram('Off_NVtx', title='Number of Offline Vertices;NVtx;Events',
                                 path='Offline',xbins=100,xmin=0.0,xmax=100.)
    shifterGroup.defineHistogram('Off_xVtx', title='Offline xVtx;xVtx;Events',
                                 path='Offline',xbins=200,xmin=-1.5,xmax=+1.5)
    shifterGroup.defineHistogram('Off_yVtx', title='Offline yVtx;yVtx;Events',
                                 path='Offline',xbins=200,xmin=-1.5,xmax=+1.5)
    shifterGroup.defineHistogram('Off_zVtx', title='Offline zVtx;zVtx;Events',
                                 path='Offline',xbins=200,xmin=-200.0,xmax=+200.0)

    # Histograms which depend on the trigger chain


    AllChains = []
    for chain in bjet_triglist :
        AllChains.append(chain[2:])
        # print " inside bjet_triglist chain[2:8] : " , chain[2:8]
        if chain[2:8] == 'HLT_mu' : # mu-jets
            # print "        mu-jet histogram is defined for ", chain[2:]

            HistName = 'jetPt_' + chain[2:]
            if chain[0:1] == "E" :
                myGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
                                        path=chain[2:],xbins=100,xmin=-0.0,xmax=750.0)
                # print " ==> histogam ",HistName," is defined for myGroup"
            if chain[0:1] == "S" :
                shifterGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
                                             path=chain[2:],xbins=100,xmin=-0.0,xmax=750.0)
                # print " ==> histogam ",HistName," is defined for shifterGroup"

            continue
        else :                      # b-jets
            # print "        b-jet histogram is defined for ", chain[2:]

            HistName = 'PVz_tr_' + chain[2:]
            if chain[0:1] == "E" :
                myGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
                                        path=chain[2:],xbins=200,xmin=-200.0,xmax=200.0)
                # print " ==> histogam ",HistName," is defined for myGroup"
            if chain[0:1] == "S" :
                shifterGroup.defineHistogram(HistName, title='Distribution of online zPV;zPV;Events',
                                             path=chain[2:],xbins=200,xmin=-200.0,xmax=200.0)
                # print " ==> histogam ",HistName," is defined for shifterGroup"

            HistName = 'd0_' + chain[2:]
            if chain[0:1] == "E" :
                myGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
                                        path=chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
                # print " ==> histogam ",HistName," is defined for myGroup"
            if chain[0:1] == "S" :
                shifterGroup.defineHistogram(HistName, title='Distribution of d0;d0;Events',
                                             path=chain[2:],xbins=200,xmin=-2.0,xmax=2.0)
                # print " ==> histogam ",HistName," is defined for shifterGroup"

            HistName = 'jetPt_' + chain[2:]
            if chain[0:1] == "E" :
                myGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
                                        path=chain[2:],xbins=100,xmin=-0.0,xmax=750.0)
                # print " ==> histogam ",HistName," is defined for myGroup"
            if chain[0:1] == "S" :
                shifterGroup.defineHistogram(HistName, title='Distribution of Pt_jet;Pt_jet;Events',
                                             path=chain[2:],xbins=100,xmin=-0.0,xmax=750.0)
                # print " ==> histogam ",HistName," is defined for shifterGroup"

            HistName = 'wMV2c20_' + chain[2:]
            if chain[0:1] == "E" :
                myGroup.defineHistogram(HistName, title='Distribution of MV2c20 discriminant;MV2c20;Events',
                                        path=chain[2:],xbins=200,xmin=-1.0,xmax=1.0)
                # print " ==> histogam ",HistName," is defined for myGroup"
            if chain[0:1] == "S" :
                shifterGroup.defineHistogram(HistName, title='Distribution of MV2c20 discriminant;MV2c20;Events',
                                             path=chain[2:],xbins=200,xmin=-1.0,xmax=1.0)
                # print " ==> histogam ",HistName," is defined for shifterGroup"
            continue


    # print " ==> In TrigBjetMonitorAlgorithm.py: AllChains list: ", AllChains
    trigBjetMonAlg.AllChains = AllChains
    shifterTrigBjetMonAlg.AllChains = AllChains



    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can 
    # just return directly (and not create "result" above)
    return helper.result()
예제 #17
0
def SCTHitEffMonAlgConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''
    ### STEP 1 ###
    # 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(inputFlags, 'SCTHitEffMonCfg')

    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example
    # algorithm in the AthenaMonitoring package. Just pass the type to the
    # helper. Then, the helper will instantiate an instance and set up the
    # base class configuration following the inputFlags. The returned object
    # is the algorithm.
    from AthenaConfiguration.ComponentFactory import CompFactory
    myMonAlg = helper.addAlgorithm(CompFactory.SCTHitEffMonAlg,
                                   'SCTHitEffMonAlg')
    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)

    ### STEP 3 ###
    # Edit properties of a algorithm
    myMonAlg.TriggerChain = ''

    from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
    result.merge(BunchCrossingCondAlgCfg(inputFlags))

    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    result.merge(MagneticFieldSvcCfg(inputFlags))

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # set up geometry / conditions
    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
    result.merge(InDetGeometryCfg(inputFlags))

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.

    from ROOT import SCT_Monitoring as sctMon

    myMonGroup = [
        helper.addGroup(myMonAlg, "SCTHitEffMonitorEC", "SCT/SCTEC/"),
        helper.addGroup(myMonAlg, "SCTHitEffMonitorB", "SCT/SCTB/"),
        helper.addGroup(myMonAlg, "SCTHitEffMonitorEA", "SCT/SCTEA/"),
        helper.addGroup(myMonAlg, "SCTHitEffMonitor", "SCT/GENERAL/")
    ]

    ### STEP 5 ###
    # Configure histograms

    # Conversion of ROOT.vector of ROOT.TString to list of str
    subDetName = []
    for i in range(len(sctMon.subDetName)):
        subDetName.append(sctMon.subDetName[i].Data())

    mapName = ["m_eff_", "eff_", "p_eff_"]
    ineffmapName = ["ineffm_", "ineff_", "ineffp_"]

    sumEff = ["summaryeffm", "summaryeff", "summaryeffp"]
    sumEffTitle = [
        "Summary Module Efficiency in Endcap C",
        "Summary Module Efficiency in Barrel",
        "Summary Module Efficiency in Endcap A"
    ]

    limit = [sctMon.N_DISKS * 2, sctMon.N_BARRELS * 2, sctMon.N_DISKS * 2]

    # GENERAL
    myMonGroup[sctMon.GENERAL_INDEX].defineHistogram(
        varname="isub, eff;" + "SctTotalEff",
        type="TProfile",
        title="SCT Total Efficiency",
        path="eff",
        xbins=sctMon.N_REGIONS,
        xmin=0.,
        xmax=sctMon.N_REGIONS,
        xlabels=subDetName)

    myMonGroup[sctMon.GENERAL_INDEX].defineHistogram(
        varname="isub, eff;" + "SctTotalEffBCID",
        type="TProfile",
        title="SCT Total Efficiency for First BCID",
        path="eff",
        xbins=sctMon.N_REGIONS,
        xmin=0.,
        xmax=sctMon.N_REGIONS,
        xlabels=subDetName,
        cutmask="isFirstBCID")

    myMonGroup[sctMon.GENERAL_INDEX].defineHistogram(
        varname="sideHash, eff;" + "effHashCode",
        type="TProfile",
        title="Efficiency vs module Hash code" +
        ";Module Hash Code;Efficiency",
        path="eff",
        xbins=sctMon.n_mod[sctMon.GENERAL_INDEX] * 2,
        xmin=-0.5,
        xmax=sctMon.n_mod[sctMon.GENERAL_INDEX] * 2 - 0.5)

    myMonGroup[sctMon.GENERAL_INDEX].defineHistogram(
        varname="LumiBlock, eff;" + "effLumiBlock",
        type="TProfile",
        title="Efficiency vs Luminosity block" + ";;Efficiency",
        path="eff",
        xbins=sctMon.NBINS_LBs,
        xmin=0.5,
        xmax=sctMon.NBINS_LBs + 0.5)

    ### This histogram should be filled by post processing ###
    # myMonGroup[sctMon.GENERAL_INDEX].defineHistogram(varname= "eff;" + "SctEffDistribution",
    #                                                  type= "TH1F",
    #                                                  title= "SCT Efficiency Distribution"+";Efficiency;Links",
    #                                                  path="eff",
    #                                                  xbins= 500,
    #                                                  xmin=0.,
    #                                                  xmax=1.)

    # SCTEC, SCTB, SCTEA
    for isub in range(sctMon.N_REGIONS):
        profileLabels = range(limit[isub])
        for k in range(limit[isub]):
            profileLabels[k] = dedicatedTitle(k, isub)
        # Efficiency
        myMonGroup[isub].defineHistogram(
            varname="layerPlusHalfSide, eff;" + sumEff[isub],
            type="TProfile",
            title=sumEffTitle[isub] + ";;Efficiency",
            path="eff",
            xbins=2 * sctMon.n_layers[isub],
            xmin=0.,
            xmax=sctMon.n_layers[isub],
            xlabels=profileLabels)
        # Efficiency for first BCIDs
        myMonGroup[isub].defineHistogram(
            varname="layerPlusHalfSide, eff;" + sumEff[isub] + "BCID",
            type="TProfile",
            title=sumEffTitle[isub] + " for First BC" + ";;Efficiency",
            path="eff",
            xbins=2 * sctMon.n_layers[isub],
            xmin=0.,
            xmax=sctMon.n_layers[isub],
            xlabels=profileLabels,
            cutmask="isFirstBCID")
        # Efficiency as a function of LB
        myMonGroup[isub].defineHistogram(
            varname="LumiBlock, eff;" +
            "effLumiBlock",  #different names for fill
            type="TProfile",
            title="Efficiency vs Luminosity block in " +
            sctMon.subDetName[isub] + ";Luminosity block" + ";Efficiency",
            path="eff",
            xbins=sctMon.NBINS_LBs,
            xmin=0.5,
            xmax=sctMon.NBINS_LBs + 0.5)

        # Disks for SCTEC and SCTEA and layers for SCTB
        for layer_disk in range(sctMon.n_layers[isub]):
            for side in range(2):
                etaPhiSuffix = "_" + str(layer_disk) + "_" + str(side)
                effName = mapName[isub] + str(layer_disk) + "_" + str(side)
                ineffName = ineffmapName[isub] + str(layer_disk) + "_" + str(
                    side)
                # Efficiency
                myMonGroup[isub].defineHistogram(
                    varname="ieta" + etaPhiSuffix + ",iphi" + etaPhiSuffix +
                    ",eff;" + effName,
                    type="TProfile2D",
                    title="Hit efficiency of" + sctMon.layerName[isub].Data() +
                    str(layer_disk) + " / side " + str(side) + " in " +
                    subDetName[isub] +
                    ";Index in the direction of #eta;Index in the direction of #phi",
                    path="eff",
                    xbins=sctMon.n_etabins[isub],
                    xmin=sctMon.f_etabin[isub] - .5,
                    xmax=sctMon.l_etabin[isub] + .5,
                    ybins=sctMon.n_phibins[isub],
                    ymin=sctMon.f_phibin[isub] - .5,
                    ymax=sctMon.l_phibin[isub] + .5)
                # Efficiency for first BCIDs
                myMonGroup[isub].defineHistogram(
                    varname="ieta" + etaPhiSuffix + ",iphi" + etaPhiSuffix +
                    ",eff;" + effName + "_bcid",
                    type="TProfile2D",
                    title="Hit efficiency of" + sctMon.layerName[isub].Data() +
                    str(layer_disk) + " / side " + str(side) + " in " +
                    subDetName[isub] + " for first BCID" +
                    ";Index in the direction of #eta;Index in the direction of #phi",
                    path="eff",
                    xbins=sctMon.n_etabins[isub],
                    xmin=sctMon.f_etabin[isub] - .5,
                    xmax=sctMon.l_etabin[isub] + .5,
                    ybins=sctMon.n_phibins[isub],
                    ymin=sctMon.f_phibin[isub] - .5,
                    ymax=sctMon.l_phibin[isub] + .5,
                    cutmask="isFirstBCID")
                # Inefficiency
                myMonGroup[isub].defineHistogram(
                    varname="ieta" + etaPhiSuffix + ",iphi" + etaPhiSuffix +
                    ",ineff;" + ineffName,
                    type="TProfile2D",
                    title="Hit inefficiency of" +
                    sctMon.layerName[isub].Data() + str(layer_disk) +
                    " / side " + str(side) + " in " + subDetName[isub] +
                    ";Index in the direction of #eta;Index in the direction of #phi",
                    path="eff",
                    xbins=sctMon.n_etabins[isub],
                    xmin=sctMon.f_etabin[isub] - .5,
                    xmax=sctMon.l_etabin[isub] + .5,
                    ybins=sctMon.n_phibins[isub],
                    ymin=sctMon.f_phibin[isub] - .5,
                    ymax=sctMon.l_phibin[isub] + .5)

    # Merge with result object and return
    result.merge(helper.result())
    return result
예제 #18
0
def SCTLorentzMonAlgConfig(inputFlags):

    ### STEP 1 ###
    # 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(inputFlags, 'SCTLorentzMonCfg')

    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example
    # algorithm in the AthenaMonitoring package. Just pass the type to the
    # helper. Then, the helper will instantiate an instance and set up the
    # base class configuration following the inputFlags. The returned object
    # is the algorithm.
    from AthenaConfiguration.ComponentFactory import CompFactory
    myMonAlg = helper.addAlgorithm(CompFactory.SCTLorentzMonAlg,
                                   'SCTLorentzMonAlg')

    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)

    ### STEP 3 ###
    # Edit properties of a algorithm
    myMonAlg.TriggerChain = ''
    # myMonAlg.RandomHist = True

    # Set InDetTrackSummaryTool to TrackSummaryTool of SCTLorentzMonAlg
    from .TrackSummaryToolWorkaround import TrackSummaryToolWorkaround
    myMonAlg.TrackSummaryTool = result.popToolsAndMerge(
        TrackSummaryToolWorkaround(inputFlags))

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decion tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # set up geometry / conditions
    from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg
    result.merge(BeamPipeGeometryCfg(inputFlags))
    from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg
    result.merge(InDetGeometryCfg(inputFlags))

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # myMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned
    # object here is the standard GenericMonitoringTool.
    myMonGroup = helper.addGroup(myMonAlg, "SCTLorentzMonitor", "SCT/GENERAL/")

    ### STEP 5 ###
    # Configure histograms
    N_BARRELS = 4
    nSides = 2  # 0: Side 0, 1: Side 1
    nSurfaces = 2  # 0: 100, 1: 111
    surfaceNames = ["_100", "_111"]
    surfaceNames2 = ["_100_", "_111_"]
    surfaceTitles = ["100 - ", "111 - "]
    sideNames = ["_0", "_1"]
    for l in range(N_BARRELS):
        for iSurface in range(nSurfaces):
            for side in range(nSides):
                xVar = "phiToWafer_" + str(
                    l) + surfaceNames[iSurface] + sideNames[side]
                yVar = "nStrip_" + str(
                    l) + surfaceNames[iSurface] + sideNames[side]
                histTitle = surfaceTitles[
                    iSurface] + "Inc. Angle vs nStrips for Layer Side" + str(
                        l) + str(side)
                histName = "h_phiVsNstrips" + surfaceNames2[iSurface] + str(
                    l) + "Side" + str(side)
                myMonGroup.defineHistogram(
                    varname=xVar + "," + yVar + ";" +
                    histName,  # ; means alias
                    type="TProfile",
                    title=histTitle + ";#phi to Wafer;Num of Strips",
                    path="lorentz",  # path cannot be "".
                    xbins=360,
                    xmin=-90.,
                    xmax=90.)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can
    # just return directly (and not create "result" above)
    #return helper.result()

    # # Otherwise, merge with result object and return
    result.merge(helper.result())
    return result
예제 #19
0
#
#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#
'''@file TgcRawDataMonitorAlgorithm_jobOptions.py
@author M.Aoki
@date 2019-10-04
'''

from AthenaMonitoring import AthMonitorCfgHelper
helper = AthMonitorCfgHelper(DQMonFlags, "TgcRawDataMonitorCfg")

from TgcRawDataMonitoring.TgcRawDataMonitoringConf import TgcRawDataMonitorAlgorithm
tgcRawDataMonAlg = helper.addAlgorithm(TgcRawDataMonitorAlgorithm,
                                       'TgcRawDataMonAlg')

tgcRawDataMonAlg.TagAndProbe = False

tgcRawDataMonAlg.TagTrigList = 'HLT_mu26_ivarmedium'
tgcRawDataMonAlg.TagTrigList += ',HLT_mu26_ivarmedium'
tgcRawDataMonAlg.TagTrigList += ',HLT_mu26_ivarmedium_L1MU20'
tgcRawDataMonAlg.TagTrigList += ',HLT_mu6'
tgcRawDataMonAlg.TagTrigList += ',HLT_mu6_L1MU6'
tgcRawDataMonAlg.TagTrigList += ',HLT_mu20_mu8noL1;HLT_mu20'

mainDir = 'Muon/MuonRawDataMonitoring/TGC/'
pi = 3.14159265359

trigPath = 'Trig/'

myGroup = helper.addGroup(tgcRawDataMonAlg, 'TgcRawDataMonitor', mainDir)
예제 #20
0
def PprMonitoringConfig(inputFlags):
    '''Function to configure LVL1 Ppr algorithm in the monitoring system.'''

    import math
    # get the component factory - used for getting the algorithms
    from AthenaConfiguration.ComponentFactory import CompFactory
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    # any things that need setting up for job e.g.
    #from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg
    #result.merge(AtlasGeometryCfg(inputFlags))

    # make the athena monitoring helper
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'PprMonitoringCfg')

    # get any algorithms
    PprMonAlg = helper.addAlgorithm(CompFactory.PprMonitorAlgorithm,
                                    'PprMonAlg')

    # add any steering
    groupName = 'PprMonitor'  # the monitoring group name is also used for the package name
    PprMonAlg.PackageName = groupName

    # Steering properties
    threshADC = 50
    PprMonAlg.TT_ADC_HitMap_Thresh = threshADC  # ADC cut for hit maps

    # Histogram paths
    mainDir = 'L1Calo'
    trigPath = 'PPM/'

    # add monitoring algorithm to group, with group name and main directory
    myGroup = helper.addGroup(PprMonAlg, groupName, mainDir)

    # Trigger tower plots: eta-phi granularity
    etabins = [
        -4.9, -4.475, -4.050, -3.625, -3.2, -3.1, -2.9, -2.7, -2.5, -2.4, -2.3,
        -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1,
        -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1,
        0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5,
        1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.7, 2.9, 3.1, 3.2,
        3.625, 4.050, 4.475, 4.9
    ]
    phibins = 64
    phimin = 0
    phimax_2d = 64
    phimax_1d = 2. * math.pi
    maxEnergyRange = 256

    #######################
    # PPM inputs (LUT-CP) #
    #######################
    histPath = trigPath + '/LUT-CP/Distributions'

    # EM distributions
    myGroup.defineHistogram(
        'etaTT_EM;h_ppm_em_1d_tt_lutcp_Eta',
        title='EM LUT-CP: Distribution of peak in #eta; #eta',
        type='TH1F',
        path=histPath,
        xbins=etabins,
        cutmask='mask_EM_cpET_0_noPhi')

    myGroup.defineHistogram(
        'phiTT_1d_EM;h_ppm_em_1d_tt_lutcp_Phi',
        title='EM LUT-CP: Distribution of peak in #phi; #phi',
        type='TH1F',
        path=histPath,
        xbins=phibins,
        xmin=phimin,
        xmax=phimax_1d,
        cutmask='mask_EM_cpET_0_phiBins')

    myGroup.defineHistogram(
        'cpET_EM;h_ppm_em_1d_tt_lutcp_Et',
        title='EM LUT-CP: Distribution of peak; EM LUT peak [GeV/2]',
        type='TH1F',
        path=histPath,
        xbins=maxEnergyRange - 1,
        xmin=1,
        xmax=maxEnergyRange,
        cutmask='mask_EM_cpET_0_noPhi')

    # HAD distributions
    myGroup.defineHistogram(
        'etaTT_HAD;h_ppm_had_1d_tt_lutcp_Eta',
        title='HAD LUT-CP: Distribution of peak in #eta; #eta',
        type='TH1F',
        path=histPath,
        xbins=etabins,
        cutmask='mask_HAD_cpET_0_noPhi')

    myGroup.defineHistogram(
        'phiTT_1d_HAD;h_ppm_had_1d_tt_lutcp_Phi',
        title='HAD LUT-CP: Distribution of peak in #phi; #phi',
        type='TH1F',
        path=histPath,
        xbins=phibins,
        xmin=phimin,
        xmax=phimax_1d,
        cutmask='mask_HAD_cpET_0_phiBins')

    myGroup.defineHistogram(
        'cpET_HAD;h_ppm_had_1d_tt_lutcp_Et',
        title='HAD LUT-CP: Distribution of peak; HAD LUT peak [GeV/2]',
        type='TH1F',
        path=histPath,
        xbins=maxEnergyRange - 1,
        xmin=1,
        xmax=maxEnergyRange,
        cutmask='mask_HAD_cpET_0_noPhi')

    # Eta-phi maps
    histPath = trigPath + '/LUT-CP/EtaPhiMaps'

    myGroup.defineHistogram(
        'etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_lutcp_AverageEt',
        title='EM Average LUT-CP Et for Et > 5 GeV/2',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_EM_cpET_5_phiBins',
        weight='cpET_EM')

    myGroup.defineHistogram(
        'etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_lutcp_AverageEt',
        title='HAD Average LUT-CP Et for Et > 5 GeV/2',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_HAD_cpET_5_phiBins',
        weight='cpET_HAD')

    ########################
    # PPM inputs (LUT-JEP) #
    ########################
    histPath = trigPath + '/LUT-JEP/Distributions'

    # EM distributions
    myGroup.defineHistogram('etaTT_EM;h_ppm_em_1d_tt_lutjep_Eta',
                            title='EM LUT-JEP: Distribution of peak in #eta',
                            type='TH1F',
                            path=histPath,
                            xbins=etabins,
                            cutmask='mask_EM_jepET_0_noPhi')

    myGroup.defineHistogram(
        'phiTT_1d_EM;h_ppm_em_1d_tt_lutjep_Phi',
        title='EM LUT-JEP: Distribution of peak in #phi; #phi',
        type='TH1F',
        path=histPath,
        xbins=phibins,
        xmin=phimin,
        xmax=phimax_1d,
        cutmask='mask_EM_jepET_0_phiBins')

    myGroup.defineHistogram(
        'jepET_EM;h_ppm_em_1d_tt_lutjep_Et',
        title='EM LUT-JEP: Distribution of peak; EM LUT peak [GeV]',
        type='TH1F',
        path=histPath,
        xbins=maxEnergyRange - 1,
        xmin=1,
        xmax=maxEnergyRange,
        cutmask='mask_EM_jepET_0_noPhi')

    # HAD distributions
    myGroup.defineHistogram('etaTT_HAD;h_ppm_had_1d_tt_lutjep_Eta',
                            title='HAD LUT-JEP: Distribution of peak in #eta',
                            type='TH1F',
                            path=histPath,
                            xbins=etabins,
                            cutmask='mask_HAD_jepET_0_noPhi')

    myGroup.defineHistogram(
        'phiTT_1d_HAD;h_ppm_had_1d_tt_lutjep_Phi',
        title='HAD LUT-JEP: Distribution of peak in #phi; #phi',
        type='TH1F',
        path=histPath,
        xbins=phibins,
        xmin=phimin,
        xmax=phimax_1d,
        cutmask='mask_HAD_jepET_0_phiBins')

    myGroup.defineHistogram(
        'jepET_HAD;h_ppm_had_1d_tt_lutjep_Et',
        title='HAD LUT-JEP: Distribution of peak; HAD LUT peak [GeV]',
        type='TH1F',
        path=histPath,
        xbins=maxEnergyRange - 1,
        xmin=1,
        xmax=maxEnergyRange,
        cutmask='mask_HAD_jepET_0_noPhi')

    # Eta-phi maps
    histPath = trigPath + '/LUT-JEP/EtaPhiMaps'

    myGroup.defineHistogram(
        'etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_lutjep_AverageEt',
        title='EM Average LUT-JEP Et for Et > 5 GeV',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_EM_jepET_5_phiBins',
        weight='jepET_EM')

    myGroup.defineHistogram(
        'etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_lutjep_AverageEt',
        title='HAD Average LUT-JEP Et for Et > 5 GeV',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_HAD_jepET_5_phiBins',
        weight='jepET_HAD')

    ####################
    # PPM inputs (ADC) #
    ####################
    histPath = trigPath + '/ADC/EtaPhiMaps'

    # EM tower maps
    myGroup.defineHistogram(
        'etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_adc_HitMap',
        title='#eta - #phi map of EM FADC > ' + str(threshADC) +
        ' for triggered timeslice; Tower #eta; Tower #phi',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_EM_timeslice')

    myGroup.defineHistogram(
        'etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_adc_ProfileHitMap',
        title='#eta - #phi profile map of EM FADC > ' + str(threshADC) +
        ' for triggered timeslice; Tower #eta; Tower #phi',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_EM_timeslice',
        weight='emTT_ADC')

    # HAD tower maps
    myGroup.defineHistogram(
        'etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_adc_HitMap',
        title='#eta - #phi map of HAD FADC > ' + str(threshADC) +
        ' for triggered timeslice; Tower #eta; Tower #phi',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_HAD_timeslice')

    myGroup.defineHistogram(
        'etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_adc_ProfileHitMap',
        title='#eta - #phi profile map of HAD FADC > ' + str(threshADC) +
        ' for triggered timeslice; Tower #eta; Tower #phi',
        type='TH2F',
        path=histPath,
        xbins=etabins,
        ybins=phibins,
        ymin=phimin,
        ymax=phimax_2d,
        cutmask='mask_HAD_timeslice',
        weight='hadTT_ADC')

    acc = helper.result()
    result.merge(acc)
    return result
예제 #21
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
예제 #22
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
예제 #23
0
def InDetGlobalMonitoringRun3TestConfig(flags):
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()
    
    # run on RAW only
    if flags.DQ.Environment in ('online', 'tier0', 'tier0Raw'):
        ##        from InDetRecExample.InDetKeys import InDetKeys    ## not sure it works now
        
        ########### here begins InDetGlobalTrackMonAlg ###########
        kwargsInDetGlobalTrackMonAlg = { 
            'DoIBL' : True,                       #InDetFlags.doIBL(), #Turn on/off IBL histograms 
            'TrackName'  : 'CombinedInDetTracks',  #Until new config ready
            'TrackName2' : 'CombinedInDetTracks',  #Until new config ready
            'TrackName3' : 'CombinedInDetTracks',  #Until new config ready
        }
        
        
        from AthenaMonitoring import AthMonitorCfgHelper
        helper = AthMonitorCfgHelper(flags, "InDetGlobalMonitoringRun3Test")
        
        from AthenaConfiguration.ComponentFactory import CompFactory
        #        from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalTrackMonAlg
        from InDetGlobalMonitoringRun3Test.InDetGlobalTrackMonAlgCfg import InDetGlobalTrackMonAlgCfg 

        inDetGlobalTrackMonAlg = helper.addAlgorithm(CompFactory.InDetGlobalTrackMonAlg, 'InDetGlobalTrackMonAlg')
        for k, v in kwargsInDetGlobalTrackMonAlg.items():
            setattr(inDetGlobalTrackMonAlg, k, v)

        inDetGlobalTrackMonAlg.TrackSelectionTool.UseTrkTrackTools = True
        inDetGlobalTrackMonAlg.TrackSelectionTool.CutLevel         = "TightPrimary"
        inDetGlobalTrackMonAlg.TrackSelectionTool.maxNPixelHoles   = 1
        inDetGlobalTrackMonAlg.TrackSelectionTool.minPt            = 5000
        #        InDetGlobalTrackMonAlg.Baseline_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        #        InDetGlobalTrackMonAlg.Baseline_TrackSelectionTool.Extrapolator     = InDetExtrapolator
        #
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.UseTrkTrackTools = True
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.CutLevel         = "TightPrimary"
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.minPt            = 5000
        #        InDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        #        InDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator     = InDetExtrapolator
        

        # Run 3 configs - stolen from SCT
        from SCT_Monitoring.TrackSummaryToolWorkaround import TrackSummaryToolWorkaround
        inDetGlobalTrackMonAlg.TrackSelectionTool.TrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags))
        inDetGlobalTrackMonAlg.TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags))
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        
        InDetGlobalTrackMonAlgCfg(helper, inDetGlobalTrackMonAlg, **kwargsInDetGlobalTrackMonAlg)
        ########### here ends InDetGlobalTrackMonAlg ###########
        
        
        ########### here begins InDetGlobalPrimaryVertexMonAlg ###########
        from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalPrimaryVertexMonAlg
        from InDetGlobalMonitoringRun3Test.InDetGlobalPrimaryVertexMonAlgCfg import InDetGlobalPrimaryVertexMonAlgCfg 
        
        myInDetGlobalPrimaryVertexMonAlg = helper.addAlgorithm(InDetGlobalPrimaryVertexMonAlg, 'InDetGlobalPrimaryVertexMonAlg')
        
        kwargsInDetGlobalPrimaryVertexMonAlg = { 
            'vxContainerName'                      : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(),
            'vxContainerNameWithOutBeamConstraint' : 'VxPrimaryCandidateWithBeamConstraint', #InDetKeys.PrimaryVerticesWithoutBeamConstraint(),
            'vxContainerNameSplit'                 : 'VxPrimaryCandidateSplitStream', #InDetKeys.PrimaryVerticesSplitStream(),
            'doEnhancedMonitoring'                 : True # InDetFlags.doMonitoringPrimaryVertexingEnhanced()
        }
        
        for k, v in kwargsInDetGlobalPrimaryVertexMonAlg.items():
            setattr(kwargsInDetGlobalPrimaryVertexMonAlg, k, v)
            
        InDetGlobalPrimaryVertexMonAlgCfg(helper, myInDetGlobalPrimaryVertexMonAlg, **kwargsInDetGlobalPrimaryVertexMonAlg)

        ########### here ends InDetGlobalPrimaryVertexMonAlg ###########

        ########### here begins InDetGlobalBeamSpotMonAlg ###########
        
        from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalBeamSpotMonAlg
        from InDetGlobalMonitoringRun3Test.InDetGlobalBeamSpotMonAlgCfg import InDetGlobalBeamSpotMonAlgCfg 
        
        myInDetGlobalBeamSpotMonAlg = helper.addAlgorithm(InDetGlobalBeamSpotMonAlg, 'InDetGlobalBeamSpotMonAlg')
        
        kwargsInDetGlobalBeamSpotMonAlg = { 
            'BeamSpotKey'                      : 'BeamSpotData', #InDetKeys.BeamSpotData(),
            'vxContainerName'                  : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(),
            'trackContainerName'               : 'InDetTrackParticles', #InDetKeys.xAODTrackParticleContainer(),
            'useBeamspot'                      : True, # InDetFlags.useBeamConstraint()
            'vxContainerWithBeamConstraint'    : False # InDetFlags.useBeamConstraint()
        }
        
        for k, v in kwargsInDetGlobalBeamSpotMonAlg.items():
            setattr(kwargsInDetGlobalBeamSpotMonAlg, k, v)

        InDetGlobalBeamSpotMonAlgCfg(helper, myInDetGlobalBeamSpotMonAlg, **kwargsInDetGlobalBeamSpotMonAlg)

        ########### here ends InDetGlobalBeamSpotMonAlg ###########
        
    return acc
예제 #24
0
def TrigBphysMonConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

    ### STEP 1 ###
    # 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(inputFlags,'TrigBphysAthMonitorCfg')


    ### STEP 2 ###
    # Adding an algorithm to the helper. Here, we will use the example 
    # algorithm in the AthenaMonitoring package. Just pass the type to the 
    # helper. Then, the helper will instantiate an instance and set up the 
    # base class configuration following the inputFlags. The returned object 
    # is the algorithm.
    # The added algorithm must exist as a .h file 

    from AthenaConfiguration.ComponentFactory import CompFactory
    trigBphysMonAlg = helper.addAlgorithm(CompFactory.TrigBphysMonitorAlgorithm,'TrigBphysMonAlg')
    #from AthenaCommon.Constants import DEBUG,INFO
    #trigBphysMonAlg.OutputLevel = INFO

    # You can actually make multiple instances of the same algorithm and give 
    # them different configurations
    #shifterTrigBphysMonAlg = helper.addAlgorithm(TrigBphysMonitorAlgorithm,'ShifterTrigBphysMonAlg')

    # # If for some really obscure reason you need to instantiate an algorithm
    # # yourself, the AddAlgorithm method will still configure the base 
    # # properties and add the algorithm to the monitoring sequence.
    # helper.AddAlgorithm(myExistingAlg)


    ### STEP 3 ###
    # Edit properties of a algorithm
    # some generic property
    # trigBphysMonAlg.RandomHist = True
    # to enable a trigger filter, for example:
    #trigBphysMonAlg.TriggerChain = 'HLT_mu26_ivarmedium'
    #trigBphysMonAlg.TriggerChain = 'HLT_e24_lhtight_nod0'
    monitored_chains = ['HLT_2mu10_bJpsimumu_L12MU10', 'HLT_2mu10_bUpsimumu_L12MU10']
    monitored_containers = ['HLT_DimuEF']
    trigBphysMonAlg.MonitoredChains = monitored_chains
    trigBphysMonAlg.MonitoredContainers = monitored_containers

    ### STEP 4 ###
    # Add some tools. N.B. Do not use your own trigger decision tool. Use the
    # standard one that is included with AthMonitorAlgorithm.

    # # First, add a tool that's set up by a different configuration function. 
    # # In this case, CaloNoiseToolCfg returns its own component accumulator, 
    # # which must be merged with the one from this function.
    # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg
    # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags)
    # result.merge(caloNoiseAcc)
    # trigBphysMonAlg.CaloNoiseTool = caloNoiseTool
    

    # # Then, add a tool that doesn't have its own configuration function. In
    # # this example, no accumulator is returned, so no merge is necessary.
    # from MyDomainPackage.MyDomainPackageConf import MyDomainTool
    # trigBphysMonAlg.MyDomainTool = MyDomainTool()

    # Add a generic monitoring tool (a "group" in old language). The returned 
    # object here is the standard GenericMonitoringTool.
    expertGroup = helper.addGroup(
        trigBphysMonAlg,
        'TrigBphysMonitor',
        'HLT/BphysMon/Expert/'
    )
      

    # Add a GMT for the other example monitor algorithm
    #shifterGroup = helper.addGroup(shifterTrigBphysMonAlg,'TrigBphysMonitor','HLT/BphysMon/Shifter/')

    ### STEP 5 ###
    # Configure histograms
    #NB! The histograms defined here must match the ones in the cxx file exactly
    for monitored_chain in monitored_chains : 
      # number of events histograms will be shown in root Containers/ folder
      expertGroup.defineHistogram('ncandidates_Chain_'+monitored_chain,title='Number of Bphys candidates;number of candidates;Entries',
                                  path='Chains',xbins=10,xmin=-0.5,xmax=9.5)
      # the others in per-container folders
      expertGroup.defineHistogram('dimu_mass_Chain_'+monitored_chain,title='Dimuon mass;m(#mu^{+}#mu^{-}) [GeV];Events / (0.1 GeV)',
                                  path='Chains/'+monitored_chain,xbins=150,xmin=0.0,xmax=15.0)
      expertGroup.defineHistogram('dimu_pt_Chain_'+monitored_chain,title='Dimuon transverse momentum;p_{T}(#mu^{+}#mu^{-}) [GeV];Events / (1 GeV)',
                                  path='Chains/'+monitored_chain,xbins=40,xmin=0.0,xmax=40.0)
      expertGroup.defineHistogram('dimu_chi2_Chain_'+monitored_chain,title='Dimuon #chi^{2};#chi^{2}(#mu^{+}#mu^{-});Events / (0.5)',
                                  path='Chains/'+monitored_chain,xbins=80,xmin=0.0,xmax=40.0)
    for monitored_container in monitored_containers : 
      # number of events histograms will be shown in root Containers/ folder
      expertGroup.defineHistogram('ncandidates_Container_'+monitored_container,title='Number of Bphys candidates;number of candidates;Entries',
                                  path='Containers',xbins=10,xmin=-0.5,xmax=9.5)
      # the others in per-container folders
      expertGroup.defineHistogram('dimu_mass_Container_'+monitored_container,title='Dimuon mass;m(#mu^{+}#mu^{-}) [GeV];Events / (0.1 GeV)',
                                  path='Containers/'+monitored_container,xbins=150,xmin=0.0,xmax=15.0)

    #shifterGroup.defineHistogram('run',title='Run Number;run;Events',
                                  #path='SomePath',xbins=1000000,xmin=-0.5,xmax=999999.5)

    ### STEP 6 ###
    # Finalize. The return value should be a tuple of the ComponentAccumulator
    # and the sequence containing the created algorithms. If we haven't called
    # any configuration other than the AthMonitorCfgHelper here, then we can 
    # just return directly (and not create "result" above)
    return helper.result()
예제 #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
예제 #26
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
예제 #27
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
예제 #28
0
def METMonitoringConfig(inputFlags):
    # '''Function to configures some algorithms in the monitoring system.'''

    #    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    #    result = ComponentAccumulator()

    from AthenaMonitoring import AthMonitorCfgHelper
    #    helper = AthMonitorCfgHelper(inputFlags,'AthMonitorCfg')
    helper = AthMonitorCfgHelper(inputFlags, 'METMonitor')

    from AthenaConfiguration.ComponentFactory import CompFactory
    METRefFinal_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                             'METRefFinal_MonAlg')
    #    anotherExampleMonAlg = helper.addAlgorithm(METMonitoringExampleAlg,'AnotherExampleMonAlg')
    met_types = [
        "MET_RefFinal", "MET_RefJet", "MET_Muon", "MET_RefEle", "MET_RefGamma",
        "MET_RefTau", "MET_PVSoftTrk"
    ]

    METRefFinal_MonAlg.METContainer = "MET_Reference_AntiKt4EMTopo"
    METRefFinal_MonAlg.metKeys = met_types
    METRefFinal_MonAlg.alltrigger = True
    group = helper.addGroup(METRefFinal_MonAlg, "METMonitor",
                            "MissingEt/AllTriggers/MET_AntiKt4EMTopo/")

    for mets in met_types:
        defineHistograms(METRefFinal_MonAlg, group, helper, mets)

    if inputFlags.DQ.DataType != 'cosmics':
        METPflow_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                              'METPflow_MonAlg')
        pfmet_types = [
            "MET_PFlow", "MET_PFlow_RefJet", "MET_PFlow_Muon",
            "MET_PFlow_RefEle", "MET_PFlow_RefGamma", "MET_PFlow_RefTau",
            "MET_PFlow_PVSoftTrk"
        ]
        METPflow_MonAlg.METContainer = "MET_Reference_AntiKt4EMPFlow"
        METPflow_MonAlg.metKeys = pfmet_types
        METPflow_MonAlg.alltrigger = True

        group = helper.addGroup(METPflow_MonAlg, "METMonitor",
                                "MissingEt/AllTriggers/MET_AntiKt4EMPFlow/")
        for mets in pfmet_types:
            defineHistograms(METPflow_MonAlg, group, helper, mets)

    METEMTopo_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                           'METEMTopo_MonAlg')
    emtopomet_types = ["MET_Topo"]
    METEMTopo_MonAlg.METContainer = "MET_EMTopo"
    METEMTopo_MonAlg.metKeys = emtopomet_types
    METEMTopo_MonAlg.alltrigger = True

    group = helper.addGroup(METEMTopo_MonAlg, "METMonitor",
                            "MissingEt/AllTriggers/MET_Calo/EMTopo")
    for mets in emtopomet_types:
        defineHistograms(METEMTopo_MonAlg, group, helper, mets)

    METCalo_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                         'METCalo_MonAlg')
    metcalo_types = ["PEMB", "EMB", "PEME", "EME", "TILE", "HEC", "FCAL"]
    METCalo_MonAlg.METContainer = "MET_Calo"
    METCalo_MonAlg.METCaloKeys = metcalo_types
    METCalo_MonAlg.alltrigger = True

    group = helper.addGroup(METCalo_MonAlg, "METMonitor",
                            "MissingEt/AllTriggers/MET_Calo/MET_Cell")
    for mets in metcalo_types:
        defineHistogramsCalo(METCalo_MonAlg, group, helper, mets)
#trigger
    METRefFinal_XE30_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                  'METRefFinal_XE30_MonAlg')
    METRefFinal_XE30_MonAlg.METContainer = "MET_Reference_AntiKt4EMTopo"
    METRefFinal_XE30_MonAlg.metTotalKey = "FinalTrk"
    METRefFinal_XE30_MonAlg.metKeys = met_types
    METRefFinal_XE30_MonAlg.dotrigger = True
    group = helper.addGroup(METRefFinal_XE30_MonAlg, "METMonitor",
                            "MissingEt/TrigXE30/MET_AntiKt4EMTopo/")
    for mets in met_types:
        defineHistograms(METRefFinal_XE30_MonAlg, group, helper, mets)

    if inputFlags.DQ.DataType != 'cosmics':
        METPflow_XE30_MonAlg = helper.addAlgorithm(
            CompFactory.METMonitoringAlg, 'METPflow_XE30_MonAlg')
        METPflow_XE30_MonAlg.METContainer = "MET_Reference_AntiKt4EMPFlow"
        METPflow_XE30_MonAlg.metTotalKey = "FinalTrk"
        METPflow_XE30_MonAlg.metKeys = pfmet_types
        METPflow_XE30_MonAlg.dotrigger = True
        group = helper.addGroup(METPflow_XE30_MonAlg, "METMonitor",
                                "MissingEt/TrigXE30/MET_AntiKt4EMPflow/")
        for mets in pfmet_types:
            defineHistograms(METPflow_XE30_MonAlg, group, helper, mets)

    METCalo_XE30_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                              'METCalo_XE30_MonAlg')
    METCalo_XE30_MonAlg.METCaloContainer = "MET_Calo"
    METCalo_XE30_MonAlg.METCaloKeys = metcalo_types
    METCalo_XE30_MonAlg.dotrigger = True
    group = helper.addGroup(METCalo_XE30_MonAlg, "METMonitor",
                            "MissingEt/TrigXE30/MET_Calo/MET_Cell")
    for mets in metcalo_types:
        defineHistogramsCalo(METCalo_XE30_MonAlg, group, helper, mets)

    METEMTopo_XE30_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                'METEMTopo_XE30_MonAlg')
    METEMTopo_XE30_MonAlg.METContainer = "MET_EMTopo"
    METEMTopo_XE30_MonAlg.METAntiKt4EMTopoContainer = "MET_Reference_AntiKt4EMTopo"
    emtopomet_types = ["MET_Topo"]
    METEMTopo_XE30_MonAlg.metKeys = emtopomet_types
    METEMTopo_XE30_MonAlg.dotrigger = True
    METEMTopo_XE30_group = helper.addGroup(
        METEMTopo_XE30_MonAlg, "METMonitor",
        "MissingEt/TrigXE30/MET_Calo/EMTopo")
    for mets in emtopomet_types:
        defineHistograms(METEMTopo_XE30_MonAlg, METEMTopo_XE30_group, helper,
                         mets)

# metcut
    METRefFinal_METCut_MonAlg = helper.addAlgorithm(
        CompFactory.METMonitoringAlg, 'METRefFinal_METCut_MonAlg')
    METRefFinal_METCut_MonAlg.METContainer = "MET_Reference_AntiKt4EMTopo"
    METRefFinal_METCut_MonAlg.metTotalKey = "FinalTrk"
    METRefFinal_METCut_MonAlg.metKeys = met_types
    METRefFinal_METCut_MonAlg.dometcut = True
    METRefFinal_METCut_MonAlg.metcut = 80
    group = helper.addGroup(METRefFinal_METCut_MonAlg, "METMonitor",
                            "MissingEt/CutMet80/MET_AntiKt4EMTopo/")
    for mets in met_types:
        defineHistograms(METRefFinal_METCut_MonAlg, group, helper, mets)

    if inputFlags.DQ.DataType != 'cosmics':
        METPflow_METCut_MonAlg = helper.addAlgorithm(
            CompFactory.METMonitoringAlg, 'METPflow_METCut_MonAlg')
        METPflow_METCut_MonAlg.METContainer = "MET_Reference_AntiKt4EMPFlow"
        METPflow_METCut_MonAlg.metKeys = pfmet_types
        METPflow_METCut_MonAlg.dometcut = True
        METPflow_METCut_MonAlg.metcut = 80
        group = helper.addGroup(METPflow_METCut_MonAlg, "METMonitor",
                                "MissingEt/CutMet80/MET_AntiKt4EMPflow/")
        for mets in pfmet_types:
            defineHistograms(METPflow_METCut_MonAlg, group, helper, mets)

    METCalo_METCut_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                'METCalo_METCut_MonAlg')
    metcalo_types = ["PEMB", "EMB", "PEME", "EME", "TILE", "HEC", "FCAL"]
    METCalo_METCut_MonAlg.METCaloContainer = "MET_Calo"
    METCalo_METCut_MonAlg.METCaloKeys = metcalo_types
    METCalo_METCut_MonAlg.dometcut = True
    METCalo_METCut_MonAlg.metcut = 80
    METCalo_METCut_group = helper.addGroup(
        METCalo_METCut_MonAlg, "METMonitor",
        "MissingEt/CutMet80/MET_Calo/MET_Cell")
    for mets in metcalo_types:
        defineHistogramsCalo(METCalo_METCut_MonAlg, METCalo_METCut_group,
                             helper, mets)

    METEMTopo_METCut_MonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                  'METEMTopo_METCut_MonAlg')
    METEMTopo_METCut_MonAlg.METContainer = "MET_EMTopo"
    METEMTopo_METCut_MonAlg.METAntiKt4EMTopoContainer = "MET_Reference_AntiKt4EMTopo"
    emtopomet_types = ["MET_Topo"]
    METEMTopo_METCut_MonAlg.metKeys = emtopomet_types
    METEMTopo_METCut_MonAlg.dometcut = True
    METEMTopo_METCut_MonAlg.metcut = 80
    METEMTopo_METCut_group = helper.addGroup(
        METEMTopo_METCut_MonAlg, "METMonitor",
        "MissingEt/CutMet80/MET_Calo/EMTopo")
    for mets in emtopomet_types:
        defineHistograms(METEMTopo_METCut_MonAlg, METEMTopo_METCut_group,
                         helper, mets)
# Jet cleaning

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

    JetCleaning_METMonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                'JetCleaning_METMonAlg')
    JetCleaning_METMonAlg.metKeys = met_types
    JetCleaning_METMonAlg.DoJetCleaning = True
    JetCleaning_METMonAlg.JetCleaningTool = jetCleaningTool
    JetCleaningGroup = helper.addGroup(
        JetCleaning_METMonAlg, "METMonitor",
        "MissingEt/Jetcleaning/MET_AntiKt4EMTopo/")
    JetCleaning_METMonAlg.JetContainerName = "AntiKt4EMTopoJets"
    for mets in met_types:
        if mets == 'MET_PFlow_PVSoftTrk':
            JetCleaning_METMonAlg.JetContainerName = "AntiKt4EMPFlowJets"
        defineHistograms(JetCleaning_METMonAlg, JetCleaningGroup, helper, mets)

    if inputFlags.DQ.DataType != 'cosmics':
        PflowJetCleaning_METMonAlg = helper.addAlgorithm(
            CompFactory.METMonitoringAlg, 'PflowJetCleaning_METMonAlg')
        PflowJetCleaning_METMonAlg.METContainer = "MET_Reference_AntiKt4EMPFlow"
        PflowJetCleaning_METMonAlg.metKeys = pfmet_types
        PflowJetCleaning_METMonAlg.DoJetCleaning = True
        PflowJetCleaning_METMonAlg.JetCleaningTool = jetCleaningTool
        PflowJetCleaningGroup = helper.addGroup(
            PflowJetCleaning_METMonAlg, "METMonitor",
            "MissingEt/Jetcleaning/MET_AntiKt4EMPflow/")
        PflowJetCleaning_METMonAlg.JetContainerName = "AntiKt4EMPFlowJets"
        for mets in pfmet_types:
            defineHistograms(PflowJetCleaning_METMonAlg, PflowJetCleaningGroup,
                             helper, mets)

    METCaloJetCleaning_MonAlg = helper.addAlgorithm(
        CompFactory.METMonitoringAlg, 'METCaloJetCleaning_MonAlg')
    metcalo_types = ["PEMB", "EMB", "PEME", "EME", "TILE", "HEC", "FCAL"]
    METCaloJetCleaning_MonAlg.METCaloContainer = "MET_Calo"
    METCaloJetCleaning_MonAlg.METCaloKeys = metcalo_types
    METCaloJetCleaning_MonAlg.DoJetCleaning = True
    METCaloJetCleaning_MonAlg.JetCleaningTool = jetCleaningTool
    group = helper.addGroup(METCaloJetCleaning_MonAlg, "METMonitor",
                            "MissingEt/Jetcleaning/MET_Calo/MET_Cell")
    for mets in metcalo_types:
        defineHistogramsCalo(METCaloJetCleaning_MonAlg, group, helper, mets)

    METEMTopoJetCleaning_MonAlg = helper.addAlgorithm(
        CompFactory.METMonitoringAlg, 'METEMTopoJetCleaning_MonAlg')
    emtopomet_types = ["MET_Topo"]
    METEMTopoJetCleaning_MonAlg.METContainer = "MET_EMTopo"
    METEMTopoJetCleaning_MonAlg.metKeys = emtopomet_types
    METEMTopoJetCleaning_MonAlg.DoJetCleaning = True
    METEMTopoJetCleaning_MonAlg.JetCleaningTool = jetCleaningTool
    group = helper.addGroup(METEMTopoJetCleaning_MonAlg, "METMonitor",
                            "MissingEt/Jetcleaning/MET_Calo/EMTopo/")
    for mets in emtopomet_types:
        defineHistograms(METEMTopoJetCleaning_MonAlg, group, helper, mets)

    # Badjets

    jetCleaningTool.CutLevel = "LooseBad"
    #    jetCleaningTool.CutLevel = "TightBad"
    jetCleaningTool.DoUgly = False

    BadJets_METMonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                            'BadJets_METMonAlg')
    BadJets_METMonAlg.metKeys = met_types
    BadJets_METMonAlg.DoJetCleaning = True
    BadJets_METMonAlg.alltrigger = True
    BadJets_METMonAlg.DoBadJets = True
    BadJets_METMonAlg.JetCleaningTool = jetCleaningTool
    BadJets_METMonAlg.JetContainerName = "AntiKt4EMTopoJets"
    BadJetsGroup = helper.addGroup(
        BadJets_METMonAlg, "METMonitor",
        "MissingEt/AllTriggers/BadJets/MET_AntiKt4EMTopo")
    for mets in met_types:
        defineHistograms(BadJets_METMonAlg, BadJetsGroup, helper, mets)

    if inputFlags.DQ.DataType != 'cosmics':
        BadPFJets_METMonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                  'BadPFJets_METMonAlg')
        BadPFJets_METMonAlg.METContainer = "MET_Reference_AntiKt4EMPFlow"
        BadPFJets_METMonAlg.metKeys = pfmet_types
        BadPFJets_METMonAlg.DoJetCleaning = True
        BadPFJets_METMonAlg.alltrigger = True
        BadPFJets_METMonAlg.DoBadJets = True
        BadPFJets_METMonAlg.JetCleaningTool = jetCleaningTool
        BadPFJets_METMonAlg.JetContainerName = "AntiKt4EMPFlowJets"
        BadPFJetsGroup = helper.addGroup(
            BadPFJets_METMonAlg, "METMonitor",
            "MissingEt/AllTriggers/BadJets/MET_AntiKt4EMPflow/")
        for mets in pfmet_types:
            defineHistograms(BadPFJets_METMonAlg, BadPFJetsGroup, helper, mets)

    BadJets_CaloMETMonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                'BadJets_CaloMETMonAlg')
    metcalo_types = ["PEMB", "EMB", "PEME", "EME", "TILE", "HEC", "FCAL"]
    BadJets_CaloMETMonAlg.METCaloContainer = "MET_Calo"
    BadJets_CaloMETMonAlg.METCaloKeys = metcalo_types
    BadJets_CaloMETMonAlg.DoJetCleaning = True
    BadJets_CaloMETMonAlg.alltrigger = True
    BadJets_CaloMETMonAlg.DoBadJets = True
    BadJets_CaloMETMonAlg.JetContainerName = "AntiKt4EMTopoJets"
    BadJets_CaloMETMonAlg.JetCleaningTool = jetCleaningTool
    BadJetsGroup_CaloMETMonAlg = helper.addGroup(
        BadJets_CaloMETMonAlg, "METMonitor",
        "MissingEt/AllTriggers/BadJets/MET_Calo/MET_Cell")
    for mets in metcalo_types:
        defineHistogramsCalo(BadJets_CaloMETMonAlg, BadJetsGroup_CaloMETMonAlg,
                             helper, mets)

    BadJets_EMTopoMETMonAlg = helper.addAlgorithm(CompFactory.METMonitoringAlg,
                                                  'BadJets_EMTopoMETMonAlg')
    BadJets_EMTopoMETMonAlg.metKeys = emtopomet_types
    BadJets_EMTopoMETMonAlg.METContainer = "MET_EMTopo"
    BadJets_EMTopoMETMonAlg.DoJetCleaning = True
    BadJets_EMTopoMETMonAlg.alltrigger = True
    BadJets_EMTopoMETMonAlg.DoBadJets = True
    BadJets_EMTopoMETMonAlg.JetCleaningTool = jetCleaningTool
    BadJetsGroup = helper.addGroup(
        BadJets_EMTopoMETMonAlg, "METMonitor",
        "MissingEt/AllTriggers/BadJets/MET_Calo/EMTopo")
    for mets in emtopomet_types:
        defineHistograms(BadJets_EMTopoMETMonAlg, BadJetsGroup, helper, mets)
    return helper.result()
예제 #29
0
def RpcMonitoringConfig(inputFlags):

    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'RpcMonitoringConfig')
    from AthenaConfiguration.ComponentFactory import CompFactory
    RPCMonitorAlgorithm = CompFactory.RPCMonitorAlgorithm

    rpcMonitorAlg = helper.addAlgorithm(RPCMonitorAlgorithm,
                                        "RPCMonitorAlgorithmAlg")
    # set properties of algorithm RPCMonitorAlgorithm
    rpcMonitorAlg.MinRoIDR = 0.3
    rpcMonitorAlg.MinPt = 2000
    rpcMonitorAlg.MuQuality = 1

    myGroup = helper.addGroup(rpcMonitorAlg, 'RPCMonitorAlgorithm',
                              'Muon/MuonRawDataMonitoring/RPC/')

    myGroup.defineHistogram('run;Run',
                            title='Run Number;run;Events',
                            type='TH1I',
                            path='PlotCand',
                            xbins=1000000,
                            xmin=-0.5,
                            xmax=999999.5)
    myGroup.defineHistogram('nMu;NMuon',
                            title='Number of Muons;nMuons;Events',
                            type='TH1I',
                            path='PlotCand',
                            xbins=10,
                            xmin=-0.5,
                            xmax=9.5)
    myGroup.defineHistogram('nMuBarrel;NMuonBarrel',
                            title='Number of Barrel Muons;nMuons;Events',
                            type='TH1I',
                            path='PlotCand',
                            xbins=5,
                            xmin=-0.5,
                            xmax=4.5)

    myGroup.defineHistogram('muPtCollection;MuonPt',
                            title='muon Pt;Pt[MeV];Muons',
                            type='TH1D',
                            path='PlotCand',
                            xbins=200,
                            xmin=0,
                            xmax=1000e3)
    myGroup.defineHistogram('roiEtaCollection;roiEta',
                            title='roi eta;roi #eta;rois',
                            type='TH1D',
                            path='PlotCand',
                            xbins=50,
                            xmin=-2.5,
                            xmax=2.5)
    myGroup.defineHistogram('roiBarrelEtaCollection;roiBarrelEta',
                            title='Barrel roi eta;roi #eta;rois',
                            type='TH1D',
                            path='PlotCand',
                            xbins=50,
                            xmin=-2.5,
                            xmax=2.5)
    myGroup.defineHistogram('roiBarrelThrCollection;roiBarrelThrs',
                            title='Barrel roi threshold;roi threshold;rois',
                            type='TH1I',
                            path='PlotCand',
                            xbins=6,
                            xmin=0.5,
                            xmax=6.5)

    myGroup.defineHistogram('ptDen;Pt',
                            title='muon Pt;Pt[MeV];Muons',
                            type='TH1D',
                            path='TriggerEff/Denominator',
                            xbins=150,
                            xmin=0.0,
                            xmax=150.0e3)
    myGroup.defineHistogram('ptDen;Pt_bins',
                            title='muon Pt;Pt[MeV];Muons',
                            type='TH1D',
                            path='TriggerEff/Denominator',
                            xbins=[
                                0, 3.0e3, 4.0e3, 5.0e3, 6.0e3, 7.0e3, 8.0e3,
                                10.0e3, 12.0e3, 15.0e3, 20.0e3, 25.0e3, 30.0e3,
                                40.0e3, 60.0e3, 80.0e3, 81.0e3
                            ])
    myGroup.defineHistogram('ptNumThr1;Pt',
                            title='muon Pt;Pt[MeV];Muons',
                            type='TH1D',
                            path='TriggerEff/Thr1',
                            xbins=150,
                            xmin=0.0,
                            xmax=150.0e3)
    myGroup.defineHistogram('ptNumThr1;Pt_bins',
                            title='muon Pt;Pt[MeV];Muons',
                            type='TH1D',
                            path='TriggerEff/Thr1',
                            xbins=[
                                0, 3.0e3, 4.0e3, 5.0e3, 6.0e3, 7.0e3, 8.0e3,
                                10.0e3, 12.0e3, 15.0e3, 20.0e3, 25.0e3, 30.0e3,
                                40.0e3, 60.0e3, 80.0e3, 81.0e3
                            ])
    myGroup.defineHistogram('etaDen,phiDen;barrel_eta_phi',
                            type='TH2D',
                            title='muons;#eta;#phi',
                            path='TriggerEff/Denominator',
                            xbins=42,
                            xmin=-1.05,
                            xmax=1.05,
                            ybins=32,
                            ymin=-3.1415926,
                            ymax=3.1415926)
    myGroup.defineHistogram('etaNumThr1,phiNumThr1;barrel_eta_phi',
                            type='TH2D',
                            title='muons;#eta;#phi',
                            path='TriggerEff/Thr1',
                            xbins=42,
                            xmin=-1.05,
                            xmax=1.05,
                            ybins=32,
                            ymin=-3.1415926,
                            ymax=3.1415926)

    myGroup.defineHistogram(
        'isPassed,ptDen;eff_vs_Pt',
        title='Trigger Efficiency;Pt[MeV];#epsilon',
        type='TEfficiency',
        path='TriggerEff',
        #xbins=[0,3.0e3,4.0e3,5.0e3,6.0e3,7.0e3,8.0e3,10.0e3,12.0e3,15.0e3,20.0e3,25.0e3,30.0e3,40.0e3,60.0e3,80.0e3,81.0e3])
        xbins=10,
        xmin=0.0,
        xmax=80.0e3)

    myGroup.defineHistogram('isPassed,etaDen,phiDen;eff_vs_eta_phi',
                            title='Trigger Efficiency;#eta;#phi;#epsilon',
                            type='TEfficiency',
                            path='TriggerEff',
                            xbins=42,
                            xmin=-1.05,
                            xmax=1.05,
                            ybins=32,
                            ymin=-3.1415926,
                            ymax=3.1415926)

    return helper.result()
예제 #30
0
def CpmMonitoringConfig(inputFlags):
    '''Function to configure LVL1 Cpm algorithm in the monitoring system.'''

    import math 
    # get the component factory - used for getting the algorithms
    from AthenaConfiguration.ComponentFactory import CompFactory
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    result = ComponentAccumulator()

    # make the athena monitoring helper
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags,'CpmMonitoringCfg')

    # get any algorithms
    CpmMonAlg = helper.addAlgorithm(CompFactory.CpmMonitorAlgorithm,'CpmMonAlg')

    # add any steering
    groupName = 'CpmMonitor' # the monitoring group name is also used for the package name
    CpmMonAlg.PackageName = groupName
    crates = 4
    CpmMonAlg.s_crates = crates
    maxSlices = 5
    CpmMonAlg.s_maxSlices = maxSlices
    isolBits = 4
    CpmMonAlg.s_isolBits = isolBits
    tobsPerCPM = 5
    CpmMonAlg.s_tobsPerCPM = tobsPerCPM
    maxTobsPerCmx = 70
    CpmMonAlg.MaxTOBsPerCMX = maxTobsPerCmx

    # set up the directory structure
    mainDir = 'L1Calo'
    trigPath = 'CPM' # replaces m_rootDir
    errorDir=trigPath+"/Errors/Hardware"
    monDetailPath=errorDir+"/Detail/"
    monCPMinputPath=trigPath+"/Input/"
    monRoIPath=trigPath+"/Output/"
    #monCMXPath=trigPath+"_CMX/Errors/Hardware/"
    monCMXinPath=trigPath+"_CMX/Input/"
    #monCMXoutPath=trigPath+"_CMX/Output/"

    # add monitoring algorithm to group, with group name and main directory 
    myGroup = helper.addGroup(CpmMonAlg, groupName , mainDir)

    #
    #   CPM Towers - monCPMinputPath
    #
    # Trigger Tower plots - for binning see TrigT1CaloLWHistogramTool::bookPPMEmEtaVsPhi
    etabins_2d=66
    etamin_2d=-3.3
    etamax_2d=3.3
    phibins_2d=64
    phimin_2d=0.0
    phimax_2d=64.0    
    # for 2D histograms x,y;histogram alias
    myGroup.defineHistogram('etaTT,phiTT;ppm_em_2d_etaPhi_tt_Hitmap',title='PPM Trigger Tower EM eta/phi;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_em_TT',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaTT,phiTT;ppm_had_2d_etaPhi_tt_Hitmap',title='PPM Trigger Tower HAD eta/phi;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_had_TT',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    
    # CPMTower plots
    maxEnergyRange = 256 # Maximum energy plotted
    # EM 1d
    myGroup.defineHistogram('etCpmTT_em;cpm_em_1d_tt_Et', title='CPM Tower EM Et;CPM Tower EM Energy;',
                            cutmask='',path=monCPMinputPath,xbins=maxEnergyRange,xmin=0,xmax=maxEnergyRange)
    myGroup.defineHistogram('etaCpmTT_em;cpm_em_1d_tt_Eta', title='CPM Tower EM eta;CPM Tower EM #eta;',
                            cutmask='',path=monCPMinputPath,xbins=50,xmin=-2.5,xmax=2.5)
    myGroup.defineHistogram('phiCpmTT_em;cpm_em_1d_tt_Phi', title='CPM Tower EM phi;CPM Tower EM #phi;',
                            cutmask='',path=monCPMinputPath,xbins=64,xmin=0,xmax=2*math.pi)
    # EM 2d
    myGroup.defineHistogram('etaCpmTT_em,phiScaledCpmTT_em;cpm_em_2d_etaPhi_tt_Hitmap',
                            title='CPM Tower EM eta/phi;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaCpmTT_em,phiScaledCpmTT_em;cpm_em_2d_etaPhi_tt_EtWeighted',
                            title='CPM Tower EM eta/phi weighted;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d, weight="etCpmTT_em")

    
    # HAD 1d
    myGroup.defineHistogram('etCpmTT_had;cpm_had_1d_tt_Et', title='CPM Tower HAD Et;CPM Tower HAD Energy;',
                            cutmask='',path=monCPMinputPath,xbins=maxEnergyRange,xmin=0,xmax=maxEnergyRange)
    myGroup.defineHistogram('etaCpmTT_had;cpm_had_1d_tt_Eta', title='CPM Tower HAD eta;CPM Tower HAD #eta;',
                            cutmask='',path=monCPMinputPath,xbins=50,xmin=-2.5,xmax=2.5)
    myGroup.defineHistogram('phiCpmTT_had;cpm_had_1d_tt_Phi', title='CPM Tower HAD phi;CPM Tower HAD #phi;',
                            cutmask='',path=monCPMinputPath,xbins=64,xmin=0,xmax=2*math.pi)
    # HAD 2d
    myGroup.defineHistogram('etaCpmTT_had,phiScaledCpmTT_had;cpm_had_2d_etaPhi_tt_Hitmap',
                            title='CPM Tower HAD eta/phi;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaCpmTT_had,phiScaledCpmTT_had;cpm_had_2d_etaPhi_tt_EtWeighted'
                            ,title='CPM Tower HAD eta/phi weighted;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='',path=monCPMinputPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d, weight="etCpmTT_had")

    xbinshist = int(crates * maxSlices)
    myGroup.defineHistogram('sliceCpmTT_tot,peakCpmTT_tot;cpm_2d_tt_Slices'
                            ,title='CPM Slices and Triggered Slice;Crate/Number of Slices;Triggered Slice',type='TH2F',
                            cutmask='',path=monCPMinputPath,
                            xbins=xbinshist,xmin=0,xmax=xbinshist,ybins=maxSlices,ymin=0,ymax=maxSlices)


    #
    # Errors - monDetailPath
    #
    # em - tot means addition of CPM and Overlap containers
    myGroup.defineHistogram('etaCpmTT_em_tot,phiScaledCpmTT_em_tot;cpm_em_2d_etaPhi_tt_Parity'
                            ,title='CPM Tower EM Parity Errors;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='parityErrorCpmTT_em',path=monDetailPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaCpmTT_em_tot,phiScaledCpmTT_em_tot;cpm_em_2d_etaPhi_tt_LinkDown',
                            title='CPM Tower EM Link Down Errors;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='linkDownErrorCpmTT_em',path=monDetailPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)

    # had
    myGroup.defineHistogram('etaCpmTT_had_tot,phiScaledCpmTT_had_tot;cpm_had_2d_etaPhi_tt_Parity',
                            title='CPM Tower HAD Parity Errors;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='parityErrorCpmTT_had',path=monDetailPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaCpmTT_had_tot,phiScaledCpmTT_had_tot;cpm_had_2d_etaPhi_tt_LinkDown',
                            title='CPM Tower HAD Link Down Errors;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='linkDownErrorCpmTT_had',path=monDetailPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)


    #
    #  CPM TOB RoIs - monRoIPath
    #
    isolRange=32 # Maximum range for encoded isolation
    myGroup.defineHistogram('energyTobRoIsEner;cpm_1d_roi_EnergyEm', title='CPM TOB RoI Cluster Energy EM;Cluster Energy;',
                            cutmask='mask_tobroi_ener_em',path=monRoIPath,
                            xbins=maxEnergyRange,xmin=0,xmax=maxEnergyRange)
    myGroup.defineHistogram('energyTobRoIsEner;cpm_1d_roi_EnergyTau', title='CPM TOB RoI Cluster Energy Tau;Cluster Energy;',
                            cutmask='mask_tobroi_ener_tau',path=monRoIPath,
                            xbins=maxEnergyRange,xmin=0,xmax=maxEnergyRange)

    myGroup.defineHistogram('energyTobRoIsIsol;cpm_1d_roi_IsolationEm', title='CPM TOB RoI Encoded Isolation Value EM;;',
                            cutmask='mask_tobroi_isol_em',path=monRoIPath,
                            xbins=isolRange,xmin=0,xmax=isolRange)
    myGroup.defineHistogram('energyTobRoIsIsol;cpm_1d_roi_IsolationTau', title='CPM TOB RoI Encoded Isolation Value Tau;;',
                            cutmask='mask_tobroi_isol_tau',path=monRoIPath,
                            xbins=isolRange,xmin=0,xmax=isolRange)


    # bit masks to be done
    #myGroup.defineHistogram('bitsTobRoIsIsol;cpm_1d_roi_IsolationBitsEm', title='CPM TOB RoI Encoded Isolation Bits EM;;',
    #                        cutmask='mask_tobroi_isol_em',path=monRoIPath,
    #                        xbins=isolBits,xmin=0,xmax=isolBits)

    # 2D
    # For binning see TrigT1CaloLWHistogramTool::bookCPMRoIEtaVsPhi,fillCPMRoIEtaVsPhi m_shrinkEtaBins=true
    # isolation
    myGroup.defineHistogram('etaTobRoIsIsol,phiTobRoIsIsol;cpm_2d_etaPhi_roi_HitmapIsolEm',
                            title='CPM TOB RoIs EM Non-zero Isolation Hit Map;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_isol_em',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaTobRoIsIsol,phiTobRoIsIsol;cpm_2d_etaPhi_roi_HitmapIsolTau',
                            title='CPM TOB RoIs Tau Non-zero Isolation Hit Map;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_isol_tau',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)

    # energy
    myGroup.defineHistogram('etaTobRoIsEner,phiTobRoIsEner;cpm_2d_etaPhi_roi_HitmapEm',
                            title='CPM TOB RoIs EM Hit Map;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_ener_em',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaTobRoIsEner,phiTobRoIsEner;cpm_2d_etaPhi_roi_EtWeightedEm',
                            title='CPM TOB RoIs EM Weighted by Energy;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_ener_em',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d, weight="energyTobRoIsEner")

    myGroup.defineHistogram('etaTobRoIsEner,phiTobRoIsEner;cpm_2d_etaPhi_roi_HitmapTau',
                            title='CPM TOB RoIs Tau Hit Map;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_ener_tau',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d)
    myGroup.defineHistogram('etaTobRoIsEner,phiTobRoIsEner;cpm_2d_etaPhi_roi_EtWeightedTau',
                            title='CPM TOB RoIs Tau Weighted by Energy;Tower #eta; Tower #phi',type='TH2F',
                            cutmask='mask_tobroi_ener_tau',path=monRoIPath,
                            xbins=etabins_2d,xmin=etamin_2d,xmax=etamax_2d,ybins=phibins_2d,ymin=phimin_2d,ymax=phimax_2d, weight="energyTobRoIsEner")

    # TOBs per CPM 
    myGroup.defineHistogram('tobPerCPMEm;cpm_1d_roi_TOBsPerCPMEm', title='CPM TOB RoI TOBs per CPM EM;Number of TOBs;',
                            cutmask='',path=monRoIPath,
                            xbins=tobsPerCPM+1,xmin=1,xmax=tobsPerCPM+2)
    myGroup.defineHistogram('tobPerCPMTau;cpm_1d_roi_TOBsPerCPMTau', title='CPM TOB RoI TOBs per CPM Tau;Number of TOBs;',
                            cutmask='',path=monRoIPath,
                            xbins=tobsPerCPM+1,xmin=1,xmax=tobsPerCPM+2)
    # How to set labels e.g.
    # m_h_cpm_1d_roi_TOBsPerCPMEm->GetXaxis()->SetBinLabel(s_tobsPerCPM + 1, "More");

    #
    #  CMX-CP TOBs - monCMXinPath
    #
    myGroup.defineHistogram('enerTobCmxEner;cmx_1d_tob_TOBsPerCMXLeft', title='CMX-CP TOBs per CMX Left;Number of TOBs;',
                            cutmask='',path=monCMXinPath,
                            xbins=maxTobsPerCmx,xmin=0,xmax=maxTobsPerCmx)


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