CMS 3D CMS Logo

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