CMS 3D CMS Logo

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  }
16  deprecateddefaults = {
17  "resonance": "",
18  "switchONfit": "",
19  "rebinphi": "",
20  "rebinetadiff": "",
21  "rebineta": "",
22  "rebinpt": "",
23  }
24  defaults.update(deprecateddefaults)
25  mandatories = ["etamaxneg", "etaminneg", "etamaxpos", "etaminpos"]
26  self.configBaseName = configBaseName
27  self.scriptBaseName = scriptBaseName
28  self.crabCfgBaseName = crabCfgBaseName
29  self.resultBaseName = resultBaseName
30  self.outputBaseName = outputBaseName
31  self.needParentFiles = False
32  GenericValidationData.__init__(self, valName, alignment, config,
33  "zmumu", addDefaults=defaults,
34  addMandatories=mandatories,
35  addneedpackages=['MuonAnalysis/MomentumScaleCalibration'])
36  if self.general["zmumureference"].startswith("/store"):
37  self.general["zmumureference"] = "root://eoscms//eos/cms" + self.general["zmumureference"]
38  if self.NJobs > 1:
39  raise AllInOneError("Parallel jobs not implemented for the Z->mumu validation!\n"
40  "Please set parallelJobs = 1.")
41  for option in deprecateddefaults:
42  if self.general[option]:
43  raise AllInOneError("The '%s' option has been moved to the [plots:zmumu] section. Please specify it there."%option)
44  del self.general[option]
45 
46  def createConfiguration(self, path):
47  cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
48  self.alignmentToValidate.name )
49  repMap = self.getRepMap()
50  self.filesToCompare[GenericValidationData.defaultReferenceName] = \
51  replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap)
52  cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
53  GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
54 
55  def createScript(self, path):
56  return GenericValidationData.createScript(self, path, template = configTemplates.zMuMuScriptTemplate)
57 
58  def createCrabCfg(self, path):
59  return GenericValidationData.createCrabCfg(self, path, self.crabCfgBaseName)
60 
61  def getRepMap(self, alignment = None):
62  if alignment == None:
63  alignment = self.alignmentToValidate
64  repMap = GenericValidationData.getRepMap(self, alignment)
65  repMap.update({
66  "nEvents": self.general["maxevents"],
67  "outputFile": ("0_zmumuHisto.root"
68  ",genSimRecoPlots.root"
69  ",FitParameters.txt"),
70  "eosdir": os.path.join(self.general["eosdir"], "%s/%s/%s" % (self.outputBaseName, self.name, alignment.name)),
71  "workingdir": ".oO[datadir]Oo./%s/%s/%s" % (self.outputBaseName, self.name, alignment.name),
72  "plotsdir": ".oO[datadir]Oo./%s/%s/%s/plots" % (self.outputBaseName, self.name, alignment.name),
73  })
74  return repMap
75 
76  def appendToExtendedValidation( self, validationsSoFar = "" ):
77  """
78  if no argument or "" is passed a string with an instantiation is
79  returned, else the validation is appended to the list
80  """
81  repMap = self.getRepMap()
82  if validationsSoFar != "":
83  validationsSoFar += ' '
84  validationsSoFar += replaceByMap('filenames.push_back("root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./BiasCheck.root"); titles.push_back(".oO[title]Oo."); colors.push_back(.oO[color]Oo.); linestyles.push_back(.oO[style]Oo.);\n', repMap)
85  return validationsSoFar
def appendToExtendedValidation(self, validationsSoFar="")
def getRepMap(self, alignment=None)
def __init__(self, valName, alignment, config, configBaseName="TkAlZMuMuValidation", scriptBaseName="TkAlZMuMuValidation", crabCfgBaseName="TkAlZMuMuValidation", resultBaseName="ZMuMuValidation", outputBaseName="ZMuMuValidation")
def replaceByMap(target, the_map)
— Helpers —############################
def getRepMap(self, alignment=None)