def _process_cmdline_args(): import AthenaCommon.AthOptionsParser as aop opts = aop.parse(chk_tcmalloc=False) #----------------------------------------------------------------- # side-effect: bootstrap ourselves and handle the environment # changing options (tcmalloc/stdcmalloc -> LD_PRELOAD) # => we may need to os.execvpe ourselves with the correct new env. _frozen = os.environ.get('_ATHENA_APP_FROZEN', '0') os.environ['_ATHENA_APP_FROZEN'] = _frozen # may not return ! _bootstrap_env(opts) #----------------------------------------------------------------- from AthenaCommon.Logging import log as msg from AthenaCommon.Logging import logging msg.setLevel(getattr(logging, opts.msg_lvl)) import AthenaCommon.ExitCodes as ExitCodes if len(opts.scripts) <= 0 and opts.run_batch: msg.error("batch mode requires at least one joboptions") raise aop.AthOptionsError(reason=ExitCodes.INCLUDE_ERROR) return opts
def _process_cmdline_args(): import AthenaCommon.AthOptionsParser as aop opts = aop.parse(chk_tcmalloc=False) #----------------------------------------------------------------- # side-effect: bootstrap ourselves and handle the environment # changing options (tcmalloc/stdcmalloc -> LD_PRELOAD) # => we may need to os.execvpe ourselves with the correct new env. _frozen = os.environ.get('_ATHENA_APP_FROZEN', '0') os.environ['_ATHENA_APP_FROZEN'] = _frozen # may not return ! _bootstrap_env(opts) #----------------------------------------------------------------- from AthenaCommon.Logging import log as msg from AthenaCommon.Logging import logging msg.setLevel(getattr(logging, opts.msg_lvl)) import AthenaCommon.ExitCodes as ExitCodes if len(opts.scripts)<=0 and opts.run_batch: msg.error("batch mode requires at least one joboptions") raise aop.AthOptionsError(reason=ExitCodes.INCLUDE_ERROR) return opts
def setUp(self): # trivial case without any nested sequences log.setLevel(DEBUG) dummyCfgFlags = AthConfigFlags() dummyCfgFlags.lock() def AlgsConf1(flags): acc = ComponentAccumulator() a1 = TestAlgo("Algo1") a2 = TestAlgo("Algo2") return acc, [a1, a2] def AlgsConf2(flags): acc = ComponentAccumulator() result, algs = AlgsConf1(flags) acc.merge(result) a = TestAlgo("Algo3") print("algo3 when created %s" % id(a)) algs.append(a) return acc, algs acc = ComponentAccumulator() # top level algs acc1, algs = AlgsConf2(dummyCfgFlags) acc.merge(acc1) acc.addEventAlgo(algs) def AlgsConf3(flags): acc = ComponentAccumulator() na1 = TestAlgo("NestedAlgo1") return acc, na1 def AlgsConf4(flags): acc, na1 = AlgsConf3(flags) NestedAlgo2 = TestAlgo("NestedAlgo2") NestedAlgo2.OutputLevel = 7 return acc, na1, NestedAlgo2 acc.addSequence(seqAND("Nest")) acc.addSequence(seqAND("subSequence1"), parentName="Nest") acc.addSequence(parOR("subSequence2"), parentName="Nest") acc.addSequence(seqAND("sub2Sequence1"), parentName="subSequence1") acc.addSequence(seqAND("sub3Sequence1"), parentName="subSequence1") acc.addSequence(seqAND("sub4Sequence1"), parentName="subSequence1") accNA1 = AlgsConf4(dummyCfgFlags) acc.merge(accNA1[0]) acc.addEventAlgo(accNA1[1:], "sub2Sequence1") outf = open("testFile.pkl", "wb") acc.store(outf) outf.close() self.acc = acc
def muonRdoDecodeTestMC(): from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior = 1 from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.Files = [ "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r7572_tid07644622_00/RDO.07644622._000001.pool.root.1" ] ConfigFlags.lock() ConfigFlags.dump() from AthenaCommon.Logging import log log.setLevel(DEBUG) log.info('About to setup Rpc RDO data decoding') cfg = ComponentAccumulator() # We are reading a pool file for this test from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) # Schedule RDO conversion # RPC decoding rpcdecodingAcc = RpcRDODecodeCfg(ConfigFlags) cfg.merge(rpcdecodingAcc) # TGC decoding tgcdecodingAcc = TgcRDODecodeCfg(ConfigFlags) cfg.merge(tgcdecodingAcc) # MDT decoding mdtdecodingAcc = MdtRDODecodeCfg(ConfigFlags) cfg.merge(mdtdecodingAcc) # CSC decoding cscdecodingAcc = CscRDODecodeCfg(ConfigFlags) cfg.merge(cscdecodingAcc) cscbuildingAcc = CscClusterBuildCfg(ConfigFlags) cfg.merge(cscbuildingAcc) log.info('Print Config') cfg.printConfig(withDetails=True) # Store config as pickle log.info('Save Config') with open('MuonRdoDecode.pkl', 'wb') as f: cfg.store(f) f.close() return cfg
# 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() 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 INFO log.setLevel(INFO) # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import ConfigFlags path = '/afs/cern.ch/work/j/jodafons/public/valid_sampleA/AOD.20745922._000041.pool.root.1' ConfigFlags.Input.Files = [path] ConfigFlags.Input.isMC = False ConfigFlags.Output.HISTFileName = 'TrigEgammaMonitorOutput.root' ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg = MainServicesCfg(ConfigFlags)
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() if __name__=='__main__': from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 log.setLevel(DEBUG) from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags createLArMonConfigFlags() ConfigFlags.Input.Files = ["/eos/atlas/atlastier0/rucio/data20_calib/calibration_LArElec-Delay-32s-Medium-Em/00374740/data20_calib.00374740.calibration_LArElec-Delay-32s-Medium-Em.daq.RAW/data20_calib.00374740.calibration_LArElec-Delay-32s-Medium-Em.daq.RAW._lb0000._SFO-2._0001.data"] ConfigFlags.Output.HISTFileName = 'LArCalibMonOutput.root' ConfigFlags.DQ.enableLumiAccess = False ConfigFlags.DQ.useTrigger = False ConfigFlags.Beam.Type = 'collisions' ConfigFlags.DQ.DataType = 'collisions' ConfigFlags.AtlasVersion = 'ATLAS-R2-2016-01-00-01' ConfigFlags.Detector.GeometryCSC=False ConfigFlags.Detector.GeometrysTGC=False ConfigFlags.Detector.GeometryMM=False
def muonRdoDecodeTestData(forTrigger=False): # Add a flag, forTrigger, which will initially put the ByteStreamDecodeCfg code into "Cached Container" mode from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior = 1 from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.RAW # Set global tag by hand for now ConfigFlags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2018-13" #"CONDBR2-BLKPA-2015-17" ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" #"ATLAS-R2-2015-03-01-00" ConfigFlags.lock() ConfigFlags.dump() from AthenaCommon.Logging import log log.setLevel(INFO) log.info('About to setup Raw data decoding') cfg = ComponentAccumulator() # Seem to need this to read BS properly from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg cfg.merge(ByteStreamReadCfg(ConfigFlags)) # Add the MuonCache to ComponentAccumulator for trigger/RoI testing mode if forTrigger: # cache creators loaded independently from MuonConfig.MuonBytestreamDecodeConfig import MuonCacheCfg cfg.merge(MuonCacheCfg()) # Schedule Rpc bytestream data decoding from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg rpcdecodingAcc = RpcBytestreamDecodeCfg(ConfigFlags, forTrigger) cfg.merge(rpcdecodingAcc) # Schedule Mdt bytestream data decoding from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg tgcdecodingAcc = TgcBytestreamDecodeCfg(ConfigFlags, forTrigger) cfg.merge(tgcdecodingAcc) from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg mdtdecodingAcc = MdtBytestreamDecodeCfg(ConfigFlags, forTrigger) cfg.merge(mdtdecodingAcc) from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg cscdecodingAcc = CscBytestreamDecodeCfg(ConfigFlags, forTrigger) cfg.merge(cscdecodingAcc) # Schedule RDO conversion rpcdecodingAcc = RpcRDODecodeCfg(ConfigFlags) cfg.merge(rpcdecodingAcc) tgcdecodingAcc = TgcRDODecodeCfg(ConfigFlags) cfg.merge(tgcdecodingAcc) mdtdecodingAcc = MdtRDODecodeCfg(ConfigFlags) cfg.merge(mdtdecodingAcc) cscdecodingAcc = CscRDODecodeCfg(ConfigFlags) cfg.merge(cscdecodingAcc) cscbuildingAcc = CscClusterBuildCfg(ConfigFlags) cfg.merge(cscbuildingAcc) # Need to add POOL converter - may be a better way of doing this? cfg.addService(CompFactory.AthenaPoolCnvSvc()) cfg.getService("EventPersistencySvc").CnvServices += ["AthenaPoolCnvSvc"] log.info('Print Config') cfg.printConfig(withDetails=True) if forTrigger: pklName = 'MuonRdoDecode_Cache.pkl' else: pklName = 'MuonRdoDecode.pkl' # Store config as pickle log.info('Save Config') with open(pklName, 'wb') as f: cfg.store(f) f.close() return cfg
result.addCondAlgo(mag_field_cache_cond_alg) return result if __name__ == "__main__": # To run this, do e.g. # python ../athena/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior = 1 from AthenaCommon.Logging import log from AthenaCommon.Constants import VERBOSE from AthenaConfiguration.AllConfigFlags import ConfigFlags log.setLevel(VERBOSE) from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.Input.isMC = False ConfigFlags.lock() cfg = ComponentAccumulator() acc = MagneticFieldSvcCfg(ConfigFlags) log.verbose(acc.getPrimary()) cfg.merge(acc) f = open("MagneticFieldSvc.pkl", "wb") cfg.store(f) f.close()
path=cosmic_path, title='Cosmics Seeds - Digit Max > '+str(int(larCosmicsMonAlg.MuonADCthreshold_FCAL))+' [ADC] in S2 FCal;#eta cell;#phi cell;Number of Hits', xbins=FCal_bins, ybins=lArDQGlobals.Cell_Variables["phiRange"]["FCal"]["A"]["2"]) if __name__=='__main__': from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import WARNING from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 log.setLevel(WARNING) from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.Output.HISTFileName = 'LArCosmicsMonOutput.root' ConfigFlags.DQ.enableLumiAccess = False ConfigFlags.DQ.useTrigger = False ConfigFlags.Beam.Type = 'collisions' ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon import Logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory if __name__=="__main__": # Setting needed for the ComponentAccumulator to do its thing from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=True # Set message levels from AthenaCommon import Constants msgLvl = "WARNING" from AthenaCommon.Logging import log log.setLevel(msgLvl) # Config flags steer the job at various levels from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.isMC = True ConfigFlags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/ASG/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1"] # Flags relating to multithreaded execution nthreads=0 ConfigFlags.Concurrency.NumThreads =nthreads if nthreads>0: ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.Concurrency.NumConcurrentEvents = 1 ConfigFlags.MET.UseTracks = True ConfigFlags.MET.DoPFlow = True if ConfigFlags.Beam.Type == 'cosmics' or ConfigFlags.Beam.Type == 'singlebeam':# used to have " or not rec.doInDet()" on the end
args = parser.parse_args() if args.Help: parser.print_help() import sys sys.exit(0) # Setting needed for the ComponentAccumulator to do its thing from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior = True # Set message levels from AthenaCommon import Constants msgLvl = getattr(Constants, args.msgLvl) from AthenaCommon.Logging import log log.setLevel(msgLvl) # Config flags steer the job at various levels from AthenaConfiguration.AllConfigFlags import ConfigFlags ConfigFlags.Input.Files = args.filesIn.split(",") # Flags relating to multithreaded execution ConfigFlags.Concurrency.NumThreads = args.nThreads if args.nThreads > 0: ConfigFlags.Scheduler.ShowDataDeps = True ConfigFlags.Scheduler.ShowDataFlow = True ConfigFlags.Scheduler.ShowControlFlow = True ConfigFlags.Concurrency.NumConcurrentEvents = args.nThreads # Prevent the flags from being modified ConfigFlags.lock()