CMS 3D CMS Logo

Zmumu.py
Go to the documentation of this file.
1 import copy
2 import os
3 
4 def Zmumu(config, validationDir):
5 
6  jobs = []
7  zmumuType = "single"
8 
9 
10  IOVs = []
11 
12 
13  if not zmumuType in config["validations"]["Zmumu"]:
14  raise Exception("No 'single' key word in config for Zmumu")
15 
16  for datasetName in config["validations"]["Zmumu"][zmumuType]:
17  for IOV in config["validations"]["Zmumu"][zmumuType][datasetName]["IOV"]:
18 
19  if not IOV in IOVs:
20  IOVs.append(IOV)
21 
22  for alignment in config["validations"]["Zmumu"][zmumuType][datasetName]["alignments"]:
23 
24  workDir = "{}/Zmumu/{}/{}/{}/{}".format(validationDir, zmumuType, datasetName, alignment, IOV)
25 
26 
27  local = {}
28  local["output"] = "{}/{}/{}/{}/{}/{}".format(config["LFS"], config["name"], zmumuType, alignment, datasetName, IOV)
29  local["alignment"] = copy.deepcopy(config["alignments"][alignment])
30  local["validation"] = copy.deepcopy(config["validations"]["Zmumu"][zmumuType][datasetName])
31  local["validation"].pop("alignments")
32  local["validation"]["IOV"] = IOV
33  if "goodlumi" in local["validation"]:
34  local["validation"]["goodlumi"] = local["validation"]["goodlumi"].format(IOV)
35 
36 
37  job = {
38  "name": "Zmumu_{}_{}_{}_{}".format(zmumuType, alignment, datasetName, IOV),
39  "dir": workDir,
40  "exe": "cmsRun",
41  "cms-config": "{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py".format(os.environ["CMSSW_BASE"]),
42  "run-mode": "Condor",
43  "dependencies": [],
44  "config": local,
45  }
46 
47  jobs.append(job)
48 
49 
50  if "merge" in config["validations"]["Zmumu"]:
51 
52  mergeJobs = []
53  zmumuType = "merge"
54 
55 
56  for mergeName in config["validations"]["Zmumu"][zmumuType]:
57  for IOV in IOVs:
58 
59  workDir = "{}/Zmumu/{}/{}/{}".format(validationDir, zmumuType, mergeName, IOV)
60 
61 
62  local = {}
63 
64  job = {
65  "name": "Zmumu_{}_{}_{}".format(zmumuType, mergeName, IOV),
66  "dir": workDir,
67  "exe": "Zmumumerge",
68  "run-mode": "Condor",
69  "dependencies": [],
70  "config": local,
71  }
72 
73  for alignment in config["alignments"]:
74 
75  local.setdefault("alignments", {})
76  local["alignments"][alignment] = copy.deepcopy(config["alignments"][alignment])
77  local["validation"] = copy.deepcopy(config["validations"]["Zmumu"][zmumuType][mergeName])
78  local["output"] = "{}/{}/{}/{}/{}".format(config["LFS"], config["name"], zmumuType, mergeName, IOV)
79 
80 
81  for singleJob in jobs:
82 
83  alignment, datasetName, singleIOV = singleJob["name"].split("_")[2:]
84 
85  if int(singleIOV) == IOV and datasetName in config["validations"]["Zmumu"][zmumuType][mergeName]["singles"]:
86  local["alignments"][alignment]["file"] = singleJob["config"]["output"]
87  job["dependencies"].append(singleJob["name"])
88 
89  mergeJobs.append(job)
90 
91  jobs.extend(mergeJobs)
92 
93  return jobs
def Zmumu(config, validationDir)
Definition: Zmumu.py:4