def SetupMuonStandaloneCA(args, ConfigFlags): # When running from a pickled file, athena inserts some services automatically. So only use this if running now. if args.run: from AthenaConfiguration.MainServicesConfig import MainServicesCfg cfg = MainServicesCfg(ConfigFlags) msgService = cfg.getService('MessageSvc') msgService.Format = "S:%s E:%e % F%128W%S%7W%R%T %0W%M" else: cfg = ComponentAccumulator() from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) return cfg
#cfgFlags.Input.isMC=False #cfgFlags.Input.Files=["/atlas/guirriec/git-athena/q431_2019-03-02T2147/myESD_2019.pool.root"] cfgFlags.Output.ESDFileName = "esdOut.pool.root" # Flags relating to multithreaded execution cfgFlags.Concurrency.NumThreads = args.nThreads if args.nThreads > 0: cfgFlags.Scheduler.ShowDataDeps = True cfgFlags.Scheduler.ShowDataFlow = True cfgFlags.Scheduler.ShowControlFlow = True cfgFlags.Concurrency.NumConcurrentEvents = args.nThreads from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(cfgFlags) acc.getService("MessageSvc").Format = "% F%80W%S%7W%R%T %0W%M" # Prevent the flags from being modified cfgFlags.lock() acc.merge(PrepareStandAloneBTagCfg(cfgFlags)) JetCollection = ['AntiKt4EMTopo', 'AntiKt4EMPFlow'] if args.highlevel: acc.merge(BTagHLTaggersCfg(cfgFlags, JetCollection=JetCollection)) else: kwargs = {} kwargs['Release'] = args.release if args.release == "21.2": kwargs["TimeStamp"] = ['201810', '201903']
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" ] flags.Trigger.L1Decoder.forceEnableAllChains = True flags.Concurrency.NumThreads = 1 flags.Concurrency.NumConcurrentEvents = 1 flags.InDet.useSctDCS = False flags.InDet.usePixelDCS = False flags.lock() from AthenaCommon.Constants import DEBUG, WARNING acc = MainServicesCfg(flags) acc.getService('AvalancheSchedulerSvc').VerboseSubSlots = True # this delcares to the scheduer that EventInfo object is produced acc.addEventAlgo( CompFactory.SGInputLoader(Load=[('xAOD::EventInfo', 'StoreGateSvc+EventInfo')]), "AthAlgSeq") from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg acc.merge(ByteStreamReadCfg(flags)) from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig acc.merge(TriggerHistSvcConfig(flags)) from TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenuMT_newJO import generateMenu as generateHLTMenu
# Test setup log.setLevel(DEBUG) ConfigFlags.Input.Files = defaultTestFiles.RAW ConfigFlags.fillFromArgs() ConfigFlags.Output.ESDFileName = "myESD.pool.root" ConfigFlags.lock() # Construct our accumulator to run from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc = MainServicesCfg(ConfigFlags) from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg acc.merge( ByteStreamReadCfg(ConfigFlags, ["TileRawChannelContainer/TileRawChannelCnt"])) acc.merge(TileRawChannelToL2OutputCfg(ConfigFlags, streamName='ESD')) acc.getService('StoreGateSvc').Dump = True ConfigFlags.dump() acc.printConfig(withDetails=True, summariseProps=True) acc.store(open('TileL2.pkl', 'wb')) sc = acc.run(maxEvents=3) # Success should be 0 import sys sys.exit(not sc.isSuccess())
from AthenaCommon.Configurable import Configurable from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from AthenaConfiguration.AllConfigFlags import ConfigFlags from MuonConfig.CSC_DigitizationConfig import CSC_DigitBuilderDigitToRDOCfg # Set up logging and new style config log.setLevel(DEBUG) Configurable.configurableRun3Behavior = True # Configure ConfigFlags.Input.Files = defaultTestFiles.HITS ConfigFlags.Output.RDOFileName = "myRDO.pool.root" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" ConfigFlags.lock() # Function tests # Construct our accumulator to run acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) acc.merge(CSC_DigitBuilderDigitToRDOCfg(ConfigFlags)) # Dump config acc.getService("StoreGateSvc").Dump = True acc.getService("ConditionStore").Dump = True acc.printConfig(withDetails=True) ConfigFlags.dump() # Execute and finish sc = acc.run(maxEvents=3) # Success should be 0 sys.exit(not sc.isSuccess())
import os from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG from AthenaCommon.Configurable import Configurable from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg # Set up logging and new style config log.setLevel(DEBUG) Configurable.configurableRun3Behavior = True from AthenaConfiguration.TestDefaults import defaultTestFiles # Provide MC input ConfigFlags.Input.Files = defaultTestFiles.AOD ConfigFlags.GeoModel.Align.Dynamic = True ConfigFlags.lock() # Construct ComponentAccumulator acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) acc.merge(AtlasGeometryCfg(ConfigFlags)) #acc.getService("StoreGateSvc").Dump=True acc.getService("ConditionStore").Dump=True acc.printConfig(withDetails=True) f=open('AtlasGeoModelCfg_HITS.pkl','wb') acc.store(f) f.close() ConfigFlags.dump() # Execute and finish acc.run(maxEvents=3)
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg cfg.merge(PoolReadCfg(ConfigFlags)) cfg.merge(PoolWriteCfg(ConfigFlags)) # todo its own cfg ... myRunNumber = 284500 myFirstLB = 1 myInitialTimeStamp = 1446539185 evtMax = 4 from AthenaConfiguration.ComponentFactory import CompFactory evtIdModifierSvc = CompFactory.EvtIdModifierSvc(EvtStoreName="StoreGateSvc") iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool() iovDbMetaDataTool.MinMaxRunNumbers = [myRunNumber, 2147483647] cfg.addPublicTool(iovDbMetaDataTool) EvtIdModifierSvc_add_modifier(evtIdModifierSvc, run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=evtMax) eventSelector = cfg.getService("EventSelector") eventSelector.OverrideRunNumber = True eventSelector.RunNumber = myRunNumber eventSelector.FirstLB = myFirstLB eventSelector.InitialTimeStamp = myInitialTimeStamp # Necessary to avoid a crash if hasattr(eventSelector, "OverrideRunNumberFromInput"): eventSelector.OverrideRunNumberFromInput = True cfg.addService(evtIdModifierSvc) # ... up to here? # add BeamEffectsAlg from BeamEffects.BeamEffectsAlgConfig import BeamEffectsAlgCfg cfg.merge(BeamEffectsAlgCfg(ConfigFlags)) # add the ISF_MainConfig from ISF_Config.ISF_MainConfigNew import Kernel_FullG4MTCfg
# cfg.merge( PoolReadCfg( ConfigFlags ) ) from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg cfg.merge(ByteStreamReadCfg(ConfigFlags)) acc = regSelCfg(ConfigFlags) cfg.merge(acc) RegSelTestAlg = CompFactory.RegSelTestAlg testerAlg = RegSelTestAlg() testerAlg.Mt = True testerAlg.OutputLevel = DEBUG cfg.addEventAlgo(testerAlg) AthenaPoolCnvSvc = CompFactory.AthenaPoolCnvSvc apcs = AthenaPoolCnvSvc() cfg.addService(apcs) EvtPersistencySvc = CompFactory.EvtPersistencySvc cfg.addService( EvtPersistencySvc("EventPersistencySvc", CnvServices=[ apcs.getFullJobOptName(), ])) cfg.getService("IOVDbSvc").OutputLevel = DEBUG cfg.store(open("test.pkl", "wb")) print("used flags") ConfigFlags.dump() cfg.run(0) print("All OK")
# Function tests accAlg = EventInfoCnvAlgCfg(ConfigFlags) # reset to prevent errors on deletion accAlg.__init__() # Construct our accumulator to run acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) # Add event info overlay acc.merge(EventInfoCnvAlgCfg(ConfigFlags)) # Add output acc.merge(OutputStreamCfg(ConfigFlags, "HITS")) # Dump config if args.verboseAccumulators: acc.printConfig(withDetails=True) acc.getService("StoreGateSvc").Dump = True ConfigFlags.dump() # Execute and finish sc = acc.run(maxEvents=args.maxEvents) # Dump config summary acc.printConfig(withDetails=False) # Success should be 0 sys.exit(not sc.isSuccess())
# 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
def TPCnvTest(infile, keys, useGeoModelSvc=False, useIOVDbSvc=False, doPixel=False, doSCT=False, doTRT=False, doLAr=False, doTile=False, doMuon=False): # Make sure we don't have a stale file catalog. if os.path.exists('PoolFileCatalog.xml'): os.remove('PoolFileCatalog.xml') if ('ATLAS_REFERENCE_TAG' not in globals() and 'ATLAS_REFERENCE_TAG' in os.environ): ATLAS_REFERENCE_TAG = os.environ['ATLAS_REFERENCE_TAG'] # noqa: F841 refpaths = [ os.environ.get('ATLAS_REFERENCE_DATA', None), '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art', '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs', '/afs/cern.ch/atlas/maxidisk/d33/referencefiles' ] if infile.startswith('rtt:'): infile = infile[4:] infile = find_file(infile, refpaths) # Provide MC input ConfigFlags.Input.Files = [infile] ConfigFlags.GeoModel.AtlasVersion = 'ATLAS-R1-2012-03-01-00' ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Detector.GeometryPixel = doPixel ConfigFlags.Detector.GeometrySCT = doSCT ConfigFlags.Detector.GeometryTRT = doTRT ConfigFlags.Detector.GeometryLAr = doLAr ConfigFlags.Detector.GeometryTile = doTile ConfigFlags.Detector.GeometryMuon = doMuon ConfigFlags.lock() # Construct ComponentAccumulator acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) if useIOVDbSvc: acc.merge(IOVDbSvcCfg(ConfigFlags)) if useGeoModelSvc: if ConfigFlags.Detector.GeometryPixel: acc.merge(PixelGeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometrySCT: acc.merge(SCT_GeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryTRT: acc.merge(TRT_GeometryCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryLAr: acc.merge(LArGMCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryTile: acc.merge(TileGMCfg(ConfigFlags)) useGeoModelSvc = True if ConfigFlags.Detector.GeometryMuon: acc.merge(MuonGeoModelCfg(ConfigFlags)) useGeoModelSvc = True #acc.merge(ForDetGeometryCfg(ConfigFlags)) acc.merge(GeoModelCfg(ConfigFlags)) acc.getService("GeoModelSvc").IgnoreTagDifference = True acc.addEventAlgo( Dumper('dumper', ConfigFlags.Input.Files[0], keys, refpaths), 'AthAlgSeq') return acc.run(maxEvents=10)
numThreads = 1 ConfigFlags.Concurrency.NumThreads = numThreads ConfigFlags.Concurrency.NumConcurrentEvents = numThreads # Might change this later, but good enough for the moment. ConfigFlags.Detector.GeometryPixel = True ConfigFlags.Detector.GeometrySCT = True ConfigFlags.InDet.doPixelClusterSplitting = True from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.RDO ConfigFlags.lock() ConfigFlags.dump() from AthenaConfiguration.MainServicesConfig import MainServicesCfg top_acc = MainServicesCfg(ConfigFlags) msgService = top_acc.getService('MessageSvc') msgService.Format = "S:%s E:%e % F%138W%S%7W%R%T %0W%M" acc = InDetClusterizationAlgorithmsCfg(ConfigFlags) top_acc.merge(acc) # import pdb ; pdb.set_trace() iovsvc = top_acc.getService('IOVDbSvc') iovsvc.OutputLevel = 5 ##acc.setAppProperty("EvtMax",25) ##acc.store(open("test_SiClusterization.pkl", "w")) top_acc.run(25) #with open('test4.pkl', mode="wb") as f: # dill.dump(acc, f) top_acc.store(open("test00.pkl", "wb"))
# First define the output list outputlist = ["EventInfo#*"] originaljets = ["AntiKt4EMPFlowJets", "AntiKt4EMTopoJets"] for jetcoll in originaljets: outputlist += [ "xAOD::JetContainer#" + jetcoll, "xAOD::JetAuxContainer#" + jetcoll + "Aux.-PseudoJet" ] for jetdef in jetdefs: key = "{0}{1}Jets".format("New", jetdef.basename) outputlist += [ "xAOD::JetContainer#" + key, "xAOD::JetAuxContainer#" + key + "Aux.-PseudoJet" ] # Now get the output stream components from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg cfg.merge(OutputStreamCfg(ConfigFlags, "xAOD", ItemList=outputlist)) pprint(cfg.getEventAlgo("OutputStreamxAOD").ItemList) # Optionally, print the contents of the store every event cfg.getService("StoreGateSvc").Dump = args.dumpSG # Save this configuration to a pickle file f = open("JetRecTest.pkl", "wb") cfg.store(f) f.close() # Run the job cfg.run(maxEvents=args.nEvents)