CMS 3D CMS Logo

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

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 getRepMap (self, alignment=None)
 
- Public Member Functions inherited from genericValidation.GenericValidation
def __init__ (self, valName, alignment, config, valType, addDefaults={}, addMandatories=[], addneedpackages=[])
 
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)
 
def getRepMap (self, alignment=None)
 

Static Public Attributes

 addDefaults
 
 addMandatories
 
 allCompares = config.getCompares()
 
 copyImages
 
dictionary defaults
 
dictionary files = {replaceByMap("TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
 
list mandatories = ["levels", "dbOutput"]
 
tuple msg
 
 referenceAlignment
 
string referenceName = "IDEAL"
 
 referenceName = self.referenceAlignment.name
 
- Static Public Attributes inherited from genericValidation.GenericValidation
string defaultReferenceName = "DEFAULT"
 

Static Private Attributes

 __compares
 

Additional Inherited Members

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

Detailed Description

Object representing a geometry comparison job.

Definition at line 9 of file geometryComparison.py.

Constructor & Destructor Documentation

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 14 of file geometryComparison.py.

14  config, copyImages = True):
15  """
16  Constructor of the GeometryComparison class.
17 
18  Arguments:
19  - `valName`: String which identifies individual validation instances
20  - `alignment`: `Alignment` instance to validate
21  - `referenceAlignment`: `Alignment` instance which is compared
22  with `alignment`
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  """

Member Function Documentation

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 103 of file geometryComparison.py.

References geometryComparison.GeometryComparison.__compares, genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), geometryComparison.GeometryComparison.referenceAlignment, helperFunctions.replaceByMap(), and split.

103  def createConfiguration(self, path ):
104  # self.__compares
105  repMap = self.getRepMap()
106  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
107  self.alignmentToValidate.name)
108  cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
109  repMaps = {cfgFileName: repMap}
110  if not self.referenceAlignment == "IDEAL":
111  referenceRepMap = self.getRepMap( self.referenceAlignment )
112  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
113  self.referenceAlignment.name )
114  cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
115  repMaps[cfgFileName] = referenceRepMap
116 
117  cfgSchedule = cfgs.keys()
118  for common in self.__compares:
119  repMap.update({
120  "levels": self.__compares[common][0],
121  "dbOutput": self.__compares[common][1]
122  })
123  if self.__compares[common][1].split()[0] == "true":
124  repMap["dbOutputService"] = configTemplates.dbOutputTemplate
125  else:
126  repMap["dbOutputService"] = ""
127  cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
128  ".oO[name]Oo._cfg.py"),repMap)
129  cfgs[cfgName] = configTemplates.compareTemplate
130  repMaps[cfgName] = repMap
131 
132  cfgSchedule.append( cfgName )
133  GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule, repMaps = repMaps)
134 
def replaceByMap(target, the_map)
— Helpers —############################
def getRepMap(self, alignment=None)
double split
Definition: MVATrainer.cc:139
def geometryComparison.GeometryComparison.createCrabCfg (   self,
  path 
)

Definition at line 296 of file geometryComparison.py.

296  def createCrabCfg(self, path):
297  msg = ("Parallelization not supported for geometry comparison. Please "
298  "choose another 'jobmode'.")
299  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

Definition at line 135 of file geometryComparison.py.

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

135  def createScript(self, path):
136  repMap = self.getRepMap()
137  repMap["runComparisonScripts"] = ""
138  scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
139  %self.name), repMap)
140 
141  y_ranges = ""
142  plottedDifferences = ["dx","dy","dz","dr","rdphi","dalpha","dbeta","dgamma"]
143  for diff in plottedDifferences:
144  y_ranges += ","+repMap["%s_min"%diff]
145  y_ranges += ","+repMap["%s_max"%diff]
146 
147  for name in self.__compares:
148  if '"DetUnit"' in self.__compares[name][0].split(","):
149  repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
150  repMap["nIndex"] = ("")
151  repMap["runComparisonScripts"] += \
152  ("rfcp .oO[Alignment/OfflineValidation]Oo."
153  "/scripts/comparisonScript.C .\n"
154  "rfcp .oO[Alignment/OfflineValidation]Oo."
155  "/scripts/GeometryComparisonPlotter.h .\n"
156  "rfcp .oO[Alignment/OfflineValidation]Oo."
157  "/scripts/GeometryComparisonPlotter.cc .\n"
158  "root -b -q 'comparisonScript.C+(\""
159  ".oO[name]Oo..Comparison_common"+name+".root\",\""
160  "./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",\".oO[useDefaultRange]Oo.\",\".oO[plotOnlyGlobal]Oo.\",\".oO[plotPng]Oo.\""+y_ranges+")'\n"
161  "rfcp "+path+"/TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C .\n"
162  "root -l -b -q TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C+\n")
163  if self.copyImages:
164  repMap["runComparisonScripts"] += \
165  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
166  ".Comparison_common"+name+"_Images\n")
167  repMap["runComparisonScripts"] += \
168  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
169  ".Comparison_common"+name+"_Images/Translations\n")
170  repMap["runComparisonScripts"] += \
171  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
172  ".Comparison_common"+name+"_Images/Rotations\n")
173 
174 
175  ### At the moment translations are images with suffix _1 and _2, rotations _3 and _4
176  ### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
177  ### If comparisonScript.C is changed, check if the following lines need to be changed as well
178 
179  if repMap["plotPng"] == "true":
180  repMap["runComparisonScripts"] += \
181  ("find . -maxdepth 1 -name \"*_1*\" "
182  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
183  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
184  repMap["runComparisonScripts"] += \
185  ("find . -maxdepth 1 -name \"*_2*\" "
186  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
187  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
188 
189  repMap["runComparisonScripts"] += \
190  ("find . -maxdepth 1 -name \"*_3*\" "
191  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
192  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
193  repMap["runComparisonScripts"] += \
194  ("find . -maxdepth 1 -name \"*_4*\" "
195  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
196  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
197 
198  else:
199  repMap["runComparisonScripts"] += \
200  ("find . -maxdepth 1 -name \"*_1*\" "
201  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
202  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
203 
204  repMap["runComparisonScripts"] += \
205  ("find . -maxdepth 1 -name \"*_2*\" "
206  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
207  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
208 
209  repMap["runComparisonScripts"] += \
210  ("find . -maxdepth 1 -name "
211  "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
212  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
213  ".Comparison_common"+name+"_Images/\" \n")
214  repMap["runComparisonScripts"] += \
215  ("find . -maxdepth 1 -name "
216  "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
217  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
218  ".Comparison_common"+name+"_Images/\" \n")
219  repMap["runComparisonScripts"] += \
220  ("if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
221  "then\n"
222  " rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
223  +"_ArrowPlots\n"
224  "else\n"
225  " mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
226  +"_ArrowPlots\n"
227  "fi\n")
228  repMap["runComparisonScripts"] += \
229  ("rfcp .oO[Alignment/OfflineValidation]Oo."
230  "/scripts/makeArrowPlots.C "
231  ".\n"
232  "root -b -q 'makeArrowPlots.C(\""
233  ".oO[name]Oo..Comparison_common"+name
234  +".root\",\".oO[name]Oo.."
235  +name+"_ArrowPlots\")'\n")
236  repMap["runComparisonScripts"] += \
237  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
238  ".Comparison_common"+name+"_Images/ArrowPlots\n")
239  repMap["runComparisonScripts"] += \
240  ("find .oO[name]Oo.."+name+"_ArrowPlots "
241  "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
242  "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
243  ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
244  repMap["runComparisonScripts"] += \
245  ("find . "
246  "-maxdepth 1 -name \".oO[common]Oo._.oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
247  "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
248  ".Comparison_common"+name+"_Images/.oO[common]Oo._.oO[name]Oo..Visualization.gif\"\n")
249 
250  resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
251  ".oO[name]Oo..root"%name), repMap)
252  resultingFile = os.path.expandvars( resultingFile )
253  resultingFile = os.path.abspath( resultingFile )
254  resultingFile = "root://eoscms//eos/cms" + resultingFile #needs to be AFTER abspath so that it doesn't eat the //
255  self.filesToCompare[ name ] = resultingFile
256 
257  else:
258  raise AllInOneError("Need to have DetUnit in levels!")
259 
260  repMap["CommandLine"]=""
261  repMap["CommandLine"]+= \
262  "# copy module list required for comparison script \n"
263  if repMap["moduleList"].startswith("/store"):
264  repMap["CommandLine"]+= \
265  "xrdcp root://eoscms//eos/cms.oO[moduleList]Oo. .\n"
266  elif repMap["moduleList"].startswith("root://"):
267  repMap["CommandLine"]+= \
268  "xrdcp .oO[moduleList]Oo. .\n"
269  else:
270  repMap["CommandLine"]+= \
271  "rfcp .oO[moduleList]Oo. .\n"
272 
273  try:
274  getCommandOutput2(replaceByMap("cd $(mktemp -d)\n.oO[CommandLine]Oo.\ncat .oO[moduleListBase]Oo.", repMap))
275  except RuntimeError:
276  raise AllInOneError(replaceByMap(".oO[moduleList]Oo. does not exist!", repMap))
277 
278  for cfg in self.configFiles:
279  # FIXME: produce this line only for enabled dbOutput
280  # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
281  # postProcess = "rfcp *.db .oO[datadir]Oo.\n"
282  postProcess = ""
283  repMap["CommandLine"]+= \
284  repMap["CommandLineTemplate"]%{"cfgFile":cfg,
285  "postProcess":postProcess}
286  repMap["CommandLine"]+= ("# overall postprocessing\n"
287  ".oO[runComparisonScripts]Oo.\n"
288  )
289 
290  #~ print configTemplates.scriptTemplate
291  scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap )}
def getCommandOutput2(command)
def replaceByMap(target, the_map)
— Helpers —############################
def getRepMap(self, alignment=None)
double split
Definition: MVATrainer.cc:139
def geometryComparison.GeometryComparison.getRepMap (   self,
  alignment = None 
)

Definition at line 73 of file geometryComparison.py.

References geometryComparison.GeometryComparison.__compares, genericValidation.GenericValidation.alignmentToValidate, and geometryComparison.GeometryComparison.referenceAlignment.

Referenced by plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

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

Member Data Documentation

geometryComparison.GeometryComparison.addDefaults
static

Definition at line 56 of file geometryComparison.py.

geometryComparison.GeometryComparison.addMandatories
static

Definition at line 57 of file geometryComparison.py.

geometryComparison.GeometryComparison.allCompares = config.getCompares()
static

Definition at line 63 of file geometryComparison.py.

geometryComparison.GeometryComparison.copyImages
static
dictionary geometryComparison.GeometryComparison.defaults
static
Initial value:
1 = {
2  "3DSubdetector1":"1",
3  "3DSubdetector2":"2",
4  "3DTranslationalScaleFactor":"50",
5  "modulesToPlot":"all",
6  "moduleList": "/store/caf/user/cschomak/emptyModuleList.txt",
7  "useDefaultRange":"false",
8  "plotOnlyGlobal":"false",
9  "plotPng":"true",
10  "dx_min":"-99999",
11  "dx_max":"-99999",
12  "dy_min":"-99999",
13  "dy_max":"-99999",
14  "dz_min":"-99999",
15  "dz_max":"-99999",
16  "dr_min":"-99999",
17  "dr_max":"-99999",
18  "rdphi_min":"-99999",
19  "rdphi_max":"-99999",
20  "dalpha_min":"-99999",
21  "dalpha_max":"-99999",
22  "dbeta_min":"-99999",
23  "dbeta_max":"-99999",
24  "dgamma_min":"-99999",
25  "dgamma_max":"-99999",
26  }

Definition at line 28 of file geometryComparison.py.

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

dictionary geometryComparison.GeometryComparison.files = {replaceByMap("TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
static
list geometryComparison.GeometryComparison.mandatories = ["levels", "dbOutput"]
static

Definition at line 54 of file geometryComparison.py.

tuple geometryComparison.GeometryComparison.msg
static
Initial value:
1 = ("Could not find compare section '%s' in '%s'"
2  %(valName, allCompares))

Definition at line 68 of file geometryComparison.py.

Referenced by MatrixReader.MatrixException.__str__(), cmsHarvester.Usage.__str__(), and cmsHarvester.Error.__str__().

geometryComparison.GeometryComparison.referenceAlignment
static
string geometryComparison.GeometryComparison.referenceName = "IDEAL"
static

Definition at line 59 of file geometryComparison.py.

geometryComparison.GeometryComparison.referenceName = self.referenceAlignment.name
static

Definition at line 61 of file geometryComparison.py.