CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
trackSplittingValidation.py
Go to the documentation of this file.
1 import os
2 import configTemplates
3 from genericValidation import GenericValidationData
4 from helperFunctions import replaceByMap
5 from TkAlExceptions import AllInOneError
6 
7 
9  def __init__(self, valName, alignment, config):
10  mandatories = ["trackcollection", "maxevents", "dataset"]
11  GenericValidationData.__init__(self, valName, alignment, config,
12  "split", addMandatories = mandatories)
13 
14  def createConfiguration(self, path ):
15  cfgName = "TkAlTrackSplitting.%s.%s_cfg.py"%(self.name,
16  self.alignmentToValidate.name)
17  repMap = self.getRepMap()
18  cfgs = {cfgName:replaceByMap(configTemplates.TrackSplittingTemplate,
19  repMap)}
20  self.filesToCompare[GenericValidationData.defaultReferenceName] = \
21  repMap["resultFile"]
22  GenericValidationData.createConfiguration(self, cfgs, path)
23 
24  def createScript(self, path):
25  scriptName = "TkAlTrackSplitting.%s.%s.sh"%(self.name,
26  self.alignmentToValidate.name)
27  repMap = self.getRepMap()
28  repMap["CommandLine"]=""
29  for cfg in self.configFiles:
30  repMap["CommandLine"]+= (repMap["CommandLineTemplate"]
31  %{"cfgFile":cfg, "postProcess":""})
32 
33  scripts = {scriptName: replaceByMap(configTemplates.scriptTemplate,
34  repMap)}
35  return GenericValidationData.createScript(self, scripts, path)
36 
37  def createCrabCfg(self, path, crabCfgBaseName = "TkAlTrackSplitting"):
38  return GenericValidationData.createCrabCfg(self, path, crabCfgBaseName)
39 
40  def getRepMap( self, alignment = None ):
41  repMap = GenericValidationData.getRepMap(self)
42  repMap.update({
43  "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo."
44  "/TrackSplitting_"
45  + self.name +
46  "_.oO[name]Oo..root"),
47  repMap ),
48  "outputFile": replaceByMap( ("TrackSplitting_"
49  + self.name +
50  "_.oO[name]Oo..root"),
51  repMap ),
52  "nEvents": self.general["maxevents"],
53  "TrackCollection": self.general["trackcollection"]
54  })
55  repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
56  repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
57  # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
58  # if self.jobmode.split( ',' )[0] == "crab":
59  # repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
60  return repMap
61 
62 
63  def appendToExtendedValidation( self, validationsSoFar = "" ):
64  """
65  if no argument or "" is passed a string with an instantiation is
66  returned, else the validation is appended to the list
67  """
68  repMap = self.getRepMap()
69  comparestring = self.getCompareStrings("TrackSplittingValidation")
70  if validationsSoFar != "":
71  validationsSoFar += ','
72  validationsSoFar += comparestring
73  return validationsSoFar
74 
def replaceByMap
— Helpers —############################