CMS 3D CMS Logo

primaryVertexResolution.py
Go to the documentation of this file.
1 import os
2 from . import configTemplates
3 from . import globalDictionaries
4 from .genericValidation import GenericValidationData, ValidationWithPlots, pythonboolstring
5 from .helperFunctions import replaceByMap
6 from .TkAlExceptions import AllInOneError
7 
9  configBaseName = "TkAlPrimaryVertexResolution"
10  scriptBaseName = "TkAlPrimaryVertexResolution"
11  crabCfgBaseName = "TkAlPrimaryVertexResolution"
12  resultBaseName = "PrimaryVertexResolution"
13  outputBaseName = "PrimaryVertexResolution"
14  defaults = {
15  # N.B.: the reference needs to be updated each time the format of the output is changed
16  "pvresolutionreference": ("/store/group/alca_trackeralign/validation/PVResolution/Reference/PrimaryVertexResolution_phaseIMC92X_upgrade2017_Ideal.root"),
17  "multiIOV":"False",
18  "startScale":"1.",
19  "endScale":"1000.",
20  "nTracksBins":"60.",
21  "nVtxBins":"40."
22  }
23  #mandatories = {"isda","ismc","runboundary","trackcollection","vertexcollection","lumilist","ptCut","etaCut","runControl","numberOfBins"}
24  mandatories = {"runControl","runboundary","doTriggerSelection","triggerBits","trackcollection"}
25  valType = "pvresolution"
26  def __init__(self, valName, alignment, config):
27  super(PrimaryVertexResolution, self).__init__(valName, alignment, config)
28 
29  if self.general["pvresolutionreference"].startswith("/store"):
30  self.general["pvresolutionreference"] = "root://eoscms//eos/cms" + self.general["pvresolutionreference"]
31  if self.NJobs > 1:
32  raise AllInOneError("Parallel jobs not implemented for the SplotVertexResolution validation!\n"
33  "Please set parallelJobs = 1.")
34  @property
35  def ValidationTemplate(self):
36  return configTemplates.PrimaryVertexResolutionTemplate
37 
38  @property
40  return configTemplates.SingleTrackRefitter
41 
42  @property
43  def DefinePath(self):
44  return configTemplates.PVResolutionPath
45 
46  @property
47  def ValidationSequence(self):
48  #never enters anywhere, since we use the custom DefinePath which includes the goodVertexSkim
49  return ""
50 
51  @property
52  def ProcessName(self):
53  return "PrimaryVertexResolution"
54 
55  def createScript(self, path):
56  return super(PrimaryVertexResolution, self).createScript(path, template = configTemplates.PVResolutionScriptTemplate)
57 
58  def createCrabCfg(self, path):
59  return super(PrimaryVertexResolution, self).createCrabCfg(path, self.crabCfgBaseName)
60 
61  def getRepMap(self, alignment = None):
62  if alignment == None:
63  alignment = self.alignmentToValidate
64  repMap = super(PrimaryVertexResolution, self).getRepMap(alignment)
65  repMap.update({
66  "nEvents": self.general["maxevents"],
67  "TrackCollection": self.general["trackcollection"],
68  "eosdir": os.path.join(self.general["eosdir"]),
69  #"eosdir": os.path.join(self.general["eosdir"], "%s/%s/%s" % (self.outputBaseName, self.name, alignment.name)),
70  "workingdir": ".oO[datadir]Oo./%s/%s/%s" % (self.outputBaseName, self.name, alignment.name),
71  "plotsdir": ".oO[datadir]Oo./%s/%s/%s/plots" % (self.outputBaseName, self.name, alignment.name),
72  })
73 
74  return repMap
75 
76  def appendToMerge(self):
77  """
78  if no argument or "" is passed a string with an instantiation is returned,
79  else the validation is appended to the list
80  """
81  repMap = self.getRepMap()
82 
83  parameters = " ".join(os.path.join("root://eoscms//eos/cms", file.lstrip("/")) for file in repMap["resultFiles"])
84 
85  mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
86  return "hadd -f %s %s\n" % (mergedoutputfile, parameters)
87 
88  def appendToPlots(self):
89  repMap = self.getRepMap()
90  return (' PVResolution::loadFileList("root://eoscms//eos/cms%(finalResultFile)s",'
91  '"PrimaryVertexResolution","%(title)s", %(color)s, %(style)s);\n')%repMap
92 
93  @classmethod
94  def runPlots(cls, validations):
95  return configTemplates.PVResolutionPlotExecution
96 
97  @classmethod
99  return "TkAlPrimaryVertexResolutionPlot.C"
100 
101  @classmethod
103  return configTemplates.PVResolutionPlotTemplate
104 
105  @classmethod
106  def plotsdirname(cls):
107  return "PrimaryVertexResolution"
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def getRepMap(self, alignment=None)
def __init__(self, valName, alignment, config)