CMS 3D CMS Logo

Functions
GCP_TkAlMap Namespace Reference

Functions

def main ()
 
def parser ()
 

Function Documentation

◆ main()

def GCP_TkAlMap.main ( )

Definition at line 12 of file GCP_TkAlMap.py.

References createfilelist.int, parser(), print(), and str.

12 def main():
13  print('*---------------------------------------*')
14  print('| GCP TkAlMap |')
15  print('*---------------------------------------*')
16 
17  # Get arguments
18  args = parser()
19 
20  # Get configuration
21  with open(args.config, 'r') as configFile: if args.config.split('.')[-1] == 'json':
22  config = json.load(configFile)
23 
24  elif args.config.split('.')[-1] == 'yaml':
25  config = yaml.load(configFile, Loader=yaml.Loader)
26 
27  else:
28  raise Exception('Unknown config extension "{}". Please use json/yaml format!'.format(args.config.split('.')[-1]))
29 
30  # Init variables
31  var_list = ['dr', 'dx', 'dy', 'dz', 'rdphi', 'dphi', 'dalpha', 'dbeta', 'dgamma', 'du', 'dv', 'dw', 'da', 'db', 'dg']
32  var_ranges = {}
33  for var in var_list:
34  var_ranges[var] = [None, None]
35 
36  # Digest
37  al_ref = config['alignments']['ref']['title']
38  al_comp = config['alignments']['comp']['title']
39  in_file = config['input']
40  out_dir = config['output']
41  phase = 1
42  auto_tk = True
43  if 'detector_phase' in config['validation']['GCP']:
44  phase = int(config['validation']['GCP']['detector_phase'])
45  auto_tk = False
46  palette = 2
47  if 'map_palette' in config['validation']['GCP']: palette = int(config['validation']['GCP']['map_palette'])
48  save_png = False
49  if 'save_png' in config['validation']['GCP']: save_png = config['validation']['GCP']['save_png']
50  save_pdf = True
51  if 'save_pdf' in config['validation']['GCP']: save_pdf = config['validation']['GCP']['save_pdf']
52 
53  print('Current setup:')
54  print(' - reference alingment : '+al_ref)
55  print(' - compared alingment : '+al_comp)
56  print(' - tracker version : phase '+str(phase))
57  print(' - auto detect tracker version : '+str(auto_tk))
58  print(' - color palette : '+str(palette))
59  print(' - input root file : '+in_file)
60  print(' - output directory : '+out_dir)
61  print(' - saving as png : '+str(save_png))
62  print(' - saving as pdf : '+str(save_pdf))
63  print('')
64  print('Active plots:')
65  print(' - plot 4 sigma capped values : '+str(do_4scap))
66  print(' - plot default range capped values : '+str(do_drange))
67  print(' - plot un-capped values : '+str(do_frange))
68  print(' - plot full detector : '+str(do_full))
69  print(' - plot pixel detector : '+str(do_pixel))
70  print(' - plot strips detector : '+str(do_strips))
71  print('')
72  print('Changed default ranges:')
73  for var in var_ranges:
74  if var_ranges[var][0] is None and var_ranges[var][1] is None: continue
75  prt_srt = ' - '+var+'\t: [ '
76  if var_ranges[var][0] is None: prt_srt += 'default'
77  else: prt_srt += str(var_ranges[var][0])
78  prt_srt += '\t, '
79  if var_ranges[var][1] is None: prt_srt += 'default'
80  else: prt_srt += str(var_ranges[var][1])
81  prt_srt += '\t]'
82  print(prt_srt)
83 
84  print('Loading maps')
85  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)
86  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)
87  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)
88  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)
89  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)
90  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)
91  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)
92  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)
93  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)
94 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def parser()
Definition: GCP_TkAlMap.py:7
def main()
Definition: GCP_TkAlMap.py:12
#define str(s)

◆ parser()

def GCP_TkAlMap.parser ( )

Definition at line 7 of file GCP_TkAlMap.py.

Referenced by main().

7 def parser():
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()
11 
def parser()
Definition: GCP_TkAlMap.py:7