ATLAS Offline Software
Loading...
Searching...
No Matches
mult_lhe_input.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2include("EvgenProdTools/merge_lhe_files.py")
3include("EvgenProdTools/find_unique_file.py")
4
5myInputFiles = runArgs.inputGeneratorFile
6genInputFiles = myInputFiles.split(',')
7numberOfFiles = len(genInputFiles)
8
9if numberOfFiles > 1:
10 allFiles = []
11 for file in genInputFiles:
12 print ("input file name ",file)
13# Since we can have multiple files from the same task, inputroot must include more of the filename
14# to make it unique
15 if ".tar" in os.path.basename(file):
16 inputroot = os.path.basename(file).split(".tar.")[0]
17 else:
18 input0 = os.path.basename(file).split("._")[0]
19 input1 = (os.path.basename(file).split("._")[1]).split(".")[0]
20 inputroot = input0+"._"+input1
21
22 realEventsFile = find_unique_file('*%s.*ev*ts' % inputroot)
23# The only input format where merging is permitted is LHE
24 with open(realEventsFile, 'r') as f:
25 first_line = f.readline()
26 if(not ("LesHouche" in first_line)):
27 raise RuntimeError("%s is NOT a LesHouche file" % realEventsFile)
28 allFiles.append(realEventsFile)
29
30 print (("Found more than one LHE file: {}".format(numberOfFiles)))
31# my_lhe_file = "merged_lhef.events"
32# skeleton.GENtoEVGEN splits the file name on "._" (in rel. 20.7.9.9.6,MCProd,
33# so insert this in the merged file name - to make it run also for this release)
34 my_lhe_file = "merged_lhef._0.events"
35 merge_lhe_files(allFiles, my_lhe_file )
36 print (("Using uncompressed LHE file '{}' as inputGeneratorFile".format(my_lhe_file)))
37 runArgs.inputGeneratorFile = my_lhe_file
38
39
if(febId1==febId2)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177