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",
23 deprecateddefaults = {
27 "OfflineTreeBaseDir":
"",
30 defaults.update(deprecateddefaults)
31 mandatories = {
"trackcollection"}
34 def __init__(self, valName, alignment, config):
35 super(OfflineValidation, self).
__init__(valName, alignment, config)
37 for name
in "offlineModuleLevelHistsTransient",
"offlineModuleLevelProfiles",
"stripYResiduals":
42 raise AllInOneError(
"The '%s' option has been moved to the [plots:offline] section. Please specify it there."%option)
45 if self.
NJobs > 1
and self.
general[
"offlineModuleLevelHistsTransient"] ==
"True":
46 msg = (
"To be able to merge results when running parallel jobs," 47 " set offlineModuleLevelHistsTransient to false.")
52 if self.
NTracks < 0:
raise ValueError
54 raise AllInOneError(
"maxtracks has to be a positive integer, or 0 for no limit")
57 raise AllInOneError(
"maxtracks has to be divisible by parallelJobs")
61 return "OfflineValidator" 65 return configTemplates.offlineTemplate
69 return configTemplates.OfflineValidationSequence
73 return configTemplates.offlineFileOutputTemplate
82 repMap = super(OfflineValidation, self).
getRepMap(alignment)
84 "nEvents": self.
general[
"maxevents"],
85 "offlineValidationMode":
"Standalone",
86 "TrackCollection": self.
general[
"trackcollection"],
87 "filetoplot":
"root://eoscms//eos/cms.oO[finalResultFile]Oo.",
93 return ' p.loadFileList(".oO[filetoplot]Oo.", ".oO[title]Oo.", .oO[color]Oo., .oO[style]Oo.);\n' 97 from .plottingOptions
import PlottingOptions
99 with open(outFilePath,
"w")
as theFile:
100 theFile.write(
replaceByMap(configTemplates.mergeOfflineParJobsTemplate, {}))
101 result = super(OfflineValidation, cls).
initMerge()
102 result += (
"cp .oO[Alignment/OfflineValidation]Oo./scripts/merge_TrackerOfflineValidation.C .\n" 103 "rfcp .oO[mergeOfflineParJobsScriptPath]Oo. .\n")
109 parameters =
"root://eoscms//eos/cms" +
",root://eoscms//eos/cms".
join(repMap[
"resultFiles"])
111 mergedoutputfile =
"root://eoscms//eos/cms%(finalResultFile)s"%repMap
112 return (
'root -x -b -q -l "TkAlOfflineJobsMerge.C(\\\"' 113 +parameters+
'\\\",\\\"'+mergedoutputfile+
'\\\")"')
117 return "TkAlExtendedOfflineValidation.C" 121 return configTemplates.extendedValidationTemplate
125 return "ExtendedOfflineValidation_Images" 129 return "compareAlignments.cc" 154 configBaseName =
"TkAlOfflineValidationDQM" 156 super(OfflineValidationDQM, self).
__init__(valName, alignment, config)
157 if not config.has_section(
"DQM"):
158 msg =
"You need to have a DQM section in your configfile!" 166 repMap = super(OfflineValidationDQM, self).
getRepMap(alignment)
168 "workdir": os.path.expandvars(repMap[
"workdir"]),
169 "offlineValidationMode":
"Dqm",
170 "workflow": (
"/%s/TkAl%s-.oO[alignmentName]Oo._R%09i_R%09i_" 171 "ValSkim-v1/ALCARECO" 173 datetime.datetime.now().strftime(
"%y"),
177 if "__" in repMap[
"workflow"]:
178 msg = (
"the DQM workflow specefication must not contain '__'. " 179 "it is: %s"%repMap[
"workflow"])
185 return configTemplates.offlineDqmFileOutputTemplate
def getRepMap(self, alignment=None)
def FileOutputTemplate(self)
def pythonboolstring(string, name)
def presentationsubsections(cls)
def ValidationSequence(self)
def FileOutputTemplate(self)
def createScript(self, path)
def comparealignmentsname(cls)
def __init__(self, valName, alignment, config)
def getRepMap(self, alignment=None)
def plottingscripttemplate(cls)
def ValidationTemplate(self)
def plottingscriptname(cls)
def PlottingOptions(config, valType)
def replaceByMap(target, the_map)
— Helpers —############################
dictionary deprecateddefaults
static std::string join(char **cmd)
def createCrabCfg(self, path)
def __init__(self, valName, alignment, config)
def getRepMap(self, alignment=None)