4 def Zmumu(config, validationDir):
6 jobs, singleJobs = [], []
16 if not zmumuType
in config[
"validations"][
"Zmumu"]:
17 raise Exception(
"No 'single' key word in config for Zmumu")
19 for singleName
in config[
"validations"][
"Zmumu"][zmumuType]:
20 aux_IOV = config[
"validations"][
"Zmumu"][zmumuType][singleName][
"IOV"]
21 if not isinstance(aux_IOV, list)
and aux_IOV.endswith(
".txt"):
22 config[
"validations"][
"Zmumu"][zmumuType][singleName][
"IOV"] = []
23 with open(aux_IOV,
'r') as IOVfile: for line
in IOVfile.readlines():
24 if len(line) != 0: config[
"validations"][
"Zmumu"][zmumuType][singleName][
"IOV"].
append(
int(line))
25 for IOV
in config[
"validations"][
"Zmumu"][zmumuType][singleName][
"IOV"]:
27 if singleName
not in IOVs.keys():
29 if IOV
not in IOVs[singleName]:
30 IOVs[singleName].
append(IOV)
32 for alignment
in config[
"validations"][
"Zmumu"][zmumuType][singleName][
"alignments"]:
34 workDir =
"{}/Zmumu/{}/{}/{}/{}".
format(validationDir, zmumuType, singleName, alignment, IOV)
38 local[
"output"] =
"{}/{}/Zmumu/{}/{}/{}/{}".
format(config[
"LFS"], config[
"name"], zmumuType, alignment, singleName, IOV)
39 local[
"alignment"] = copy.deepcopy(config[
"alignments"][alignment])
40 local[
"alignment"][
"name"] = alignment
41 local[
"validation"] = copy.deepcopy(config[
"validations"][
"Zmumu"][zmumuType][singleName])
42 local[
"validation"].pop(
"alignments")
43 local[
"validation"][
"IOV"] = IOV
44 if "dataset" in local[
"validation"]:
45 local[
"validation"][
"dataset"] = local[
"validation"][
"dataset"].
format(IOV)
46 if "goodlumi" in local[
"validation"]:
47 local[
"validation"][
"goodlumi"] = local[
"validation"][
"goodlumi"].
format(IOV)
51 "name":
"Zmumu_{}_{}_{}_{}".
format(zmumuType, alignment, singleName, IOV),
54 "cms-config":
"{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/Zmumu_cfg.py".
format(os.environ[
"CMSSW_BASE"]),
60 singleJobs.append(job)
62 jobs.extend(singleJobs)
65 if "merge" in config[
"validations"][
"Zmumu"]:
71 for mergeName
in config[
"validations"][
"Zmumu"][zmumuType]:
74 for singleName
in config[
"validations"][
"Zmumu"][zmumuType][mergeName][
'singles']:
75 if len(IOVs[singleName]) == 1
and int(IOVs[singleName][0]) == 1: singlesMC.append(singleName)
76 isMConly = (len(singlesMC) == len(config[
"validations"][
"Zmumu"][zmumuType][mergeName][
'singles']))
78 isDataMerged[mergeName] = 0
79 elif len(singlesMC) == 0:
80 isDataMerged[mergeName] = 1
82 isDataMerged[mergeName] = -1
85 for iname,singleName
in enumerate(config[
"validations"][
"Zmumu"][zmumuType][mergeName][
'singles']):
86 isMC = (singleName
in singlesMC)
87 if isMConly
and iname > 0:
continue 88 elif isMConly: singlesMC.pop(singlesMC.index(singleName))
90 for IOV
in IOVs[singleName]:
92 workDir =
"{}/Zmumu/{}/{}/{}".
format(validationDir, zmumuType, mergeName, IOV)
98 "name":
"Zmumu_{}_{}_{}".
format(zmumuType, mergeName, IOV),
101 "run-mode":
"Condor",
107 for alignment
in config[
"alignments"]:
109 local.setdefault(
"alignments", {})
110 if alignment
in config[
"validations"][
"Zmumu"][
"single"][singleName][
"alignments"]:
111 local[
"alignments"][alignment] = copy.deepcopy(config[
"alignments"][alignment])
112 local[
"alignments"][alignment][
'index'] = config[
"validations"][
"Zmumu"][
"single"][singleName][
"alignments"].
index(alignment)
113 local[
"alignments"][alignment][
'isMC'] =
False 114 for singleMCname
in singlesMC:
115 if alignment
in config[
"validations"][
"Zmumu"][
"single"][singleMCname][
"alignments"]:
116 local[
"alignments"][alignment] = copy.deepcopy(config[
"alignments"][alignment])
117 local[
"alignments"][alignment][
'index'] = len(config[
"validations"][
"Zmumu"][
"single"][singleName][
"alignments"])
118 local[
"alignments"][alignment][
'index'] += idxIncrement + config[
"validations"][
"Zmumu"][
"single"][singleMCname][
"alignments"].
index(alignment)
119 local[
"alignments"][alignment][
'isMC'] =
True 120 idxIncrement += len(config[
"validations"][
"Zmumu"][
"single"][singleMCname][
"alignments"])
121 local[
"validation"] = copy.deepcopy(config[
"validations"][
"Zmumu"][zmumuType][mergeName])
122 local[
"validation"][
"IOV"] = IOV
123 if "customrighttitle" in local[
"validation"].
keys():
124 if "IOV" in local[
"validation"][
"customrighttitle"]:
125 local[
"validation"][
"customrighttitle"] = local[
"validation"][
"customrighttitle"].
replace(
"IOV",
str(IOV))
126 local[
"output"] =
"{}/{}/Zmumu/{}/{}/{}".
format(config[
"LFS"], config[
"name"], zmumuType, mergeName, IOV)
129 if "style" in config.keys():
130 if "Zmumu" in config[
'style'].
keys():
131 if zmumuType
in config[
'style'][
'Zmumu'].
keys():
132 local[
"style"] = copy.deepcopy(config[
"style"][
"Zmumu"][zmumuType])
133 if "Rlabel" in local[
"style"]
and "customrighttitle" in local[
"validation"].
keys():
134 print(
"WARNING: custom right label is overwritten by global settings")
137 for singleJob
in jobs:
139 _alignment, _singleName, _singleIOV = singleJob[
"name"].
split(
"_")[2:]
140 if _singleName
in config[
"validations"][
"Zmumu"][zmumuType][mergeName][
"singles"]:
141 if int(_singleIOV) == IOV
or (
int(_singleIOV) == 1
and _singleName
in singlesMC):
142 local[
"alignments"][_alignment][
"file"] = singleJob[
"config"][
"output"]
143 job[
"dependencies"].
append(singleJob[
"name"])
145 mergeJobs.append(job)
147 jobs.extend(mergeJobs)
149 if "trends" in config[
"validations"][
"Zmumu"]:
150 print(
"[WARNING] Zmumu trends are not implemented yet. Nothing to do here...")
153 def replace(string, replacements)
def Zmumu(config, validationDir)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)