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

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

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

255  def createCrabCfg(self, path):
256  msg = ("Parallelization not supported for geometry comparison. Please "
257  "choose another 'jobmode'.")
258  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

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

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

References genericValidation.GenericValidation.alignmentToValidate.

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

Member Data Documentation

geometryComparison.GeometryComparison.addMandatories = mandatories)
static

Definition at line 36 of file geometryComparison.py.

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

Definition at line 42 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 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 250 of file geometryComparison.py.

Referenced by chain.Chain._guessTreeName(), MatrixReader.MatrixReader.prepare(), and MatrixReader.MatrixReader.showRaw().

list geometryComparison.GeometryComparison.mandatories = ["levels", "dbOutput"]
static

Definition at line 33 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 47 of file geometryComparison.py.

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

geometryComparison.GeometryComparison.referenceAlignment

Definition at line 58 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createConfiguration().

string geometryComparison.GeometryComparison.referenceName = "IDEAL"
static

Definition at line 38 of file geometryComparison.py.

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

Definition at line 40 of file geometryComparison.py.