4 from genericValidation
import GenericValidation
5 from helperFunctions
import replaceByMap
6 from TkAlExceptions
import AllInOneError
11 Object representing a geometry comparison job.
13 def __init__( self, valName, alignment, referenceAlignment,
14 config, copyImages =
True, randomWorkdirPart =
None):
16 Constructor of the GeometryComparison class.
19 - `valName`: String which identifies individual validation instances
20 - `alignment`: `Alignment` instance to validate
21 - `referenceAlignment`: `Alignment` instance which is compared
23 - `config`: `BetterConfigParser` instance which includes the
24 configuration of the validations
25 - `copyImages`: Boolean which indicates whether png- and pdf-files
26 should be copied back from the batch farm
27 - `randomWorkDirPart`: If this option is ommitted a random number is
28 generated to create unique path names for the
29 individual validation instances.
31 GenericValidation.__init__(self, valName, alignment, config)
32 if not randomWorkdirPart ==
None:
37 except ConfigParser.NoOptionError:
39 referenceName =
"IDEAL"
41 referenceName = self.referenceAlignment.name
43 allCompares = config.getCompares()
45 if valName
in allCompares:
46 self.
__compares[valName] = allCompares[valName]
48 msg = (
"Could not find compare section '%s' in '%s'"
49 %(valName, allCompares))
56 repMap = GenericValidation.getRepMap( self, alignment )
57 referenceName =
"IDEAL"
59 referenceName = self.referenceAlignment.name
62 "comparedGeometry": (
".oO[alignmentName]Oo."
64 "referenceGeometry":
"IDEAL",
66 "reference": referenceName
68 if not referenceName ==
"IDEAL":
69 repMap[
"referenceGeometry"] = (
".oO[reference]Oo."
71 repMap[
"name"] +=
"_vs_.oO[reference]Oo."
77 cfgs = {
"TkAlCompareToNTuple.%s.%s_cfg.py"%(
79 replaceByMap( configTemplates.intoNTuplesTemplate, repMap)}
82 cfgFileName =
"TkAlCompareToNTuple.%s.%s_cfg.py"%(
84 cfgs[cfgFileName] =
replaceByMap(configTemplates.intoNTuplesTemplate,
87 cfgSchedule = cfgs.keys()
89 repMap.update({
"common": common,
94 repMap[
"dbOutputService"] = configTemplates.dbOutputTemplate
96 repMap[
"dbOutputService"] =
""
97 cfgName =
replaceByMap((
"TkAlCompareCommon.oO[common]Oo.."
98 ".oO[name]Oo._cfg.py"),repMap)
99 cfgs[cfgName] =
replaceByMap(configTemplates.compareTemplate, repMap)
101 cfgSchedule.append( cfgName )
102 GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule)
106 repMap[
"runComparisonScripts"] =
""
107 scriptName =
replaceByMap((
"TkAlGeomCompare.%s..oO[name]Oo..sh"
111 repMap[
"runComparisonScripts"] += \
112 (
"rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
113 "/scripts/comparisonScript.C .\n"
114 "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
115 "/scripts/comparisonPlots.h .\n"
116 "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
117 "/scripts/comparisonPlots.cc .\n"
118 "root -b -q 'comparisonScript.C(\""
119 ".oO[name]Oo..Comparison_common"+name+
".root\",\""
122 repMap[
"runComparisonScripts"] += \
123 (
"rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
124 ".Comparison_common"+name+
"_Images\n")
125 repMap[
"runComparisonScripts"] += \
126 (
"find . -maxdepth 1 -name \"plot*.eps\" "
127 "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
128 "/.oO[name]Oo..Comparison_common"+name+
"_Images/\" \n")
129 repMap[
"runComparisonScripts"] += \
130 (
"find . -maxdepth 1 -name \"plot*.pdf\" "
131 "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
132 "/.oO[name]Oo..Comparison_common"+name+
"_Images/\" \n")
133 repMap[
"runComparisonScripts"] += \
134 (
"find . -maxdepth 1 -name "
135 "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
136 " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
137 ".Comparison_common"+name+
"_Images/\" \n")
138 repMap[
"runComparisonScripts"] += \
139 (
"find . -maxdepth 1 -name "
140 "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
141 " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
142 ".Comparison_common"+name+
"_Images/\" \n")
143 repMap[
"runComparisonScripts"] += \
144 (
"if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
146 " rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
149 " mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
152 repMap[
"runComparisonScripts"] += \
153 (
"rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
154 "/OfflineValidation/scripts/makeArrowPlots "
155 "$CWD/TkAllInOneTool\n"
156 "root -b -q 'makeArrowPlots.C(\""
157 ".oO[name]Oo..Comparison_common"+name
158 +
".root\",\".oO[name]Oo.."
159 +name+
"_ArrowPlots\")'\n")
160 repMap[
"runComparisonScripts"] += \
161 (
"rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
162 ".Comparison_common"+name+
"_Images/ArrowPlots\n")
163 repMap[
"runComparisonScripts"] += \
164 (
"find .oO[name]Oo.."+name+
"_ArrowPlots "
165 "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
166 "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
167 ".Comparison_common"+name+
"_Images/ArrowPlots\"\n")
169 resultingFile =
replaceByMap((
"/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
170 ".oO[name]Oo..root"%name), repMap)
171 resultingFile = os.path.expandvars( resultingFile )
172 resultingFile = os.path.abspath( resultingFile )
173 repMap[
"runComparisonScripts"] += \
174 (
"cmsStage -f OUTPUT_comparison.root %s\n"
178 repMap[
"CommandLine"]=
""
183 postProcess =
"rfcp *.db .oO[datadir]Oo.\n"
184 repMap[
"CommandLine"]+= \
185 repMap[
"CommandLineTemplate"]%{
"cfgFile":cfg,
186 "postProcess":postProcess}
187 repMap[
"CommandLine"]+= (
"# overall postprocessing\n"
188 ".oO[runComparisonScripts]Oo.\n"
191 scripts = {scriptName:
replaceByMap( configTemplates.scriptTemplate, repMap ) }
192 return GenericValidation.createScript(self, scripts, path)
195 msg = (
"Parallelization not supported for geometry comparison. Please "
196 "choose another 'jobmode'.")
def replaceByMap
— Helpers —############################