13 from Alignment.OfflineValidation.TkAlMap
import TkAlMap
17 parser = argparse.ArgumentParser(description =
"run the python plots for the AllInOneTool validations", formatter_class=argparse.RawTextHelpFormatter)
18 parser.add_argument(
"config", metavar=
'config', type=str, action=
"store", help=
"GCP AllInOneTool config (json/yaml format)")
19 parser.add_argument(
"-b",
"--batch", action =
"store_true", help =
"Batch mode")
21 sys.argv.append(
'-b' )
23 return parser.parse_args()
26 root_file =
str(config[
'output']) +
'/GCPtree.root' 27 destination =
str(config[
'output'])
28 plot_dir = destination +
'/TkAlMaps' 30 com_vs_ref = config[
'alignments'][
'comp'][
'title'] +
' vs ' + config[
'alignments'][
'ref'][
'title']
31 iov_vs_iov =
str(config[
'validation'][
'IOVcomp']) +
' - ' +
str(config[
'validation'][
'IOVref'])
32 title =
'#splitline{'+com_vs_ref+
'}{'+iov_vs_iov+
'}' 34 if not os.path.isdir(plot_dir): os.mkdir(plot_dir)
37 if 'plotPng' in config[
'validation'][
'GCP']:
38 plot_png = config[
'validation'][
'GCP'][
'plotPng']
42 var_list = [
'dr',
'dx',
'dy',
'dz',
'rdphi',
'dphi']
44 'dummy_var', title, root_file,
45 use_default_range=
True, two_sigma_cap=
False,
47 palette=palette, check_tracker=
True 50 'dummy_var', title, root_file,
51 use_default_range=
True, two_sigma_cap=
False,
53 palette=palette, check_tracker=
True 57 print(
' --- Creating maps for variable: '+var)
58 var_range = [
None,
None]
59 if var+
'_min' in config[
'validation'][
'GCP']: var_range[0] =
float(config[
'validation'][
'GCP'][var+
'_min'])
60 if var+
'_max' in config[
'validation'][
'GCP']: var_range[1] =
float(config[
'validation'][
'GCP'][var+
'_max'])
62 TkMap_pixel.set_var(var, var_range=var_range)
64 TkMap_pixel.save(out_dir=plot_dir)
65 if plot_png: TkMap_pixel.save(out_dir=plot_dir, extension=
'png')
66 TkMap_pixel.plot_variable_distribution(out_dir=plot_dir)
68 TkMap_strips.set_var(var)
69 TkMap_strips.analyse()
70 TkMap_strips.save(out_dir=plot_dir)
71 if plot_png: TkMap_strips.save(out_dir=plot_dir, extension=
'png')
72 TkMap_strips.plot_variable_distribution(out_dir=plot_dir)
74 if __name__ ==
'__main__':
78 with open(args.config,
"r") as configFile: 79 if args.config.split(
".")[-1] ==
"json":
80 config = json.load(configFile)
82 elif args.config.split(
".")[-1] ==
"yaml":
83 config = yaml.load(configFile, Loader=yaml.Loader)
86 raise Exception(
"Unknown config extension '{}'. Please use json/yaml format!".
format(args.config.split(
".")[-1]))
88 print(
' ----- TkAlMaps -----')
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def TkAlMap_plots(config)