CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
zMuMuValidation.py
Go to the documentation of this file.
1 import os
2 import configTemplates
3 import globalDictionaries
4 from genericValidation import GenericValidationData
5 from helperFunctions import replaceByMap
6 from TkAlExceptions import AllInOneError
7 
8 
10  def __init__(self, valName, alignment, config,
11  configBaseName = "TkAlZMuMuValidation", scriptBaseName = "TkAlZMuMuValidation", crabCfgBaseName = "TkAlZMuMuValidation",
12  resultBaseName = "ZMuMuValidation", outputBaseName = "ZMuMuValidation"):
13  defaults = {
14  "zmumureference": ("/store/caf/user/emiglior/Alignment/TkAlDiMuonValidation/Reference/BiasCheck_DYToMuMu_Summer12_TkAlZMuMu_IDEAL.root"),
15  "resonance": "Z"
16  }
17  mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"]
18  self.configBaseName = configBaseName
19  self.scriptBaseName = scriptBaseName
20  self.crabCfgBaseName = crabCfgBaseName
21  self.resultBaseName = resultBaseName
22  self.outputBaseName = outputBaseName
23  self.needParentFiles = False
24  GenericValidationData.__init__(self, valName, alignment, config,
25  "zmumu", addDefaults=defaults,
26  addMandatories=mandatories)
27  if self.general["zmumureference"].startswith("/store"):
28  self.general["zmumureference"] = "root://eoscms//eos/cms" + self.general["zmumureference"]
29  if self.NJobs > 1:
30  raise AllInOneError("Parallel jobs not implemented for the Z->mumu validation!\n"
31  "Please set parallelJobs = 1.")
32 
33  def createConfiguration(self, path):
34  cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
35  self.alignmentToValidate.name )
36  repMap = self.getRepMap()
37  cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
38  GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
39 
40  def createScript(self, path):
41  return GenericValidationData.createScript(self, path, template = configTemplates.zMuMuScriptTemplate)
42 
43  def createCrabCfg(self, path):
44  return GenericValidationData.createCrabCfg(self, path, self.crabCfgBaseName)
45 
46  def getRepMap(self, alignment = None):
47  if alignment == None:
48  alignment = self.alignmentToValidate
49  repMap = GenericValidationData.getRepMap(self, alignment)
50  repMap.update({
51  "nEvents": self.general["maxevents"],
52  "outputFile": ("0_zmumuHisto.root"
53  ",genSimRecoPlots.root"
54  ",FitParameters.txt"),
55  "eosdir": os.path.join(self.general["eosdir"], "%s/%s/%s" % (self.outputBaseName, self.name, alignment.name)),
56  "workingdir": ".oO[datadir]Oo./%s/%s/%s" % (self.outputBaseName, self.name, alignment.name),
57  "plotsdir": ".oO[datadir]Oo./%s/%s/%s/plots" % (self.outputBaseName, self.name, alignment.name),
58  })
59  return repMap