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
 
 jobmode
 
 name
 
 NJobs
 
 randomWorkdirPart
 
 scramarch
 
 scriptFiles
 

Static Public Attributes

 addMandatories = mandatories)
 
tuple allCompares = config.getCompares()
 
dictionary defaults
 
dictionary files = {replaceByMap("TkAl3DVisualization_.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,
  randomWorkdirPart = None 
)
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
- `randomWorkDirPart`: If this option is ommitted a random number is
               generated to create unique path names for the
               individual validation instances.

Definition at line 14 of file geometryComparison.py.

14 
15  config, copyImages = True, randomWorkdirPart = None):
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
28  - `randomWorkDirPart`: If this option is ommitted a random number is
29  generated to create unique path names for the
30  individual validation instances.
"""

Member Function Documentation

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 82 of file geometryComparison.py.

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

82 
83  def createConfiguration(self, path ):
84  # self.__compares
85  repMap = self.getRepMap()
86  cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
87  self.alignmentToValidate.name, self.randomWorkdirPart)
88  cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
89  repMaps = {cfgFileName: repMap}
90  if not self.referenceAlignment == "IDEAL":
91  referenceRepMap = self.getRepMap( self.referenceAlignment )
92  cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
93  self.referenceAlignment.name, self.randomWorkdirPart )
94  cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
95  repMaps[cfgFileName] = referenceRepMap
96 
97  cfgSchedule = cfgs.keys()
98  for common in self.__compares:
99  repMap.update({"common": common,
100  "levels": self.__compares[common][0],
101  "dbOutput": self.__compares[common][1]
102  })
103  if self.__compares[common][1].split()[0] == "true":
104  repMap["dbOutputService"] = configTemplates.dbOutputTemplate
105  else:
106  repMap["dbOutputService"] = ""
107  cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
108  ".oO[name]Oo._cfg.py"),repMap)
109  cfgs[cfgName] = configTemplates.compareTemplate
110  repMaps[cfgName] = repMap
111 
112  cfgSchedule.append( cfgName )
113  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 258 of file geometryComparison.py.

259  def createCrabCfg(self, path):
260  msg = ("Parallelization not supported for geometry comparison. Please "
261  "choose another 'jobmode'.")
262  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

Definition at line 114 of file geometryComparison.py.

References genericValidation.GenericValidation.configFiles, genericValidation.GenericValidation.filesToCompare, genericValidation.GenericValidation.getRepMap(), alignment.Alignment.getRepMap(), entry.name, genericValidation.GenericValidation.name, alignment.Alignment.name, MuonGeometrySanityCheckPoint.name, plotscripts.SawTeethFunction.name, helperFunctions.replaceByMap(), and split.

115  def createScript(self, path):
116  repMap = self.getRepMap()
117  repMap["runComparisonScripts"] = ""
118  scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
119  %self.name), repMap)
120  for name in self.__compares:
121  if '"DetUnit"' in self.__compares[name][0].split(","):
122  repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
123  repMap["nIndex"] = ("")
124  repMap["runComparisonScripts"] += \
125  ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
126  "/scripts/comparisonScript.C .\n"
127  "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
128  "/scripts/GeometryComparisonPlotter.h .\n"
129  "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
130  "/scripts/GeometryComparisonPlotter.cc .\n"
131  "root -b -q 'comparisonScript.C+(\""
132  ".oO[name]Oo..Comparison_common"+name+".root\",\""
133  "./\")'\n"
134  "rfcp "+path+"/TkAl3DVisualization_.oO[name]Oo..C .\n"
135  "root -l -b -q TkAl3DVisualization_.oO[name]Oo..C+\n")
136  if self.copyImages:
137  repMap["runComparisonScripts"] += \
138  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
139  ".Comparison_common"+name+"_Images\n")
140  repMap["runComparisonScripts"] += \
141  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
142  ".Comparison_common"+name+"_Images/Translations\n")
143  repMap["runComparisonScripts"] += \
144  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
145  ".Comparison_common"+name+"_Images/Rotations\n")
146  repMap["runComparisonScripts"] += \
147  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
148  ".Comparison_common"+name+"_Images/CrossTalk\n")
149 
150 
151  ### At the moment translations are immages with suffix _1 and _2, rotations _3 and _4, and cross talk _5, _6, _7 and _8
152  ### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
153  ### If comparisonScript.C is changed, check if the following lines need to be changed as well
154  repMap["runComparisonScripts"] += \
155  ("find . -maxdepth 1 -name \"*_1*\" "
156  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
157  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
158  repMap["runComparisonScripts"] += \
159  ("find . -maxdepth 1 -name \"*_2*\" "
160  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
161  "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
162 
163  repMap["runComparisonScripts"] += \
164  ("find . -maxdepth 1 -name \"*_3*\" "
165  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
166  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
167  repMap["runComparisonScripts"] += \
168  ("find . -maxdepth 1 -name \"*_4*\" "
169  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
170  "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
171 
172  repMap["runComparisonScripts"] += \
173  ("find . -maxdepth 1 -name \"*_5*\" "
174  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
175  "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
176  repMap["runComparisonScripts"] += \
177  ("find . -maxdepth 1 -name \"*_6*\" "
178  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
179  "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
180  repMap["runComparisonScripts"] += \
181  ("find . -maxdepth 1 -name \"*_7*\" "
182  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
183  "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
184  repMap["runComparisonScripts"] += \
185  ("find . -maxdepth 1 -name \"*_8*\" "
186  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
187  "/.oO[name]Oo..Comparison_common"+name+"_Images/CrossTalk/\" \n")
188 
189  repMap["runComparisonScripts"] += \
190  ("find . -maxdepth 1 -name "
191  "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
192  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
193  ".Comparison_common"+name+"_Images/\" \n")
194  repMap["runComparisonScripts"] += \
195  ("find . -maxdepth 1 -name "
196  "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
197  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
198  ".Comparison_common"+name+"_Images/\" \n")
199  repMap["runComparisonScripts"] += \
200  ("if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
201  "then\n"
202  " rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
203  +"_ArrowPlots\n"
204  "else\n"
205  " mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
206  +"_ArrowPlots\n"
207  "fi\n")
208  repMap["runComparisonScripts"] += \
209  ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
210  "/OfflineValidation/scripts/makeArrowPlots.C "
211  ".\n"
212  "root -b -q 'makeArrowPlots.C(\""
213  ".oO[name]Oo..Comparison_common"+name
214  +".root\",\".oO[name]Oo.."
215  +name+"_ArrowPlots\")'\n")
216  repMap["runComparisonScripts"] += \
217  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
218  ".Comparison_common"+name+"_Images/ArrowPlots\n")
219  repMap["runComparisonScripts"] += \
220  ("find .oO[name]Oo.."+name+"_ArrowPlots "
221  "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
222  "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
223  ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
224  repMap["runComparisonScripts"] += \
225  ("find . "
226  "-maxdepth 1 -name \".oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
227  "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
228  ".Comparison_common"+name+"_Images/.oO[name]Oo..Visualization.gif\"\n")
229 
230  resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
231  ".oO[name]Oo..root"%name), repMap)
232  resultingFile = os.path.expandvars( resultingFile )
233  resultingFile = os.path.abspath( resultingFile )
234  repMap["runComparisonScripts"] += \
235  ("cmsStage -f OUTPUT_comparison.root %s\n"
236  %resultingFile)
237  self.filesToCompare[ name ] = resultingFile
238 
239  repMap["CommandLine"]=""
240 
241  for cfg in self.configFiles:
242  # FIXME: produce this line only for enabled dbOutput
243  # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
244  # postProcess = "rfcp *.db .oO[datadir]Oo.\n"
245  postProcess = ""
246  repMap["CommandLine"]+= \
247  repMap["CommandLineTemplate"]%{"cfgFile":cfg,
248  "postProcess":postProcess}
249  repMap["CommandLine"]+= ("# overall postprocessing\n"
250  ".oO[runComparisonScripts]Oo.\n"
251  )
252 
253  #~ 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 57 of file geometryComparison.py.

References genericValidation.GenericValidation.alignmentToValidate.

57 
58  def getRepMap(self, alignment = None):
59  if alignment == None:
60  alignment = self.alignmentToValidate
61  repMap = GenericValidation.getRepMap( self, alignment )
62  referenceName = "IDEAL"
63  referenceTitle = "IDEAL"
64  if not self.referenceAlignment == "IDEAL":
65  referenceName = self.referenceAlignment.name
66  referenceTitle = self.referenceAlignment.title
67 
68  repMap.update({
69  "comparedGeometry": (".oO[alignmentName]Oo."
70  "ROOTGeometry.root"),
71  "referenceGeometry": "IDEAL", # will be replaced later
72  # if not compared to IDEAL
73  "reference": referenceName,
74  "referenceTitle": referenceTitle,
75  "alignmentTitle": self.alignmentToValidate.title
76  })
77  if not referenceName == "IDEAL":
78  repMap["referenceGeometry"] = (".oO[reference]Oo."
79  "ROOTGeometry.root")
80  repMap["name"] += "_vs_.oO[reference]Oo."
81  return repMap

Member Data Documentation

geometryComparison.GeometryComparison.addMandatories = mandatories)
static

Definition at line 39 of file geometryComparison.py.

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

Definition at line 47 of file geometryComparison.py.

dictionary geometryComparison.GeometryComparison.defaults
static
Initial value:
1 = {
2  "3DSubdetector1":"1",
3  "3DSubdetector2":"2",
4  "3DTranslationalScaleFactor":"50"
5  }

Definition at line 31 of file geometryComparison.py.

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

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

Definition at line 254 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 36 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 52 of file geometryComparison.py.

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

geometryComparison.GeometryComparison.referenceAlignment

Definition at line 63 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createConfiguration().

string geometryComparison.GeometryComparison.referenceName = "IDEAL"
static

Definition at line 43 of file geometryComparison.py.

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

Definition at line 45 of file geometryComparison.py.