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

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

98 
99  def createConfiguration(self, path ):
100  # self.__compares
101  repMap = self.getRepMap()
102  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
103  self.alignmentToValidate.name)
104  cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
105  repMaps = {cfgFileName: repMap}
106  if not self.referenceAlignment == "IDEAL":
107  referenceRepMap = self.getRepMap( self.referenceAlignment )
108  cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
109  self.referenceAlignment.name )
110  cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
111  repMaps[cfgFileName] = referenceRepMap
112 
113  cfgSchedule = cfgs.keys()
114  for common in self.__compares:
115  repMap.update({"common": common,
116  "levels": self.__compares[common][0],
117  "dbOutput": self.__compares[common][1]
118  })
119  if self.__compares[common][1].split()[0] == "true":
120  repMap["dbOutputService"] = configTemplates.dbOutputTemplate
121  else:
122  repMap["dbOutputService"] = ""
123  cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
124  ".oO[name]Oo._cfg.py"),repMap)
125  cfgs[cfgName] = configTemplates.compareTemplate
126  repMaps[cfgName] = repMap
127 
128  cfgSchedule.append( cfgName )
129  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 278 of file geometryComparison.py.

279  def createCrabCfg(self, path):
280  msg = ("Parallelization not supported for geometry comparison. Please "
281  "choose another 'jobmode'.")
282  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

Definition at line 130 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, TrackerSectorStruct.name, MuonGeometrySanityCheckPoint.name, plotscripts.SawTeethFunction.name, helperFunctions.replaceByMap(), and split.

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

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  repMap.update({
85  "comparedGeometry": (".oO[alignmentName]Oo."
86  "ROOTGeometry.root"),
87  "referenceGeometry": "IDEAL", # will be replaced later
88  # if not compared to IDEAL
89  "reference": referenceName,
90  "referenceTitle": referenceTitle,
91  "alignmentTitle": self.alignmentToValidate.title
92  })
93  if not referenceName == "IDEAL":
94  repMap["referenceGeometry"] = (".oO[reference]Oo."
95  "ROOTGeometry.root")
96  repMap["name"] += "_vs_.oO[reference]Oo."
97  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[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
static

Definition at line 274 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.