CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Alignment/OfflineValidation/python/TkAlAllInOneTool/trackSplittingValidation.py

Go to the documentation of this file.
00001 import os
00002 import configTemplates
00003 from genericValidation import GenericValidationData
00004 from helperFunctions import replaceByMap
00005 from TkAlExceptions import AllInOneError
00006 
00007 
00008 class TrackSplittingValidation(GenericValidationData):
00009     def __init__(self, valName, alignment, config):
00010         mandatories = ["trackcollection", "maxevents", "dataset"]
00011         GenericValidationData.__init__(self, valName, alignment, config,
00012                                        "split", addMandatories = mandatories)
00013 
00014     def createConfiguration(self, path ):
00015         cfgName = "TkAlTrackSplitting.%s.%s_cfg.py"%(self.name,
00016                                                      self.alignmentToValidate.name)
00017         repMap = self.getRepMap()
00018         cfgs = {cfgName:replaceByMap(configTemplates.TrackSplittingTemplate,
00019                                      repMap)}
00020         self.filesToCompare[GenericValidationData.defaultReferenceName] = \
00021             repMap["resultFile"]
00022         GenericValidationData.createConfiguration(self, cfgs, path)
00023 
00024     def createScript(self, path):
00025         scriptName = "TkAlTrackSplitting.%s.%s.sh"%(self.name,
00026                                                     self.alignmentToValidate.name)
00027         repMap = self.getRepMap()
00028         repMap["CommandLine"]=""
00029         for cfg in self.configFiles:
00030             repMap["CommandLine"]+= (repMap["CommandLineTemplate"]
00031                                      %{"cfgFile":cfg, "postProcess":""})
00032 
00033         scripts = {scriptName: replaceByMap(configTemplates.scriptTemplate,
00034                                             repMap)}
00035         return GenericValidationData.createScript(self, scripts, path)
00036 
00037     def createCrabCfg(self, path, crabCfgBaseName = "TkAlTrackSplitting"):
00038         return GenericValidationData.createCrabCfg(self, path, crabCfgBaseName)
00039 
00040     def getRepMap( self, alignment = None ):
00041         repMap = GenericValidationData.getRepMap(self)
00042         repMap.update({ 
00043             "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo."
00044                                          "/TrackSplitting_"
00045                                          + self.name +
00046                                          "_.oO[name]Oo..root"),
00047                                         repMap ),
00048             "outputFile": replaceByMap( ("TrackSplitting_"
00049                                          + self.name +
00050                                          "_.oO[name]Oo..root"),
00051                                         repMap ),
00052             "nEvents": self.general["maxevents"],
00053             "TrackCollection": self.general["trackcollection"]
00054             })
00055         repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
00056         repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
00057         # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
00058         # if self.jobmode.split( ',' )[0] == "crab":
00059         #     repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
00060         return repMap