CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
plottingOptions.BasePlottingOptions Class Reference
Inheritance diagram for plottingOptions.BasePlottingOptions:
plottingOptions.PlottingOptionsOffline plottingOptions.PlottingOptionsOverlap plottingOptions.PlottingOptionsPrimaryVertex plottingOptions.PlottingOptionsPVResolution plottingOptions.PlottingOptionsTrackSplitting plottingOptions.PlottingOptionsZMuMu

Public Member Functions

def __init__
 
def getRepMap
 

Public Attributes

 cmssw
 
 cmsswreleasebase
 
 config
 
 general
 
 randomWorkdirPart
 
 scramarch
 
 type
 

Static Public Attributes

dictionary defaults
 
tuple mandatories = set()
 
dictionary needpackages = {"Alignment/OfflineValidation"}
 

Detailed Description

Definition at line 19 of file plottingOptions.py.

Constructor & Destructor Documentation

def plottingOptions.BasePlottingOptions.__init__ (   self,
  config,
  valType 
)

Definition at line 31 of file plottingOptions.py.

31 
32  def __init__(self, config, valType):
33  import random
34  self.type = valType
35  self.general = config.getGeneral()
36  self.randomWorkdirPart = "%0i"%random.randint(1,10e9)
37  self.config = config
38 
39  theUpdate = config.getResultingSection("plots:"+self.type,
40  defaultDict = self.defaults,
41  demandPars = self.mandatories)
42  self.general.update(theUpdate)
43 
44  self.cmssw = self.general["cmssw"]
45  badcharacters = r"\'"
46  for character in badcharacters:
47  if character in self.cmssw:
48  raise AllInOneError("The bad characters " + badcharacters + " are not allowed in the cmssw\n"
49  "path name. If you really have it in such a ridiculously named location,\n"
50  "try making a symbolic link somewhere with a decent name.")
51  try:
52  os.listdir(self.cmssw)
53  except OSError:
54  raise AllInOneError("Your cmssw release " + self.cmssw + ' does not exist')
55 
56  if self.cmssw == os.environ["CMSSW_BASE"]:
57  self.scramarch = os.environ["SCRAM_ARCH"]
58  self.cmsswreleasebase = os.environ["CMSSW_RELEASE_BASE"]
59  else:
60  command = ("cd '" + self.cmssw + "' && eval `scramv1 ru -sh 2> /dev/null`"
61  ' && echo "$CMSSW_BASE\n$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
62  commandoutput = getCommandOutput2(command).split('\n')
63  self.cmssw = commandoutput[0]
64  self.scramarch = commandoutput[1]
65  self.cmsswreleasebase = commandoutput[2]
66 
67  for package in self.needpackages:
68  for placetolook in self.cmssw, self.cmsswreleasebase:
69  pkgpath = os.path.join(placetolook, "src", package)
70  if os.path.exists(pkgpath):
71  self.general[package] = pkgpath
72  break
73  else:
74  raise AllInOneError("Package {} does not exist in {} or {}!".format(package, self.cmssw, self.cmsswreleasebase))
75 
76  self.general["publicationstatus"] = self.general["publicationstatus"].upper()
77  self.general["era"] = self.general["era"].upper()
78 
79  if not self.general["publicationstatus"] and not self.general["customtitle"]:
80  self.general["publicationstatus"] = "INTERNAL"
81  if self.general["customtitle"] and not self.general["publicationstatus"]:
82  self.general["publicationstatus"] = "CUSTOM"
83 
84  if self.general["publicationstatus"] != "CUSTOM" and self.general["customtitle"]:
85  raise AllInOneError("If you would like to use a custom title, please leave out the 'publicationstatus' parameter")
86  if self.general["publicationstatus"] == "CUSTOM" and not self.general["customtitle"]:
87  raise AllInOneError("If you want to use a custom title, you should provide it using 'customtitle' in the [plots:%s] section" % valType)
88 
89  if self.general["era"] != "NONE" and self.general["customrighttitle"]:
90  raise AllInOneError("If you would like to use a custom right title, please leave out the 'era' parameter")
91 
92  publicationstatusenum = ["INTERNAL", "INTERNAL_SIMULATION", "PRELIMINARY", "PUBLIC", "SIMULATION", "UNPUBLISHED", "CUSTOM"]
93  eraenum = ["NONE", "CRUZET15", "CRAFT15", "COLL0T15"]
94  if self.general["publicationstatus"] not in publicationstatusenum:
95  raise AllInOneError("Publication status must be one of " + ", ".join(publicationstatusenum) + "!")
96  if self.general["era"] not in eraenum:
97  raise AllInOneError("Era must be one of " + ", ".join(eraenum) + "!")
98 
99  knownOpts = set(self.defaults.keys())|self.mandatories|self.optionals
100  ignoreOpts = []
101  config.checkInput("plots:"+self.type,
102  knownSimpleOptions = knownOpts,
103  ignoreOptions = ignoreOpts)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Function Documentation

def plottingOptions.BasePlottingOptions.getRepMap (   self)

Definition at line 104 of file plottingOptions.py.

References plottingOptions.BasePlottingOptions.cmssw, genericValidation.GenericValidation.cmssw, plottingOptions.BasePlottingOptions.cmsswreleasebase, genericValidation.GenericValidation.cmsswreleasebase, plottingOptions.BasePlottingOptions.general, genericValidation.GenericValidation.general, plottingOptions.BasePlottingOptions.randomWorkdirPart, genericValidation.GenericValidation.randomWorkdirPart, plottingOptions.BasePlottingOptions.scramarch, genericValidation.GenericValidation.scramarch, presentation.ValidationPlots.validationclass(), plottingOptions.PlottingOptionsTrackSplitting.validationclass, plottingOptions.PlottingOptionsZMuMu.validationclass, plottingOptions.PlottingOptionsOffline.validationclass, plottingOptions.PlottingOptionsPrimaryVertex.validationclass, plottingOptions.PlottingOptionsOverlap.validationclass, and plottingOptions.PlottingOptionsPVResolution.validationclass.

Referenced by trackSplittingValidation.TrackSplittingValidation.appendToMerge(), primaryVertexResolution.PrimaryVertexResolution.appendToMerge(), primaryVertexValidation.PrimaryVertexValidation.appendToMerge(), trackSplittingValidation.TrackSplittingValidation.appendToPlots(), primaryVertexResolution.PrimaryVertexResolution.appendToPlots(), primaryVertexValidation.PrimaryVertexValidation.appendToPlots(), zMuMuValidation.ZMuMuValidation.appendToPlots(), zMuMuValidation.ZMuMuValidation.filesToCompare(), and plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

105  def getRepMap(self):
106  result = self.general
107  result.update({
108  "workdir": os.path.join(self.general["workdir"],
109  self.randomWorkdirPart),
110  "datadir": self.general["datadir"],
111  "logdir": self.general["logdir"],
112  "CMSSW_BASE": self.cmssw,
113  "SCRAM_ARCH": self.scramarch,
114  "CMSSW_RELEASE_BASE": self.cmsswreleasebase,
115  "validationId": self.validationclass.__name__,
116  })
117  if issubclass(self.validationclass, ValidationWithPlots):
118  result["plottingscriptname"] = self.validationclass.plottingscriptname()
119  result["plottingscriptpath"] = ".oO[scriptsdir]Oo./.oO[plottingscriptname]Oo."
120  result["PlotsDirName"] = self.validationclass.plotsdirname()
121  if issubclass(self.validationclass, ValidationWithComparison):
122  result["compareAlignmentsPath"] = self.validationclass.comparealignmentspath()
123  result["compareAlignmentsName"] = self.validationclass.comparealignmentsname()
124  return result

Member Data Documentation

plottingOptions.BasePlottingOptions.cmssw

Definition at line 43 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.cmsswreleasebase

Definition at line 57 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.config

Definition at line 36 of file plottingOptions.py.

Referenced by preexistingValidation.PreexistingValidation.getRepMap(), and zMuMuValidation.ZMuMuValidation.trackcollection().

dictionary plottingOptions.BasePlottingOptions.defaults
static
Initial value:
1 = {
2  "cmssw" : os.environ["CMSSW_BASE"],
3  "publicationstatus" : "",
4  "customtitle" : "",
5  "customrighttitle" : "",
6  "era" : "NONE",
7  "legendheader" : "",
8  "legendoptions":"all",
9  }

Definition at line 20 of file plottingOptions.py.

Referenced by tree.Tree.reset(), and tree.Tree.var().

plottingOptions.BasePlottingOptions.general

Definition at line 34 of file plottingOptions.py.

Referenced by primaryVertexValidation.PrimaryVertexValidation.__init__(), primaryVertexResolution.PrimaryVertexResolution.__init__(), offlineValidation.OfflineValidation.__init__(), zMuMuValidation.ZMuMuValidation.__init__(), preexistingValidation.PreexistingOfflineValidation.__init__(), plottingOptions.PlottingOptionsTrackSplitting.__init__(), plottingOptions.PlottingOptionsZMuMu.__init__(), plottingOptions.PlottingOptionsOffline.__init__(), plottingOptions.PlottingOptionsPrimaryVertex.__init__(), preexistingValidation.PreexistingValidation.filesToCompare(), overlapValidation.OverlapValidation.getRepMap(), monteCarloValidation.MonteCarloValidation.getRepMap(), trackSplittingValidation.TrackSplittingValidation.getRepMap(), primaryVertexResolution.PrimaryVertexResolution.getRepMap(), preexistingValidation.PreexistingValidation.getRepMap(), primaryVertexValidation.PrimaryVertexValidation.getRepMap(), offlineValidation.OfflineValidation.getRepMap(), zMuMuValidation.ZMuMuValidation.getRepMap(), preexistingValidation.PreexistingOfflineValidation.getRepMap(), plottingOptions.BasePlottingOptions.getRepMap(), and preexistingValidation.PreexistingPrimaryVertexValidation.getRepMap().

tuple plottingOptions.BasePlottingOptions.mandatories = set()
static

Definition at line 29 of file plottingOptions.py.

dictionary plottingOptions.BasePlottingOptions.needpackages = {"Alignment/OfflineValidation"}
static

Definition at line 30 of file plottingOptions.py.

plottingOptions.BasePlottingOptions.randomWorkdirPart

Definition at line 35 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.scramarch

Definition at line 56 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.type

Definition at line 33 of file plottingOptions.py.

Referenced by core.autovars.NTupleVariable.makeBranch(), DQM.DQMReader.read_objects(), and core.AutoHandle.AutoHandle.ReallyLoad().