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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 31 of file plottingOptions.py.

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

Member Function Documentation

◆ getRepMap()

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

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

Member Data Documentation

◆ cmssw

plottingOptions.BasePlottingOptions.cmssw

Definition at line 43 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ cmsswreleasebase

plottingOptions.BasePlottingOptions.cmsswreleasebase

Definition at line 57 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 20 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 29 of file plottingOptions.py.

◆ needpackages

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

Definition at line 30 of file plottingOptions.py.

◆ randomWorkdirPart

plottingOptions.BasePlottingOptions.randomWorkdirPart

Definition at line 35 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ scramarch

plottingOptions.BasePlottingOptions.scramarch

Definition at line 56 of file plottingOptions.py.

Referenced by plottingOptions.BasePlottingOptions.getRepMap().

◆ type

plottingOptions.BasePlottingOptions.type