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()
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
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
xmin=0.0, xmax=16.0) myGroup.defineHistogram('thrNumber_endcap', title='thrNumber_endcap;thrNumber;Events', path=trigPath, xbins=16, xmin=0.0, xmax=16.0) myGroup.defineHistogram('thrNumber_forward', title='thrNumber_forward;thrNumber;Events', path=trigPath, xbins=16, xmin=0.0, xmax=16.0) array = helper.addArray([16], tgcRawDataMonAlg, 'TgcRawDataMonitor') array.defineHistogram('roiEta,roiPhi', title='roiEta2Phi;roiEta;roiPhi', type='TH2F', path=mainDir + trigPath, xbins=100, xmin=-2.5, xmax=2.5, ybins=48, ymin=-pi, ymax=pi) array.defineHistogram('roiEta', title='roiEta;roiEta;Events', type='TH1F',
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 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
def Run3AFPExampleMonitoringConfig(inputFlags): '''Function to configures some algorithms in the monitoring system.''' from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags, 'Run3AFPMonitorCfg') from AthenaConfiguration.ComponentFactory import CompFactory #from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPSiLayerAlgorithm afpSiLayerAlgorithmFac = CompFactory.AFPSiLayerAlgorithm afpSiLayerAlgorithm = helper.addAlgorithm(afpSiLayerAlgorithmFac, 'AFPSiLayerAlg') #from Run3AFPMonitoring.Run3AFPMonitoringConf import AFPToFAlgorithm afpToFAlgorithmFac = CompFactory.AFPToFAlgorithm afpToFAlgorithm = helper.addAlgorithm(afpToFAlgorithmFac, 'AFPToFAlg') # Add a generic monitoring tool (a "group" in old language). The returned # object here is the standard GenericMonitoringTool. AFPSiGroup = helper.addGroup(afpSiLayerAlgorithm, 'AFPSiLayerTool', 'AFP/') AFPToFGroup = helper.addGroup(afpToFAlgorithm, 'AFPToFTool', 'AFP/') AFPSiGroup.defineHistogram( 'lb,nSiHits', title='Luminosity Block;lb;total number of Hits', type='TProfile', path='SiT/', xbins=1000, xmin=-0.5, xmax=999.5) AFPToFGroup.defineHistogram( 'lb,nTofHits', title='Luminosity Block;lb;total number of Hits', type='TProfile', path='ToF/', xbins=1000, xmin=-0.5, xmax=999.5) AFPToFGroup.defineHistogram( 'numberOfHit_S0', title='Number of hit per bar station 0;total number of Hits', path='ToF/', xbins=4, xmin=-0.5, xmax=3.5) AFPToFGroup.defineHistogram( 'numberOfHit_S3', title='Number of hit per bar station 3;total number of Hits', path='ToF/', xbins=4, xmin=-0.5, xmax=3.5) # Using a map of groups layerList = ['P0', 'P1', 'P2', 'P3'] ## TODO XXX adapt to the enum/xAOD namespace names combinedList = ['farAside', 'nearAside', 'nearCside', 'farCside'] array = helper.addArray([combinedList, layerList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath='AFP/SiT/') array.defineHistogram('pixelColIDChip', title='1D hitmap for {0} Layer {1};pixelColIDChip', path='PixelColIDChip', xbins=80, xmin=0.5, xmax=80.5) array.defineHistogram('pixelRowIDChip', title='1D hitmap for {0} Layer {1};pixelRowIDChip', path='PixelRowIDChip', xbins=336, xmin=0.5, xmax=336.5) array.defineHistogram( 'pixelColIDChip,pixelRowIDChip', title='hitmap for {0} Layer {1};pixelColIDChip;pixelRowIDChip', type='TH2F', path='pixelColRow2D', xbins=80, xmin=0.5, xmax=80.5, ybins=336, ymin=0.5, ymax=336.5) array.defineHistogram( 'timeOverThreshold', type='TH1F', title='1D Time over threshold for {0} Layer {1};timeOverThreshold', path='SiTimeOverThreshold', xbins=60, xmin=0, xmax=20) array.defineHistogram( 'clusterX,clusterY', title='Cluster position in station {0} Layer {1};clusterX;clusterY', type='TH2F', path='Cluster', xbins=80, xmin=0.5, xmax=80.5, ybins=336, ymin=0.5, ymax=336.5) array = helper.addArray([combinedList], afpSiLayerAlgorithm, 'AFPSiLayerTool', topPath='AFP/Track/') array.defineHistogram( 'trackX,trackY', title='Track posistion position in station {0};trackX;trackY', type='TH2F', path='Track', xbins=80, xmin=0.5, xmax=80.5, ybins=336, ymin=0.5, ymax=336.5) arrayOneList = helper.addArray([combinedList], afpToFAlgorithm, 'AFPToFTool', topPath='AFP/ToF/') arrayOneList.defineHistogram( 'trainID,barInTrainID', title='ToF hit bar vs train {0};trainID;barInTrainID', type='TH2F', path='HitBarvsTrain/', xbins=4, xmin=-0.5, xmax=3.5, ybins=4, ymin=-0.5, ymax=3.5) # Finalize. The return value should be a tuple of the ComponentAccumulator return helper.result()