5 from Alignment.OfflineValidation.TkAlMap
import TkAlMap
8 parser = argparse.ArgumentParser(description =
"Parse AllInOne config to TkAlMap. Only ment for condor jobs.", formatter_class=argparse.RawTextHelpFormatter)
9 parser.add_argument(
"config", metavar=
'config', type=str, action=
"store", help=
"Global AllInOneTool config (json/yaml format)")
10 return parser.parse_args()
13 print(
'*---------------------------------------*')
14 print(
'| GCP TkAlMap |')
15 print(
'*---------------------------------------*')
21 with open(args.config,
'r') as configFile: 22 if args.config.split(
'.')[-1] ==
'json':
23 config = json.load(configFile)
25 elif args.config.split(
'.')[-1] ==
'yaml':
26 config = yaml.load(configFile, Loader=yaml.Loader)
29 raise Exception(
'Unknown config extension "{}". Please use json/yaml format!'.
format(args.config.split(
'.')[-1]))
32 var_list = [
'dr',
'dx',
'dy',
'dz',
'rdphi',
'dphi',
'dalpha',
'dbeta',
'dgamma',
'du',
'dv',
'dw',
'da',
'db',
'dg']
35 var_ranges[var] = [
None,
None]
38 al_ref = config[
'alignments'][
'ref'][
'title']
39 al_comp = config[
'alignments'][
'comp'][
'title']
40 in_file = config[
'input']
41 out_dir = config[
'output']
44 if 'detector_phase' in config[
'validation'][
'GCP']:
45 phase =
int(config[
'validation'][
'GCP'][
'detector_phase'])
48 if 'map_palette' in config[
'validation'][
'GCP']: palette =
int(config[
'validation'][
'GCP'][
'map_palette'])
50 if 'save_png' in config[
'validation'][
'GCP']: save_png = config[
'validation'][
'GCP'][
'save_png']
52 if 'save_pdf' in config[
'validation'][
'GCP']: save_pdf = config[
'validation'][
'GCP'][
'save_pdf']
54 print(
'Current setup:')
55 print(
' - reference alingment : '+al_ref)
56 print(
' - compared alingment : '+al_comp)
57 print(
' - tracker version : phase '+
str(phase))
58 print(
' - auto detect tracker version : '+
str(auto_tk))
59 print(
' - color palette : '+
str(palette))
60 print(
' - input root file : '+in_file)
61 print(
' - output directory : '+out_dir)
62 print(
' - saving as png : '+
str(save_png))
63 print(
' - saving as pdf : '+
str(save_pdf))
65 print(
'Active plots:')
66 print(
' - plot 4 sigma capped values : '+
str(do_4scap))
67 print(
' - plot default range capped values : '+
str(do_drange))
68 print(
' - plot un-capped values : '+
str(do_frange))
69 print(
' - plot full detector : '+
str(do_full))
70 print(
' - plot pixel detector : '+
str(do_pixel))
71 print(
' - plot strips detector : '+
str(do_strips))
73 print(
'Changed default ranges:')
74 for var
in var_ranges:
75 if var_ranges[var][0]
is None and var_ranges[var][1]
is None:
continue 76 prt_srt =
' - '+var+
'\t: [ ' 77 if var_ranges[var][0]
is None: prt_srt +=
'default' 78 else: prt_srt +=
str(var_ranges[var][0])
80 if var_ranges[var][1]
is None: prt_srt +=
'default' 81 else: prt_srt +=
str(var_ranges[var][1])
86 TkMap_full =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'full', palette=palette, check_tracker=auto_tk)
87 TkMap_pixel =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'pixel', palette=palette, check_tracker=auto_tk)
88 TkMap_strips =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'strips', palette=palette, check_tracker=auto_tk)
89 TkMap_cap_full =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
True, GEO_file=geometry_file, tracker=
'full', palette=palette, check_tracker=auto_tk)
90 TkMap_cap_pixel =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
True, GEO_file=geometry_file, tracker=
'pixel', palette=palette, check_tracker=auto_tk)
91 TkMap_cap_strips =
TkAlMap(
'test', title, in_file, use_default_range=
False, two_sigma_cap=
True, GEO_file=geometry_file, tracker=
'strips', palette=palette, check_tracker=auto_tk)
92 TkMap_drange_full =
TkAlMap(
'test', title, in_file, use_default_range=
True, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'full', palette=palette, check_tracker=auto_tk)
93 TkMap_drange_pixel =
TkAlMap(
'test', title, in_file, use_default_range=
True, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'pixel', palette=palette, check_tracker=auto_tk)
94 TkMap_drange_strips =
TkAlMap(
'test', title, in_file, use_default_range=
True, two_sigma_cap=
False, GEO_file=geometry_file, tracker=
'strips', palette=palette, check_tracker=auto_tk)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)