diff --git a/Control/AthenaMonitoring/CMakeLists.txt b/Control/AthenaMonitoring/CMakeLists.txt index 40b8f009a40b15f3f79fd26a7886a558046ace1b..3f7b0e5c38b2fe33e7c98aa77cd1352da441c577 100644 --- a/Control/AthenaMonitoring/CMakeLists.txt +++ b/Control/AthenaMonitoring/CMakeLists.txt @@ -47,6 +47,7 @@ atlas_add_component( AthenaMonitoring # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) +atlas_install_scripts( share/Run3DQTestingDriver.py ) # Units tests C++: file( GLOB CXX_TEST_FILES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cxx ) diff --git a/Control/AthenaMonitoring/python/AthMonitorCfgHelper.py b/Control/AthenaMonitoring/python/AthMonitorCfgHelper.py index 5b9a8921bbd88b73016ebfffb3e56747ecd9eeca..4f34c6c1589ad8e4f95770eb6d577a2dd128ea87 100644 --- a/Control/AthenaMonitoring/python/AthMonitorCfgHelper.py +++ b/Control/AthenaMonitoring/python/AthMonitorCfgHelper.py @@ -93,9 +93,13 @@ class AthMonitorCfgHelper(object): ''' from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool tool = GenericMonitoringTool(name) - acc, histsvc = getDQTHistSvc(self.inputFlags) - self.resobj.merge(acc) - tool.THistSvc = histsvc + if self.inputFlags.DQ.isReallyOldStyle: + from AthenaCommon.AppMgr import ServiceMgr + tool.THistSvc = ServiceMgr.THistSvc + else: + acc = getDQTHistSvc(self.inputFlags) + self.resobj.merge(acc) + tool.HistPath = self.inputFlags.DQ.FileKey + ('/%s' % topPath if topPath else '') alg.GMTools += [tool] return tool @@ -204,11 +208,17 @@ def getDQTHistSvc(inputFlags): from GaudiSvc.GaudiSvcConf import THistSvc result = ComponentAccumulator() + + if inputFlags.DQ.isReallyOldStyle: + from AthenaCommon.AppMgr import ServiceMgr + result.addService(ServiceMgr.THistSvc) + return result + histsvc = THistSvc() histsvc.Output += ["%s DATAFILE='%s' OPT='RECREATE'" % (inputFlags.DQ.FileKey, inputFlags.Output.HISTFileName)] result.addService(histsvc) - return result, histsvc + return result def getTriggerTranslatorToolSimple(inputFlags): ''' Set up the Trigger Translator Tool; no reason for this to be called diff --git a/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py b/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..e9e46073ee897ef3a8a8c0393a3e34fca26c377b --- /dev/null +++ b/Control/AthenaMonitoring/python/AthenaMonitoringCfg.py @@ -0,0 +1,25 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def AthenaMonitoringCfg(flags): + import logging + local_logger = logging.getLogger('AthenaMonitoringCfg') + result = ComponentAccumulator() + + if flags.DQ.Steering.doSCTMon: + local_logger.info('Set up SCT monitoring') + from SCT_Monitoring.SCTLorentzMonAlg import SCTLorentzMonAlgConfig + result.merge(SCTLorentzMonAlgConfig(flags)) + + if flags.DQ.Steering.doTileMon: + local_logger.info('Set up Tile monitoring') + from TileMonitoring.TileJetMonitorAlgorithm import TileJetMonitoringConfig + result.merge(TileJetMonitoringConfig(flags)) + + if flags.DQ.Steering.doHLTMon: + local_logger.info('Set up HLT monitoring') + from TrigHLTMonitoring.TrigHLTMonitoringConfig import TrigHLTMonitoringConfig + result.merge(TrigHLTMonitoringConfig(flags)) + + return result diff --git a/Control/AthenaMonitoring/python/DQConfigFlags.py b/Control/AthenaMonitoring/python/DQConfigFlags.py index ca071d98cf655a0444f50379dedb03f1ee237d6d..d114421b0112a9c839cf77271b941c8fa3d6cebe 100644 --- a/Control/AthenaMonitoring/python/DQConfigFlags.py +++ b/Control/AthenaMonitoring/python/DQConfigFlags.py @@ -4,14 +4,39 @@ from AthenaConfiguration.AthConfigFlags import AthConfigFlags +_steeringFlags = [ 'doGlobalMon', 'LVL1CaloMon', 'doCTPMon', 'doHLTMon', + 'doPixelMon', 'doSCTMon', 'doTRTMon', 'doInDetMon', + 'doLArMon', 'doTileMon', + 'doCaloGlobalMon', 'doMuonMon', + 'doLucidMon', 'doAFPMon', + 'doHIMon', 'doEgammaMon', 'doJetMon', 'doMissingEtMon', + 'doTauMon', 'doJetTagMon' ] + +_lowLevelSteeringFlags = [ 'InDet.doGlobalMon', 'InDet.doAlignMon', + 'InDet.doPerfMon', 'Muon.doRawMon', + 'Muon.doTrackMon', 'Muon.doAlignMon', + 'Muon.doSegmentMon', + 'Muon.doPhysicsMon', 'Muon.doTrkPhysMon', + 'Muon.doCombinedMon' + ] + def createDQConfigFlags(): acf=AthConfigFlags() acf.addFlag('DQ.doMonitoring', True) - acf.addFlag('DQ.doGlobalMon', True) acf.addFlag('DQ.doStreamAwareMon', True) acf.addFlag('DQ.disableAtlasReadyFilter', False) acf.addFlag('DQ.FileKey', 'CombinedMonitoring') acf.addFlag('DQ.useTrigger', True) + + # temp thing for steering from inside old-style ... + acf.addFlag('DQ.isReallyOldStyle', False) + + # steering ... + for flag in _steeringFlags + _lowLevelSteeringFlags: + acf.addFlag('DQ.Steering.' + flag, True) + # HLT steering ... + from TrigHLTMonitoring.TrigHLTMonitoringConfig import createHLTDQConfigFlags + acf.join(createHLTDQConfigFlags()) return acf def createComplexDQConfigFlags(): @@ -44,3 +69,10 @@ def getEnvironment(flags): else: # this could use being rethought to properly encode input and output types perhaps ... return 'tier0' + +def allSteeringFlagsOff(): + from AthenaConfiguration.AllConfigFlags import ConfigFlags + for flag in _steeringFlags: + setattr(getattr(ConfigFlags, 'DQ.Steering'), flag, False) + #print flag + #getattr(ConfigFlags, 'DQ.Steering.' + flag).set(False) diff --git a/Control/AthenaMonitoring/python/TriggerInterface.py b/Control/AthenaMonitoring/python/TriggerInterface.py index ea0b0c6172520ba0844340fe4bc3774cb31c6b8b..5fd91ea6c994cb5fbb10691bcbd2f1880b8741c3 100644 --- a/Control/AthenaMonitoring/python/TriggerInterface.py +++ b/Control/AthenaMonitoring/python/TriggerInterface.py @@ -65,6 +65,13 @@ def getTrigDecisionTool(flags): from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool rv = ComponentAccumulator() + + if flags.DQ.isReallyOldStyle: + from AthenaCommon.AppMgr import ToolSvc + rv.addPublicTool(ToolSvc.TrigDecisionTool) + getTrigDecisionTool.rv = rv + return getTrigDecisionTool.rv + rv.merge(getTrigConfigSvc(flags)) tdt = Trig__TrigDecisionTool('TrigDecisionTool', TrigConfigSvc=rv.getService('TrigConfigSvc')) diff --git a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py index 8a71101a4b7bc6b8348219a798acf81792601ecd..f9576f4e667253a0f84c8658fa245fa6e8d56289 100644 --- a/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py +++ b/Control/AthenaMonitoring/share/DataQualitySteering_jobOptions.py @@ -282,4 +282,22 @@ if DQMonFlags.doMonitoring(): postprocfunc(tool) del postprocfunc + # # set up new-style monitoring with new-style configuration + # # only enable this when we understand details better... + # local_logger.info('Setting up new-style DQ monitoring') + # from AthenaMonitoring.AthenaMonitoringCfg import AthenaMonitoringCfg + # from AthenaCommon.Configurable import Configurable + + # _ = Configurable.configurableRun3Behavior + # Configurable.configurableRun3Behavior = 1 + # from AthenaConfiguration.AllConfigFlags import ConfigFlags + # ConfigFlags.Input.Files = jobproperties.AthenaCommonFlags.FilesInput() + # ConfigFlags.Output.HISTFileName = DQMonFlags.histogramFile() + # ConfigFlags.DQ.isReallyOldStyle = True + # _2 = AthenaMonitoringCfg(ConfigFlags) + # Configurable.configurableRun3Behavior = _ + # _2.printConfig() + # _2.appendToGlobals() + # del _, _2 + del local_logger diff --git a/Control/AthenaMonitoring/share/Run3DQTestingDriver.py b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py new file mode 100755 index 0000000000000000000000000000000000000000..0354bc70bbc3720d205ffea7ae7c63fa11898b83 --- /dev/null +++ b/Control/AthenaMonitoring/share/Run3DQTestingDriver.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file DQTestingDriver.py +@author C. D. Burton +@author P. Onyisi +@date 2019-06-20 +@brief Driver script to run DQ with new-style configuration on an ESD/AOD +''' + +if __name__=='__main__': + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument('--preExec', help='Code to execute before locking configs') + parser.add_argument('--dqOffByDefault', action='store_true', + help='Set all DQ steering flags to False, user must then switch them on again explicitly') + parser.add_argument('flags', nargs='*', help='Config flag overrides') + args = parser.parse_args() + + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import INFO + log.setLevel(INFO) + + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + + ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q431/21.0/myESD.pool.root'] + ConfigFlags.Output.HISTFileName = 'ExampleMonitorOutput.root' + if args.dqOffByDefault: + from AthenaMonitoring.DQConfigFlags import allSteeringFlagsOff + allSteeringFlagsOff() + ConfigFlags.fillFromArgs(args.flags) + + if args.preExec: + # bring things into scope + from AthenaMonitoring.DQConfigFlags import allSteeringFlagsOff + log.info('Executing preExec: %s', args.preExec) + exec(args.preExec) + + log.info('FINAL CONFIG FLAGS SETTINGS FOLLOW') + ConfigFlags.dump() + + ConfigFlags.lock() + + # Initialize configuration object, add accumulator, merge, and run. + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg = MainServicesSerialCfg() + cfg.merge(PoolReadCfg(ConfigFlags)) + + # load DQ + from AthenaMonitoring.AthenaMonitoringCfg import AthenaMonitoringCfg + dq = AthenaMonitoringCfg(ConfigFlags) + cfg.merge(dq) + + # If you want to turn on more detailed messages ... + # exampleMonitorAcc.getEventAlgo('ExampleMonAlg').OutputLevel = 2 # DEBUG + cfg.printConfig(withDetails=False) # set True for exhaustive info + + cfg.run() #use cfg.run(20) to only run on first 20 events diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt index 8aea144471a62ba529580be2370e51e61dee1d8c..fd882b674431d95fd905d9d2fe20f1e735826ed8 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/CMakeLists.txt @@ -53,4 +53,5 @@ atlas_add_component( SCT_Monitoring # Install files from the package: atlas_install_headers( SCT_Monitoring ) atlas_install_joboptions( share/*.py ) +atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py similarity index 75% rename from InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg.py rename to InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py index 0ee0c47eb32a82bdabf361aa1726c508ec7f73cb..58a2c56a6e5bbfa8338a198eb8c7ca92f392334f 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg.py +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/python/SCTLorentzMonAlg.py @@ -55,6 +55,10 @@ def SCTLorentzMonAlgConfig(inputFlags): # result.merge(caloNoiseAcc) # myMonAlg.CaloNoiseTool = caloNoiseTool + # set up geometry / conditions + from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg + result.merge(InDetGeometryCfg(inputFlags)) + # # Then, add a tool that doesn't have its own configuration function. In # # this example, no accumulator is returned, so no merge is necessary. # from MyDomainPackage.MyDomainPackageConf import MyDomainTool @@ -101,45 +105,8 @@ def SCTLorentzMonAlgConfig(inputFlags): # 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() + #return helper.result() # # Otherwise, merge with result object and return - # acc, seq = helper.result() - # result.merge(acc) - # return result - - -if __name__=='__main__': - # Setup the Run III behavior - from AthenaCommon.Configurable import Configurable - Configurable.configurableRun3Behavior = 1 - - # Setup logs - from AthenaCommon.Logging import log - from AthenaCommon.Constants import DEBUG,INFO - log.setLevel(INFO) - - # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags - ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc16_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s3170_r10572_homeMade.pool.root"] - ConfigFlags.Input.isMC = True - ConfigFlags.Output.HISTFileName = 'SCTLorentzMonOutput.root' - ConfigFlags.GeoModel.Align.Dynamic = False - ConfigFlags.Detector.GeometryID = True - ConfigFlags.Detector.GeometryMuon = True - ConfigFlags.lock() - - # Initialize configuration object, add accumulator, merge, and run. - from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg - from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesSerialCfg() - cfg.merge(PoolReadCfg(ConfigFlags)) - - from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg - geoCfg=AtlasGeometryCfg(ConfigFlags) - cfg.merge(geoCfg) - - sctLorentzMonAcc = SCTLorentzMonAlgConfig(ConfigFlags) - - cfg.merge(sctLorentzMonAcc) - cfg.run() + result.merge(helper.result()) + return result diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg_test.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg_test.py new file mode 100644 index 0000000000000000000000000000000000000000..4a0268a5dd5a6ef647a7defac9660039a955dbd4 --- /dev/null +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/SCTLorentzMonAlg_test.py @@ -0,0 +1,46 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file SCTLorentzMonAlg.py +@author Susumu Oda +@date 2019-04-02 +@brief Based on AthenaMonitoring/ExampleMonitorAlgorithm.py +''' + +from SCTLorentzMonAlg import SCTLorentzMonAlgConfig + +if __name__=='__main__': + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG,INFO + log.setLevel(INFO) + + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc16_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s3170_r10572_homeMade.pool.root"] + ConfigFlags.Input.isMC = True + ConfigFlags.Output.HISTFileName = 'SCTLorentzMonOutput.root' + ConfigFlags.GeoModel.Align.Dynamic = False + ConfigFlags.Detector.GeometryID = True + ConfigFlags.Detector.GeometryMuon = True + ConfigFlags.lock() + + # Initialize configuration object, add accumulator, merge, and run. + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg = MainServicesSerialCfg() + cfg.merge(PoolReadCfg(ConfigFlags)) + + from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + geoCfg=AtlasGeometryCfg(ConfigFlags) + cfg.merge(geoCfg) + + sctLorentzMonAcc = SCTLorentzMonAlgConfig(ConfigFlags) + + cfg.merge(sctLorentzMonAcc) + cfg.run() diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py index b06aea39f0311574c5c19f3d1a9e8e56c2d47b22..04f1f342776154893b408b38e8420da6aea0dfdd 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitoringConfig.py @@ -1,4 +1,20 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +def createHLTDQConfigFlags(): + from AthenaConfiguration.AthConfigFlags import AthConfigFlags + acf=AthConfigFlags() + acf.addFlag('DQ.Steering.HLT.doMET', True) + return acf + +def TrigHLTMonitoringConfig(flags): + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + result = ComponentAccumulator() + + if flags.DQ.Steering.HLT.doMET: + from TrigMETMonitoring.TrigMETMonitorAlgorithm import TrigMETMonConfig + result.merge(TrigMETMonConfig(flags)) + + return result def HLTGeneralTool(): #from AthenaCommon.AppMgr import ToolSvc