CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
monteCarloValidation.py
Go to the documentation of this file.
1 import os
2 import configTemplates
3 import globalDictionaries
4 from dataset import Dataset
5 from genericValidation import GenericValidationData
6 from helperFunctions import replaceByMap
7 from TkAlExceptions import AllInOneError
8 
9 
11  def __init__(self, valName, alignment, config):
12  mandatories = [ "dataset", "maxevents" ]
13  GenericValidationData.__init__(self, valName, alignment, config,
14  "mcValidate", addMandatories=mandatories)
15 
16  def createConfiguration(self, path ):
17  cfgName = "TkAlMcValidate.%s.%s_cfg.py"%(self.name,
18  self.alignmentToValidate.name)
19  repMap = self.getRepMap()
20  cfgs = {cfgName:replaceByMap(configTemplates.mcValidateTemplate,
21  repMap)}
22  self.filesToCompare[GenericValidationData.defaultReferenceName] = \
23  repMap["resultFile"]
24  GenericValidationData.createConfiguration(self, cfgs, path)
25 
26  def createScript(self, path):
27  scriptName = "TkAlMcValidate.%s.%s.sh"%(self.name,
28  self.alignmentToValidate.name)
29  repMap = self.getRepMap()
30  repMap["CommandLine"]=""
31  for cfg in self.configFiles:
32  repMap["CommandLine"] += \
33  repMap["CommandLineTemplate"]%{"cfgFile":cfg, "postProcess":"" }
34 
35  scripts = {scriptName: replaceByMap(configTemplates.scriptTemplate,
36  repMap)}
37  return GenericValidationData.createScript(self, scripts, path)
38 
39  def createCrabCfg(self, path, crabCfgBaseName = "TkAlMcValidate"):
40  return GenericValidationData.createCrabCfg(self, path,
41  crabCfgBaseName)
42 
43  def getRepMap( self, alignment = None ):
44  repMap = GenericValidationData.getRepMap(self, alignment)
45  repMap.update({
46  "resultFile": replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo."
47  "/McValidation_"
48  + self.name +
49  "_.oO[name]Oo..root"), repMap ),
50  "outputFile": replaceByMap(("McValidation_"
51  + self.name +
52  "_.oO[name]Oo..root"), repMap ),
53  "nEvents": self.general["maxevents"]
54  })
55  repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
56  repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
57  return repMap
58 
def replaceByMap
— Helpers —############################