30 def JetHT(config, validationDir):
39 dayFormat = today.strftime(
"%Y-%m-%d")
42 if not runType
in config[
"validations"][
"JetHT"]:
43 raise Exception(
"No 'single' key word in config for JetHT")
45 for datasetName
in config[
"validations"][
"JetHT"][runType]:
47 for alignment
in config[
"validations"][
"JetHT"][runType][datasetName][
"alignments"]:
49 workDir =
"{}/JetHT/{}/{}/{}".
format(validationDir, runType, datasetName, alignment)
53 local[
"output"] =
"{}/{}/JetHT/{}/{}/{}".
format(config[
"LFS"], config[
"name"], runType, datasetName, alignment)
54 local[
"alignment"] = copy.deepcopy(config[
"alignments"][alignment])
55 local[
"validation"] = copy.deepcopy(config[
"validations"][
"JetHT"][runType][datasetName])
56 local[
"validation"].pop(
"alignments")
61 if "dataset" in config[
"validations"][
"JetHT"][runType][datasetName]:
62 inputList = config[
"validations"][
"JetHT"][runType][datasetName][
"dataset"]
65 if re.match(
r'^/[^/.]+/[^/.]+/[^/.]+$', inputList ):
72 inputList =
"needToHaveSomeDefaultFileHere.txt" 74 if "filesPerJob" in config[
"validations"][
"JetHT"][runType][datasetName]:
75 filesPerJob = config[
"validations"][
"JetHT"][runType][datasetName][
"filesPerJob"]
80 oneJobForEachRun = (len(runsInFiles) > 0)
82 nCondorJobs = nInputFiles
83 local[
"runsInFiles"] = runsInFiles
85 nCondorJobs = math.ceil(nInputFiles / filesPerJob)
88 crabCustomConfiguration = {
"overwrite":[],
"remove":[],
"add":[]}
89 crabCustomConfiguration[
"overwrite"].
append(
"inputList = \'{}\'".
format(inputList))
90 crabCustomConfiguration[
"overwrite"].
append(
"jobTag = \'TkAlJetHTAnalysis_{}_{}_{}_{}\'".
format(runType, datasetName, alignment, dayFormat))
91 crabCustomConfiguration[
"overwrite"].
append(
"config.Data.unitsPerJob = {}".
format(filesPerJob))
95 crabCustomConfiguration[
"remove"].
append(
"inputList")
96 crabCustomConfiguration[
"remove"].
append(
"config.Data.userInputFiles")
97 crabCustomConfiguration[
"remove"].
append(
"config.Data.totalUnits")
98 crabCustomConfiguration[
"remove"].
append(
"config.Data.outputPrimaryDataset")
99 crabCustomConfiguration[
"overwrite"].pop(0)
100 crabCustomConfiguration[
"add"].
append(
"config.Data.inputDataset = \'{}\'".
format(inputList))
101 crabCustomConfiguration[
"add"].
append(
"config.Data.inputDBS = \'global\'")
103 local[
"crabCustomConfiguration"] = crabCustomConfiguration
107 "name":
"JetHT_{}_{}_{}".
format(runType, alignment, datasetName),
110 "cms-config":
"{}/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/JetHT_cfg.py".
format(os.environ[
"CMSSW_BASE"]),
111 "run-mode":
"Condor",
112 "nCondorJobs": nCondorJobs,
113 "exeArguments":
"validation_cfg.py config=validation.json jobNumber=$JOBNUMBER",
121 if "merge" in config[
"validations"][
"JetHT"]:
126 for datasetName
in config[
"validations"][
"JetHT"][runType]:
128 for alignment
in config[
"validations"][
"JetHT"][runType][datasetName][
"alignments"]:
131 workDir =
"{}/JetHT/{}/{}/{}".
format(validationDir, runType, datasetName, alignment)
133 inputDirectory =
"{}/{}/JetHT/single/{}/{}".
format(config[
"LFS"], config[
"name"], datasetName, alignment)
134 outputDirectory =
"{}/{}/JetHT/{}/{}/{}".
format(config[
"LFS"], config[
"name"], runType, datasetName, alignment)
138 local[
"output"] = outputDirectory
141 eosInputDirectory = inputDirectory
142 eosOutputDirectory = outputDirectory
144 if inputDirectory.startswith(
"/eos/cms"):
145 eosInputDirectory = inputDirectory[8:]
146 eosOutputDirectory = outputDirectory[8:]
150 if eosInputDirectory.startswith(
"/store"):
155 "name":
"JetHT_{}_{}_{}".
format(runType, alignment, datasetName),
157 "exe":
"addHistograms.sh",
158 "exeArguments":
"{} {} {} JetHTAnalysis_merged".
format(localRun, eosInputDirectory, eosOutputDirectory),
159 "run-mode":
"Condor",
160 "flavour":
"espresso",
166 for singleJob
in jobs:
168 singleAlignment, singleDatasetName = singleJob[
"name"].
split(
"_")[2:]
170 if singleDatasetName
in config[
"validations"][
"JetHT"][runType][datasetName][
"singles"]:
171 if singleAlignment == alignment:
172 job[
"dependencies"].
append(singleJob[
"name"])
174 mergeJobs.append(job)
176 jobs.extend(mergeJobs)
179 if "plot" in config[
"validations"][
"JetHT"]:
185 for datasetName
in config[
"validations"][
"JetHT"][runType]:
188 workDir =
"{}/JetHT/{}/{}".
format(validationDir, runType, datasetName)
189 outputDirectory =
"{}/{}/JetHT/{}/{}".
format(config[
"LFS"], config[
"name"], runType, datasetName)
193 if "jethtplot" in config[
"validations"][
"JetHT"][runType][datasetName]:
194 local[
"jethtplot"] = copy.deepcopy(config[
"validations"][
"JetHT"][runType][datasetName][
"jethtplot"])
195 local[
"output"] = outputDirectory
198 if "profilePtBorders" in config[
"validations"][
"JetHT"][
"single"][datasetName]:
199 local[
"jethtplot"][
"widePtBinBorders"] = config[
"validations"][
"JetHT"][
"single"][datasetName][
"profilePtBorders"]
201 local[
"jethtplot"][
"alignments"] = {}
204 for alignment
in config[
"validations"][
"JetHT"][runType][datasetName][
"alignments"]:
206 inputDirectory =
"{}/{}/JetHT/merge/{}/{}".
format(config[
"LFS"], config[
"name"], datasetName, alignment)
208 eosInputFile = inputDirectory +
"/JetHTAnalysis_merged.root" 211 if eosInputFile.startswith(
"/eos/cms"):
212 eosInputFile = eosInputFile[8:]
215 if eosInputFile.startswith(
"/store"):
216 eosInputFile =
"root://eoscms.cern.ch/" + eosInputFile
218 local[
"jethtplot"][
"alignments"][alignment] = copy.deepcopy(config[
"alignments"][alignment])
219 local[
"jethtplot"][
"alignments"][alignment][
"inputFile"] = eosInputFile
220 local[
"jethtplot"][
"alignments"][alignment][
"legendText"] = config[
"alignments"][alignment][
"title"]
223 if not "lumiPerIovFile" in local[
"jethtplot"]:
224 local[
"jethtplot"][
"lumiPerIovFile"] = fnc.digest_path(
"Alignment/OfflineValidation/data/lumiPerRun_Run2.txt")
228 "name":
"JetHT_{}_{}".
format(runType, datasetName),
230 "exe":
"jetHtPlotter",
231 "run-mode":
"Condor",
232 "flavour":
"espresso",
238 for mergeJob
in mergeJobs:
240 mergeAlignment, mergeDatasetName = mergeJob[
"name"].
split(
"_")[2:]
242 if mergeDatasetName
in config[
"validations"][
"JetHT"][runType][datasetName][
"merges"]:
243 job[
"dependencies"].
append(mergeJob[
"name"])
247 jobs.extend(plotJobs)
250 def findNumberOfUnits(fileList)
def split(sequence, size)
def JetHT(config, validationDir)