CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
plottingOptions.BasePlottingOptions Class Reference
Inheritance diagram for plottingOptions.BasePlottingOptions:
genericValidation.ValidationMetaClass plottingOptions.PlottingOptionsOffline plottingOptions.PlottingOptionsOverlap plottingOptions.PlottingOptionsPrimaryVertex plottingOptions.PlottingOptionsPVResolution plottingOptions.PlottingOptionsTrackSplitting plottingOptions.PlottingOptionsZMuMu

Public Member Functions

def __init__ (self, config, valType)
 
def getRepMap (self)
 
- Public Member Functions inherited from genericValidation.ValidationMetaClass
def __new__ (cls, clsname, bases, dct)
 

Public Attributes

 cmssw
 
 cmsswreleasebase
 
 config
 
 general
 
 randomWorkdirPart
 
 scramarch
 
 type
 

Static Public Attributes

dictionary defaults
 
 mandatories = set()
 
dictionary needpackages = {"Alignment/OfflineValidation"}
 
- Static Public Attributes inherited from genericValidation.ValidationMetaClass
list dicts = ["defaults"]
 
list sets = ["mandatories", "optionals", "needpackages"]
 

Detailed Description

Definition at line 20 of file plottingOptions.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 32 of file plottingOptions.py.

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)
104 

Member Function Documentation

◆ getRepMap()

def plottingOptions.BasePlottingOptions.getRepMap (   self)

Definition at line 105 of file plottingOptions.py.

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
125 

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 plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

Member Data Documentation

◆ cmssw

plottingOptions.BasePlottingOptions.cmssw

Definition at line 44 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ cmsswreleasebase

plottingOptions.BasePlottingOptions.cmsswreleasebase

Definition at line 58 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ config

plottingOptions.BasePlottingOptions.config

◆ defaults

dictionary plottingOptions.BasePlottingOptions.defaults
static
Initial value:
= {
"cmssw" : os.environ["CMSSW_BASE"],
"publicationstatus" : "",
"customtitle" : "",
"customrighttitle" : "",
"era" : "NONE",
"legendheader" : "",
"legendoptions":"all",
}

Definition at line 21 of file plottingOptions.py.

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

◆ general

plottingOptions.BasePlottingOptions.general

◆ mandatories

plottingOptions.BasePlottingOptions.mandatories = set()
static

Definition at line 30 of file plottingOptions.py.

◆ needpackages

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

Definition at line 31 of file plottingOptions.py.

◆ randomWorkdirPart

plottingOptions.BasePlottingOptions.randomWorkdirPart

Definition at line 36 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ scramarch

plottingOptions.BasePlottingOptions.scramarch

Definition at line 57 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ type

plottingOptions.BasePlottingOptions.type
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
helperFunctions.getCommandOutput2
def getCommandOutput2(command)
Definition: helperFunctions.py:52
format
pileupCalc.upper
upper
Definition: pileupCalc.py:214
update
#define update(a, b)
Definition: TrackClassifier.cc:10