diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py index 6baf7eb3080a54c052d1c1de4b82b07c554bcb01..790fe5d32bea0c20b1a9930f70b30889b52c18bb 100644 --- a/DDG4/python/DDSim/DD4hepSimulation.py +++ b/DDG4/python/DDSim/DD4hepSimulation.py @@ -41,7 +41,13 @@ try: except ImportError: ARGCOMPLETEENABLED = False -POSSIBLEINPUTFILES = (".stdhep", ".slcio", ".HEPEvt", ".hepevt", ".hepmc", ".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", ".hepmc3.tree.root", ".pairs") +POSSIBLEINPUTFILES = ( + ".stdhep", ".slcio", ".HEPEvt", ".hepevt", + ".hepmc", ".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", + ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", + ".hepmc3.tree.root", + ".pairs", +) class DD4hepSimulation(object): @@ -408,7 +414,11 @@ class DD4hepSimulation(object): elif inputFile.endswith(".hepevt"): gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepevt%d" % index) gen.Input = "Geant4EventReaderHepEvtLong|" + inputFile - elif inputFile.endswith((".hepmc", ".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", ".hepmc3.tree.root")): + elif inputFile.endswith(( + ".hepmc", ".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", + ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", + ".hepmc3.tree.root", + )): if self.hepmc3.useHepMC3: gen = DDG4.GeneratorAction(kernel, "Geant4InputAction/hepmc%d" % index) gen.Parameters = self.hepmc3.getParameters() @@ -532,7 +542,11 @@ class DD4hepSimulation(object): fileNames = [fileNames] if not all(fileName.endswith(extensions) for fileName in fileNames): self._errorMessages.append("ERROR: Unknown fileformat for file: %s" % fileNames) - if not self.hepmc3.useHepMC3 and any(fileName.endswith((".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", ".hepmc3.tree.root")) for fileName in fileNames): + if not self.hepmc3.useHepMC3 and any(fileName.endswith(( + ".hepmc.gz", ".hepmc.xz", ".hepmc.bz2", + ".hepmc3", ".hepmc3.gz", ".hepmc3.xz", ".hepmc3.bz2", + ".hepmc3.tree.root", + )) for fileName in fileNames): self._errorMessages.append("ERROR: HepMC3 files or compressed HepMC2 require the use of HepMC3 library") return fileNames