diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py index 41e41c22488508b1f100625c0aeceb5d1e9c7a5c..c9d995820fd96354c3e6212155fdd9b4cc0d794b 100644 --- a/DDG4/python/DDSim/DD4hepSimulation.py +++ b/DDG4/python/DDSim/DD4hepSimulation.py @@ -541,7 +541,8 @@ class DD4hepSimulation(object): fileNames = [fileNames] if not all(fileName.endswith(tuple(extensions)) for fileName in fileNames): self._errorMessages.append("ERROR: Unknown fileformat for file: %s" % fileNames) - if not self.hepmc3.useHepMC3 and any(fileName.endswith(tuple(HEPMC3_SUPPORTED_EXTENSIONS)) for fileName in fileNames): + is_hepmc3_extension = any(fileName.endswith(tuple(HEPMC3_SUPPORTED_EXTENSIONS)) for fileName in fileNames) + if not self.hepmc3.useHepMC3 and is_hepmc3_extension: self._errorMessages.append("ERROR: HepMC3 files or compressed HepMC2 require the use of HepMC3 library") return fileNames