diff --git a/Generators/GeneratorModules/python/EvgenAlg.py b/Generators/GeneratorModules/python/EvgenAlg.py index 878765d65ae001948c094450dafbab5b38d6cca1..4355c766c79c38c7dd6317f3fd4c9004de2d72c5 100644 --- a/Generators/GeneratorModules/python/EvgenAlg.py +++ b/Generators/GeneratorModules/python/EvgenAlg.py @@ -34,8 +34,11 @@ class EvgenAlg(PyAthena.Alg): def execute(self): - from AthenaPython.PyAthena import McEventCollection, HepMC - + from AthenaPython.PyAthena import McEventCollection + try: + from AthenaPython.PyAthena import HepMC3 as HepMC + except ImportError: + from AthenaPython.PyAthena import HepMC as HepMC self.msg.debug("Executing [%s]", self.getName()) ## Retrieve MC event collection or create a new one diff --git a/Generators/ParticleGun/python/__init__.py b/Generators/ParticleGun/python/__init__.py index fcd9a3056102080fd4b1a12ad74bc61ce47e9780..2ee18eb4fd062e83cb51df39b9c056228ff422d2 100644 --- a/Generators/ParticleGun/python/__init__.py +++ b/Generators/ParticleGun/python/__init__.py @@ -69,7 +69,10 @@ class ParticleGun(EvgenAlg): """ ## Set event weight(s) # TODO: allow weighted sampling? - from AthenaPython.PyAthena import HepMC + try: + from AthenaPython.PyAthena import HepMC3 as HepMC + except ImportError: + from AthenaPython.PyAthena import HepMC as HepMC evt.weights().push_back(1.0) ## Make and fill particles