1 from __future__
import absolute_import
3 from .
import configTemplates
4 from .
import globalDictionaries
5 from .genericValidation
import GenericValidationData_CTSR, ParallelValidation, ValidationWithComparison, ValidationForPresentation, ValidationWithPlots, ValidationWithPlotsSummary
6 from .helperFunctions
import replaceByMap, addIndex, pythonboolstring
7 from .presentation
import SubsectionFromList, SubsectionOnePage
8 from .TkAlExceptions
import AllInOneError
11 configBaseName =
"TkAlOfflineValidation"
12 scriptBaseName =
"TkAlOfflineValidation"
13 crabCfgBaseName =
"TkAlOfflineValidation"
14 resultBaseName =
"AlignmentValidation"
15 outputBaseName =
"AlignmentValidation"
17 "offlineModuleLevelHistsTransient":
"False",
18 "offlineModuleLevelProfiles":
"True",
19 "stripYResiduals":
"False",
24 deprecateddefaults = {
28 "OfflineTreeBaseDir":
"",
31 defaults.update(deprecateddefaults)
32 mandatories = {
"trackcollection"}
35 def __init__(self, valName, alignment, config):
36 super(OfflineValidation, self).
__init__(valName, alignment, config)
38 for name
in "offlineModuleLevelHistsTransient",
"offlineModuleLevelProfiles",
"stripYResiduals":
43 raise AllInOneError(
"The '%s' option has been moved to the [plots:offline] section. Please specify it there."%option)
46 if self.
NJobs > 1
and self.
general[
"offlineModuleLevelHistsTransient"] ==
"True":
47 msg = (
"To be able to merge results when running parallel jobs,"
48 " set offlineModuleLevelHistsTransient to false.")
53 if self.
NTracks < 0:
raise ValueError
55 raise AllInOneError(
"maxtracks has to be a positive integer, or 0 for no limit")
58 raise AllInOneError(
"maxtracks has to be divisible by parallelJobs")
62 return "OfflineValidator"
66 return configTemplates.offlineTemplate
70 return configTemplates.OfflineValidationSequence
74 return configTemplates.offlineFileOutputTemplate
83 repMap = super(OfflineValidation, self).
getRepMap(alignment)
85 "nEvents": self.
general[
"maxevents"],
86 "offlineValidationMode":
"Standalone",
87 "TrackCollection": self.
general[
"trackcollection"],
88 "filetoplot":
"root://eoscms//eos/cms.oO[finalResultFile]Oo.",
94 return ' p.loadFileList(".oO[filetoplot]Oo.", ".oO[title]Oo.", .oO[color]Oo., .oO[style]Oo.);\n'
98 from .plottingOptions
import PlottingOptions
102 with open(outFilePath,
"w")
as theFile:
103 theFile.write(
replaceByMap(configTemplates.mergeOfflineParJobsTemplate, {}))
104 result = super(OfflineValidation, cls).
initMerge()
105 result += (
"cp .oO[Alignment/OfflineValidation]Oo./scripts/merge_TrackerOfflineValidation.C .\n"
106 "cp .oO[mergeOfflineParJobsScriptPath]Oo. .\n")
112 parameters =
"root://eoscms//eos/cms" +
",root://eoscms//eos/cms".
join(repMap[
"resultFiles"])
114 mergedoutputfile =
"root://eoscms//eos/cms%(finalResultFile)s"%repMap
115 return (
'root -x -b -q -l "TkAlOfflineJobsMerge.C(\\\"'
116 +parameters+
'\\\",\\\"'+mergedoutputfile+
'\\\")"')
120 return "TkAlExtendedOfflineValidation.C"
124 return configTemplates.extendedValidationTemplate
128 return "ExtendedOfflineValidation_Images"
132 return "compareAlignments.cc"
157 configBaseName =
"TkAlOfflineValidationDQM"
159 super(OfflineValidationDQM, self).
__init__(valName, alignment, config)
160 if not config.has_section(
"DQM"):
161 msg =
"You need to have a DQM section in your configfile!"
169 repMap = super(OfflineValidationDQM, self).
getRepMap(alignment)
171 "workdir": os.path.expandvars(repMap[
"workdir"]),
172 "offlineValidationMode":
"Dqm",
173 "workflow": (
"/%s/TkAl%s-.oO[alignmentName]Oo._R%09i_R%09i_"
174 "ValSkim-v1/ALCARECO"
176 datetime.datetime.now().strftime(
"%y"),
180 if "__" in repMap[
"workflow"]:
181 msg = (
"the DQM workflow specefication must not contain '__'. "
182 "it is: %s"%repMap[
"workflow"])
188 return configTemplates.offlineDqmFileOutputTemplate