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 | Private 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

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

Private Attributes

 __compares
 

Additional Inherited Members

- 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.
31  """
32  mandatories = ["levels", "dbOutput"]
33  GenericValidation.__init__(self, valName, alignment, config, "compare", addMandatories = mandatories)
34  if not randomWorkdirPart == None:
35  self.randomWorkdirPart = randomWorkdirPart
36  self.referenceAlignment = referenceAlignment
37  referenceName = "IDEAL"
38  if not self.referenceAlignment == "IDEAL":
39  referenceName = self.referenceAlignment.name
40 
41  allCompares = config.getCompares()
42  self.__compares = {}
43  if valName in allCompares:
44  self.__compares[valName] = allCompares[valName]
45  else:
46  msg = ("Could not find compare section '%s' in '%s'"
47  %(valName, allCompares))
48  raise AllInOneError(msg)
49  self.copyImages = copyImages

Member Function Documentation

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 71 of file geometryComparison.py.

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

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

214  def createCrabCfg(self, path):
215  msg = ("Parallelization not supported for geometry comparison. Please "
216  "choose another 'jobmode'.")
217  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

Definition at line 103 of file geometryComparison.py.

References geometryComparison.GeometryComparison.__compares, genericValidation.GenericValidation.configFiles, geometryComparison.GeometryComparison.copyImages, 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.

104  def createScript(self, path):
105  repMap = self.getRepMap()
106  repMap["runComparisonScripts"] = ""
107  scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
108  %self.name), repMap)
109  for name in self.__compares:
110  if '"DetUnit"' in self.__compares[name][0].split(","):
111  repMap["runComparisonScripts"] += \
112  ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
113  "/scripts/comparisonScript.C .\n"
114  "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
115  "/scripts/GeometryComparisonPlotter.h .\n"
116  "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
117  "/scripts/GeometryComparisonPlotter.cc .\n"
118  "root -b -q 'comparisonScript.C+(\""
119  ".oO[name]Oo..Comparison_common"+name+".root\",\""
120  "./\")'\n")
121  if self.copyImages:
122  repMap["runComparisonScripts"] += \
123  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
124  ".Comparison_common"+name+"_Images\n")
125  repMap["runComparisonScripts"] += \
126  ("find . -maxdepth 1 -name \"*PXB*\" "
127  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
128  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
129  repMap["runComparisonScripts"] += \
130  ("find . -maxdepth 1 -name \"*PXF*\" "
131  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
132  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
133  repMap["runComparisonScripts"] += \
134  ("find . -maxdepth 1 -name \"*TIB*\" "
135  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
136  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
137  repMap["runComparisonScripts"] += \
138  ("find . -maxdepth 1 -name \"*TID*\" "
139  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
140  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
141  repMap["runComparisonScripts"] += \
142  ("find . -maxdepth 1 -name \"*TEC*\" "
143  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
144  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
145  repMap["runComparisonScripts"] += \
146  ("find . -maxdepth 1 -name \"*TOB*\" "
147  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
148  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
149  repMap["runComparisonScripts"] += \
150  ("find . -maxdepth 1 -name \"*tracker*\" "
151  "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
152  "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
153  repMap["runComparisonScripts"] += \
154  ("find . -maxdepth 1 -name "
155  "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
156  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
157  ".Comparison_common"+name+"_Images/\" \n")
158  repMap["runComparisonScripts"] += \
159  ("find . -maxdepth 1 -name "
160  "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
161  " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
162  ".Comparison_common"+name+"_Images/\" \n")
163  repMap["runComparisonScripts"] += \
164  ("if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
165  "then\n"
166  " rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
167  +"_ArrowPlots\n"
168  "else\n"
169  " mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
170  +"_ArrowPlots\n"
171  "fi\n")
172  repMap["runComparisonScripts"] += \
173  ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
174  "/OfflineValidation/scripts/makeArrowPlots.C "
175  "$CWD/TkAllInOneTool\n"
176  "root -b -q 'makeArrowPlots.C(\""
177  ".oO[name]Oo..Comparison_common"+name
178  +".root\",\".oO[name]Oo.."
179  +name+"_ArrowPlots\")'\n")
180  repMap["runComparisonScripts"] += \
181  ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
182  ".Comparison_common"+name+"_Images/ArrowPlots\n")
183  repMap["runComparisonScripts"] += \
184  ("find .oO[name]Oo.."+name+"_ArrowPlots "
185  "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
186  "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
187  ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
188 
189  resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
190  ".oO[name]Oo..root"%name), repMap)
191  resultingFile = os.path.expandvars( resultingFile )
192  resultingFile = os.path.abspath( resultingFile )
193  repMap["runComparisonScripts"] += \
194  ("cmsStage -f OUTPUT_comparison.root %s\n"
195  %resultingFile)
196  self.filesToCompare[ name ] = resultingFile
197 
198  repMap["CommandLine"]=""
199 
200  for cfg in self.configFiles:
201  # FIXME: produce this line only for enabled dbOutput
202  # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
203  postProcess = "rfcp *.db .oO[datadir]Oo.\n"
204  repMap["CommandLine"]+= \
205  repMap["CommandLineTemplate"]%{"cfgFile":cfg,
206  "postProcess":postProcess}
207  repMap["CommandLine"]+= ("# overall postprocessing\n"
208  ".oO[runComparisonScripts]Oo.\n"
209  )
210 
211  scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }
212  return GenericValidation.createScript(self, scripts, path)
def replaceByMap
— Helpers —############################
double split
Definition: MVATrainer.cc:139
def geometryComparison.GeometryComparison.getRepMap (   self,
  alignment = None 
)

Definition at line 50 of file geometryComparison.py.

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

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

Member Data Documentation

geometryComparison.GeometryComparison.__compares
private

Definition at line 41 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createConfiguration(), and geometryComparison.GeometryComparison.createScript().

geometryComparison.GeometryComparison.copyImages

Definition at line 48 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createScript().

geometryComparison.GeometryComparison.randomWorkdirPart

Definition at line 34 of file geometryComparison.py.

geometryComparison.GeometryComparison.referenceAlignment

Definition at line 35 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createConfiguration(), and geometryComparison.GeometryComparison.getRepMap().