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