diff --git a/DDDigi/python/DDDigi.py b/DDDigi/python/DDDigi.py index e7da48f84913af38e18248cb5bd5824e9865867d..73ea412776f831139d22316e5b834edcbb9b97a6 100644 --- a/DDDigi/python/DDDigi.py +++ b/DDDigi/python/DDDigi.py @@ -132,7 +132,7 @@ def _getKernelProperty(self, name): #--------------------------------------------------------------------------- def _setKernelProperty(self, name, value): - if Interface.setPropertyKernel(self.get(),name,str(value)): + if Interface.setPropertyKernel(self.get(),str(name),str(value)): return msg = 'DigiKernel::SetProperty [Unhandled]: Cannot set Kernel.'+name+' = '+str(value) raise KeyError(msg) @@ -147,23 +147,23 @@ Kernel.terminate = _kernel_terminate ActionHandle = digi.ActionHandle #--------------------------------------------------------------------------- def Action(kernel, nam, parallel=False): - obj = Interface.createAction(kernel,nam) + obj = Interface.createAction(kernel,str(nam)) obj.parallel = parallel return obj #--------------------------------------------------------------------------- def TestAction(kernel, nam, sleep=0): - obj = Interface.createAction(kernel,'DigiTestAction/'+nam) + obj = Interface.createAction(kernel,str('DigiTestAction/'+nam)) if sleep != 0: obj.sleep = sleep return obj #--------------------------------------------------------------------------- def ActionSequence(kernel, nam, parallel=False): - obj = Interface.createSequence(kernel,nam) + obj = Interface.createSequence(kernel,str(nam)) obj.parallel = parallel return obj #--------------------------------------------------------------------------- def Synchronize(kernel, nam, parallel=False): - obj = Interface.createSync(kernel,nam) + obj = Interface.createSync(kernel,str(nam)) obj.parallel = parallel return obj #--------------------------------------------------------------------------- diff --git a/DDG4/examples/CLICSidSimuLCIO.py b/DDG4/examples/CLICSidSimuLCIO.py index ad86e1e46f1558f978cd267b1b66b73b7cf8dad4..bfed67f00f178091f491d8a32475bf0095f2a1e7 100644 --- a/DDG4/examples/CLICSidSimuLCIO.py +++ b/DDG4/examples/CLICSidSimuLCIO.py @@ -20,7 +20,7 @@ def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepINSTALL'] example_dir = install_dir+'/examples/DDG4/examples'; - kernel.loadGeometry("file:"+install_dir+"/examples/CLICSiD/compact/compact.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/CLICSiD/compact/compact.xml")) simple = DDG4.Simple(kernel,tracker='LcioTestTrackerAction') simple.printDetectors() @@ -124,11 +124,11 @@ def run(): # Now build the physics list: phys = simple.setupPhysics('QGSP_BERT') ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') - ph.addParticleConstructor('G4BosonConstructor') - ph.addParticleConstructor('G4LeptonConstructor') - ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) - ph.addPhysicsConstructor('G4StepLimiterPhysics') - ph.addPhysicsConstructor('G4OpticalPhysics') + ph.addParticleConstructor(str('G4BosonConstructor')) + ph.addParticleConstructor(str('G4LeptonConstructor')) + ph.addParticleProcess(str('e[+-]'),str('G4eMultipleScattering'),-1,1,1) + ph.addPhysicsConstructor(str('G4StepLimiterPhysics')) + ph.addPhysicsConstructor(str('G4OpticalPhysics')) ph.enableUI() phys.add(ph) diff --git a/DDG4/examples/CLICSidSimuMarkus.py b/DDG4/examples/CLICSidSimuMarkus.py index 7a30d0799b5c0d5c8638d6e300814773b5da5e28..1fa8486717ac7ea505fa2e2e87eaeebd9d3a39f5 100644 --- a/DDG4/examples/CLICSidSimuMarkus.py +++ b/DDG4/examples/CLICSidSimuMarkus.py @@ -44,7 +44,7 @@ def run(): description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] example_dir = install_dir+'/examples/DDG4/examples'; - kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml") + kernel.loadGeometry(str("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml")) ##kernel.loadXML("file:"+example_dir+"/DDG4_field.xml") DDG4.importConstants(description,debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') diff --git a/DDG4/examples/SiDSim.py b/DDG4/examples/SiDSim.py index 8d68f8a9c86fc81c0da4de849dd5d8e7e6fe6623..269eab120ee6d31a4357cba4db3c173cf7abda1d 100644 --- a/DDG4/examples/SiDSim.py +++ b/DDG4/examples/SiDSim.py @@ -22,7 +22,7 @@ def run(): kernel = DDG4.Kernel() description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") + kernel.loadGeometry(str("file:"+install_dir+"/DDDetectors/compact/SiD.xml")) DDG4.importConstants(description) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') @@ -169,11 +169,7 @@ def run(): logger.info("# Now build the physics list:") phys = geant4.setupPhysics('QGSP_BERT') - ph = geant4.addPhysics('Geant4PhysicsList/Myphysics') - #ph.addParticleConstructor('G4BosonConstructor') - #ph.addParticleConstructor('G4LeptonConstructor') - #ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) - #ph.addPhysicsConstructor('G4OpticalPhysics') + ph = geant4.addPhysics(str('Geant4PhysicsList/Myphysics')) # Add special particle types from specialized physics constructor part = geant4.addPhysics('Geant4ExtraParticles/ExtraParticles') diff --git a/DDG4/examples/SiDSim_MT.py b/DDG4/examples/SiDSim_MT.py index 82d0222a761e1c1f67b12b44544d78b4952f7deb..8cd3bc6e8bb3486621bf8791483b1848d37bc8f9 100644 --- a/DDG4/examples/SiDSim_MT.py +++ b/DDG4/examples/SiDSim_MT.py @@ -137,8 +137,8 @@ def run(): kernel = DDG4.Kernel() description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] - DDG4.Core.setPrintFormat("%-32s %6s %s") - kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") + DDG4.Core.setPrintFormat(str("%-32s %6s %s")) + kernel.loadGeometry(str("file:"+install_dir+"/DDDetectors/compact/SiD.xml")) DDG4.importConstants(description) kernel.NumberOfThreads = 3 diff --git a/DDG4/examples/SiD_Markus.py b/DDG4/examples/SiD_Markus.py index ae4c61acdc43f5230b69fb2c03a3b72ea92b1dda..4086943c0eddeb67077f3d1d44902caba3790248 100644 --- a/DDG4/examples/SiD_Markus.py +++ b/DDG4/examples/SiD_Markus.py @@ -152,10 +152,10 @@ def run(): kernel = DDG4.Kernel() description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml") + kernel.loadGeometry(str("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml")) DDG4.importConstants(description) DDG4.Core.setPrintLevel(Output.DEBUG) - DDG4.Core.setPrintFormat("%-32s %6s %s") + DDG4.Core.setPrintFormat(str("%-32s %6s %s")) kernel.NumberOfThreads = 1 geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerWeightedAction') diff --git a/DDG4/examples/readHEPMC.py b/DDG4/examples/readHEPMC.py index 3edf9f5ff468f74224c821e43628a80c7ff961b7..43cbf49da9a852dcb6bb5b4a52724c277c1a7841 100644 --- a/DDG4/examples/readHEPMC.py +++ b/DDG4/examples/readHEPMC.py @@ -23,7 +23,7 @@ def run(input_file): gen.Input = "Geant4EventReaderHepMC|"+input_file gen.OutputLevel = Output.DEBUG gen.HaveAbort = False - prim_vtx = DDG4.std_vector('dd4hep::sim::Geant4Vertex*')() + prim_vtx = DDG4.std_vector(str('dd4hep::sim::Geant4Vertex*'))() parts = gen.new_particles() ret = 1 evtid=0 diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index 214ae4523a9961ce4d6124b65bfb9f55ba3ea104..0e7b45060e9ad69372288a106efe5058f1d9cd00 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -165,7 +165,7 @@ Kernel.terminate = _kernel_terminate ActionHandle = Sim.ActionHandle #--------------------------------------------------------------------------- def SensitiveAction(kernel,nam,det,shared=False): - return Interface.createSensitive(kernel,str(nam),det,shared) + return Interface.createSensitive(kernel,str(nam),str(det),shared) #--------------------------------------------------------------------------- def Action(kernel,nam,shared=False): return Interface.createAction(kernel,str(nam), shared) @@ -512,7 +512,7 @@ class Geant4: logger.info('+++ List of sensitive detectors:') for i in self.description.detectors(): o = DetElement(i.second.ptr()) - sd = self.description.sensitiveDetector(o.name()) + sd = self.description.sensitiveDetector(str(o.name())) if sd.isValid(): typ = sd.type() sdtyp = 'Unknown' @@ -543,7 +543,7 @@ class Geant4: seq.enableUI() acts = [] if collections is None: - sd = self.description.sensitiveDetector(name) + sd = self.description.sensitiveDetector(str(name)) ro = sd.readout() collections = ro.collectionNames() if len(collections)==0: @@ -582,13 +582,13 @@ class Geant4: return (seq,acts[0]) def setupCalorimeter(self,name,type=None,collections=None): - sd = self.description.sensitiveDetector(name) + sd = self.description.sensitiveDetector(str(name)) ### sd.setType('calorimeter') if type is None: type = self.sensitive_types['calorimeter'] return self.setupDetector(name,type,collections) def setupTracker(self,name,type=None,collections=None): - sd = self.description.sensitiveDetector(name) + sd = self.description.sensitiveDetector(str(name)) ### sd.setType('tracker') if type is None: type = self.sensitive_types['tracker'] return self.setupDetector(name,type,collections) diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py index cb49d140f5a94bcbfca13b11853782c816932115..e736ea1140cc65eb1446e0a894d9d6eb8658b66b 100644 --- a/DDG4/python/DDSim/DD4hepSimulation.py +++ b/DDG4/python/DDSim/DD4hepSimulation.py @@ -290,7 +290,6 @@ class DD4hepSimulation(object): kernel = DDG4.Kernel() dd4hep.setPrintLevel(self.printLevel) - #kernel.setOutputLevel('Compact',1) kernel.loadGeometry(str("file:"+ self.compactFile )) detectorDescription = kernel.detectorDescription() diff --git a/DDG4/python/g4MaterialScan.py b/DDG4/python/g4MaterialScan.py index 988e3b65fbddad626ceb0f48a2857e60a415477e..c5029e32004e5ae4dc072f810a16c2d52167701d 100644 --- a/DDG4/python/g4MaterialScan.py +++ b/DDG4/python/g4MaterialScan.py @@ -26,8 +26,8 @@ def printOpts(opts): def materialScan(opts): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepINSTALL'] - kernel.loadGeometry(opts.compact) - DDG4.Core.setPrintFormat("%-32s %6s %s") + kernel.loadGeometry(str(opts.compact)) + DDG4.Core.setPrintFormat(str("%-32s %6s %s")) geant4 = DDG4.Geant4(kernel) # Configure UI geant4.setupCshUI(ui=None) diff --git a/examples/CLICSiD/scripts/CLICSiDScan.py b/examples/CLICSiD/scripts/CLICSiDScan.py index 811d146cae6d3bed456825b0d8216630417b5fa9..de4cdb8f78da1dc6683d9e665bf9c7a0eba6f383 100644 --- a/examples/CLICSiD/scripts/CLICSiDScan.py +++ b/examples/CLICSiD/scripts/CLICSiDScan.py @@ -18,7 +18,7 @@ def run(): sid = CLICSid.CLICSid() sid.loadGeometry() - DDG4.Core.setPrintFormat("%-32s %6s %s") + DDG4.Core.setPrintFormat(str("%-32s %6s %s")) geant4 = sid.geant4 # Configure UI sid.geant4.setupCshUI(ui=None) diff --git a/examples/CLICSiD/scripts/CLICSiD_LoadROOTGeo.py b/examples/CLICSiD/scripts/CLICSiD_LoadROOTGeo.py index 1a91628272632f1bf6cae96d11d512592ac56819..f32401fc28c6c1722152a53e1dc05f14d2256912 100644 --- a/examples/CLICSiD/scripts/CLICSiD_LoadROOTGeo.py +++ b/examples/CLICSiD/scripts/CLICSiD_LoadROOTGeo.py @@ -21,7 +21,7 @@ def run(): sid = CLICSid.CLICSid() geant4 = sid.geant4 kernel = sid.kernel - sid.loadGeometry('CLICSiD_geometry.root') + sid.loadGeometry(str('CLICSiD_geometry.root')) geant4.printDetectors() if len(sys.argv) >= 2 and sys.argv[1] =="batch": diff --git a/examples/CLICSiD/scripts/CLICSid.py b/examples/CLICSiD/scripts/CLICSid.py index 79ab3ca01c7a7aed80c9e22a1d60cb52ed49e2d3..6e677885a8523b44f946ad3365cab0893af9bae1 100644 --- a/examples/CLICSiD/scripts/CLICSid.py +++ b/examples/CLICSiD/scripts/CLICSid.py @@ -20,7 +20,7 @@ class CLICSid: install_dir = os.environ['DD4hepINSTALL'] level = DDG4.printLevel() DDG4.setPrintLevel(DDG4.OutputLevel.WARNING) - self.kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") + self.kernel.loadGeometry(str("file:"+install_dir+"/DDDetectors/compact/SiD.xml")) DDG4.setPrintLevel(level) else: ui = DDG4.DD4hepUI(self.description) @@ -43,15 +43,15 @@ class CLICSid: # Example to show how to configure the Geant4 physics list def setupPhysics(self, model): phys = self.geant4.setupPhysics(model) - ph = DDG4.PhysicsList(self.kernel,'Geant4PhysicsList/Myphysics') + ph = DDG4.PhysicsList(self.kernel,str('Geant4PhysicsList/Myphysics')) # Add bosons to the model (redundant if already implemented by the model) - ph.addParticleGroup('G4BosonConstructor') + ph.addParticleGroup(str('G4BosonConstructor')) # Add leptons to the model (redundant if already implemented by the model) - ph.addParticleGroup('G4LeptonConstructor') + ph.addParticleGroup(str('G4LeptonConstructor')) # Add multiple scattering in the material - ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) + ph.addParticleProcess(str('e[+-]'),str('G4eMultipleScattering'),-1,1,1) # Add optical physics (RICH dets etc) - ph.addPhysicsConstructor('G4OpticalPhysics') + ph.addPhysicsConstructor(str('G4OpticalPhysics')) # Interactivity ph.enableUI() phys.adopt(ph) diff --git a/examples/CLICSiD/scripts/testDDPython.py b/examples/CLICSiD/scripts/testDDPython.py index 5a3e86c097616d0bccfa72bd48de67ff0f9cc575..ed62dd3abbe94bc4b9bb31b3cdd8157df3d1987a 100644 --- a/examples/CLICSiD/scripts/testDDPython.py +++ b/examples/CLICSiD/scripts/testDDPython.py @@ -38,8 +38,8 @@ class a_class: py = import_namespace_item('Core','DDPython') logger.info('+++++ Test: Execute statements in python with C++ indirection') -py.instance().execute('import sys, logging') -py.instance().execute('logging.info("Arguments: %s", str(sys.argv))') +py.instance().execute(str('import sys, logging')) +py.instance().execute(str('logging.info("Arguments: %s", str(sys.argv))')) logger.info('\n') obj=a_class() diff --git a/examples/ClientTests/scripts/Assemblies.py b/examples/ClientTests/scripts/Assemblies.py index 76ce5c3679c738692d2ab5118f7fd45823499b26..31be521039a0c90996a7eeb6e787bd6253b3f96d 100644 --- a/examples/ClientTests/scripts/Assemblies.py +++ b/examples/ClientTests/scripts/Assemblies.py @@ -12,7 +12,7 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/Assemblies.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/Assemblies.xml")) # geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() diff --git a/examples/ClientTests/scripts/DDG4TestSetup.py b/examples/ClientTests/scripts/DDG4TestSetup.py index b21db2b5b4ba39b49ac6f7e4f8d24ca34235d01e..a4d820664bb01e1f733cd338d21f42d95b2c9d87 100644 --- a/examples/ClientTests/scripts/DDG4TestSetup.py +++ b/examples/ClientTests/scripts/DDG4TestSetup.py @@ -18,9 +18,9 @@ logger.setLevel(logging.INFO) class Setup: def __init__(self, geometry_file): self.kernel = DDG4.Kernel() - self.kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - self.kernel.setOutputLevel('Gun',Output.INFO) - self.kernel.loadGeometry(geometry_file) + self.kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + self.kernel.setOutputLevel(str('Gun'),Output.INFO) + self.kernel.loadGeometry(str(geometry_file)) self.geant4 = DDG4.Geant4(self.kernel) self.geant4.printDetectors() diff --git a/examples/ClientTests/scripts/FCC_Hcal.py b/examples/ClientTests/scripts/FCC_Hcal.py index 9ef697adafdfea8e6e1e3c6a88c6d85c1dece522..6195858595fe0659b3a1aa81b352271dec65dcf1 100644 --- a/examples/ClientTests/scripts/FCC_Hcal.py +++ b/examples/ClientTests/scripts/FCC_Hcal.py @@ -16,11 +16,11 @@ def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepINSTALL'] example_dir = install_dir+'/examples/DDG4/examples'; - kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - kernel.setOutputLevel('RootOutput',Output.INFO) - kernel.setOutputLevel('ShellHandler',Output.DEBUG) - kernel.setOutputLevel('Gun',Output.INFO) - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/FCC_HcalBarrel.xml") + kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + kernel.setOutputLevel(str('RootOutput'),Output.INFO) + kernel.setOutputLevel(str('ShellHandler'),Output.DEBUG) + kernel.setOutputLevel(str('Gun'),Output.INFO) + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/FCC_HcalBarrel.xml")) geant4 = DDG4.Geant4(kernel) geant4.printDetectors() diff --git a/examples/ClientTests/scripts/LheD_tracker.py b/examples/ClientTests/scripts/LheD_tracker.py index 2e8f561dc61ad7cfc1b4ac17a9262b2a79e99f17..465b21271b9c55a780554b262e2607b07ca2ba8f 100644 --- a/examples/ClientTests/scripts/LheD_tracker.py +++ b/examples/ClientTests/scripts/LheD_tracker.py @@ -25,7 +25,7 @@ def run(): description = kernel.detectorDescription() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/LheD_tracker.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/LheD_tracker.xml")) DDG4.importConstants(description,debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') @@ -58,8 +58,8 @@ def run(): # Now build the physics list: phys = geant4.setupPhysics('QGSP_BERT') ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') - ph.addParticleConstructor('G4Geantino') - ph.addParticleConstructor('G4BosonConstructor') + ph.addParticleConstructor(str('G4Geantino')) + ph.addParticleConstructor(str('G4BosonConstructor')) ph.enableUI() phys.adopt(ph) phys.dump() diff --git a/examples/ClientTests/scripts/MultiCollections.py b/examples/ClientTests/scripts/MultiCollections.py index 20ef1d7f42a4c3538d95bcaf3e2237e52427680e..34be915e9a99d235b5260b0560b8862641441401 100644 --- a/examples/ClientTests/scripts/MultiCollections.py +++ b/examples/ClientTests/scripts/MultiCollections.py @@ -17,8 +17,8 @@ def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] geometry = "file:"+install_dir+"/examples/ClientTests/compact/MultiCollections.xml" - kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - kernel.setOutputLevel('Gun',Output.INFO) + kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + kernel.setOutputLevel(str('Gun'),Output.INFO) for i in xrange(len(sys.argv)): if sys.argv[i]=='-compact': geometry = sys.argv[i+1] @@ -29,7 +29,7 @@ def run(): elif sys.argv[i]=='batch': batch = True - kernel.loadGeometry(geometry) + kernel.loadGeometry(str(geometry)) geant4 = DDG4.Geant4(kernel) geant4.printDetectors() geant4.setupCshUI() diff --git a/examples/ClientTests/scripts/MultiSegmentCollections.py b/examples/ClientTests/scripts/MultiSegmentCollections.py index 167c44cc4db0bcc2906dc0b4b8a5befad8371799..f1a2ff9a1a3a80dc5af7cbee8af5e2153fe6f4f0 100644 --- a/examples/ClientTests/scripts/MultiSegmentCollections.py +++ b/examples/ClientTests/scripts/MultiSegmentCollections.py @@ -17,8 +17,8 @@ def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] geometry = "file:"+install_dir+"/examples/ClientTests/compact/MultiSegmentCollections.xml" - kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - kernel.setOutputLevel('Gun',Output.INFO) + kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + kernel.setOutputLevel(str('Gun'),Output.INFO) for i in xrange(len(sys.argv)): if sys.argv[i]=='-compact': geometry = sys.argv[i+1] @@ -29,7 +29,7 @@ def run(): elif sys.argv[i]=='batch': batch = True - kernel.loadGeometry(geometry) + kernel.loadGeometry(str(geometry)) geant4 = DDG4.Geant4(kernel) geant4.printDetectors() geant4.setupCshUI() diff --git a/examples/ClientTests/scripts/NestedDetectors.py b/examples/ClientTests/scripts/NestedDetectors.py index dc5627cf19f157aa3c94cd78338158ab04202da0..69647c5dc8198aa47a0ee89805293cb73b22ba9a 100644 --- a/examples/ClientTests/scripts/NestedDetectors.py +++ b/examples/ClientTests/scripts/NestedDetectors.py @@ -15,9 +15,9 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - kernel.setOutputLevel('Gun',Output.INFO) - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/NestedDetectors.xml") + kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + kernel.setOutputLevel(str('Gun'),Output.INFO) + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/NestedDetectors.xml")) geant4 = DDG4.Geant4(kernel) geant4.printDetectors() diff --git a/examples/ClientTests/scripts/SiliconBlock.py b/examples/ClientTests/scripts/SiliconBlock.py index 358d9928d14491fb3dde440062cc4d6efeba876a..5fd14a5bc8d2322223f54d4b05819f8f3adcf5bf 100644 --- a/examples/ClientTests/scripts/SiliconBlock.py +++ b/examples/ClientTests/scripts/SiliconBlock.py @@ -17,7 +17,7 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/SiliconBlock.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/SiliconBlock.xml")) DDG4.importConstants(kernel.detectorDescription(),debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') diff --git a/examples/ClientTests/scripts/TrackingRegion.py b/examples/ClientTests/scripts/TrackingRegion.py index f1954a7f5d56c27aa3fe91480f5ba59a699a3375..f89ba5e2c1a7a48690b8b48c8c5b2446de82f8de 100644 --- a/examples/ClientTests/scripts/TrackingRegion.py +++ b/examples/ClientTests/scripts/TrackingRegion.py @@ -14,7 +14,7 @@ import os, sys, time, DDG4 def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/TrackingRegion.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/TrackingRegion.xml")) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') # Configure field ##field = geant4.setupTrackingField(prt=True) diff --git a/examples/DDCMS/scripts/CMSTrackerSim.py b/examples/DDCMS/scripts/CMSTrackerSim.py index 40d6be5635dba5e376bd8b9092b25a7b19305a6c..632f7fb9378f9c7a6085fd740ae766d6cbfa4f5c 100644 --- a/examples/DDCMS/scripts/CMSTrackerSim.py +++ b/examples/DDCMS/scripts/CMSTrackerSim.py @@ -21,9 +21,9 @@ logger.setLevel(logging.INFO) def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepINSTALL'] - kernel.setOutputLevel('Geant4Converter',Output.DEBUG) - kernel.setOutputLevel('Gun',Output.INFO) - kernel.detectorDescription().fromXML("file:"+install_dir+"/examples/DDCMS/data/dd4hep-config.xml"); + kernel.setOutputLevel(str('Geant4Converter'),Output.DEBUG) + kernel.setOutputLevel(str('Gun'),Output.INFO) + kernel.detectorDescription().fromXML(str("file:"+install_dir+"/examples/DDCMS/data/dd4hep-config.xml")); kernel.NumEvents = 5 geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() diff --git a/examples/DDCodex/python/CODEX-b-alone.py b/examples/DDCodex/python/CODEX-b-alone.py index e6941fc5723ebf9872cf7dbdc72e36146a979f99..64915c6369b9f6e08fb2d106ecf9fab05cd9684a 100755 --- a/examples/DDCodex/python/CODEX-b-alone.py +++ b/examples/DDCodex/python/CODEX-b-alone.py @@ -17,7 +17,7 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/DDCodex/compact/CODEX-b-alone.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/DDCodex/compact/CODEX-b-alone.xml")) DDG4.importConstants(kernel.detectorDescription(),debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') diff --git a/examples/DDDigi/scripts/TestFramework.py b/examples/DDDigi/scripts/TestFramework.py index f0a0c61dffb15070c726763bcdbc80a1d23eb4e0..7975af40cc06b70afaeef82c996883f16d72b6ad 100644 --- a/examples/DDDigi/scripts/TestFramework.py +++ b/examples/DDDigi/scripts/TestFramework.py @@ -3,11 +3,11 @@ from __future__ import absolute_import, unicode_literals import os, sys, DDDigi -DDDigi.setPrintFormat('%-32s %5s %s') +DDDigi.setPrintFormat(str('%-32s %5s %s')) kernel = DDDigi.Kernel() install_dir = os.environ['DD4hepINSTALL'] fname = "file:"+install_dir+"/examples/ClientTests/compact/MiniTel.xml" -kernel.loadGeometry(fname) +kernel.loadGeometry(str(fname)) kernel.printProperties() digi = DDDigi.Digitize(kernel) digi.printDetectors() diff --git a/examples/DDG4_MySensDet/scripts/MyTrackerSD_sim.py b/examples/DDG4_MySensDet/scripts/MyTrackerSD_sim.py index d09278108f93fd2ea68ea655ca87cb6b7c9a8aa2..2c4e5f28f4b0e1b9e4f44e977bf5c9a822de02f3 100644 --- a/examples/DDG4_MySensDet/scripts/MyTrackerSD_sim.py +++ b/examples/DDG4_MySensDet/scripts/MyTrackerSD_sim.py @@ -17,7 +17,7 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/SiliconBlock.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/ClientTests/compact/SiliconBlock.xml")) DDG4.importConstants(kernel.detectorDescription(),debug=False) # ======================================================================================= # ===> This is actually the ONLY difference to ClientTests/scripts/SiliconBlock.py diff --git a/examples/LHeD/scripts/LHeD.py b/examples/LHeD/scripts/LHeD.py index eac078b9cd29c824302cc014212c8862c5c6f5c7..596fef71a6d0effebdc87910064e6bf0f96eef46 100644 --- a/examples/LHeD/scripts/LHeD.py +++ b/examples/LHeD/scripts/LHeD.py @@ -17,7 +17,7 @@ class LHeD: def loadGeometry(self): import os install_dir = os.environ['DD4hepExamplesINSTALL'] - self.kernel.loadGeometry("file:"+install_dir+"/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml") + self.kernel.loadGeometry(str("file:"+install_dir+"/examples/LHeD/compact/compact_Lhe_dip_sol_ell.xml")) return self # Example to show how to configure G4 magnetic field tracking @@ -38,13 +38,13 @@ class LHeD: phys = self.geant4.setupPhysics(model) ph = DDG4.PhysicsList(self.kernel,'Geant4PhysicsList/Myphysics') # Add bosons to the model (redundant if already implemented by the model) - ph.addParticleGroup('G4BosonConstructor') + ph.addParticleGroup(str('G4BosonConstructor')) # Add leptons to the model (redundant if already implemented by the model) - ph.addParticleGroup('G4LeptonConstructor') + ph.addParticleGroup(str('G4LeptonConstructor')) # Add multiple scattering in the material - ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) + ph.addParticleProcess(str('e[+-]'),str('G4eMultipleScattering'),-1,1,1) # Add optical physics (RICH dets etc) - ph.addPhysicsConstructor('G4OpticalPhysics') + ph.addPhysicsConstructor(str('G4OpticalPhysics')) # Interactivity ph.enableUI() phys.adopt(ph) diff --git a/examples/LHeD/scripts/LHeDScan.py b/examples/LHeD/scripts/LHeDScan.py index 6f824c639038c5624d40572fbdb73cb2d820460b..413d4d6775930486c14bdb472858476c04789b60 100644 --- a/examples/LHeD/scripts/LHeDScan.py +++ b/examples/LHeD/scripts/LHeDScan.py @@ -18,8 +18,8 @@ def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/LHeD/compact/compact.xml") - DDG4.Core.setPrintFormat("%-32s %6s %s") + kernel.loadGeometry(str("file:"+install_dir+"/examples/LHeD/compact/compact.xml")) + DDG4.Core.setPrintFormat(str("%-32s %6s %s")) geant4 = DDG4.Geant4(kernel) # Configure UI geant4.setupCshUI(ui=None) diff --git a/examples/LHeD/scripts/LheSimu.py b/examples/LHeD/scripts/LheSimu.py index 6238f3b25b1d3422feaccf88001117fb98d72cd4..0995c2c17e80ae3eaafd2985a4c5c488c271f610 100644 --- a/examples/LHeD/scripts/LheSimu.py +++ b/examples/LHeD/scripts/LheSimu.py @@ -315,11 +315,11 @@ def run(): # Now build the physics list: phys = geant4.setupPhysics('QGSP_BERT') ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') - ph.addParticleConstructor('G4Geantino') - ph.addParticleConstructor('G4BosonConstructor') - ph.addParticleConstructor('G4LeptonConstructor') - ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) - ph.addPhysicsConstructor('G4OpticalPhysics') + ph.addParticleConstructor(str('G4Geantino')) + ph.addParticleConstructor(str('G4BosonConstructor')) + ph.addParticleConstructor(str('G4LeptonConstructor')) + ph.addParticleProcess(str('e[+-]'),str('G4eMultipleScattering'),-1,1,1) + ph.addPhysicsConstructor(str('G4OpticalPhysics')) ph.enableUI() phys.adopt(ph) phys.dump() diff --git a/examples/OpticalSurfaces/scripts/OpNovice.py b/examples/OpticalSurfaces/scripts/OpNovice.py index 5b8eafd0a1aacc9031f3e506260b24b1fa2fdb72..6fc2bb27e410b441b19a8dae616881cf7ab1758a 100644 --- a/examples/OpticalSurfaces/scripts/OpNovice.py +++ b/examples/OpticalSurfaces/scripts/OpNovice.py @@ -17,7 +17,7 @@ from SystemOfUnits import * def run(): kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] - kernel.loadGeometry("file:"+install_dir+"/examples/OpticalSurfaces/compact/OpNovice.xml") + kernel.loadGeometry(str("file:"+install_dir+"/examples/OpticalSurfaces/compact/OpNovice.xml")) DDG4.importConstants(kernel.detectorDescription(),debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') @@ -83,14 +83,14 @@ def run(): ph.addDiscreteParticleProcess('gamma', 'G4GammaConversion') ph.addDiscreteParticleProcess('gamma', 'G4ComptonScattering') ph.addDiscreteParticleProcess('gamma', 'G4PhotoElectricEffect') - ph.addParticleProcess('e[+-]', 'G4eMultipleScattering', -1, 1, 1) - ph.addParticleProcess('e[+-]', 'G4eIonisation', -1, 2, 2) - ph.addParticleProcess('e[+-]', 'G4eBremsstrahlung', -1, 3, 3) - ph.addParticleProcess('e+', 'G4eplusAnnihilation', 0,-1, 4) - ph.addParticleProcess('mu[+-]', 'G4MuMultipleScattering',-1, 1, 1) - ph.addParticleProcess('mu[+-]', 'G4MuIonisation', -1, 2, 2) - ph.addParticleProcess('mu[+-]', 'G4MuBremsstrahlung', -1, 3, 3) - ph.addParticleProcess('mu[+-]', 'G4MuPairProduction', -1, 4, 4) + ph.addParticleProcess(str('e[+-]'), str('G4eMultipleScattering'), -1, 1, 1) + ph.addParticleProcess(str('e[+-]'), str('G4eIonisation'), -1, 2, 2) + ph.addParticleProcess(str('e[+-]'), str('G4eBremsstrahlung'), -1, 3, 3) + ph.addParticleProcess(str('e+'), str('G4eplusAnnihilation'), 0,-1, 4) + ph.addParticleProcess(str('mu[+-]'), str('G4MuMultipleScattering'),-1, 1, 1) + ph.addParticleProcess(str('mu[+-]'), str('G4MuIonisation'), -1, 2, 2) + ph.addParticleProcess(str('mu[+-]'), str('G4MuBremsstrahlung'), -1, 3, 3) + ph.addParticleProcess(str('mu[+-]'), str('G4MuPairProduction'), -1, 4, 4) ph.enableUI() phys.adopt(ph)