3 import globalDictionaries
4 from genericValidation
import GenericValidationData_CTSR, ParallelValidation, ValidationWithComparison, ValidationForPresentation, ValidationWithPlots, ValidationWithPlotsSummary
5 from helperFunctions
import replaceByMap, addIndex, pythonboolstring
6 from presentation
import SubsectionFromList, SubsectionOnePage
7 from TkAlExceptions
import AllInOneError
10 configBaseName =
"TkAlOfflineValidation" 11 scriptBaseName =
"TkAlOfflineValidation" 12 crabCfgBaseName =
"TkAlOfflineValidation" 13 resultBaseName =
"AlignmentValidation" 14 outputBaseName =
"AlignmentValidation" 16 "offlineModuleLevelHistsTransient":
"False",
17 "offlineModuleLevelProfiles":
"True",
18 "stripYResiduals":
"False",
21 deprecateddefaults = {
25 "OfflineTreeBaseDir":
"",
28 defaults.update(deprecateddefaults)
29 mandatories = {
"trackcollection"}
32 def __init__(self, valName, alignment, config):
33 super(OfflineValidation, self).
__init__(valName, alignment, config)
35 for name
in "offlineModuleLevelHistsTransient",
"offlineModuleLevelProfiles",
"stripYResiduals":
40 raise AllInOneError(
"The '%s' option has been moved to the [plots:offline] section. Please specify it there."%option)
43 if self.
NJobs > 1
and self.
general[
"offlineModuleLevelHistsTransient"] ==
"True":
44 msg = (
"To be able to merge results when running parallel jobs," 45 " set offlineModuleLevelHistsTransient to false.")
50 if self.
NTracks < 0:
raise ValueError
52 raise AllInOneError(
"maxtracks has to be a positive integer, or 0 for no limit")
55 raise AllInOneError(
"maxtracks has to be divisible by parallelJobs")
59 return "OfflineValidator" 63 return configTemplates.offlineTemplate
67 return configTemplates.OfflineValidationSequence
71 return configTemplates.offlineFileOutputTemplate
80 repMap = super(OfflineValidation, self).
getRepMap(alignment)
82 "nEvents": self.
general[
"maxevents"],
83 "offlineValidationMode":
"Standalone",
84 "TrackCollection": self.
general[
"trackcollection"],
85 "filetoplot":
"root://eoscms//eos/cms.oO[finalResultFile]Oo.",
91 return ' p.loadFileList(".oO[filetoplot]Oo.", ".oO[title]Oo.", .oO[color]Oo., .oO[style]Oo.);\n' 95 from plottingOptions
import PlottingOptions
97 with open(outFilePath,
"w")
as theFile:
98 theFile.write(
replaceByMap(configTemplates.mergeOfflineParJobsTemplate, {}))
99 result = super(OfflineValidation, cls).
initMerge()
100 result += (
"cp .oO[Alignment/OfflineValidation]Oo./scripts/merge_TrackerOfflineValidation.C .\n" 101 "rfcp .oO[mergeOfflineParJobsScriptPath]Oo. .\n")
107 parameters =
"root://eoscms//eos/cms" +
",root://eoscms//eos/cms".
join(repMap[
"resultFiles"])
109 mergedoutputfile =
"root://eoscms//eos/cms%(finalResultFile)s"%repMap
110 return (
'root -x -b -q -l "TkAlOfflineJobsMerge.C(\\\"' 111 +parameters+
'\\\",\\\"'+mergedoutputfile+
'\\\")"')
115 return "TkAlExtendedOfflineValidation.C" 119 return configTemplates.extendedValidationTemplate
123 return "ExtendedOfflineValidation_Images" 127 return "compareAlignments.cc" 152 configBaseName =
"TkAlOfflineValidationDQM" 154 super(OfflineValidationDQM, self).
__init__(valName, alignment, config)
155 if not config.has_section(
"DQM"):
156 msg =
"You need to have a DQM section in your configfile!" 164 repMap = super(OfflineValidationDQM, self).
getRepMap(alignment)
166 "workdir": os.path.expandvars(repMap[
"workdir"]),
167 "offlineValidationMode":
"Dqm",
168 "workflow": (
"/%s/TkAl%s-.oO[alignmentName]Oo._R%09i_R%09i_" 169 "ValSkim-v1/ALCARECO" 171 datetime.datetime.now().strftime(
"%y"),
175 if "__" in repMap[
"workflow"]:
176 msg = (
"the DQM workflow specefication must not contain '__'. " 177 "it is: %s"%repMap[
"workflow"])
183 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)