diff --git a/Simulation/BeamEffects/python/BeamEffectsAlgConfig.py b/Simulation/BeamEffects/python/BeamEffectsAlgConfig.py index baae1d130d89e10398dea878de53319f8aed74df..5acb0ed27f4a645eb4cf63fb8e33ece1001d2115 100755 --- a/Simulation/BeamEffects/python/BeamEffectsAlgConfig.py +++ b/Simulation/BeamEffects/python/BeamEffectsAlgConfig.py @@ -102,7 +102,7 @@ def BeamEffectsAlgBasicCfg(ConfigFlags, **kwargs): alg = Simulation__BeamEffectsAlg(name="BeamEffectsAlg", **kwargs) # Set default properties - alg.ISFRun = False + alg.ISFRun = ConfigFlags.Sim.ISFRun alg.InputMcEventCollection = "GEN_EVENT" alg.OutputMcEventCollection = "BeamTruthEvent" diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py index d7da235d5aba8660917d735b6802ff121aaf1ee0..d93468092c307e1db6c9b497e5fd3056b8e36f4e 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py +++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfigNew.py @@ -87,9 +87,8 @@ def Kernel_FullG4MTCfg(flags, name="ISF_Kernel_FullG4MT", **kwargs): acc = ComponentAccumulator() acc.merge(ParticleKillerToolCfg(flags)) - acc.merge(FullGeant4ToolCfg(flags)) + Fulltool = acc.popToolsAndMerge(FullGeant4ToolCfg(flags)) PKtool = acc.getPublicTool("ISF_ParticleKillerTool") - Fulltool = acc.getPublicTool("ISF_FullGeant4Tool") kwargs.setdefault("SimulationTools", [PKtool, Fulltool]) acc.merge(Kernel_GenericG4OnlyMTCfg(flags, name, **kwargs)) diff --git a/Simulation/ISF/ISF_Config/test/ISF_MainConfigNew_Test.py b/Simulation/ISF/ISF_Config/test/ISF_MainConfigNew_Test.py index 441273c0e6424dff4bad5335fc072fd16f4cf7e8..eba37944670f66c483e6193f160d2b90cf522e59 100644 --- a/Simulation/ISF/ISF_Config/test/ISF_MainConfigNew_Test.py +++ b/Simulation/ISF/ISF_Config/test/ISF_MainConfigNew_Test.py @@ -15,6 +15,7 @@ def EvtIdModifierSvc_add_modifier(svc, else: modify_run_nbr = 1 + if evt_nbr is None: modify_evt_nbr = 0 evt_nbr = 0 @@ -64,12 +65,12 @@ if __name__ == '__main__': from AthenaConfiguration.TestDefaults import defaultTestFiles inputDir = defaultTestFiles.d ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.evgen.EVNT.e4993.EVNT.08166201._000012.pool.root.1'] #defaultTestFiles.EVNT - ConfigFlags.Output.HITSFileName = "myHITSnew1106_2.pool.root" + ConfigFlags.Output.HITSFileName = "myHITSnew.pool.root" #Sim ConfigFlags #ConfigFlags.Sim.WorldRRange = 15000 #ConfigFlags.Sim.WorldZRange = 27000 #change defaults? - ConfigFlags.Sim.CalibrationRun = "Off" + ConfigFlags.Sim.CalibrationRun = "Off" #"DeadLAr" ConfigFlags.Sim.RecordStepInfo = False ConfigFlags.Sim.CavernBG = "Signal" ConfigFlags.Sim.BeamPipeSimMode = 'FastSim' @@ -130,6 +131,10 @@ if __name__ == '__main__': ConfigFlags.Detector.SimulateFwdRegion = False ConfigFlags.Detector.SimulateForward = False + #Frozen showers OFF = 0 + ConfigFlags.Sim.LArParameterization = 2 + + ConfigFlags.Sim.TruthStrategy = "MC15aPlus" # Finalize ConfigFlags.lock() @@ -143,7 +148,7 @@ if __name__ == '__main__': myRunNumber = 284500 myFirstLB = 1 myInitialTimeStamp = 1446539185 - evtMax = 4 + evtMax = 1 from AthenaConfiguration.ComponentFactory import CompFactory evtIdModifierSvc = CompFactory.EvtIdModifierSvc(EvtStoreName="StoreGateSvc") iovDbMetaDataTool = CompFactory.IOVDbMetaDataTool() @@ -171,6 +176,72 @@ if __name__ == '__main__': from TileGeoG4SD.TileGeoG4SDToolConfig import TileGeoG4SDCalcCfg cfg.merge(TileGeoG4SDCalcCfg(ConfigFlags)) + + + #Add to item list + #TODO - make a separate function (combine with G4AtlasAlg one?) + ItemList = ["EventInfo#*", + "McEventCollection#TruthEvent", + "JetCollection#*"] + + if ConfigFlags.Sim.IncludeParentsInG4Event: + ItemList += ["McEventCollection#GEN_EVENT"] + + ItemList += ["xAOD::JetContainer#*", + "xAOD::JetAuxContainer#*"] + + if ConfigFlags.Detector.SimulateID: + ItemList += ["SiHitCollection#*", + "TRTUncompressedHitCollection#*", + "TrackRecordCollection#CaloEntryLayer"] + + if ConfigFlags.Detector.SimulateITk: + ItemList += ["SiHitCollection#*", + "TrackRecordCollection#CaloEntryLayer"] + + if ConfigFlags.Detector.SimulateCalo: + ItemList += ["CaloCalibrationHitContainer#*", + "LArHitContainer#*", + "TileHitVector#*", + "TrackRecordCollection#MuonEntryLayer"] + + if ConfigFlags.Detector.SimulateMuon: + ItemList += ["RPCSimHitCollection#*", + "TGCSimHitCollection#*", + "MDTSimHitCollection#*", + "TrackRecordCollection#MuonExitLayer"] + if ConfigFlags.Detector.GeometryCSC: + ItemList += ["CSCSimHitCollection#*"] + if ConfigFlags.Detector.GeometrysTGC: + ItemList += ["sTGCSimHitCollection#*"] + if ConfigFlags.Detector.GeometryMM: + ItemList += ["MMSimHitCollection#*"] + + if ConfigFlags.Detector.SimulateLucid: + ItemList += ["LUCID_SimHitCollection#*"] + + if ConfigFlags.Detector.SimulateFwdRegion: + ItemList += ["SimulationHitCollection#*"] + + if ConfigFlags.Detector.SimulateZDC: + ItemList += ["ZDC_SimPixelHit_Collection#*", + "ZDC_SimStripHit_Collection#*"] + + if ConfigFlags.Detector.SimulateALFA: + ItemList += ["ALFA_HitCollection#*", + "ALFA_ODHitCollection#*"] + + if ConfigFlags.Detector.SimulateAFP: + ItemList += ["AFP_TDSimHitCollection#*", + "AFP_SIDSimHitCollection#*"] + + # TimingAlg + ItemList += ["RecoTimingObj#EVNTtoHITS_timings"] + + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + cfg.merge( OutputStreamCfg(ConfigFlags,"HITS", ItemList=ItemList, disableEventTag=True) ) + + # FIXME hack to match to buggy behaviour in old style configuration OutputStreamHITS = cfg.getEventAlgo("OutputStreamHITS") OutputStreamHITS.ItemList.remove("xAOD::EventInfo#EventInfo") @@ -193,7 +264,7 @@ if __name__ == '__main__': sc = cfg.run(maxEvents=evtMax) b = time.time() - log.info("Run G4AtlasAlg in " + str(b-a) + " seconds") + log.info("Run ISF_MainConfigNew_Test in " + str(b-a) + " seconds") # Success should be 0 #os.sys.exit(not sc.isSuccess()) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py index a3dccf52b7a660d7561f400e782c8cbbace98de9..480d0a898236be71e60de48fac4c120af267ed1f 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py @@ -4,7 +4,9 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentFactory import CompFactory from RngComps.RandomServices import RNG -from G4AtlasServices.G4AtlasServicesConfigNew import DetectorGeometrySvcCfg +from G4AtlasServices.G4AtlasServicesConfigNew import ( + DetectorGeometrySvcCfg, PhysicsListSvcCfg +) from G4AtlasServices.G4AtlasUserActionConfigNew import ( ISFUserActionSvcCfg, ISFFullUserActionSvcCfg, ISFPassBackUserActionSvcCfg, ISF_AFIIUserActionSvcCfg, @@ -19,7 +21,7 @@ from ISF_FatrasServices.ISF_FatrasConfig import G4RunManagerHelperCfg def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): - acc = RNG(flags.Random.Engine) + acc = RNG(flags.Random.Engine, name="AthRNGSvc") kwargs.setdefault("RandomNumberService", acc.getService("AthRNGSvc")) acc.merge(DetectorGeometrySvcCfg(flags)) @@ -28,8 +30,11 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): acc.merge(InputConverterCfg(flags)) kwargs.setdefault("InputConverter", acc.getService("ISF_InputConverter")) - acc.merge(ISFUserActionSvcCfg(flags)) - kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFUserActionSvc")) + #Only add it if it's not added already + if "UserActionSvc" not in kwargs.keys(): + acc.merge(ISFUserActionSvcCfg(flags)) + kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFUserActionSvc")) + kwargs.setdefault("RecordFlux", flags.Sim.RecordFlux) kwargs.setdefault("MultiThreading", flags.Concurrency.NumThreads > 0) @@ -42,20 +47,26 @@ def Geant4ToolCfg(flags, name="ISF_Geant4Tool", **kwargs): acc.merge(FastSimulationMasterToolCfg(flags)) tool = acc.getPublicTool("FastSimulationMasterTool") kwargs.setdefault("FastSimMasterTool", tool) + + #PhysicsListSvc + acc.merge( PhysicsListSvcCfg(flags) ) + kwargs.setdefault("PhysicsListSvc", acc.getService( "PhysicsListSvc") ) + # Workaround to keep other simulation flavours working while we migrate everything to be AthenaMT-compatible. if flags.Sim.ISF.Simulator in ["FullG4", "FullG4MT", "PassBackG4", "PassBackG4MT", "G4FastCalo", "G4FastCaloMT"]: - acc.addPublicTool(CompFactory.iGeant4.G4TransportTool(name, **kwargs)) + acc.setPrivateTools(CompFactory.iGeant4.G4TransportTool(name, **kwargs)) else: acc.merge(G4RunManagerHelperCfg(flags)) kwargs.setdefault("G4RunManagerHelper", acc.getPublicTool("ISF_G4RunManagerHelper")) - acc.addPublicTool(CompFactory.iGeant4.G4LegacyTransportTool(name, **kwargs)) + acc.setPrivateTools(CompFactory.iGeant4.G4LegacyTransportTool(name, **kwargs)) return acc def FullGeant4ToolCfg(flags, name="ISF_FullGeant4Tool", **kwargs): acc = ISFFullUserActionSvcCfg(flags) kwargs.setdefault("UserActionSvc", acc.getService("G4UA::ISFFullUserActionSvc")) - acc.merge(Geant4ToolCfg(flags, name, **kwargs)) + FullGeant4Tool = acc.popToolsAndMerge(Geant4ToolCfg(flags, name, **kwargs)) + acc.setPrivateTools(FullGeant4Tool) return acc