CMS 3D CMS Logo

List of all members | Public Member Functions | Public 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, addDefaults={}, addMandatories=[], addneedpackages=[])
 
def getRepMap (self)
 

Public Attributes

 cmssw
 
 cmsswreleasebase
 
 config
 
 general
 
 randomWorkdirPart
 
 scramarch
 
 type
 

Detailed Description

Definition at line 9 of file plottingOptions.py.

Constructor & Destructor Documentation

def plottingOptions.BasePlottingOptions.__init__ (   self,
  config,
  valType,
  addDefaults = {},
  addMandatories = [],
  addneedpackages = [] 
)

Definition at line 10 of file plottingOptions.py.

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

Referenced by plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

97  def getRepMap(self):
98  result = self.general
99  result.update({
100  "workdir": os.path.join(self.general["workdir"],
101  self.randomWorkdirPart),
102  "datadir": self.general["datadir"],
103  "logdir": self.general["logdir"],
104  "CMSSW_BASE": self.cmssw,
105  "SCRAM_ARCH": self.scramarch,
106  "CMSSW_RELEASE_BASE": self.cmsswreleasebase,
107  })
108  return result
109 

Member Data Documentation

plottingOptions.BasePlottingOptions.cmssw

Definition at line 36 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.cmsswreleasebase

Definition at line 50 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.config
plottingOptions.BasePlottingOptions.general
plottingOptions.BasePlottingOptions.randomWorkdirPart

Definition at line 14 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.scramarch

Definition at line 49 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

plottingOptions.BasePlottingOptions.type