17parser = argparse.ArgumentParser(description=
'Compare the rates of different streams')
18parser.add_argument(
'--HLTMenu', type=str, help=
'HLT Menu File as input')
19parser.add_argument(
'--workdir', type=str, default=
'stream_analysis', help=
'Working directory')
20parser.add_argument(
'--targetlumi', type=float, default=2.0e34, help=
'Target luminosity')
21parser.add_argument(
'--maxEvents', type=int, default=-1, help=
'Max events')
22parser.add_argument(
'aod_dir', type=str, help=
'Directory containing AOD files from a rate reprocessing')
23parser.add_argument(
'--l1_ps', type=str, help=
'L1 PSK JSON file from the Rulebook')
24parser.add_argument(
'--hlt_in', type=str, help=
'JSON file from the Rulebook with the PSK values')
25parser.add_argument(
'--hlt_ps_stream0',
'-psS0', type=str, default=
'HLTPrescale_stream0.json',
26 help=
'JSON file with the HLT PS for a single stream selected')
27parser.add_argument(
'--hlt_ps_stream',
'-psS', type=str, default=
'HLTPrescale_stream.json',
28 help=
'JSON with the HLT PS for both stream selected')
29parser.add_argument(
'--hlt_ps_chain',
'-psC',type=str, default=
'HLTPrescale_chain.json',
30 help=
'JSON with the HLT PS when the chosen chain is disabled')
31parser.add_argument(
'--hlt_ps_chain_set',
'-psCS', type=str, default=
'HLTPrescale_chainSet.json',
32 help=
'JSON with the HLT PS for the chain set chosen')
33parser.add_argument(
'--hlt_ps_chain_ref',
'-psCR', type=str, default=
'HLTPrescale_chain_ref.json',
34 help=
'JSON with the HLT PS for the reference chain in chain comparison')
35parser.add_argument(
'--hlt_ps_chain_comp',
'-psCC', type=str, default=
'HLTPrescale_chain_comp.json',
36 help=
'JSON with the HLT PS for the compared chain in chain comparison')
37parser.add_argument(
'--stream0', type=str, default=
'Main',
38 help=
'Reference stream for stream and chain analysis, default is Main')
39parser.add_argument(
'--stream', nargs=
'+', type=str, default=
' ',
40 help=
'List of streams to compare to stream0')
41parser.add_argument(
'--chain', nargs=
'+', type=str, default=
' ',
42 help=
'List of chains to compare to stream0')
43parser.add_argument(
'--chain_set', nargs=
'+', type=str, default=
' ',
44 help=
'Set of chains get the unique rate of')
45parser.add_argument(
'--chain_comp', nargs=
'+', type=str, default=
' ',
46 help=
'List of chains to compare to the first chain in the list')
47parser.add_argument(
'--stream_out', type=str, default=
'streamRates.txt',
48 help=
'output stream analysis file as a txt file')
49parser.add_argument(
'--chain_out', type=str, default=
'chainRates.txt',
50 help=
'output chain analysis file as a txt file')
51parser.add_argument(
'--chain_comp_out', type=str, default=
'chainCompRates.csv',
52 help=
'output chain comparison file as a csv file')
53parser.add_argument(
"--force",
"-f", default=
False, action=
"store_true", help=
"Overwrite existing output directory")
56args = parser.parse_args()
61 os.mkdir(args.workdir)
64 shutil.rmtree(args.workdir)
65 os.mkdir(args.workdir)
67 print(
"\nthe output directory already exists, please clean up or be more creative :)")
68 print(
"or use --force if you want to overwirte the existing output directory.\n")
74filesIn = glob(f
'{os.path.abspath(args.aod_dir)}/*')
75print(f
"Found {len(filesIn)} input files in '{args.aod_dir}'")
77HLTMenu_filen = args.HLTMenu.split(
'/', 1)[1]
if '/' in args.HLTMenu
else args.HLTMenu
78hlt_in_filen = args.hlt_in.split(
'/', 1)[1]
if '/' in args.hlt_in
else args.hlt_in
79l1_ps_filen = args.l1_ps.split(
'/', 1)[1]
if '/' in args.l1_ps
else args.l1_ps
81hlt_ps_stream0_filen = args.hlt_ps_stream0.split(
'/', 1)[1]
if '/' in args.hlt_ps_stream0
else args.hlt_ps_stream0
82hlt_ps_stream_filen = args.hlt_ps_stream.split(
'/', 1)[1]
if '/' in args.hlt_ps_stream
else args.hlt_ps_stream
83hlt_ps_chain_filen = args.hlt_ps_chain.split(
'/', 1)[1]
if '/' in args.hlt_ps_chain
else args.hlt_ps_chain
84hlt_ps_chain_set_filen = args.hlt_ps_chain_set.split(
'/', 1)[1]
if '/' in args.hlt_ps_chain_set
else args.hlt_ps_chain_set
85hlt_ps_chain_ref_filen = args.hlt_ps_chain_ref.split(
'/', 1)[1]
if '/' in args.hlt_ps_chain_ref
else args.hlt_ps_chain_ref
86hlt_ps_chain_comp_filen = args.hlt_ps_chain_comp.split(
'/', 1)[1]
if '/' in args.hlt_ps_chain_comp
else args.hlt_ps_chain_comp
88stream0_filen = args.stream0.split(
'/', 1)[1]
if '/' in args.stream0
else args.stream0
89stream_filen = args.stream.split(
'/', 1)[1]
if '/' in args.stream
else args.stream
90chain_filen = args.chain.split(
'/', 1)[1]
if '/' in args.chain
else args.chain
91chain_set_filen = args.chain_set.split(
'/', 1)[1]
if '/' in args.chain_set
else args.chain_set
92chain_comp_filen = args.chain_comp.split(
'/', 1)[1]
if '/' in args.chain_comp
else args.chain_comp
94output_stream_filen = args.stream_out.split(
'/', 1)[1]
if '/' in args.stream_out
else args.stream_out
95output_chain_filen = args.chain_out.split(
'/', 1)[1]
if '/' in args.chain_out
else args.chain_out
96output_chain_comp_filen = args.chain_comp_out.split(
'/', 1)[1]
if '/' in args.chain_comp_out
else args.chain_comp_out
98shutil.copy(args.HLTMenu, f
"{args.workdir}/{HLTMenu_filen}")
99shutil.copy(args.l1_ps, f
"{args.workdir}/{l1_ps_filen}")
100shutil.copy(args.hlt_in, f
"{args.workdir}/{hlt_in_filen}")
103os.chdir(args.workdir)
106 '--inputPrescalesHLTJSON', hlt_in_filen,
107 '--outputPrescalesHLTJSON1', hlt_ps_stream0_filen,
108 '--outputPrescalesHLTJSON2', hlt_ps_stream_filen,
109 '--stream0', stream0_filen,
110 '--stream', stream_filen,
111 '--chain', chain_filen,
112 '--chainSet', chain_set_filen,
113 '--chainComp', chain_comp_filen,
129 for i
in menu[
'chains']:
130 for k
in psks[
'prescales']:
132 for j
in menu[
'chains'][i][
'streams']:
134 dict_stream1[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
136 dict_stream2[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
139 dict_stream2[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
141 dict_stream1[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
143 dict_stream1[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
144 dict_stream2[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
145 return dict_stream1, dict_stream2
157 for i
in menu[
'chains']:
158 for k
in psks[
'prescales']:
160 for j
in menu[
'chains'][i][
'streams']:
162 dict_stream[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
164 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
167 dict_stream[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
168 "prescale": psks[
'prescales'][k][
'prescale'],
"enabled":
True}
169 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
170 return dict_stream, dict_chain
179 for i
in menu[
'chains']:
181 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": 1,
"enabled":
True}
182 elif i == comp_chain:
183 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": 1,
"enabled":
True}
185 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
196 for i
in menu[
'chains']:
198 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": 1,
"enabled":
True}
200 dict_chain[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
206 "filetype":
"hltprescale",
207 "name":
"Physics_pp_2.0e+34_2340b",
211 with open(psk_file,
'w')
as file:
212 json.dump(psk_dict, file, indent=4)
223 for i
in menu[
'chains']:
224 for k
in psks[
'prescales']:
226 dict_chain_set[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": psks[
'prescales'][k][
'prescale'],
228 for j
in range(len(chains)):
230 dict_chain_set[i] = {
"hash": menu[
'chains'][i][
'nameHash'],
"prescale": -1,
"enabled":
False}
232 return dict_chain_set
245 regex_input = input(
"RegEx expression: ")
248 chains_to_analyse = []
250 for i
in menu[
'chains']:
251 list_of_chains.append(i)
254 for chain
in list_of_chains:
255 if re.match(regex_input, chain):
257 chains_to_analyse.append(chain)
262 print(
'These are the chains you are trying to compare: ',
"\n".join(chains_to_analyse))
263 user_conf = input(
'Are you sure you want to continue? [y/n]')
264 if user_conf.lower()
in [
"yes",
"y"]:
265 print(
"sure, let's go")
266 return chains_to_analyse
267 if user_conf.lower()
in [
"no",
'n']:
268 print(
"alright, then try again")
270 print(
'Are you sure you are RegEx entering the expression correctly? Try again :)')
282 'RatesAnalysisProcessingWrapper.py',
284 '--l1_ps', l1_ps_filen,
285 '--targetlumi', str(args.targetlumi),
291 cmd_rates += [
'--maxEvents',str(args.maxEvents)]
293 command =
' '.join(cmd_rates)
295 status = os.WEXITSTATUS(os.system(command))
305 df_stream0 = pd.read_csv(f
"{dir}/output/csv/Table_Rate_Group_HLT_All.csv")
306 df_stream0.set_index(
'Name', inplace=
True)
307 rate0 =
float(df_stream0.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate [Hz]'])
308 rate0err =
float(df_stream0.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate Err [Hz]'])
310 df_global = pd.read_csv(f
"{stream2}/output/csv/Table_Rate_Group_HLT_All.csv")
311 df_global.set_index(
'Name', inplace=
True)
312 rateglobal =
float(df_global.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate [Hz]'])
313 rateglobalerr =
float(df_global.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate Err [Hz]'])
315 df_stream2 = pd.read_csv(f
"{stream2}/output/csv/Table_Rate_ChainHLT_HLT_All.csv")
316 df_stream2.set_index(
'Name', inplace=
True)
317 rate2 =
float(df_global.loc[f
"STREAM:{stream2}"][
'Weighted PS Rate [Hz]'])
318 rate2err =
float(df_global.loc[f
"STREAM:{stream2}"][
'Weighted PS Rate Err [Hz]'])
320 unique_rate = rateglobal - rate0
323 percentage = (rate2 - unique_rate)/rate2 * 100
324 except ZeroDivisionError:
325 print(
"Cannot compute streams' overlap percentage (ZeroDivisionError): percentage set to None")
329 with open(output_stream_filen,
'w')
as f:
330 print(
'Computing the unique rate of a stream w.r.t. a different stream', file=f)
331 print(
'Reference Stream: ', stream1, file=f)
332 print(
'Compared Stream: ', stream2, file=f)
333 table = [[rate0, rate0err],
334 [rateglobal, rateglobalerr],
337 df_out = pd.DataFrame(table, index = [f
'Total rate of {stream1}' ,
'Rate of the two streams including overlap', f
'Total rate of {stream2}', f
"Unique rate of {stream2}"],
338 columns = [
'Weighted PS Rate [Hz]',
"Weighted PS Rate Err [Hz]"])
339 print(df_out, file=f)
340 print(f
"The overlap between {stream1} and {stream2} is {percentage}", file=f)
344 df = pd.read_csv(f
"{chain}/output/csv/Table_Rate_Group_HLT_All.csv")
345 df.set_index(
'Name', inplace=
True)
347 df_chain = pd.read_csv(f
"{dir}/output/csv/Table_Rate_ChainHLT_HLT_All.csv")
348 df_stream = pd.read_csv(f
"{dir}/output/csv/Table_Rate_Group_HLT_All.csv")
349 df_chain.set_index(
'Name', inplace=
True)
350 df_stream.set_index(
'Name', inplace=
True)
352 chain_rate =
float(df_chain.loc[chain][
'Unique Rate [Hz]'])
353 chain_rate_err =
float(df_chain.loc[chain][
'Unique Rate Err [Hz]'])
355 global_rate =
float(df_stream.loc[f
"STREAM:{stream}"][
'Weighted PS Rate [Hz]'])
356 global_rate_err =
float(df_stream.loc[f
"STREAM:{stream}"][
'Weighted PS Rate Err [Hz]'])
358 global_dis_rate =
float(df.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate [Hz]'])
359 global_dis_rate_err =
float(df.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate Err [Hz]'])
361 unique_contri = global_rate - global_dis_rate
362 percentage = unique_contri/global_rate * 100
364 with open(output_chain_filen,
'w')
as f:
365 print(
'Computing the unique rate of a chain w.r.t. a stream', file=f)
366 print(
'Reference Stream: ', stream, file=f)
367 print(
'Compared Chain: ', chain, file=f)
368 table = [[chain_rate, chain_rate_err],
369 [global_rate, global_rate_err],
370 [global_dis_rate, global_dis_rate_err],
371 [unique_contri,
'---']]
372 df_out = pd.DataFrame(table, index = [
'Chain Unique Rate',
'Stream and Chain Rate',
373 'Stream without Chain Rate',
'Unique Contribution'],
374 columns = [
'Rate [Hz]',
'Rate Error [Hz]'])
375 print(df_out, file=f)
376 print(f
"{chain} has a unique contribution of", percentage,
'% to ' f
"{stream}", file=f)
380 df1 = pd.read_csv(f
"{chain1}/output/csv/Table_Rate_ChainHLT_HLT_All.csv")
381 df1.set_index(
'Name', inplace=
True)
383 df2 = pd.read_csv(f
"{chain2}/output/csv/Table_Rate_ChainHLT_HLT_All.csv")
384 df2.set_index(
'Name', inplace=
True)
387 wrate1 =
float(df1.loc[chain1][
'Weighted PS Rate [Hz]'])
388 urate1 =
float(df1.loc[chain1][
'Unique Rate [Hz]'])
389 wrate1err =
float(df1.loc[chain1][
'Weighted PS Rate Err [Hz]'])
390 urate1err =
float(df1.loc[chain1][
'Unique Rate Err [Hz]'])
393 wrate1_comb =
float(df2.loc[chain1][
'Weighted PS Rate [Hz]'])
394 urate1_comb =
float(df2.loc[chain1][
'Unique Rate [Hz]'])
395 wrate2 =
float(df2.loc[chain2][
'Weighted PS Rate [Hz]'])
396 urate2 =
float(df2.loc[chain2][
'Unique Rate [Hz]'])
397 wrate1_comb_err =
float(df2.loc[chain1][
'Weighted PS Rate Err [Hz]'])
398 urate1_comb_err =
float(df2.loc[chain1][
'Unique Rate Err [Hz]'])
399 wrate2err =
float(df2.loc[chain2][
'Weighted PS Rate Err [Hz]'])
400 urate2err =
float(df2.loc[chain2][
'Unique Rate Err [Hz]'])
403 percentage = wrate2/wrate1_comb * 100
404 except ZeroDivisionError:
405 print(
"Cannot compute chains' overlap percentage (ZeroDivisionError): percentage set to None")
408 with open(f
"ChainComp_{i}",
'w')
as f:
409 table = [[wrate1, wrate1err, urate1, urate1err],
410 [wrate1_comb, wrate1_comb_err, urate1_comb, urate1_comb_err],
411 [wrate2, wrate2err, urate2, urate2err]]
412 pd.set_option(
'display.max_colwidth',
None)
413 df_out = pd.DataFrame(table, columns = [
'Weighted PS Rate',
'Weighted PS Rate Error',
'Unique Rate',
'Unique Rate Error'],
414 index = [
'Reference Chain Only',
'Reference Chain',
'Comparison Chain'])
415 print(df_out, file=f)
416 print(
'The overlap between ' f
"{chain1} and " f
"{chain2} is", percentage,
'%', file=f)
419 df1 = pd.read_csv(
"fullMenu/output/csv/Table_Rate_Group_HLT_All.csv")
420 df1.set_index(
'Name', inplace=
True)
422 df2 = pd.read_csv(
"setMenu/output/csv/Table_Rate_Group_HLT_All.csv")
423 df2.set_index(
'Name', inplace=
True)
426 fullrate =
float(df1.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate [Hz]'])
427 setrate =
float(df2.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate [Hz]'])
428 fullrate_err =
float(df1.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate Err [Hz]'])
429 setrate_err =
float(df2.loc[
'RATE_GLOBAL_HLT'][
'Weighted PS Rate Err [Hz]'])
431 unique_rate = fullrate - setrate
432 percentage = unique_rate/setrate * 100
434 with open(
"SetMonitoring.txt",
'w')
as f:
435 table = [[fullrate, fullrate_err],
436 [setrate, setrate_err]]
437 pd.set_option(
'display.max_colwidth',
None)
438 df_out = pd.DataFrame(table, columns = [
'Global HLT Rate',
'Global HLT Rate Error'],
439 index = [
'Full Menu',
'Chains disabled'])
440 print(
"The chains that have been disabled are: ", file=f)
441 for i
in range(len(chains)):
442 print(f
"{chains[i]}", file=f)
443 print(
"-------------------------------------------------------", file=f)
444 print(df_out, file=f)
445 print(
"-------------------------------------------------------", file=f)
446 print(
'Unique rate of the set: ', unique_rate, file=f)
447 print(
'The set has a contribution of', percentage,
'% to the Global HLT Rate', file=f)
452 with open(
'ChainAnalysisSummary.txt',
'w')
as t:
454 pd.set_option(
'max_colwidth', 400)
456 print(
'The reference chain is ',chains_list[0] , file=t)
457 print(
'--------------------------------------------------------------------------------', file=t)
458 print(
'--------------------------------------------------------------------------------', file=t)
460 for p
in range(1, len(chains_list)):
462 print(
'For chain', chains_list[p],
':' , file=t)
463 df = pd.read_csv(f
"ChainComp_{p}")
464 print(df.drop([0]), file=t)
465 print(
'--------------------------------------------------------------------------------', file=t)
471if stream_filen !=
' ':
474 streamdir = os.getcwd()
476 for j
in range(len(stream_filen)):
478 os.makedirs(f
"stream_{s}")
480 shutil.copy(args.HLTMenu, f
"stream_{s}/{HLTMenu_filen}")
481 shutil.copy(args.l1_ps, f
"stream_{s}/{l1_ps_filen}")
482 shutil.copy(args.hlt_in, f
"stream_{s}/{hlt_in_filen}")
484 os.chdir(f
"stream_{s}")
487 dict_stream0 =
stream_json(HLTMenu_filen, hlt_in_filen, stream0_filen, stream_filen[j])[0]
488 dict_stream =
stream_json(HLTMenu_filen, hlt_in_filen, stream0_filen, stream_filen[j])[1]
490 psk_file(dict_stream0, hlt_ps_stream0_filen)
491 psk_file(dict_stream, hlt_ps_stream_filen)
493 exec_rates(hlt_ps_stream0_filen, f
"{stream0_filen}")
494 exec_rates(hlt_ps_stream_filen, stream_filen[j])
496 stream_rate(stream0_filen, stream_filen[j], f
"{stream0_filen}")
500if chain_filen == [
'regex']:
502 chaindir = os.getcwd()
507 for i
in range(len(regex_chains)):
510 os.makedirs(f
"chain_{s}")
512 shutil.copy(args.HLTMenu, f
"chain_{s}/{HLTMenu_filen}")
513 shutil.copy(args.l1_ps, f
"chain_{s}/{l1_ps_filen}")
514 shutil.copy(args.hlt_in, f
"chain_{s}/{hlt_in_filen}")
516 os.chdir(f
"chain_{s}")
519 dict_stream0 =
chain_json(HLTMenu_filen, hlt_in_filen, regex_chains[i], stream0_filen)[0]
520 dict_chain =
chain_json(HLTMenu_filen, hlt_in_filen, regex_chains[i], stream0_filen)[1]
523 psk_file(dict_stream0, hlt_ps_stream0_filen)
524 psk_file(dict_chain, hlt_ps_chain_filen)
526 exec_rates(hlt_ps_stream0_filen, f
"{stream0_filen}")
527 exec_rates(hlt_ps_chain_filen, regex_chains[i])
529 chain_rate(regex_chains[i], stream0_filen, f
"{stream0_filen}")
532 os.remove(HLTMenu_filen)
533 os.remove(l1_ps_filen)
534 os.remove(hlt_in_filen)
535 os.remove(hlt_ps_chain_filen)
536 os.remove(hlt_ps_stream0_filen)
540elif chain_filen !=
' ':
542 chaindir = os.getcwd()
544 for i
in range(len(chain_filen)):
547 os.makedirs(f
"chain_{c}")
549 shutil.copy(args.HLTMenu, f
"chain_{c}/{HLTMenu_filen}")
550 shutil.copy(args.l1_ps, f
"chain_{c}/{l1_ps_filen}")
551 shutil.copy(args.hlt_in, f
"chain_{c}/{hlt_in_filen}")
553 os.chdir(f
"chain_{c}")
556 dict_stream0 =
chain_json(HLTMenu_filen, hlt_in_filen, chain_filen[i], stream0_filen)[0]
557 dict_chain =
chain_json(HLTMenu_filen, hlt_in_filen, chain_filen[i], stream0_filen)[1]
560 psk_file(dict_stream0, hlt_ps_stream0_filen)
561 psk_file(dict_chain, hlt_ps_chain_filen)
563 exec_rates(hlt_ps_stream0_filen, f
"{stream0_filen}")
564 exec_rates(hlt_ps_chain_filen, chain_filen[i])
567 chain_rate(chain_filen[i], stream0_filen, f
"{stream0_filen}")
570 os.remove(HLTMenu_filen)
571 os.remove(l1_ps_filen)
572 os.remove(hlt_in_filen)
573 os.remove(hlt_ps_chain_filen)
574 os.remove(hlt_ps_stream0_filen)
578if chain_comp_filen == [
'regex']:
581 os.makedirs(
'chain_comp')
583 shutil.copy(args.HLTMenu, f
"chain_comp/{HLTMenu_filen}")
584 shutil.copy(args.l1_ps, f
"chain_comp/{l1_ps_filen}")
585 shutil.copy(args.hlt_in, f
"chain_comp/{hlt_in_filen}")
587 os.chdir(
'chain_comp')
588 chain_comp_dir = os.getcwd()
592 psk_file(dict_chain_ref, hlt_ps_chain_ref_filen)
593 exec_rates(hlt_ps_chain_ref_filen, regex_chainsComp[0])
594 os.remove(hlt_ps_chain_ref_filen)
596 for i
in range(1, len(regex_chainsComp)):
598 dict_chain_comp =
chain_comp_json(HLTMenu_filen, regex_chainsComp[0], regex_chainsComp[i])
599 psk_file(dict_chain_comp, hlt_ps_chain_comp_filen)
600 exec_rates(hlt_ps_chain_comp_filen, regex_chainsComp[i])
603 os.chdir(chain_comp_dir)
606 os.remove(HLTMenu_filen)
607 os.remove(l1_ps_filen)
608 os.remove(hlt_in_filen)
609 os.remove(hlt_ps_chain_comp_filen)
614elif chain_comp_filen !=
' ':
616 os.makedirs(
'chain_comp')
618 shutil.copy(args.HLTMenu, f
"chain_comp/{HLTMenu_filen}")
619 shutil.copy(args.l1_ps, f
"chain_comp/{l1_ps_filen}")
620 shutil.copy(args.hlt_in, f
"chain_comp/{hlt_in_filen}")
621 os.chdir(
'chain_comp')
622 chain_comp_dir = os.getcwd()
625 dict_chain_ref =
chain_ref_json(HLTMenu_filen, chain_comp_filen[0])
626 psk_file(dict_chain_ref, hlt_ps_chain_ref_filen)
627 exec_rates(hlt_ps_chain_ref_filen, chain_comp_filen[0])
628 os.remove(hlt_ps_chain_ref_filen)
630 for i
in range(1, len(chain_comp_filen)):
631 dict_chain_comp =
chain_comp_json(HLTMenu_filen, chain_comp_filen[0], chain_comp_filen[i])
632 psk_file(dict_chain_comp, hlt_ps_chain_comp_filen)
633 exec_rates(hlt_ps_chain_comp_filen, chain_comp_filen[i])
636 os.chdir(chain_comp_dir)
639 os.remove(HLTMenu_filen)
640 os.remove(l1_ps_filen)
641 os.remove(hlt_in_filen)
642 os.remove(hlt_ps_chain_comp_filen)
647if chain_set_filen == [
'regex']:
651 os.makedirs(
'chain_set')
653 shutil.copy(args.HLTMenu, f
"chain_set/{HLTMenu_filen}")
654 shutil.copy(args.l1_ps, f
"chain_set/{l1_ps_filen}")
655 shutil.copy(args.hlt_in, f
"chain_set/{hlt_in_filen}")
656 os.chdir(
'chain_set')
657 chain_set_dir = os.getcwd()
662 psk_file(dict_chain_set, hlt_ps_chain_set_filen)
666elif chain_set_filen !=
' ':
668 os.makedirs(
'chain_set')
670 shutil.copy(args.HLTMenu, f
"chain_set/{HLTMenu_filen}")
671 shutil.copy(args.l1_ps, f
"chain_set/{l1_ps_filen}")
672 shutil.copy(args.hlt_in, f
"chain_set/{hlt_in_filen}")
673 os.chdir(
'chain_set')
674 chain_set_dir = os.getcwd()
678 dict_chain_set =
chain_set_json(HLTMenu_filen, hlt_in_filen, chain_set_filen)
679 psk_file(dict_chain_set, hlt_ps_chain_set_filen)
void print(char *figname, TCanvas *c1)
stream_rate(stream1, stream2, dir)
chain_ref_json(menu_in, chain)
stream_json(menu_in, psks_in, stream1, stream2)
chain_comp_rate(chain1, chain2)
chain_json(menu_in, psks_in, chain, stream)
chain_rate(chain, stream, dir)
chain_comp_json(menu_in, ref_chain, comp_chain)
chain_set_json(menu_in, psks_in, chains)