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  configBaseName = "TkAlMcValidate", scriptBaseName = "TkAlMcValidate", crabCfgBaseName = "TkAlMcValidate",
13  resultBaseName = "McValidation", outputBaseName = "McValidation"):
14  self.configBaseName = configBaseName
15  self.scriptBaseName = scriptBaseName
16  self.crabCfgBaseName = crabCfgBaseName
17  self.resultBaseName = resultBaseName
18  self.outputBaseName = outputBaseName
19  self.needParentFiles = True
20  GenericValidationData.__init__(self, valName, alignment, config,
21  "mcValidate")
22  if self.NJobs > 1:
23  raise AllInOneError("Parallel jobs not implemented for the MC validation!\n"
24  "Please set parallelJobs = 1.")
25 
26  def createConfiguration(self, path ):
27  cfgName = "%s.%s.%s_cfg.py"%(self.configBaseName, self.name,
28  self.alignmentToValidate.name)
29  repMap = self.getRepMap()
30  cfgs = {cfgName: configTemplates.mcValidateTemplate}
31  self.filesToCompare[GenericValidationData.defaultReferenceName] = \
32  repMap["finalResultFile"]
33  GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
34 
35  def createScript(self, path):
36  return GenericValidationData.createScript(self, path)
37 
38  def createCrabCfg(self, path):
39  return GenericValidationData.createCrabCfg(self, path, self.crabCfgBaseName)
40 
41  def getRepMap( self, alignment = None ):
42  repMap = GenericValidationData.getRepMap(self, alignment)
43  repMap.update({
44  "nEvents": self.general["maxevents"]
45  })
46  repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
47  repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
48  return repMap
49