Beispiel #1
0
def DQTDataFlowMonAlgConfig(flags):
    from AthenaMonitoring import AthMonitorCfgHelper
    from AthenaConfiguration.ComponentFactory import CompFactory
    helper = AthMonitorCfgHelper(flags, 'DQTDataFlowMonAlgCfg')
    _DQTDataFlowMonAlgConfigCore(helper, CompFactory.DQTDataFlowMonAlg,
                                 flags.Input.isMC)
    return helper.result()
Beispiel #2
0
def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False):

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

    from AthenaConfiguration.ComponentFactory import CompFactory
    LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg, inputFlags,
                        cellDebug, dspDebug)

    return helper.result()
Beispiel #3
0
def LArAffectedRegionsConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

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

    from AthenaConfiguration.ComponentFactory import CompFactory
    LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg,
                                 inputFlags)

    return helper.result()
Beispiel #4
0
def TrigMuonMonConfig(inputFlags):

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

    L1MuonMonConfig(helper)
    L2MuonSAMonConfig(helper)
    L2muCombMonConfig(helper)
    EFMuonMonConfig(helper)
    TrigMuonEfficiencyMonTTbarConfig(helper)
    TrigMuonEfficiencyMonZTPConfig(helper)

    return helper.result()
Beispiel #5
0
def LArCoverageConfig(inputFlags):
    '''Function to configures some algorithms in the monitoring system.'''

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

    from AthenaConfiguration.ComponentFactory import CompFactory
    LArCoverageConfigCore(helper, CompFactory.LArCoverageAlg, inputFlags)

    cfg.merge(helper.result())
    return cfg
Beispiel #6
0
def DQTDetSynchMonAlgConfig(flags):
    from AthenaMonitoring import AthMonitorCfgHelper
    from AthenaConfiguration.ComponentFactory import CompFactory
    helper = AthMonitorCfgHelper(flags, 'DQTDetSynchMonAlgCfg')
    _DQTDetSynchMonAlgConfigCore(helper, CompFactory.DQTDetSynchMonAlg,
                                 flags.Common.isOnline, False)
    acc = helper.result()
    # RPC currently crashes, switch off
    acc.getEventAlgo('DQTDetSynchMonAlg').doRPC = False
    from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg
    acc.merge(MagneticFieldSvcCfg(flags))
    from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
    acc.merge(TileCablingSvcCfg(flags))
    return acc
Beispiel #7
0
def LArHVCorrMonConfig(inputFlags):

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

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

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

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

    # The following class will make a sequence, configure algorithms, and link
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(inputFlags, 'TrigEgammaAthMonitorCfg')
    # configure alg and ana tools
    from TrigEgammaMonitoring.TrigEgammaMonitoringMTConfig import TrigEgammaMonAlgBuilder
    monAlgCfg = TrigEgammaMonAlgBuilder(
        helper, '2018', detailedHistograms=True)  # Using 2018 e/g tunings
    # build monitor and book histograms
    monAlgCfg.configure()

    # 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 the componenet accumulator to the main call
    return helper.result()
Beispiel #9
0
def TrigJetMonConfig(inputFlags):

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

  # This is the right place to get the info, but the autoconfig of the flag
  # is not yet implemented
  AthenaMT = ConfigFlags.Trigger.EDMDecodingVersion==3

  # AthenaMT or Legacy
  InputType = 'MT' if AthenaMT else 'Legacy'

  # Loop over L1 jet collectoins
  for jetcoll in L1JetCollections:
    l1jetconf = l1JetMonitoringConfig(ConfigFlags,jetcoll)
    l1jetconf.toAlg(helper)

  # Loop over L1 jet chains
  for chain,jetcoll in Chain2L1JetCollDict.items():
    l1chainconf = l1JetMonitoringConfig(ConfigFlags,jetcoll,chain)
    l1chainconf.toAlg(helper)

  # Loop over offline jet collections
  for jetcoll in OfflineJetCollections:
    offlineMonitorConf = jetMonitoringConfig(inputFlags,jetcoll,AthenaMT)
    offlineMonitorConf.toAlg(helper)

  # Loop over HLT jet collections
  for jetcoll in JetCollections[InputType]:
    monitorConf = jetMonitoringConfig(inputFlags,jetcoll,AthenaMT)
    # then we turn the full specification into properly configured algorithm and tools.
    # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec'
    monitorConf.toAlg(helper)

  # Loop over HLT jet chains
  for chain,jetcoll in Chain2JetCollDict[InputType].items():
    chainMonitorConf = jetChainMonitoringConfig(inputFlags,jetcoll,chain,AthenaMT)
    chainMonitorConf.toAlg(helper)

  # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system.
  return helper.result()
Beispiel #10
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()
Beispiel #11
0
def standardJetMonitoring(inputFlags):
    """Standard jet monitoring function to be inserted from top-level algs. 
    returns an a component accumulator as given by AthMonitorCfgHelper.result()
    Details of what goes into jet monitoring is implemented by dedicated functions such as jetMonAlgConfig().
    """

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


    # create a list of JetMonitoringAlg specifications
    jetAlgConfs = [
        # use the helper function defined above :
        jetMonAlgConfig( "AntiKt4LCTopoJets", inputFlags),
        #jetMonAlgConfig( "AntiKt4LCTopoJets", truthJetName="AntiKt4TruthJets"),     #How can we make sure truth jets are available ??
        jetMonAlgConfig( "AntiKt4EMPFlowJets", inputFlags),
        ]
    
    # schedule each JetMonitoringAlg by invoking the toAlg() methods of the config specification
    for conf in jetAlgConfs:        
        conf.toAlg(helper) # adds the conf as a JetMonitoringAlg to the helper
    
    return helper.result() # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system.
Beispiel #12
0
def TileMBTSMonitoringConfig(flags, **kwargs):
    ''' Function to configure TileMBTSMonitorAlgorithm algorithm in the monitoring system.'''

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

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

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

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

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

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

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

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

    accumalator = helper.result()
    result.merge(accumalator)
    return result
Beispiel #13
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
Beispiel #14
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
Beispiel #15
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()
Beispiel #16
0
  # Loop over L1 jet collectoins
  for jetcoll in L1JetCollections:
    l1jetconf = l1JetMonitoringConfig(ConfigFlags,jetcoll)
    l1jetconf.toAlg(helper)

  # Loop over L1 jet chains
  for chain,jetcoll in Chain2L1JetCollDict.items():
    l1chainconf = l1JetMonitoringConfig(ConfigFlags,jetcoll,chain)
    l1chainconf.toAlg(helper)

  # Loop over offline jet collections
  for jetcoll in OfflineJetCollections:
    offlineMonitorConf = jetMonitoringConfig(ConfigFlags,jetcoll,AthenaMT)
    offlineMonitorConf.toAlg(helper)

  # Loop over HLT jet collections
  for jetcoll in JetCollections[InputType]:
    monitorConf = jetMonitoringConfig(ConfigFlags,jetcoll,AthenaMT)
    # then we turn the full specification into properly configured algorithm and tools.
    # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec'
    monitorConf.toAlg(helper)

  # Loop over HLT jet chains
  for chain,jetcoll in Chain2JetCollDict[InputType].items():
    chainMonitorConf = jetChainMonitoringConfig(ConfigFlags,jetcoll,chain,AthenaMT)
    chainMonitorConf.toAlg(helper)

  cfg.merge(helper.result())
  
  cfg.run()
Beispiel #17
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()
Beispiel #18
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()
Beispiel #19
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
Beispiel #20
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
Beispiel #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
Beispiel #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
Beispiel #23
0
                      title='muPhi_forward_A;muPhi;Events',
                      type='TH1F',
                      path=mainDir + trigPath,
                      xbins=24,
                      xmin=-pi,
                      xmax=pi)

array.defineHistogram('muPhi_barrel_C',
                      title='muPhi_barrel_C;muPhi;Events',
                      type='TH1F',
                      path=mainDir + trigPath,
                      xbins=16,
                      xmin=-pi,
                      xmax=pi)
array.defineHistogram('muPhi_endcap_C',
                      title='muPhi_endcap_C;muPhi;Events',
                      type='TH1F',
                      path=mainDir + trigPath,
                      xbins=48,
                      xmin=-pi,
                      xmax=pi)
array.defineHistogram('muPhi_forward_C',
                      title='muPhi_forward_C;muPhi;Events',
                      type='TH1F',
                      path=mainDir + trigPath,
                      xbins=24,
                      xmin=-pi,
                      xmax=pi)

topSequence += helper.result()
Beispiel #24
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
Beispiel #25
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
Beispiel #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
Beispiel #27
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
Beispiel #28
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
def InDetGlobalMonitoringRun3TestConfig(flags):
    from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
    acc = ComponentAccumulator()
    
    from AthenaMonitoring import AthMonitorCfgHelper
    helper = AthMonitorCfgHelper(flags, "InDetGlobalMonitoringRun3Test")
        
    from AthenaConfiguration.ComponentFactory import CompFactory

    # 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 InDetGlobalMonitoringRun3Test.InDetGlobalTrackMonAlgCfg import InDetGlobalTrackMonAlgCfg 

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

        inDetGlobalTrackMonAlg.TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('InDetGlobalTrackMonAlg_TrackSelectionTool')
        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 = CompFactory.InDet.InDetTrackSelectionTool('InDetGlobalTrackMonAlg_TightTrackSelectionTool')
        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
        InDetTrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags))
        inDetGlobalTrackMonAlg.TrackSummaryTool = InDetTrackSummaryTool
        inDetGlobalTrackMonAlg.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        inDetGlobalTrackMonAlg.TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        
        InDetGlobalTrackMonAlgCfg(helper, inDetGlobalTrackMonAlg, **kwargsInDetGlobalTrackMonAlg)
        ########### here ends InDetGlobalTrackMonAlg ###########

#LRT

        ########### here begins InDetGlobalLRTMonAlg ###########
        kwargsInDetGlobalLRTMonAlg = { 
            '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 InDetGlobalMonitoringRun3Test.InDetGlobalLRTMonAlgCfg import InDetGlobalLRTMonAlgCfg 

        InDetGlobalLRTMonAlg = helper.addAlgorithm(CompFactory.InDetGlobalLRTMonAlg, 'InDetGlobalLRTMonAlg')
        for k, v in kwargsInDetGlobalLRTMonAlg.items():
            setattr(InDetGlobalLRTMonAlg, k, v)

        InDetGlobalLRTMonAlg.TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('InDetGlobalLRTMonAlg_TrackSelectionTool')
        InDetGlobalLRTMonAlg.TrackSelectionTool.UseTrkTrackTools = True
        InDetGlobalLRTMonAlg.TrackSelectionTool.CutLevel         = "TightPrimary"
        InDetGlobalLRTMonAlg.TrackSelectionTool.maxNPixelHoles   = 1
        InDetGlobalLRTMonAlg.TrackSelectionTool.minPt            = 5000
        #        InDetGlobalLRTMonAlg.Baseline_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        #        InDetGlobalLRTMonAlg.Baseline_TrackSelectionTool.Extrapolator     = InDetExtrapolator
        #
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('InDetGlobalLRTMonAlg_TightTrackSelectionTool')
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.UseTrkTrackTools = True
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.CutLevel         = "TightPrimary"
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.minPt            = 5000
        #        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        #        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.Extrapolator     = InDetExtrapolator
        

        # Run 3 configs - stolen from SCT
        from SCT_Monitoring.TrackSummaryToolWorkaround import TrackSummaryToolWorkaround
        InDetTrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags))
        InDetGlobalLRTMonAlg.TrackSummaryTool = InDetTrackSummaryTool
        InDetGlobalLRTMonAlg.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        InDetGlobalLRTMonAlg.TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
        InDetGlobalLRTMonAlg.Tight_TrackSelectionTool.Extrapolator     = acc.getPublicTool("InDetExtrapolator")
        
        InDetGlobalLRTMonAlgCfg(helper, InDetGlobalLRTMonAlg, **kwargsInDetGlobalLRTMonAlg)
        ########### here ends InDetGlobalLRTMonAlg ###########


        
    # run on ESD
    if flags.DQ.Environment != 'tier0Raw':
        ########### here begins InDetGlobalPrimaryVertexMonAlg ###########
        from InDetGlobalMonitoringRun3Test.InDetGlobalPrimaryVertexMonAlgCfg import InDetGlobalPrimaryVertexMonAlgCfg 
        
        myInDetGlobalPrimaryVertexMonAlg = helper.addAlgorithm(CompFactory.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(myInDetGlobalPrimaryVertexMonAlg, k, v)
            
        InDetGlobalPrimaryVertexMonAlgCfg(helper, myInDetGlobalPrimaryVertexMonAlg, **kwargsInDetGlobalPrimaryVertexMonAlg)

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

        ########### here begins InDetGlobalBeamSpotMonAlg ###########
        from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg
        acc.merge(BeamSpotCondAlgCfg(flags))
       
        from InDetGlobalMonitoringRun3Test.InDetGlobalBeamSpotMonAlgCfg import InDetGlobalBeamSpotMonAlgCfg 
        
        myInDetGlobalBeamSpotMonAlg = helper.addAlgorithm(CompFactory.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(myInDetGlobalBeamSpotMonAlg, k, v)

        InDetGlobalBeamSpotMonAlgCfg(helper, myInDetGlobalBeamSpotMonAlg, **kwargsInDetGlobalBeamSpotMonAlg)

        ########### here ends InDetGlobalBeamSpotMonAlg ###########
        
    acc.merge(helper.result())
    return acc
Beispiel #30
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()