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  }
19  #mandatories = {"isda","ismc","runboundary","trackcollection","vertexcollection","lumilist","ptCut","etaCut","runControl","numberOfBins"}
20  mandatories = {"runControl","runboundary","doTriggerSelection","triggerBits","trackcollection"}
21  valType = "pvresolution"
22  def __init__(self, valName, alignment, config):
23  super(PrimaryVertexResolution, self).__init__(valName, alignment, config)
24 
25  if self.general["pvresolutionreference"].startswith("/store"):
26  self.general["pvresolutionreference"] = "root://eoscms//eos/cms" + self.general["pvresolutionreference"]
27  if self.NJobs > 1:
28  raise AllInOneError("Parallel jobs not implemented for the SplotVertexResolution validation!\n"
29  "Please set parallelJobs = 1.")
30  @property
31  def ValidationTemplate(self):
32  return configTemplates.PrimaryVertexResolutionTemplate
33 
34  @property
36  return configTemplates.SingleTrackRefitter
37 
38  @property
39  def DefinePath(self):
40  return configTemplates.PVResolutionPath
41 
42  @property
43  def ValidationSequence(self):
44  #never enters anywhere, since we use the custom DefinePath which includes the goodVertexSkim
45  return ""
46 
47  @property
48  def ProcessName(self):
49  return "PrimaryVertexResolution"
50 
51  def createScript(self, path):
52  return super(PrimaryVertexResolution, self).createScript(path, template = configTemplates.PVResolutionScriptTemplate)
53 
54  def createCrabCfg(self, path):
55  return super(PrimaryVertexResolution, self).createCrabCfg(path, self.crabCfgBaseName)
56 
57  def getRepMap(self, alignment = None):
58  if alignment == None:
59  alignment = self.alignmentToValidate
60  repMap = super(PrimaryVertexResolution, self).getRepMap(alignment)
61  repMap.update({
62  "nEvents": self.general["maxevents"],
63  "TrackCollection": self.general["trackcollection"],
64  "eosdir": os.path.join(self.general["eosdir"]),
65  #"eosdir": os.path.join(self.general["eosdir"], "%s/%s/%s" % (self.outputBaseName, self.name, alignment.name)),
66  "workingdir": ".oO[datadir]Oo./%s/%s/%s" % (self.outputBaseName, self.name, alignment.name),
67  "plotsdir": ".oO[datadir]Oo./%s/%s/%s/plots" % (self.outputBaseName, self.name, alignment.name),
68  })
69 
70  return repMap
71 
72  def appendToMerge(self):
73  """
74  if no argument or "" is passed a string with an instantiation is returned,
75  else the validation is appended to the list
76  """
77  repMap = self.getRepMap()
78 
79  parameters = " ".join(os.path.join("root://eoscms//eos/cms", file.lstrip("/")) for file in repMap["resultFiles"])
80 
81  mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
82  return "hadd -f %s %s\n" % (mergedoutputfile, parameters)
83 
84  def appendToPlots(self):
85  repMap = self.getRepMap()
86  return (' PVResolution::loadFileList("root://eoscms//eos/cms%(finalResultFile)s",'
87  '"PrimaryVertexResolution","%(title)s", %(color)s, %(style)s);\n')%repMap
88 
89  @classmethod
90  def runPlots(cls, validations):
91  return configTemplates.PVResolutionPlotExecution
92 
93  @classmethod
95  return "TkAlPrimaryVertexResolutionPlot.C"
96 
97  @classmethod
99  return configTemplates.PVResolutionPlotTemplate
100 
101  @classmethod
102  def plotsdirname(cls):
103  return "PrimaryVertexResolution"
primaryVertexResolution.PrimaryVertexResolution.plottingscripttemplate
def plottingscripttemplate(cls)
Definition: primaryVertexResolution.py:98
primaryVertexResolution.PrimaryVertexResolution.plottingscriptname
def plottingscriptname(cls)
Definition: primaryVertexResolution.py:94
primaryVertexResolution.PrimaryVertexResolution.ValidationTemplate
def ValidationTemplate(self)
Definition: primaryVertexResolution.py:31
primaryVertexResolution.PrimaryVertexResolution
Definition: primaryVertexResolution.py:8
primaryVertexResolution.PrimaryVertexResolution.DefinePath
def DefinePath(self)
Definition: primaryVertexResolution.py:39
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
primaryVertexResolution.PrimaryVertexResolution.crabCfgBaseName
string crabCfgBaseName
Definition: primaryVertexResolution.py:11
primaryVertexResolution.PrimaryVertexResolution.ValidationSequence
def ValidationSequence(self)
Definition: primaryVertexResolution.py:43
primaryVertexResolution.PrimaryVertexResolution.appendToMerge
def appendToMerge(self)
Definition: primaryVertexResolution.py:72
primaryVertexResolution.PrimaryVertexResolution.createScript
def createScript(self, path)
Definition: primaryVertexResolution.py:51
genericValidation.GenericValidation.NJobs
NJobs
Definition: genericValidation.py:69
primaryVertexResolution.PrimaryVertexResolution.runPlots
def runPlots(cls, validations)
Definition: primaryVertexResolution.py:90
primaryVertexResolution.PrimaryVertexResolution.TrackSelectionRefitting
def TrackSelectionRefitting(self)
Definition: primaryVertexResolution.py:35
primaryVertexResolution.PrimaryVertexResolution.ProcessName
def ProcessName(self)
Definition: primaryVertexResolution.py:48
genericValidation.GenericValidation.general
general
Definition: genericValidation.py:58
genericValidation.ValidationWithPlots
Definition: genericValidation.py:599
primaryVertexResolution.PrimaryVertexResolution.__init__
def __init__(self, valName, alignment, config)
Definition: primaryVertexResolution.py:22
genericValidation.GenericValidation.alignmentToValidate
alignmentToValidate
Definition: genericValidation.py:57
genericValidation.GenericValidation.name
name
Definition: genericValidation.py:56
primaryVertexResolution.PrimaryVertexResolution.createCrabCfg
def createCrabCfg(self, path)
Definition: primaryVertexResolution.py:54
genericValidation.GenericValidation.getRepMap
def getRepMap(self, alignment=None)
Definition: genericValidation.py:137
genericValidation.GenericValidationData
Definition: genericValidation.py:251
primaryVertexResolution.PrimaryVertexResolution.outputBaseName
string outputBaseName
Definition: primaryVertexResolution.py:13
primaryVertexResolution.PrimaryVertexResolution.getRepMap
def getRepMap(self, alignment=None)
Definition: primaryVertexResolution.py:57
primaryVertexResolution.PrimaryVertexResolution.plotsdirname
def plotsdirname(cls)
Definition: primaryVertexResolution.py:102
TkAlExceptions.AllInOneError
Definition: TkAlExceptions.py:1
primaryVertexResolution.PrimaryVertexResolution.appendToPlots
def appendToPlots(self)
Definition: primaryVertexResolution.py:84