def getMonTool_PFAlgorithm(): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') #monTool.HistPath = 'MyGroup/MySubDir' # default is the parent name of MonTool monTool.defineHistogram('TIME_execute', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0., xmax=1000.) monTool.defineHistogram('TIME_subtract', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0., xmax=1000.) monTool.defineHistogram('N_efrTracks', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0., xmax=1000.) monTool.defineHistogram('N_efrClusters', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0., xmax=2000.) return monTool
def MbtsFexMTMonitoring(): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram('triggerEnergies', path='EXPERT', type='TH1D', title='triggerEnergies', xbins=100, xmin=-0, xmax=60999.5) monTool.defineHistogram('triggerEta', path='EXPERT', type='TH1D', title='triggerEta', xbins=250, xmin=-5, xmax=5) monTool.defineHistogram('triggerPhi', path='EXPERT', type='TH1I', title='triggerPhi', xbins=100, xmin=-3.2, xmax=3.2) monTool.defineHistogram('triggerTimes', path='EXPERT', type='TH1I', title='triggerTimes', xbins=100, xmin=-0, xmax=60999.5) return monTool
class TrigCOOLUpdateHelper(_TrigCOOLUpdateHelper): __slots__ = () def __init__(self, name='TrigCOOLUpdateHelper'): super(TrigCOOLUpdateHelper, self).__init__(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) self.MonTool.defineHistogram('TIME_CoolFolderUpdate', path='EXPERT', type='TH1F', title='Time for conditions update;time [ms]', xbins=100, xmin=0, xmax=200) return def enable(self, folders = ['/Indet/Onl/Beampos', '/TRIGGER/LUMI/HLTPrefLumi', '/TRIGGER/HLT/PrescaleKey']): """Enable COOL folder updates for given folders (only use this for data)""" from AthenaCommon.AppMgr import ServiceMgr as svcMgr if not hasattr(svcMgr,'IOVDbSvc'): return self.CoolFolderMap = '/TRIGGER/HLT/COOLUPDATE' self.Folders = folders from IOVDbSvc.CondDB import conddb conddb.addFolder('TRIGGER', self.CoolFolderMap) # Make sure relevant folders are marked as 'extensible' for i, dbf in enumerate(svcMgr.IOVDbSvc.Folders): for f in self.Folders: if f in dbf and '<extensible/>' not in f: svcMgr.IOVDbSvc.Folders[i] += ' <extensible/>' log.info('IOVDbSvc folder %s not marked as extensible. Fixing this...', f)
def InDetMonitoringTool(): newMonTool = GenericMonitoringTool("MonTool") newMonTool.defineHistogram('numSctClusters', type='TH1F', path='EXPERT', title="Number of SCT Clusters", xbins=50, xmin=0., xmax=100) newMonTool.defineHistogram('numPixClusters', type='TH1F', path='EXPERT', title="Number of PIXEL Clusters", xbins=50, xmin=0., xmax=100) newMonTool.defineHistogram('numSctSpacePoints', type='TH1F', path='EXPERT', title="Number of SCT Space Points", xbins=50, xmin=0., xmax=100) newMonTool.defineHistogram('numPixSpacePoints', type='TH1F', path='EXPERT', title="Number of PIXEL Space Points", xbins=50, xmin=0., xmax=100) return newMonTool
def __init__(self, name='TrigCOOLUpdateHelper'): super(TrigCOOLUpdateHelper, self).__init__(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) self.MonTool.defineHistogram('TIME_CoolFolderUpdate', path='EXPERT', type='TH1F', title='Time for conditions update;time [ms]', xbins=100, xmin=0, xmax=200) return
def __init__(self, name='TrigCaloDataAccessSvc'): super(TrigCaloDataAccessSvc, self).__init__(name) from AthenaCommon.AppMgr import ServiceMgr as svcMgr from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.Logging import logging log = logging.getLogger(name) if ( globalflags.DatabaseInstance == "COMP200" and TriggerFlags.doCaloOffsetCorrection() ) : log.warning("Not possible to run BCID offset correction with COMP200") else: if TriggerFlags.doCaloOffsetCorrection(): if globalflags.DataSource()=='data' and athenaCommonFlags.isOnline(): log.info('Enable HLT calo offset correction for data') from IOVDbSvc.CondDB import conddb conddb.addFolder("LAR_ONL","/LAR/ElecCalibFlat/OFC") from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc svcMgr += LArFlatConditionSvc() svcMgr.LArFlatConditionSvc.OFCInput="/LAR/ElecCalibFlat/OFC" svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ] from IOVDbSvc.CondDB import conddb conddb.addFolder("LAR_ONL","/LAR/ElecCalibFlat/OFC",className = 'CondAttrListCollection') from AthenaCommon.AlgSequence import AthSequencer condSequence = AthSequencer("AthCondSeq") from LArRecUtils.LArRecUtilsConf import LArFlatConditionsAlg_LArOFCFlat_ as LArOFCCondAlg condSequence += LArOFCCondAlg (ReadKey="/LAR/ElecCalibFlat/OFC", WriteKey='LArOFC') from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgOnlineDefault LuminosityCondAlgOnlineDefault() from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault CaloBCIDAvgAlgDefault() else: log.info('Enable HLT calo offset correction for MC') from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault CaloBCIDAvgAlgDefault() from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() if not hasattr(topSequence,"CaloBCIDAvgAlg"): log.info('Cannot use timer for CaloBCIDAvgAlg') else: from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="CaloBCIDAvgAlg execution time; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=4000) topSequence.CaloBCIDAvgAlg.MonTool = monTool log.info('using timer for CaloBCIDAvgAlg') else: log.info('Disable HLT calo offset correction') return
def getMonTool_TrigJetAlgorithm(path): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.HistPath = path monTool.defineHistogram( 'nJets', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=100 ) monTool.defineHistogram( 'pt', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=500 ) monTool.defineHistogram( 'et', path='EXPERT', type='TH1F', title='Counts', xbins=100, xmin=0, xmax=500 ) monTool.defineHistogram( 'eta', path='EXPERT', type='TH1F', title='Counts', xbins=50, xmin=-5, xmax=5 ) monTool.defineHistogram( 'phi', path='EXPERT', type='TH1F', title='Counts', xbins=50, xmin=-3, xmax=3 ) return monTool
def PrescalingMonitoring(): tool = GenericMonitoringTool('PrescalingMonitoring') tool.HistPath = "HLTFramework/L1Decoder" tool.defineHistogram('LB,HLTPSK', path='EXPERT', type='TH2I', opt='kAddBinsDynamically', title='HLT prescale key used in LB;Lumiblock;HLTPSK', xbins=100, xmin=0, xmax=100, ybins=5, ymin=0, ymax=5) return tool
def TriggerSummaryAlg(name): from AthenaConfiguration.ComponentFactory import CompFactory alg = CompFactory.TriggerSummaryAlg(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/' + name) monTool.defineHistogram( 'TIME_SinceEventStart', path='EXPERT', type='TH1F', title='Time since beginning of event processing;time [ms]', xbins=100, xmin=0, xmax=3.5e3) alg.MonTool = monTool return alg
def __init__(self, name='ROBDataProviderSvc'): super(HltROBDataProviderSvc, self).__init__(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool,defineHistogram self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) self.MonTool.Histograms = [ defineHistogram('TIME_ROBReserveData', path='EXPERT', type='TH1F', title='Time to reserve ROBs for later retrieval;time [mu s]', xbins=100, xmin=0, xmax=1000), defineHistogram('NUMBER_ROBReserveData', path='EXPERT', type='TH1F', title='Number of reserved ROBs for later retrieval;number', xbins=100, xmin=0, xmax=500), defineHistogram('TIME_ROBRequest', path='EXPERT', type='TH1F', title='Time for ROB retrievals;time [mu s]', xbins=400, xmin=0, xmax=200000), defineHistogram('NUMBER_ROBRequest', path='EXPERT', type='TH1F', title='Number of retrieved ROBs;number', xbins=100, xmin=0, xmax=1000), defineHistogram('TIME_CollectAllROBs', path='EXPERT', type='TH1F', title='Time for retrieving complete event data;time [mu s]', xbins=400, xmin=0, xmax=200000), defineHistogram('NUMBER_CollectAllROBs', path='EXPERT', type='TH1F', title='Number of received ROBs for collect call;number', xbins=100, xmin=0, xmax=2500) ] return
def test_duration(self): gmt = GenericMonitoringTool(defaultDuration='run') gmt.convention = 'OFFLINE' gmt.defineHistogram('x;x_run') gmt.defineHistogram('x;x_lb', duration='lb') d = histogramDictionary(gmt.Histograms) self.assertEqual(d['x_run']['convention'], 'OFFLINE:run') self.assertEqual(d['x_lb']['convention'], 'OFFLINE:lb')
def CTPUnpackingMonitoring(maxItems, maxChains): tool = GenericMonitoringTool('CTPUnpackingMonitoring') tool.HistPath = "HLTFramework/L1Decoder" tool.Histograms = [ defineHistogram('TAVItems', path='EXPERT', type='TH1F', title='Number of active L1 TAV items;N Items;N Events', xbins=maxItems, xmin=0, xmax=maxItems), defineHistogram('Chains', path='EXPERT', type='TH1F', title='Number of activated Chains;N Chains;N Events', xbins=maxChains, xmin=0, xmax=maxChains) ] return tool
def __init__(self, name='HltEventLoopMgr'): super(HltEventLoopMgr, self).__init__(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool self.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) self.MonTool.defineHistogram('ErrorAlgName,ErrorCode', path='EXPERT', type='TH2I', title='Error StatusCodes per algorithm;Algorithm name;StatusCode', xbins=1, xmin=0, xmax=1, ybins=1, ymin=0, ymax=1) self.MonTool.defineHistogram('TotalTime', path='EXPERT', type='TH1F', title='Total event processing time (all events);Time [ms];Events', xbins=200, xmin=0, xmax=10000) self.MonTool.defineHistogram('TotalTimeAccepted', path='EXPERT', type='TH1F', title='Total event processing time (accepted events);Time [ms];Events', xbins=200, xmin=0, xmax=10000) self.MonTool.defineHistogram('TotalTimeRejected', path='EXPERT', type='TH1F', title='Total event processing time (rejected events);Time [ms];Events', xbins=200, xmin=0, xmax=10000) self.MonTool.defineHistogram('SlotIdleTime', path='EXPERT', type='TH1F', title='Time between freeing and assigning a scheduler slot;Time [ms];Events', xbins=400, xmin=0, xmax=400) return
def setupFilterMonitoring(filterAlg): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') inputKeys = filterAlg.Input monTool.HistPath = "HLTFramework/Filters" monTool.defineHistogram('name,stat;' + filterAlg.getName(), path='EXPERT', type='TH2I', title='Input activity fraction;;presence', xbins=len(inputKeys), xmin=0, xmax=len(inputKeys) + 2, xlabels=['exec', 'anyvalid'] + inputKeys, ybins=2, ymin=-0.5, ymax=1.5, ylabels=['no', 'yes']) filterAlg.MonTool = monTool
def TrackCountMonitoring(): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram('ntrks', path='EXPERT', type='TH1I', title='ntrks',xbins=100, xmin=-0.5, xmax=4999.5) from TrigMinBias.TrigMinBiasConf import TrackCountHypoAlgMT alg=TrackCountHypoAlgMT() for i in range(len(alg.min_pt)): monTool.defineHistogram('counts_minpTcutIndex_{}_maxZ0cutIndex_{}'.format(i,i), path='EXPERT', type='TH1I', title='counts for min pT and max z0 cut',xbins=100, xmin=-0.5, xmax=4999.5) return monTool
def RoIsUnpackingMonitoring(prefix, maxCount, maxEta=3.): tool = GenericMonitoringTool(prefix + 'RoIsUnpackingMonitoring') tool.HistPath = "HLTFramework/L1Decoder/RoIs" + prefix tool.Histograms = [ defineHistogram('count', path='EXPERT', type='TH1F', title='Number of RoIs;N RoIs;N Events', xbins=maxCount, xmin=0, xmax=maxCount), defineHistogram('eta', path='EXPERT', type='TH1F', title='Eta distribution;eta;N RoIs', xbins=60, xmin=-maxEta, xmax=maxEta), defineHistogram('phi', path='EXPERT', type='TH1F', title='Phi distribution;phi;N RoIs', xbins=64, xmin=-math.pi, xmax=math.pi), defineHistogram('eta, phi', path='EXPERT', type='TH2F', title='RoIs map;eta;phi', xbins=30, xmin=-maxEta, xmax=maxEta, ybins=32, ymin=-math.pi, ymax=math.pi) ] return tool
def TrigTopoEgammaElectronCfg(name='topoEgammaBuilder_TrigElectrons'): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_topoEgammaBuilder") monTool.Histograms = [ defineHistogram('EldeltaEta',type='TH1F', title='#Delta#eta', path='EXPERT',xbins=80, xmin=-0.01,xmax=0.01), defineHistogram('EldeltaPhi',type='TH1F', title='#Delta#phi', path='EXPERT',xbins=80, xmin=-0.01, xmax=0.01), defineHistogram('EleT', type='TH1F', title='p#_{T} [GeV]', path='EXPERT',xbins=80, xmin=0., xmax=100)] mlog = logging.getLogger("TrigElectronFactories") mlog.info('Starting configuration') TrigTopoEgammaElectron = AlgFactory( egammaAlgsConf.topoEgammaBuilder, name = name, SuperElectronRecCollectionName = TrigEgammaKeys.SuperElectronRecCollectionName, SuperPhotonRecCollectionName = TrigEgammaKeys.SuperPhotonRecCollectionName, ElectronOutputName = TrigEgammaKeys.outputElectronKey, PhotonOutputName = TrigEgammaKeys.outputPhotonKey, AmbiguityTool = EGammaAmbiguityTool, EMClusterTool = TrigEMClusterTool, EMShowerTool=TrigEMShowerBuilder, egammaTools = FcnWrapper(TrigEgammaDecorationTools), doAdd = False, doPhotons = False, doElectrons = True, #MonTool = monTool ) return TrigTopoEgammaElectron()
def HLTResultMTMakerCfg(name="HLTResultMTMaker"): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool m = CompFactory.HLTResultMTMaker(name) # ROBs/SubDets which are enabled but not necessarily part of the ROS-ROB map from libpyeformat_helper import SourceIdentifier, SubDetector subdets = [ SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, SubDetector.TDAQ_CALO_JET_PROC_ROI, SubDetector.TDAQ_HLT, SubDetector.TDAQ_FTK, SubDetector.TDAQ_CALO_TOPO_PROC, SubDetector.TDAQ_CALO_DIGITAL_PROC, SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI, ] m.ExtraEnabledSubDets = [] for subdetId in subdets: m.ExtraEnabledSubDets.append(int(subdetId)) def addROBs(dest, subdet, modules): for moduleId in modules: dest.append(SourceIdentifier(subdet, moduleId).code()) m.ExtraEnabledROBs = [] addROBs(m.ExtraEnabledROBs, SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, [0xa8, 0xa9, 0xaa, 0xab]) addROBs(m.ExtraEnabledROBs, SubDetector.TDAQ_CALO_JET_PROC_ROI, [0xac, 0xad]) addROBs(m.ExtraEnabledROBs, SubDetector.TDAQ_MUON_CTP_INTERFACE, [0x01]) addROBs(m.ExtraEnabledROBs, SubDetector.TDAQ_CTP, [0x01]) addROBs(m.ExtraEnabledROBs, SubDetector.TDAQ_CALO_TOPO_PROC, [0x81, 0x91, 0x82, 0x92]) # Configure HLT result monitoring histograms m.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/' + name) m.MonTool.defineHistogram('TIME_makeResult', path='EXPERT', type='TH1F', title='makeResult() call time;Time [ms];Events', xbins=200, xmin=0, xmax=50) return m
def SchedulerMonSvcCfg(flags, name='SchedulerMonSvc'): monsvc = CompFactory.SchedulerMonSvc(name) monsvc.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/'+name) # From GaudiHive AlgsExecutionStates::State enum stateNames = ['INITIAL', 'CONTROLREADY', 'DATAREADY', 'RESOURCELESS', 'SCHEDULED', 'EVTACCEPTED', 'EVTREJECTED', 'ERROR'] monsvc.MonTool.defineHistogram('SnapNumber,AlgStates', weight='StateTotalCounts', path='EXPERT', type='TH2D', title='Scheduler algorithm states vs time (snap number);Snap number;Algorithm state', xbins=1000, xmin=0, xmax=1000, ybins=8, ymin=-0.5, ymax=7.5, ylabels=stateNames, opt='kCanRebin') monsvc.MonTool.defineHistogram('WallTimeSeconds,AlgStates', weight='StateTotalCounts', path='EXPERT', type='TH2D', title='Scheduler algorithm states vs time;Time [s];Algorithm state', xbins=600, xmin=0, xmax=60, ybins=8, ymin=-0.5, ymax=7.5, ylabels=stateNames, opt='kCanRebin') monsvc.MonTool.defineHistogram('SnapNumber,FreeSlots', path='EXPERT', type='TProfile', title='Number of free slots vs time (snap number);Snap number;Number of free slots', xbins=1000, xmin=0, xmax=1000, ybins=10, ymin=0, ymax=10, opt='kCanRebin') monsvc.MonTool.defineHistogram('WallTimeSeconds,FreeSlots', path='EXPERT', type='TProfile', title='Number of free slots vs time ;Time [s];Number of free slots', xbins=600, xmin=0, xmax=60, ybins=10, ymin=0, ymax=10, opt='kCanRebin') monsvc.MonTool.defineHistogram('AlgStates', weight='StateTotalCounts', path='EXPERT', type='TH1D', title='Scheduler algorithm states;Algorithm states;Snapshots', xbins=8, xmin=-0.5, xmax=7.5, xlabels=stateNames) monsvc.MonTool.defineHistogram('FreeSlots', path='EXPERT', type='TH1D', title='Number of free slots;Free slots;Snapshots', xbins=10, xmin=0, xmax=10, opt='kCanRebin') monsvc.MonTool.defineHistogram('TIME_monCallback', path='EXPERT', type='TH1D', title='Time of callback calls;Time [us];Calls', xbins=500, xmin=0, xmax=5000) acc = ComponentAccumulator() acc.addService(monsvc) return acc
def __init__(self, name="RingerReMaker"): super(RingerReFexConfig, self).__init__(name) self.EtaBins = [ 0.0000, 999.999 ] # bin pairs: min < eta <= max, PS,barrel,crack,endcap self.GlobalCenter = False self.RingerKey = "L2CaloRings" self.EtaSearchWindowSize = 0.1 self.PhiSearchWindowSize = 0.1 self.DEtaRings = [0.025, 0.003125, 0.025, 0.05, 0.1, 0.1, 0.1] self.DPhiRings = [ 0.098174770424681, 0.098174770424681, 0.024543692606170, 0.024543692606170, 0.098174770424681, 0.098174770424681, 0.098174770424681 ] self.NRings = [8, 64, 8, 8, 4, 4, 4] self.NLayersRings = [2, 2, 2, 2, 4, 5, 4] self.NMaxCells = [320, 512, 272, 128, 128, 128, 128] self.UseHad = True from TrigT2CaloEgamma.RingerConstants import Layer self.LayersRings = [ Layer.PreSamplerB, Layer.PreSamplerE, Layer.EMB1, Layer.EME1, Layer.EMB2, Layer.EME2, Layer.EMB3, Layer.EME3, Layer.HEC0, Layer.TileBar0, Layer.TileGap2, Layer.TileExt0, Layer.HEC1, Layer.HEC2, Layer.TileBar1, Layer.TileGap0, Layer.TileExt1, Layer.HEC3, Layer.TileBar2, Layer.TileGap1, Layer.TileExt2 ] from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram("TIME_total", title="Total Time;time[ms]", xbins=50, xmin=0, xmax=5, type='TH1F', path='EXPERT') monTool.defineHistogram("TIME_load_cells", title="Load Cells Time;time[ms]", xbins=50, xmin=0, xmax=5, type='TH1F', path='EXPERT') self.MonTool = monTool
from AthenaCommon.AppMgr import theApp from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() from AthExMonitored.AthExMonitoredConf import MonitoredAlg job += MonitoredAlg('MonAlg') from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') #monTool.HistPath = 'MyGroup/MySubDir' # default is the parent name of MonTool monTool.defineHistogram('nTracks', path='EXPERT', type='TH1F', title='Counts', xbins=10, xmin=0, xmax=10) monTool.defineHistogram('eta', path='EXPERT', type='TH1F', title='#eta;;Entries', xbins=30, xmin=-3, xmax=3) monTool.defineHistogram('AbsPhi', path='EXPERT', type='TH1F', title='|#phi|;;Entries',
def test_defineTree(self): gmt = GenericMonitoringTool() gmt.defineTree('t', 'x/F') d = histogramDictionary(gmt.Histograms) self.assertEqual(d['t']['type'], 'TTree')
def test_defineHistogram(self): gmt = GenericMonitoringTool() gmt.defineHistogram('x') self.assertTrue(len(gmt.Histograms)>0)
def test_createGMT(self): gmt = GenericMonitoringTool() self.assertIsInstance(gmt, GenericMonitoringTool)
def trigCaloDataAccessSvcCfg(flags): acc = ComponentAccumulator() svc = CompFactory.TrigCaloDataAccessSvc() # since the svc depends on calo geometry configure it here from LArGeoAlgsNV.LArGMConfig import LArGMCfg acc.merge(LArGMCfg(flags)) from TileGeoModel.TileGMConfig import TileGMCfg acc.merge(TileGMCfg(flags)) from RegionSelector.RegSelConfig import regSelCfg acc.merge(regSelCfg(flags)) acc.merge(createLArRoI_Map(flags)) # Needed by bad channel maskers, refrerenced from LArCellCont. from IOVDbSvc.IOVDbSvcConfig import addFolders acc.merge(addFolders(flags, ['/LAR/BadChannels/BadChannels'], 'LAR')) acc.merge(addFolders(flags, ['/LAR/BadChannels/MissingFEBs'], 'LAR')) from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg acc.merge(TileEMScaleCondAlgCfg(flags)) from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg acc.merge(TileBadChannelsCondAlgCfg(flags)) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool import math mon = GenericMonitoringTool("TrigCaloDataAccessSvcMon") mon.defineHistogram("TIME_locking_LAr_RoI", path="EXPERT", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100), mon.defineHistogram("roiROBs_LAr", path="EXPERT", title="Number of ROBs unpacked in RoI requests", xbins=20, xmin=0, xmax=20), mon.defineHistogram("TIME_locking_LAr_FullDet", path="EXPERT", title="Time spent in unlocking the LAr collection", xbins=100, xmin=0, xmax=100), mon.defineHistogram("roiEta_LAr,roiPhi_LAr", type="TH2F", path="EXPERT", title="Geometric usage", xbins=50, xmin=-5, xmax=5, ybins=64, ymin=-math.pi, ymax=math.pi) svc.MonTool = mon acc.addService(svc) return acc
def getMETMonTool(name="MonTool"): """ Return configured GenericMonitoringTool instance for EFMissingETAlgMT """ mon = GenericMonitoringTool("MonTool") mon.defineHistogram("TIME_Total", path='EXPERT', title="Time spent Alg", xbins=100, xmin=0, xmax=100) mon.defineHistogram("TIME_Loop", path='EXPERT', title="Time spent in Tools loop", xbins=100, xmin=0, xmax=100) # signed log-scale: 0.15/bin = 1.413X/bin (factor of ~2 each two bins) # central bin is +/- 0.075 and contains values whose abs < 1.189 GeV # limits are +/- 1.189 TeV mon.defineHistogram( 'EF_MEx_log', path='EXPERT', title="EF Missing E_{x};sgn(ME_{x}) log_{10}(ME_{x}/GeV)", xbins=41, xmin=-3.075, xmax=3.075) mon.defineHistogram( 'EF_MEy_log', path='EXPERT', title="EF Missing E_{y};sgn(ME_{y}) log_{10}(ME_{y}/GeV)", xbins=41, xmin=-3.075, xmax=3.075) mon.defineHistogram( 'EF_MEz_log', path='EXPERT', title="EF Missing E_{z};sgn(ME_{z}) log_{10}(ME_{z}/GeV)", xbins=41, xmin=-3.075, xmax=3.075) # signed log-scale: 0.15/bin = 1.413X/bin (factor of ~2 each two bins) # bin centered on zero is +/- 0.075 and contains values whose abs < 1.189 GeV # limits are -74.99 GeV and 2.371 TeV mon.defineHistogram('EF_SumEt_log', path='EXPERT', title="EF Sum E_{T};log_{10}(SumE_{T}/GeV)", xbins=40, xmin=-1.875, xmax=4.125) mon.defineHistogram('EF_SumE_log', path='EXPERT', title="EF Sum E;log_{10}(SumE/GeV)", xbins=40, xmin=-1.875, xmax=4.125) # unsigned (i.e. normal) log-scale: 0.15/bin = 1.413X/bin (factor of ~2 each two bins) # limits are 708 MeV and 2.818 TeV mon.defineHistogram('EF_MET_log', path='EXPERT', title="EF |Missing E_{T}|;log_{10}(ME_{T}/GeV)", xbins=24, xmin=-0.15, xmax=3.45) mon.defineHistogram('EF_ME_log', path='EXPERT', title="EF |Missing Energy|;log_{10}(ME/GeV)", xbins=24, xmin=-0.15, xmax=3.45) # linear-scale mon.defineHistogram('EF_MET_lin', path='EXPERT', title="EF |Missing E_{T}|;ME_{T} (GeV)", xbins=205, xmin=-13.5, xmax=601.5) mon.defineHistogram('EF_ME_lin', path='EXPERT', title="EF |Missing Energy|;ME (GeV)", xbins=205, xmin=-13.5, xmax=601.5) mon.defineHistogram('EF_SumEt_lin', path='EXPERT', title="EF Sum E_{T};SumE_{T} (GeV)", xbins=305, xmin=-27., xmax=1803.) mon.defineHistogram('EF_XS', path='EXPERT', title="EF Significance; (XS/GeV^{1/2})", xbins=40, xmin=-0.025, xmax=20.025) mon.defineHistogram('EF_MET_phi', path='EXPERT', title="EF MET #phi;MET #phi (rad)", xbins=32, xmin=-3.1416, xmax=3.1416) mon.defineHistogram('EF_SumE_lin', path='EXPERT', title="EF Sum E;SumE (GeV)", xbins=305, xmin=-27., xmax=3500.) mon.defineHistogram('EF_MEx_lin', path='EXPERT', title="EF Missing E_{x};ME_{x} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) mon.defineHistogram('EF_MEy_lin', path='EXPERT', title="EF Missing E_{y};ME_{y} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) mon.defineHistogram('EF_MEz_lin', path='EXPERT', title="EF Missing E_{z};ME_{z} (GeV)", xbins=199, xmin=-298.5, xmax=298.5) return mon
def SpCountMonitoring(): from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram('totNumPixCL_1', path='EXPERT', type='TH1I', title='totNumPixCL_1', xbins=100, xmin=-0, xmax=60999.5) monTool.defineHistogram('totPixBeforeCuts', path='EXPERT', type='TH1I', title='totPixBeforeCuts', xbins=250, xmin=-0.5, xmax=6999.5) monTool.defineHistogram('totNumPixCL_2', path='EXPERT', type='TH1I', title='totNumPixCL_2', xbins=100, xmin=-0, xmax=60999.5) monTool.defineHistogram('totNumPixCLmin3', path='EXPERT', type='TH1I', title='totNumPixCLmin3', xbins=100, xmin=-0, xmax=60999.5) monTool.defineHistogram('totNumPixSP', path='EXPERT', type='TH1I', title='totNumPixSP', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('pixClBarrel', path='EXPERT', type='TH1I', title='pixClBarrel', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('pixClEndcapA', path='EXPERT', type='TH1I', title='pixClEndcapA', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('pixClEndcapC', path='EXPERT', type='TH1I', title='pixClEndcapC', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('totNumSctSP', path='EXPERT', type='TH1I', title='totNumSctSP', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('SctSpEndcapC', path='EXPERT', type='TH1I', title='SctSpEndcapC', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('SctSpBarrel', path='EXPERT', type='TH1I', title='SctSpBarrel', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('SctSpEndcapA', path='EXPERT', type='TH1I', title='SctSpEndcapA', xbins=500, xmin=-0.5, xmax=60999.5) monTool.defineHistogram('totNumPixSP, totNumSctSP', path='EXPERT', type='TH2I', title='SP ; pix SP after ToT cut; sct SP', xbins=500, xmin=-0.5, xmax=60999.5, ybins=500, ymin=-0.5, ymax=60999.5) return monTool
def _IncTool(name, threshold, sel): log.debug('TrigEgammaPrecisionElectronHypoTool _IncTool("' + name + '", threshold = ' + str(threshold) + ', sel = ' + str(sel)) from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolInc tool = TrigEgammaPrecisionElectronHypoToolInc(name) from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram monTool = GenericMonitoringTool("MonTool_" + name) monTool.Histograms = [ defineHistogram( 'dEta', type='TH1F', path='EXPERT', title= "PrecisionElectron Hypo #Delta#eta_{EF L1}; #Delta#eta_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'dPhi', type='TH1F', path='EXPERT', title= "PrecisionElectron Hypo #Delta#phi_{EF L1}; #Delta#phi_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01), defineHistogram( 'Et_em', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000), defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5), defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2), defineHistogram( 'EtaBin', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5), defineHistogram('LikelihoodRatio', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo LH", xbins=100, xmin=-5, xmax=5), defineHistogram('mu', type='TH1F', path='EXPERT', title="Average interaction per crossing", xbins=100, xmin=0, xmax=100) ] cuts = [ 'Input', '#Delta #eta EF-L1', '#Delta #phi EF-L1', 'eta', 'E_{T}^{EM}' ] monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo Passed Cuts;Cut", xbins=13, xmin=-1.5, xmax=12.5, opt="kCumulative", xlabels=cuts) ] monTool.HistPath = 'PrecisionElectronHypo/' + tool.name() tool.MonTool = monTool tool.EtaBins = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47] def same(val): return [val] * (len(tool.EtaBins) - 1) tool.ETthr = same(float(threshold)) tool.dETACLUSTERthr = 0.1 tool.dPHICLUSTERthr = 0.1 tool.ElectronLHSelector = TrigElectronSelectors(sel) #tool.ET2thr = same( 90.0*GeV ) if sel == 'nocut': tool.AcceptAll = True tool.ETthr = same(float(threshold) * GeV) tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. elif sel == "etcut": tool.ETthr = same((float(threshold) - 3) * GeV) # No other cuts applied tool.dETACLUSTERthr = 9999. tool.dPHICLUSTERthr = 9999. return tool
def TriggerEDMSerialiserToolCfg(name="TriggerEDMSerialiserTool"): from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior += 1 from TrigEDMConfig.DataScoutingInfo import getFullHLTResultID TriggerEDMSerialiserTool = CompFactory.TriggerEDMSerialiserTool # Configuration helper methods def addCollection(self, typeNameAux, moduleIds): self.CollectionsToSerialize[typeNameAux] = moduleIds def addCollectionToMainResult(self, typeNameAux): self.addCollection(typeNameAux, moduleIds=[getFullHLTResultID()]) def addCollectionListToResults(self, typeNameAuxList, moduleIds): for typeNameAux in typeNameAuxList: self.addCollection(typeNameAux, moduleIds) def addCollectionListToMainResult(self, typeNameAuxList): self.addCollectionListToResults(typeNameAuxList, moduleIds=[getFullHLTResultID()]) # Add the helper methods to the TriggerEDMSerialiserTool python class TriggerEDMSerialiserTool.addCollection = addCollection TriggerEDMSerialiserTool.addCollectionToMainResult = addCollectionToMainResult TriggerEDMSerialiserTool.addCollectionListToResults = addCollectionListToResults TriggerEDMSerialiserTool.addCollectionListToMainResult = addCollectionListToMainResult # Create and return a serialiser tool object serialiser = TriggerEDMSerialiserTool(name) from collections import OrderedDict import GaudiConfig2.semantics class OD(OrderedDict): """Purpose of this class is to present map (ordered by insertion order) interface on python side, whereas the property to look like vector of such strings "type#key;id0,id1" when it gets to setting the serialiser property """ def __repr__(self): return '[' + ','.join([ '"' + str(typekey) + ';' + ','.join([str(_) for _ in ids]) + '"' for typekey, ids in self.items() ]) + ']' def __str__(self): return self.__repr__() class TrigSerializerSemantics(GaudiConfig2.semantics.PropertySemantics): __handled_types__ = ("SerializerObjs", ) def __init__(self, cpp_type, name=None): super(TrigSerializerSemantics, self).__init__(cpp_type, name) def store(self, value): return OD(value) def default(self, value): return OD() def merge(self, a, b): a.update(b) return a def load(self, value): return value TriggerEDMSerialiserTool._descriptors[ "CollectionsToSerialize"].semantics = TrigSerializerSemantics( cpp_type="SerializerObjs") TriggerEDMSerialiserTool._descriptors[ "CollectionsToSerialize"].semantics.name = "CollectionsToSerialize" #serialiser.CollectionsToSerialize = OD() from TrigEDMConfig.TriggerEDMRun3 import tpMap tpTool = CompFactory.TrigSerTPTool() tpTool.TPMap = tpMap() serialiser.TPTool = tpTool from TrigEDMConfig.DataScoutingInfo import TruncationThresholds as truncThresholds serialiser.TruncationThresholds = truncThresholds # Configure monitoring histograms from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool serialiser.MonTool = GenericMonitoringTool('MonTool', HistPath='HLTFramework/' + name) serialiser.MonTool.defineHistogram( 'Truncation_ModuleId', path='EXPERT', type='TH1F', title= 'Module IDs of truncated HLT results;Module ID;Num of truncated results', xbins=20, xmin=0, xmax=20) serialiser.MonTool.defineHistogram( 'Truncation_TotalSize', path='EXPERT', type='TH1F', title= 'Total size of truncated HLT result;Size [kB];Num of truncated results', xbins=200, xmin=0, xmax=5000) serialiser.MonTool.defineHistogram( 'Truncation_LargestName', path='EXPERT', type='TH1F', title='Name of the largest collection;;Num of truncated results', xbins=1, xmin=0, xmax=1) serialiser.MonTool.defineHistogram( 'Truncation_LargestSize', path='EXPERT', type='TH1F', title= 'Size of the largest collection;Size [kB];Num of truncated results', xbins=200, xmin=0, xmax=5000) Configurable.configurableRun3Behavior -= 1 return serialiser
def __init__(self, name): super(EgammaFastElectronFexBase,self).__init__(name) # Tracking cuts self.TrackPt = 1.0 * GeV self.TrackPtHighEt = 2.0 * GeV self.ClusEt = 20.0 * GeV self.CaloTrackdEtaNoExtrap = 0.5 self.CaloTrackdEtaNoExtrapHighEt = 0.1 # Calo-Tracking matching cuts self.CaloTrackdETA = 0.5 self.CaloTrackdPHI = 0.5 self.CaloTrackdEoverPLow = 0.0 self.CaloTrackdEoverPHigh = 999.0 self.ParticleCaloExtensionTool = ParticleCaloExtensionTool from TriggerJobOpts.TriggerFlags import TriggerFlags if 'Validation' in TriggerFlags.enableMonitoring() or 'Online' in TriggerFlags.enableMonitoring(): monTool = GenericMonitoringTool('MonTool') monTool.defineHistogram('CaloTrackdEta', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) monTool.defineHistogram('CaloTrackdPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) monTool.defineHistogram('CaloTrackEoverP', path='EXPERT', type='TH1F', title="FastElectron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) monTool.defineHistogram('PtTrack', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) monTool.defineHistogram('PtCalo', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) monTool.defineHistogram('CaloEta',path='EXPERT', type='TH1F', title="FastElectron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) monTool.defineHistogram('CaloPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) monTool.defineHistogram('CaloTrackdEtaNoExtrapMon', path='EXPERT',type='TH1F', title="FastElectron Fex #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) self.MonTool = monTool