CMS 3D CMS Logo

Functions
GCP Namespace Reference

Functions

def GCP (config, validationDir)
 

Function Documentation

◆ GCP()

def GCP.GCP (   config,
  validationDir 
)

Definition at line 4 of file GCP.py.

References createfilelist.int, relativeConstraints.keys, and str.

4 def GCP(config, validationDir):
5 
6  jobs = []
7 
8 
9  doUnitTest = False
10  if "doUnitTest" in config["validations"]["GCP"].keys():
11  doUnitTest = config["validations"]["GCP"]["doUnitTest"]
12 
13 
14  for comparison in config["validations"]["GCP"]["compare"]:
15  for ali_pair in config["validations"]["GCP"]["compare"][comparison]:
16  ref_name = copy.deepcopy(config["validations"]["GCP"]["compare"][comparison][ali_pair]["reference"])
17  comp_name = copy.deepcopy(config["validations"]["GCP"]["compare"][comparison][ali_pair]["compared"])
18  IOVpair_list = []
19  IOVali_list = []
20 
21  # Construct pairs from IOVlist
22  IOV_list = []
23  if "IOVlist" in config["validations"]["GCP"]["compare"][comparison][ali_pair]: IOV_list = copy.deepcopy(config["validations"]["GCP"]["compare"][comparison][ali_pair]["IOVlist"])
24  IOV_list.sort()
25  for idx,IOV in enumerate(IOV_list):
26  if ref_name == comp_name:
27  IOV_pair = str(IOV)+'_vs_'+str(IOV_list[0])
28  IOV_ali_r = ref_name+'_'+str(IOV_list[0])
29  IOV_ali_c = comp_name+'_'+str(IOV)
30  else:
31  IOV_pair = str(IOV)+'_vs_'+str(IOV)
32  IOV_ali_r = ref_name+'_'+str(IOV)
33  IOV_ali_c = comp_name+'_'+str(IOV)
34  if IOV_pair not in IOVpair_list: IOVpair_list.append(IOV_pair)
35  if IOV_ali_r not in IOVali_list: IOVali_list.append(IOV_ali_r)
36  if IOV_ali_c not in IOVali_list: IOVali_list.append(IOV_ali_c)
37 
38  # Read explicit pairs from IOVpairs
39  pair_list = []
40  if "IOVpairs" in config["validations"]["GCP"]["compare"][comparison][ali_pair]: pair_list = copy.deepcopy(config["validations"]["GCP"]["compare"][comparison][ali_pair]["IOVpairs"])
41  for IOV_p in pair_list:
42  IOV_pair = str(IOV_p[0])+'_vs_'+str(IOV_p[1])
43  IOV_ali_r = ref_name+'_'+str(IOV_p[1])
44  IOV_ali_c = comp_name+'_'+str(IOV_p[0])
45  if IOV_pair not in IOVpair_list: IOVpair_list.append(IOV_pair)
46  if IOV_ali_r not in IOVali_list: IOVali_list.append(IOV_ali_r)
47  if IOV_ali_c not in IOVali_list: IOVali_list.append(IOV_ali_c)
48 
49  # GCP Ntuple job preps
50  for IOV_ali in IOVali_list:
51  ali = IOV_ali.split('_')[0]
52  IOV = int(IOV_ali.split('_')[1])
53  workDir = "{}/GCP/{}/{}/{}".format(validationDir, comparison, 'Ntuples', IOV_ali)
54 
55  # local config
56  local = {}
57  local["output"] = "{}/{}/{}/{}/{}".format(config["LFS"], config["name"], comparison, 'Ntuples', IOV_ali)
58  local["alignments"] = copy.deepcopy(config["alignments"][ali])
59  local["validation"] = {}
60  local["validation"]['GCP'] = copy.deepcopy(config["validations"]["GCP"][comparison])
61  local["validation"]['GCP']['doUnitTest'] = doUnitTest
62  local["validation"]['IOV'] = IOV
63 
64  # job info
65  job = {
66  "name": "GCP_{}_Ntuple_{}".format(comparison, IOV_ali),
67  "dir": workDir,
68  "exe": "cmsRun",
69  "cms-config": "{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/GCP_Ntuples_cfg.py".format(os.environ["CMSSW_BASE"]),
70  "run-mode": "Condor",
71  "dependencies": [],
72  "config": local,
73  "flavour": "espresso",
74  }
75 
76  # Ntuple jobs might appear multiple times, only add if not there yet
77  already_there = False
78  for j in jobs:
79  if j["name"] == job["name"]:
80  already_there = True
81  break
82 
83  if not already_there: jobs.append(job)
84 
85  # Comparison job preps
86  for IOV_pair in IOVpair_list:
87  ref_IOV = int(IOV_pair.split('_vs_')[1])
88  comp_IOV = int(IOV_pair.split('_vs_')[0])
89 
90  # local config
91  local = {}
92  local["output"] = "{}/{}/{}/{}/{}".format(config["LFS"], config["name"], comparison, ali_pair, IOV_pair)
93  local["alignments"] = {}
94  local["alignments"]["ref"] = copy.deepcopy(config["alignments"][ref_name])
95  local["alignments"]["comp"] = copy.deepcopy(config["alignments"][comp_name])
96  local["validation"] = {}
97  local["validation"]['GCP'] = copy.deepcopy(config["validations"]["GCP"][comparison])
98  local["validation"]['GCP']['doUnitTest'] = doUnitTest
99  local["validation"]["IOVref"] = ref_IOV
100  local["validation"]["ALIref"] = ref_name
101  local["validation"]["IOVcomp"] = comp_IOV
102  local["validation"]["ALIcomp"] = comp_name
103 
104  # dependancies
105  parents = []
106  for j in jobs:
107  if not comparison in j['name']: continue
108  if not 'Ntuple' in j['name']: continue
109  if ref_name in j['name'] and str(ref_IOV) in j['name']:
110  parents.append(j['name'])
111  local["input_ref"] = j['config']['output']
112  if comp_name in j['name'] and str(comp_IOV) in j['name']:
113  parents.append(j['name'])
114  local["input_comp"] = j['config']['output']
115 
116  # Comparison jobs
117  for step in ['GCPtree', 'GCPcpp', 'GCPpython']:
118  workDir = "{}/GCP/{}/{}/{}/{}".format(validationDir, comparison, ali_pair, IOV_pair, step)
119  job = {
120  "name": "GCP_{}_{}_{}_{}".format(comparison, ali_pair, IOV_pair, step),
121  "dir": workDir,
122  "run-mode": "Condor",
123  "config": local,
124  "flavour": "espresso",
125  }
126  if step == 'GCPtree':
127  job['exe'] = 'cmsRun'
128  job['cms-config'] = "{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/GCP_tree_cfg.py".format(os.environ["CMSSW_BASE"])
129  job['dependencies'] = parents
130  elif step == 'GCPcpp':
131  job['flavour'] = 'microcentury'
132  job['exe'] = 'GCP'
133  job['dependencies'] = parents + ["GCP_{}_{}_{}_{}".format(comparison, ali_pair, IOV_pair, 'GCPtree')]
134  else:
135  job['exe'] = 'GCPpyPlots.py'
136  job['dependencies'] = parents + ["GCP_{}_{}_{}_{}".format(comparison, ali_pair, IOV_pair, 'GCPtree')]
137 
138  jobs.append(job)
139 
140  return jobs
141 
int GCP(int argc, char *argv[])
Definition: GCP.cc:162
#define str(s)