CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

geometryComparison::GeometryComparison Class Reference

Inheritance diagram for geometryComparison::GeometryComparison:
genericValidation::GenericValidation

List of all members.

Public Member Functions

def __init__
def createConfiguration
def createCrabCfg
def createScript
def getRepMap

Public Attributes

 copyImages
 jobmode
 randomWorkdirPart
 referenceAlignment

Private Attributes

 __compares

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

00015                                                                       :
00016         """
00017         Constructor of the GeometryComparison class.
00018 
00019         Arguments:
00020         - `valName`: String which identifies individual validation instances
00021         - `alignment`: `Alignment` instance to validate
00022         - `referenceAlignment`: `Alignment` instance which is compared
00023                                 with `alignment`
00024         - `config`: `BetterConfigParser` instance which includes the
00025                     configuration of the validations
00026         - `copyImages`: Boolean which indicates whether png- and pdf-files 
00027                         should be copied back from the batch farm
00028         - `randomWorkDirPart`: If this option is ommitted a random number is
00029                                generated to create unique path names for the
00030                                individual validation instances.
00031         """
00032         GenericValidation.__init__(self, valName, alignment, config)
00033         if not randomWorkdirPart == None:
00034             self.randomWorkdirPart = randomWorkdirPart
00035         self.referenceAlignment = referenceAlignment
00036         try:  # try to override 'jobmode' from [general] section
00037             self.jobmode = config.get( "compare:"+self.name, "jobmode" )
00038         except ConfigParser.NoOptionError:
00039             pass
00040         referenceName = "IDEAL"
00041         if not self.referenceAlignment == "IDEAL":
00042             referenceName = self.referenceAlignment.name
00043 
00044         allCompares = config.getCompares()
00045         self.__compares = {}
00046         if valName in allCompares:
00047             self.__compares[valName] = allCompares[valName]
00048         else:
00049             msg = ("Could not find compare section '%s' in '%s'"
00050                    %(valName, allCompares))
00051             raise AllInOneError(msg)
00052         self.copyImages = copyImages
    

Member Function Documentation

def geometryComparison::GeometryComparison::createConfiguration (   self,
  path 
)

Definition at line 74 of file geometryComparison.py.

00075                                         :
00076         # self.__compares
00077         repMap = self.getRepMap()
00078         cfgs = { "TkAlCompareToNTuple.%s.%s_cfg.py"%(
00079             self.alignmentToValidate.name, self.randomWorkdirPart ):
00080                 replaceByMap( configTemplates.intoNTuplesTemplate, repMap)}
00081         if not self.referenceAlignment == "IDEAL":
00082             referenceRepMap = self.getRepMap( self.referenceAlignment )
00083             cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
00084                 self.referenceAlignment.name, self.randomWorkdirPart )
00085             cfgs[cfgFileName] = replaceByMap(configTemplates.intoNTuplesTemplate,
00086                                              referenceRepMap)
00087 
00088         cfgSchedule = cfgs.keys()
00089         for common in self.__compares:
00090             repMap.update({"common": common,
00091                            "levels": self.__compares[common][0],
00092                            "dbOutput": self.__compares[common][1]
00093                            })
00094             if self.__compares[common][1].split()[0] == "true":
00095                 repMap["dbOutputService"] = configTemplates.dbOutputTemplate
00096             else:
00097                 repMap["dbOutputService"] = ""
00098             cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
00099                                     ".oO[name]Oo._cfg.py"),repMap)
00100             cfgs[cfgName] = replaceByMap(configTemplates.compareTemplate, repMap)
00101             
00102             cfgSchedule.append( cfgName )
00103         GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule)

def geometryComparison::GeometryComparison::createCrabCfg (   self,
  path 
)

Definition at line 194 of file geometryComparison.py.

00195                                  :
00196         msg = ("Parallelization not supported for geometry comparison. Please "
00197                "choose another 'jobmode'.")
00198         raise AllInOneError(msg)
def geometryComparison::GeometryComparison::createScript (   self,
  path 
)

Definition at line 104 of file geometryComparison.py.

00104                                 :    
00105         repMap = self.getRepMap()    
00106         repMap["runComparisonScripts"] = ""
00107         scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
00108                                    %self.name), repMap)
00109         for name in self.__compares:
00110             if  '"DetUnit"' in self.__compares[name][0].split(","):
00111                 repMap["runComparisonScripts"] += \
00112                     ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
00113                      "/scripts/comparisonScript.C .\n"
00114                      "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
00115                      "/scripts/comparisonPlots.h .\n"
00116                      "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
00117                      "/scripts/comparisonPlots.cc .\n"
00118                      "root -b -q 'comparisonScript.C(\""
00119                      ".oO[name]Oo..Comparison_common"+name+".root\",\""
00120                      "./\")'\n")
00121                 if  self.copyImages:
00122                    repMap["runComparisonScripts"] += \
00123                        ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
00124                         ".Comparison_common"+name+"_Images\n")
00125                    repMap["runComparisonScripts"] += \
00126                        ("find . -maxdepth 1 -name \"plot*.eps\" "
00127                         "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
00128                         "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
00129                    repMap["runComparisonScripts"] += \
00130                        ("find . -maxdepth 1 -name \"plot*.pdf\" "
00131                         "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
00132                         "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
00133                    repMap["runComparisonScripts"] += \
00134                        ("find . -maxdepth 1 -name "
00135                         "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
00136                         " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
00137                         ".Comparison_common"+name+"_Images/\" \n")
00138                    repMap["runComparisonScripts"] += \
00139                        ("find . -maxdepth 1 -name "
00140                         "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
00141                         " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
00142                         ".Comparison_common"+name+"_Images/\" \n")
00143                    repMap["runComparisonScripts"] += \
00144                        ("if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
00145                         "then\n"
00146                         "    rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
00147                         +"_ArrowPlots\n"
00148                         "else\n"
00149                         "    mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
00150                         +"_ArrowPlots\n"
00151                         "fi\n")
00152                    repMap["runComparisonScripts"] += \
00153                        ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
00154                         "/OfflineValidation/scripts/makeArrowPlots.C "
00155                         "$CWD/TkAllInOneTool\n"
00156                         "root -b -q 'makeArrowPlots.C(\""
00157                         ".oO[name]Oo..Comparison_common"+name
00158                         +".root\",\".oO[name]Oo.."
00159                         +name+"_ArrowPlots\")'\n")
00160                    repMap["runComparisonScripts"] += \
00161                        ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
00162                         ".Comparison_common"+name+"_Images/ArrowPlots\n")
00163                    repMap["runComparisonScripts"] += \
00164                        ("find .oO[name]Oo.."+name+"_ArrowPlots "
00165                         "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
00166                         "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
00167                         ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
00168 
00169                 resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
00170                                               ".oO[name]Oo..root"%name), repMap)
00171                 resultingFile = os.path.expandvars( resultingFile )
00172                 resultingFile = os.path.abspath( resultingFile )
00173                 repMap["runComparisonScripts"] += \
00174                     ("cmsStage -f OUTPUT_comparison.root %s\n"
00175                      %resultingFile)
00176                 self.filesToCompare[ name ] = resultingFile
00177                 
00178         repMap["CommandLine"]=""
00179 
00180         for cfg in self.configFiles:
00181             # FIXME: produce this line only for enabled dbOutput
00182             # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
00183             postProcess = "rfcp *.db .oO[datadir]Oo.\n"
00184             repMap["CommandLine"]+= \
00185                 repMap["CommandLineTemplate"]%{"cfgFile":cfg,
00186                                                "postProcess":postProcess}
00187         repMap["CommandLine"]+= ("# overall postprocessing\n"
00188                                  ".oO[runComparisonScripts]Oo.\n"
00189                                  )
00190 
00191         scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }  
00192         return GenericValidation.createScript(self, scripts, path)
00193 
def geometryComparison::GeometryComparison::getRepMap (   self,
  alignment = None 
)

Reimplemented from genericValidation::GenericValidation.

Definition at line 53 of file geometryComparison.py.

00054                                          :
00055         if alignment == None:
00056             alignment = self.alignmentToValidate
00057         repMap = GenericValidation.getRepMap( self, alignment )
00058         referenceName = "IDEAL"
00059         if not self.referenceAlignment == "IDEAL":
00060             referenceName = self.referenceAlignment.name
00061         
00062         repMap.update({
00063             "comparedGeometry": (".oO[alignmentName]Oo."
00064                                  "ROOTGeometry.root"),
00065             "referenceGeometry": "IDEAL", # will be replaced later
00066                                           #  if not compared to IDEAL
00067             "reference": referenceName
00068             })
00069         if not referenceName == "IDEAL":
00070             repMap["referenceGeometry"] = (".oO[reference]Oo."
00071                                            "ROOTGeometry.root")
00072         repMap["name"] += "_vs_.oO[reference]Oo."
00073         return repMap


Member Data Documentation

Definition at line 28 of file geometryComparison.py.

Definition at line 28 of file geometryComparison.py.

Reimplemented from genericValidation::GenericValidation.

Definition at line 28 of file geometryComparison.py.

Reimplemented from genericValidation::GenericValidation.

Definition at line 28 of file geometryComparison.py.

Definition at line 28 of file geometryComparison.py.