CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
geometryComparison.GeometryComparison Class Reference
Inheritance diagram for geometryComparison.GeometryComparison:
genericValidation.GenericValidation

Public Member Functions

def __init__
 
def createConfiguration
 
def createCrabCfg
 
def createScript
 
def getRepMap
 
- Public Member Functions inherited from genericValidation.GenericValidation
def __init__
 
def createConfiguration
 
def createCrabCfg
 
def createFiles
 
def createScript
 
def getCompareStrings
 
def getRepMap
 

Public Attributes

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

Static Public Attributes

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

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 
15  config, copyImages = True):
16  """
17  Constructor of the GeometryComparison class.
18 
19  Arguments:
20  - `valName`: String which identifies individual validation instances
21  - `alignment`: `Alignment` instance to validate
22  - `referenceAlignment`: `Alignment` instance which is compared
23  with `alignment`
24  - `config`: `BetterConfigParser` instance which includes the
25  configuration of the validations
26  - `copyImages`: Boolean which indicates whether png- and pdf-files
27  should be copied back from the batch farm
"""

Member Function Documentation

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 103 of file geometryComparison.py.

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

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

Definition at line 296 of file geometryComparison.py.

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

Definition at line 135 of file geometryComparison.py.

References genericValidation.GenericValidation.configFiles, genericValidation.GenericValidation.filesToCompare, helperFunctions.getCommandOutput2(), genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), entry.name, geometrydata.GeometryData.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.

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

Definition at line 73 of file geometryComparison.py.

References genericValidation.GenericValidation.alignmentToValidate.

Referenced by plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

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

Member Data Documentation

geometryComparison.GeometryComparison.addMandatories = mandatories)
static

Definition at line 57 of file geometryComparison.py.

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

Definition at line 63 of file geometryComparison.py.

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

Definition at line 292 of file geometryComparison.py.

Referenced by chain.Chain._guessTreeName(), dataset.BaseDataset.listOfFiles(), dataset.BaseDataset.listOfGoodFiles(), MatrixReader.MatrixReader.prepare(), dataset.BaseDataset.printFiles(), and MatrixReader.MatrixReader.showRaw().

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

Definition at line 79 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createConfiguration().

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.