105 athMsgLog.info(
"Hello from the config-checker!")
108 version = h_version[0]
109 subversion = h_version[2]
110 subsubversion = h_version[4]
111 athMsgLog.info(
"The current Herwig version is "+version+
"."+subversion+
"."+subsubversion)
114 files = [f
for f
in os.listdir(
'.')
if os.path.isfile(f)]
118 HerwigINFile.append(file)
121 run_name = HerwigINFile[0]
122 athMsgLog.info(
"The Herwig7 *.in file is "+run_name)
130 f =
open(run_name,
"r")
134 if not line.startswith(
"#"):
135 cd,cd_cmd,set_commands,read_commands,create_commands,insert_commands =
sort_commands(line,
136 cd_in_line,cd_command,set_commands,
137 read_commands,create_commands,insert_commands)
138 cd_in_line,cd_command = cd,cd_cmd
144 create_commands =
clean_string(create_commands,
"create ",
"")
146 read_commands =
clean_string(read_commands,
"snippets/",
"")
149 include_path = os.environ[
'HERWIG7_PATH']+
"/share/Herwig/"
150 snippet_path = os.environ[
'HERWIG7_PATH']+
"/share/Herwig/snippets/"
152 include_files = [f
for f
in os.listdir(include_path)]
153 snippet_files = [f
for f
in os.listdir(snippet_path)]
157 for file
in include_files:
158 for command
in read_commands:
160 read_files.append(include_path+file)
161 for file
in snippet_files:
162 for command
in read_commands:
164 read_files.append(snippet_path+file)
167 for file
in read_files:
168 if ".in" not in file:
169 athMsgLog.info(
"Skipping file " + file +
" since it does not contain any in-file")
170 athMsgLog.info(
"It is just a directory, can be ignored.")
177 if not line.startswith(
"#"):
178 cd,cd_cmd,set_commands,read_commands,create_commands,insert_commands =
sort_commands(line,cd_in_line,cd_command,set_commands,read_commands,create_commands,insert_commands)
179 cd_in_line,cd_command = cd,cd_cmd
186 create_commands =
clean_string(create_commands,
"create ",
"")
188 read_commands =
clean_string(read_commands,
"snippets/",
"")
196 athMsgLog.debug(
"\n These are the commands found by the Herwig7JOChecker:\n")
200 athMsgLog.debug(
"\n")
210 with open(
"HerwigCommandDuplicates.txt",
"w")
as file:
218 with open(
"HerwigCommands.txt",
"w")
as file:
224 if found_duplicate1
or found_duplicate2
or found_duplicate3:
225 athMsgLog.warn(
"There were some settings which are overwritten, please check the log-file HerwigCommandDuplicates.txt")
228 athMsgLog.info(
"Commands have been written to HerwigCommands.txt")
229 athMsgLog.info(
"Duplicates have been written to HerwigCommandsDuplicates.txt")
230 athMsgLog.info(
"Godybe from the config-checker!")