CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
monteCarloValidation.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 import os
3 from . import configTemplates
4 from . import globalDictionaries
5 from .dataset import Dataset
6 from .genericValidation import GenericValidationData
7 from .helperFunctions import replaceByMap
8 from .TkAlExceptions import AllInOneError
9 
10 
11 class MonteCarloValidation(GenericValidationData):
12  configBaseName = "TkAlMcValidate"
13  scriptBaseName = "TkAlMcValidate"
14  crabCfgBaseName = "TkAlMcValidate"
15  resultBaseName = "McValidation"
16  outputBaseName = "McValidation"
17  needParentFiles = True
18  valType = "mcValidate"
19  def __init__(self, valName, alignment, config):
20  super(MonteCarloValidation, self).__init__(valName, alignment, config)
21  if self.NJobs > 1:
22  raise AllInOneError("Parallel jobs not implemented for the MC validation!\n"
23  "Please set parallelJobs = 1.")
24 
25  @property
26  def cfgTemplate(self):
27  return configTemplates.mcValidateTemplate
28 
29  def createScript(self, path):
30  return super(MonteCarloValidation, self).createScript(path)
31 
32  def createCrabCfg(self, path):
33  return super(MonteCarloValidation, self).createCrabCfg(path, self.crabCfgBaseName)
34 
35  def getRepMap( self, alignment = None ):
36  repMap = super(MonteCarloValidation, self).getRepMap(alignment)
37  repMap.update({
38  "nEvents": self.general["maxevents"]
39  })
40  repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
41  repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
42  return repMap
43