3 import globalDictionaries
4 from genericValidation
import GenericValidationData
5 from helperFunctions
import replaceByMap, addIndex
6 from TkAlExceptions
import AllInOneError
10 def __init__(self, valName, alignment, config, addDefaults = {}, addMandatories = [],
11 configBaseName =
"TkAlOfflineValidation", scriptBaseName =
"TkAlOfflineValidation", crabCfgBaseName =
"TkAlOfflineValidation",
12 resultBaseName =
"AlignmentValidation", outputBaseName =
"AlignmentValidation"):
14 "DMRMethod":
"median,rmsNorm",
17 "offlineModuleLevelHistsTransient":
"False",
18 "offlineModuleLevelProfiles":
"False",
19 "OfflineTreeBaseDir":
"TrackHitFilter",
20 "SurfaceShapes":
"none"
22 mandatories = [
"trackcollection" ]
23 defaults.update(addDefaults)
24 mandatories += addMandatories
31 GenericValidationData.__init__(self, valName, alignment, config,
32 "offline", addDefaults=defaults,
33 addMandatories=mandatories)
37 self.alignmentToValidate.name )
39 if self.
NJobs > 1
and self.
general[
"offlineModuleLevelHistsTransient"] ==
"True":
40 msg = (
"To be able to merge results when running parallel jobs,"
41 " set offlineModuleLevelHistsTransient to false.")
44 templateToUse = configTemplates.offlineTemplate
46 if "Cosmics" in self.
general[
"trackcollection"]:
47 Bfield = self.dataset.magneticFieldForRun()
48 if Bfield > 3.3
and Bfield < 4.3:
49 templateToUse = configTemplates.CosmicsOfflineValidation
50 print (
"B field for %s = %sT. Using the template for cosmics at 3.8T.\n"
51 "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section") % (self.dataset.name(), Bfield)
53 templateToUse = configTemplates.CosmicsAt0TOfflineValidation
54 print (
"B field for %s = %sT. Using the template for cosmics at 0T.\n"
55 "To override this behavior, specify AutoAlternates = false in the [alternateTemplates] section") % (self.dataset.name(), Bfield)
58 if "unknown " in Bfield:
59 msg = Bfield.replace(
"unknown ",
"",1)
60 elif "Bfield" is "unknown":
61 msg =
"Can't get the B field for %s." % self.dataset.name()
63 msg =
"B field for %s = %sT. This is not that close to 0T or 3.8T." % (self.dataset.name(), Bfield)
65 "To use this data, turn off the automatic alternates using AutoAlternates = false\n"
66 "in the [alternateTemplates] section, and choose the alternate template yourself.")
68 cfgs = {cfgName: templateToUse}
70 GenericValidationData.defaultReferenceName ] = repMap[
"finalResultFile"]
71 return GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
74 return GenericValidationData.createScript(self, path)
78 return GenericValidationData.createCrabCfg(self, path, self.
crabCfgBaseName)
81 repMap = GenericValidationData.getRepMap(self, alignment)
83 "nEvents": self.
general[
"maxevents"],
84 "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate,
85 "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate,
86 "offlineValidationMode":
"Standalone",
87 "offlineValidationFileOutput": configTemplates.offlineFileOutputTemplate,
88 "TrackCollection": self.
general[
"trackcollection"],
95 if no argument or "" is passed a string with an instantiation is
96 returned, else the validation is appended to the list
99 if validationsSoFar ==
"":
100 validationsSoFar = (
'PlotAlignmentValidation p("root://eoscms//eos/cms%(finalResultFile)s",'
101 '"%(title)s", %(color)s, %(style)s);\n')%repMap
103 validationsSoFar += (
' p.loadFileList("root://eoscms//eos/cms%(finalResultFile)s", "%(title)s",'
104 '%(color)s, %(style)s);\n')%repMap
105 return validationsSoFar
109 if no argument or "" is passed a string with an instantiation is returned,
110 else the validation is appended to the list
114 parameters =
"root://eoscms//eos/cms" +
",root://eoscms//eos/cms".
join(repMap[
"resultFiles"])
116 mergedoutputfile =
"root://eoscms//eos/cms%(finalResultFile)s"%repMap
117 validationsSoFar += (
'root -x -b -q -l "TkAlOfflineJobsMerge.C(\\\"'
118 +parameters+
'\\\",\\\"'+mergedoutputfile+
'\\\")"'
120 return validationsSoFar
123 def __init__(self, valName, alignment, config, configBaseName = "TkAlOfflineValidationDQM"):
124 OfflineValidation.__init__(self, valName, alignment, config,
125 configBaseName = configBaseName)
126 if not config.has_section(
"DQM"):
127 msg =
"You need to have a DQM section in your configfile!"
135 OfflineValidation.createConfiguration(self, path)
138 return OfflineValidation.createScript(self, path)
141 repMap = OfflineValidation.getRepMap(self, alignment)
143 "workdir": os.path.expandvars(repMap[
"workdir"]),
144 "offlineValidationMode":
"Dqm",
145 "offlineValidationFileOutput": configTemplates.offlineDqmFileOutputTemplate,
146 "workflow": (
"/%s/TkAl%s-.oO[alignmentName]Oo._R%09i_R%09i_"
147 "ValSkim-v1/ALCARECO"
149 datetime.datetime.now().strftime(
"%y"),
153 if "__" in repMap[
"workflow"]:
154 msg = (
"the DQM workflow specefication must not contain '__'. "
155 "it is: %s"%repMap[
"workflow"])
static std::string join(char **cmd)
def appendToExtendedValidation