test
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
 
 jobmode
 
 randomWorkdirPart
 
 referenceAlignment
 
- Public Attributes inherited from genericValidation.GenericValidation
 alignmentToValidate
 
 config
 
 configFiles
 
 crabConfigFiles
 
 filesToCompare
 
 general
 
 jobmode
 
 name
 
 randomWorkdirPart
 
 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  GenericValidation.__init__(self, valName, alignment, config)
33  if not randomWorkdirPart == None:
34  self.randomWorkdirPart = randomWorkdirPart
35  self.referenceAlignment = referenceAlignment
36  try: # try to override 'jobmode' from [general] section
37  self.jobmode = config.get( "compare:"+self.name, "jobmode" )
38  except ConfigParser.NoOptionError:
39  pass
40  referenceName = "IDEAL"
41  if not self.referenceAlignment == "IDEAL":
42  referenceName = self.referenceAlignment.name
43 
44  allCompares = config.getCompares()
45  self.__compares = {}
46  if valName in allCompares:
47  self.__compares[valName] = allCompares[valName]
48  else:
49  msg = ("Could not find compare section '%s' in '%s'"
50  %(valName, allCompares))
51  raise AllInOneError(msg)
52  self.copyImages = copyImages

Member Function Documentation

def geometryComparison.GeometryComparison.createConfiguration (   self,
  path 
)

Definition at line 74 of file geometryComparison.py.

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

74 
75  def createConfiguration(self, path ):
76  # self.__compares
77  repMap = self.getRepMap()
78  cfgs = { "TkAlCompareToNTuple.%s.%s_cfg.py"%(
79  self.alignmentToValidate.name, self.randomWorkdirPart ):
80  replaceByMap( configTemplates.intoNTuplesTemplate, repMap)}
81  if not self.referenceAlignment == "IDEAL":
82  referenceRepMap = self.getRepMap( self.referenceAlignment )
83  cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
84  self.referenceAlignment.name, self.randomWorkdirPart )
85  cfgs[cfgFileName] = replaceByMap(configTemplates.intoNTuplesTemplate,
86  referenceRepMap)
87 
88  cfgSchedule = cfgs.keys()
89  for common in self.__compares:
90  repMap.update({"common": common,
91  "levels": self.__compares[common][0],
92  "dbOutput": self.__compares[common][1]
93  })
94  if self.__compares[common][1].split()[0] == "true":
95  repMap["dbOutputService"] = configTemplates.dbOutputTemplate
96  else:
97  repMap["dbOutputService"] = ""
98  cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
99  ".oO[name]Oo._cfg.py"),repMap)
100  cfgs[cfgName] = replaceByMap(configTemplates.compareTemplate, repMap)
101 
102  cfgSchedule.append( cfgName )
103  GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule)
def replaceByMap
— Helpers —############################
double split
Definition: MVATrainer.cc:139
def geometryComparison.GeometryComparison.createCrabCfg (   self,
  path 
)

Definition at line 194 of file geometryComparison.py.

195  def createCrabCfg(self, path):
196  msg = ("Parallelization not supported for geometry comparison. Please "
197  "choose another 'jobmode'.")
198  raise AllInOneError(msg)
def geometryComparison.GeometryComparison.createScript (   self,
  path 
)

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

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

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

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

Member Data Documentation

geometryComparison.GeometryComparison.__compares
private

Definition at line 44 of file geometryComparison.py.

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

geometryComparison.GeometryComparison.copyImages

Definition at line 51 of file geometryComparison.py.

Referenced by geometryComparison.GeometryComparison.createScript().

geometryComparison.GeometryComparison.jobmode

Definition at line 36 of file geometryComparison.py.

geometryComparison.GeometryComparison.randomWorkdirPart

Definition at line 33 of file geometryComparison.py.

geometryComparison.GeometryComparison.referenceAlignment

Definition at line 34 of file geometryComparison.py.

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