CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
geometryComparison.GeometryComparison Class Reference
Inheritance diagram for geometryComparison.GeometryComparison:
genericValidation.GenericValidation genericValidation.ValidationMetaClass

Public Member Functions

def __init__ (self, valName, alignment, referenceAlignment, config, copyImages=True)
 
def createConfiguration (self, path)
 
def createCrabCfg (self, path)
 
def createScript (self, path)
 
def filesToCompare (self)
 
def getRepMap (self, alignment=None)
 
- Public Member Functions inherited from genericValidation.GenericValidation
def __init__ (self, valName, alignment, config)
 
def createConfiguration (self, fileContents, path, schedule=None, repMap=None, repMaps=None)
 
def createCrabCfg (self, fileContents, path)
 
def createFiles (self, fileContents, path, repMap=None, repMaps=None)
 
def createScript (self, fileContents, path, downloadFiles=[], repMap=None, repMaps=None)
 
def getCompareStrings (self, requestId=None, plain=False)
 
- Public Member Functions inherited from genericValidation.ValidationMetaClass
def __new__ (cls, clsname, bases, dct)
 

Public Attributes

 copyImages
 
 referenceAlignment
 
- Public Attributes inherited from genericValidation.GenericValidation
 alignmentToValidate
 
 AutoAlternates
 
 cmssw
 
 cmsswreleasebase
 
 config
 
 configFiles
 
 crabConfigFiles
 
 general
 
 jobid
 
 jobmode
 
 name
 
 needsproxy
 
 NJobs
 
 packages
 
 randomWorkdirPart
 
 scramarch
 
 scriptFiles
 

Static Public Attributes

dictionary defaults
 
dictionary mandatories = {"levels", "dbOutput"}
 
string valType = "compare"
 
- Static Public Attributes inherited from genericValidation.GenericValidation
string defaultReferenceName = "DEFAULT"
 
dictionary defaults
 
 mandatories = set()
 
dictionary needpackages = {"Alignment/OfflineValidation"}
 
dictionary optionals = {"jobmode"}
 
- Static Public Attributes inherited from genericValidation.ValidationMetaClass
list dicts = ["defaults"]
 
list sets = ["mandatories", "optionals", "needpackages"]
 

Private Attributes

 __compares
 
 __filesToCompare
 

Detailed Description

Object representing a geometry comparison job.

Definition at line 10 of file geometryComparison.py.

Constructor & Destructor Documentation

◆ __init__()

def geometryComparison.GeometryComparison.__init__ (   self,
  valName,
  alignment,
  referenceAlignment,
  config,
  copyImages = True 
)
Constructor of the GeometryComparison class.

Arguments:
- `valName`: String which identifies individual validation instances
- `alignment`: `Alignment` instance to validate
- `referenceAlignment`: `Alignment` instance which is compared
                with `alignment`
- `config`: `BetterConfigParser` instance which includes the
    configuration of the validations
- `copyImages`: Boolean which indicates whether png- and pdf-files
        should be copied back from the batch farm

Definition at line 44 of file geometryComparison.py.

44  def __init__( self, valName, alignment, referenceAlignment,
45  config, copyImages = True):
46  """
47  Constructor of the GeometryComparison class.
48 
49  Arguments:
50  - `valName`: String which identifies individual validation instances
51  - `alignment`: `Alignment` instance to validate
52  - `referenceAlignment`: `Alignment` instance which is compared
53  with `alignment`
54  - `config`: `BetterConfigParser` instance which includes the
55  configuration of the validations
56  - `copyImages`: Boolean which indicates whether png- and pdf-files
57  should be copied back from the batch farm
58  """
59  super(GeometryComparison, self).__init__(valName, alignment, config)
60  self.referenceAlignment = referenceAlignment
61  referenceName = "IDEAL"
62  if not self.referenceAlignment == "IDEAL":
63  referenceName = self.referenceAlignment.name
64 
65  allCompares = config.getCompares()
66  self.__compares = {}
67  self.__filesToCompare = {}
68  if valName in allCompares:
69  self.__compares[valName] = allCompares[valName]
70  else:
71  msg = ("Could not find compare section '%s' in '%s'"
72  %(valName, allCompares))
73  raise AllInOneError(msg)
74  self.copyImages = copyImages
75 
76  for name in "useDefaultRange", "plotOnlyGlobal", "plotPng":
77  self.general[name] = cppboolstring(self.general[name], name)
78 
79 

Member Function Documentation

◆ createConfiguration()

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 114 of file geometryComparison.py.

114  def createConfiguration(self, path ):
115  # self.__compares
116  repMap = self.getRepMap()
117  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
118  self.alignmentToValidate.name)
119  cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
120  repMaps = {cfgFileName: repMap}
121  if not self.referenceAlignment == "IDEAL":
122  referenceRepMap = self.getRepMap( self.referenceAlignment )
123  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
124  self.referenceAlignment.name )
125  cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
126  repMaps[cfgFileName] = referenceRepMap
127 
128  cfgSchedule = list(cfgs.keys())
129  for common in self.__compares:
130  repMap.update({
131  "levels": self.__compares[common][0],
132  "dbOutput": pythonboolstring(self.__compares[common][1], "dbOutput")
133  })
134  if self.__compares[common][1].split()[0] == "true":
135  repMap["dbOutputService"] = configTemplates.dbOutputTemplate
136  else:
137  repMap["dbOutputService"] = ""
138  cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
139  ".oO[name]Oo._cfg.py"),repMap)
140  cfgs[cfgName] = configTemplates.compareTemplate
141  repMaps[cfgName] = repMap
142 
143  cfgSchedule.append( cfgName )
144  super(GeometryComparison, self).createConfiguration(cfgs, path, cfgSchedule, repMaps = repMaps)
145 

References geometryComparison.GeometryComparison.__compares, genericValidation.GenericValidation.alignmentToValidate, genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), list(), helperFunctions.pythonboolstring(), geometryComparison.GeometryComparison.referenceAlignment, helperFunctions.replaceByMap(), and cms::dd.split().

◆ createCrabCfg()

def geometryComparison.GeometryComparison.createCrabCfg (   self,
  path 
)

Definition at line 305 of file geometryComparison.py.

305  def createCrabCfg(self, path):
306  msg = ("Parallelization not supported for geometry comparison. Please "
307  "choose another 'jobmode'.")
308  raise AllInOneError(msg)

◆ createScript()

def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

Definition at line 146 of file geometryComparison.py.

146  def createScript(self, path):
147  repMap = self.getRepMap()
148  repMap["runComparisonScripts"] = ""
149  scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
150  %self.name), repMap)
151 
152  y_ranges = ""
153  plottedDifferences = ["dx","dy","dz","dr","rdphi","dalpha","dbeta","dgamma"]
154  for diff in plottedDifferences:
155  y_ranges += ","+repMap["%s_min"%diff]
156  y_ranges += ","+repMap["%s_max"%diff]
157 
158  for name in self.__compares:
159  if '"DetUnit"' in self.__compares[name][0].split(","):
160  repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
161  repMap["nIndex"] = ("")
162  repMap["runComparisonScripts"] += \
163  ("cp .oO[Alignment/OfflineValidation]Oo."
164  "/scripts/comparisonScript.C .\n"
165  "cp .oO[Alignment/OfflineValidation]Oo."
166  "/scripts/GeometryComparisonPlotter.h .\n"
167  "cp .oO[Alignment/OfflineValidation]Oo."
168  "/scripts/GeometryComparisonPlotter.cc .\n"
169  "root -b -q 'comparisonScript.C+(\""
170  ".oO[name]Oo..Comparison_common"+name+".root\",\""
171  "./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",.oO[useDefaultRange]Oo.,.oO[plotOnlyGlobal]Oo.,.oO[plotPng]Oo.,.oO[makeProfilePlots]Oo."+y_ranges+")'\n"
172  "cp "+path+"/TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C .\n"
173  "root -l -b -q TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C+\n")
174  if self.copyImages:
175  repMap["runComparisonScripts"] += \
176  ("mkdir -p .oO[datadir]Oo./.oO[name]Oo."
177  ".Comparison_common"+name+"_Images/Translations\n")
178  repMap["runComparisonScripts"] += \
179  ("mkdir -p .oO[datadir]Oo./.oO[name]Oo."
180  ".Comparison_common"+name+"_Images/Rotations\n")
181 
182 
183 
186 
187  if repMap["plotPng"] == "true":
188  repMap["runComparisonScripts"] += \
189  ("find . -maxdepth 1 -name \"*_1*\" "
190  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
191  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
192  repMap["runComparisonScripts"] += \
193  ("find . -maxdepth 1 -name \"*_2*\" "
194  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
195  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
196 
197  repMap["runComparisonScripts"] += \
198  ("find . -maxdepth 1 -name \"*_3*\" "
199  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
200  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
201  repMap["runComparisonScripts"] += \
202  ("find . -maxdepth 1 -name \"*_4*\" "
203  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
204  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
205 
206  else:
207  repMap["runComparisonScripts"] += \
208  ("find . -maxdepth 1 -name \"*_1*\" "
209  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
210  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
211 
212  repMap["runComparisonScripts"] += \
213  ("find . -maxdepth 1 -name \"*_2*\" "
214  "-print | xargs -I {} bash -c \"cp {} .oO[datadir]Oo."
215  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
216 
217  repMap["runComparisonScripts"] += \
218  ("find . -maxdepth 1 -name "
219  "\"*.tex\" -print | xargs -I {} bash -c"
220  " \"cp {} .oO[datadir]Oo./.oO[name]Oo."
221  ".Comparison_common"+name+"_Images/\" \n")
222  repMap["runComparisonScripts"] += \
223  ("find . -maxdepth 1 -name "
224  "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
225  " \"cp {} .oO[datadir]Oo./.oO[name]Oo."
226  ".Comparison_common"+name+"_Images/\" \n")
227  repMap["runComparisonScripts"] += \
228  ("find . -maxdepth 1 -name "
229  "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
230  " \"cp {} .oO[datadir]Oo./.oO[name]Oo."
231  ".Comparison_common"+name+"_Images/\" \n")
232  repMap["runComparisonScripts"] += \
233  ("cp .oO[Alignment/OfflineValidation]Oo."
234  "/macros/makeArrowPlots.C "
235  ".\n"
236  "root -b -q 'makeArrowPlots.C(\""
237  ".oO[name]Oo..Comparison_common"+name
238  +".root\",\".oO[name]Oo.."
239  +name+"_ArrowPlots\")'\n")
240  repMap["runComparisonScripts"] += \
241  ("mkdir -p .oO[datadir]Oo./.oO[name]Oo."
242  ".Comparison_common"+name+"_Images/ArrowPlots\n")
243  repMap["runComparisonScripts"] += \
244  ("find .oO[name]Oo.."+name+"_ArrowPlots "
245  "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
246  "-c \"cp {} .oO[datadir]Oo./.oO[name]Oo."
247  ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
248  repMap["runComparisonScripts"] += \
249  ("find .oO[name]Oo.."+name+"_ArrowPlots "
250  "-maxdepth 1 -name \"*.pdf\" -print | xargs -I {} bash "
251  "-c \"cp {} .oO[datadir]Oo./.oO[name]Oo."
252  ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
253  repMap["runComparisonScripts"] += \
254  ("find . "
255  "-maxdepth 1 -name \".oO[common]Oo._.oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
256  "-c \"cp {} .oO[datadir]Oo./.oO[name]Oo."
257  ".Comparison_common"+name+"_Images/.oO[common]Oo._.oO[name]Oo..Visualization.gif\"\n")
258 
259  resultingFile = replaceByMap(("/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./compared%s_"
260  ".oO[name]Oo..root"%name), repMap)
261  resultingFile = os.path.expandvars( resultingFile )
262  resultingFile = os.path.abspath( resultingFile )
263  resultingFile = "root://eoscms//eos/cms" + resultingFile #needs to be AFTER abspath so that it doesn't eat the //
264  self.__filesToCompare[ name ] = resultingFile
265 
266  else:
267  raise AllInOneError("Need to have DetUnit in levels!")
268 
269  repMap["CommandLine"]=""
270  repMap["CommandLine"]+= \
271  "# copy module list required for comparison script \n"
272  if repMap["moduleList"].startswith("/store"):
273  repMap["CommandLine"]+= \
274  "xrdcp root://eoscms//eos/cms.oO[moduleList]Oo. .\n"
275  elif repMap["moduleList"].startswith("root://"):
276  repMap["CommandLine"]+= \
277  "xrdcp .oO[moduleList]Oo. .\n"
278  else:
279  repMap["CommandLine"]+= \
280  "cp .oO[moduleList]Oo. .\n"
281 
282  try:
283  getCommandOutput2(replaceByMap("cd $(mktemp -d)\n.oO[CommandLine]Oo.\ncat .oO[moduleListBase]Oo.", repMap))
284  except RuntimeError:
285  raise AllInOneError(replaceByMap(".oO[moduleList]Oo. does not exist!", repMap))
286 
287  for cfg in self.configFiles:
288  # FIXME: produce this line only for enabled dbOutput
289  # postProcess = "cp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
290  # postProcess = "cp *.db .oO[datadir]Oo.\n"
291  postProcess = ""
292  repMap["CommandLine"]+= \
293  repMap["CommandLineTemplate"]%{"cfgFile":cfg,
294  "postProcess":postProcess}
295  repMap["CommandLine"]+= ("# overall postprocessing\n"
296  ".oO[runComparisonScripts]Oo.\n"
297  )
298 
299  #~ print configTemplates.scriptTemplate
300  scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap )}
301  files = {replaceByMap("TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
302  self.createFiles(files, path)
303  return super(GeometryComparison, self).createScript(scripts, path)
304 

References geometryComparison.GeometryComparison.__compares, geometryComparison.GeometryComparison.__filesToCompare, genericValidation.GenericValidation.configFiles, geometryComparison.GeometryComparison.copyImages, genericValidation.GenericValidation.createFiles(), helperFunctions.getCommandOutput2(), genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), AlignableObjectId::entry.name, alignment.Alignment.name, genericValidation.GenericValidation.name, TrackerSectorStruct.name, MuonGeometrySanityCheckPoint.name, classes.MonitorData.name, classes.OutputData.name, geometry.Structure.name, plotscripts.SawTeethFunction.name, helperFunctions.replaceByMap(), and cms::dd.split().

◆ filesToCompare()

def geometryComparison.GeometryComparison.filesToCompare (   self)

Reimplemented from genericValidation.GenericValidation.

Definition at line 111 of file geometryComparison.py.

111  def filesToCompare(self):
112  return self.__filesToCompare
113 

References geometryComparison.GeometryComparison.__filesToCompare.

◆ getRepMap()

def geometryComparison.GeometryComparison.getRepMap (   self,
  alignment = None 
)

Reimplemented from genericValidation.GenericValidation.

Definition at line 80 of file geometryComparison.py.

80  def getRepMap(self, alignment = None):
81  if alignment == None:
82  alignment = self.alignmentToValidate
83  repMap = super(GeometryComparison, self).getRepMap( alignment )
84  referenceName = "IDEAL"
85  referenceTitle = "IDEAL"
86  if not self.referenceAlignment == "IDEAL":
87  referenceName = self.referenceAlignment.name
88  referenceTitle = self.referenceAlignment.title
89 
90  assert len(self.__compares) == 1 #? not sure how it can be anything else, but just in case
91  common = list(self.__compares.keys())[0]
92 
93  repMap.update({
94  "common": clean_name(common),
95  "comparedGeometry": (".oO[alignmentName]Oo."
96  "ROOTGeometry.root"),
97  "referenceGeometry": "IDEAL", # will be replaced later
98  # if not compared to IDEAL
99  "reference": clean_name(referenceName),
100  "referenceTitle": referenceTitle,
101  "alignmentTitle": self.alignmentToValidate.title,
102  "moduleListBase": os.path.basename(repMap["moduleList"]),
103  })
104  if not referenceName == "IDEAL":
105  repMap["referenceGeometry"] = (".oO[reference]Oo."
106  "ROOTGeometry.root")
107  repMap["name"] += "_vs_.oO[reference]Oo."
108  return repMap
109 

References geometryComparison.GeometryComparison.__compares, genericValidation.GenericValidation.alignmentToValidate, helperFunctions.clean_name(), relativeConstraints.keys, list(), and geometryComparison.GeometryComparison.referenceAlignment.

Referenced by plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

Member Data Documentation

◆ __compares

geometryComparison.GeometryComparison.__compares
private

◆ __filesToCompare

geometryComparison.GeometryComparison.__filesToCompare
private

◆ copyImages

geometryComparison.GeometryComparison.copyImages

◆ defaults

dictionary geometryComparison.GeometryComparison.defaults
static
Initial value:
= {
"3DSubdetector1":"1",
"3DSubdetector2":"2",
"3DTranslationalScaleFactor":"50",
"modulesToPlot":"all",
"moduleList": "/store/caf/user/cschomak/emptyModuleList.txt",
"useDefaultRange":"false",
"plotOnlyGlobal":"true",
"plotPng":"true",
"makeProfilePlots":"true",
"dx_min":"-99999",
"dx_max":"-99999",
"dy_min":"-99999",
"dy_max":"-99999",
"dz_min":"-99999",
"dz_max":"-99999",
"dr_min":"-99999",
"dr_max":"-99999",
"rdphi_min":"-99999",
"rdphi_max":"-99999",
"dalpha_min":"-99999",
"dalpha_max":"-99999",
"dbeta_min":"-99999",
"dbeta_max":"-99999",
"dgamma_min":"-99999",
"dgamma_max":"-99999",
"multiIOV":"False",
}

Definition at line 14 of file geometryComparison.py.

Referenced by tree.Tree.reset(), and tree.Tree.var().

◆ mandatories

dictionary geometryComparison.GeometryComparison.mandatories = {"levels", "dbOutput"}
static

Definition at line 42 of file geometryComparison.py.

◆ referenceAlignment

geometryComparison.GeometryComparison.referenceAlignment

◆ valType

string geometryComparison.GeometryComparison.valType = "compare"
static
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
helperFunctions.replaceByMap
def replaceByMap(target, the_map)
— Helpers —############################
Definition: helperFunctions.py:13
helperFunctions.clean_name
def clean_name(s)
Definition: helperFunctions.py:213
helperFunctions.getCommandOutput2
def getCommandOutput2(command)
Definition: helperFunctions.py:52
helperFunctions.cppboolstring
def cppboolstring(string, name)
Definition: helperFunctions.py:194
helperFunctions.pythonboolstring
def pythonboolstring(string, name)
Definition: helperFunctions.py:187
list
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*", "!HLTx*" if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL. It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of "!*" before the partial wildcard feature was incorporated). Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run