CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, config, valType)
 
def getRepMap (self)
 

Public Attributes

 cmssw
 
 cmsswreleasebase
 
 config
 
 general
 
 randomWorkdirPart
 
 scramarch
 
 type
 

Static Public Attributes

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

Static Private Attributes

 __metaclass__ = ValidationMetaClass
 

Detailed Description

Definition at line 15 of file plottingOptions.py.

Constructor & Destructor Documentation

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

Definition at line 28 of file plottingOptions.py.

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

Member Function Documentation

def plottingOptions.BasePlottingOptions.getRepMap (   self)

Definition at line 101 of file plottingOptions.py.

References plottingOptions.BasePlottingOptions.cmssw, genericValidation.GenericValidation.cmssw, plottingOptions.BasePlottingOptions.cmsswreleasebase, genericValidation.GenericValidation.cmsswreleasebase, plottingOptions.BasePlottingOptions.general, genericValidation.GenericValidation.general, betterConfigParser.BetterConfigParser.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, and plottingOptions.PlottingOptionsPrimaryVertex.validationclass.

Referenced by plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

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

Member Data Documentation

plottingOptions.BasePlottingOptions.__metaclass__ = ValidationMetaClass
staticprivate

Definition at line 16 of file plottingOptions.py.

plottingOptions.BasePlottingOptions.cmssw

Definition at line 40 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.cmsswreleasebase

Definition at line 54 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.config

Definition at line 33 of file plottingOptions.py.

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 17 of file plottingOptions.py.

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

plottingOptions.BasePlottingOptions.general
plottingOptions.BasePlottingOptions.mandatories = set()
static

Definition at line 26 of file plottingOptions.py.

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

Definition at line 27 of file plottingOptions.py.

plottingOptions.BasePlottingOptions.randomWorkdirPart

Definition at line 32 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.scramarch

Definition at line 53 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.type