test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def getRepMap
 

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

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

Definition at line 15 of file plottingOptions.py.

Referenced by DTNoiseCalibration.DTNoiseCalibration.initCrab(), DTTTrigProd.DTTTrigProd.initCrab(), DTDQMValidation.DTDQMValidation.initCrab(), DTTTrigValid.DTTTrigValid.initCrab(), DTAnalysisResiduals.DTAnalysisResiduals.initCrab(), DTResidualCalibration.DTResidualCalibration.initCrab(), DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.initCrab(), DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.initCrab(), DTT0DBValidation.DTT0DBValidation.initProcess(), DTDqm.DTDqm.initProcess(), DTDQMMerge.DTDQMMerge.initProcess(), DTTTrigProd.DTTTrigProd.initProcess(), DTAnalysisResiduals.DTAnalysisResiduals.initProcess(), DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.initProcess(), DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.initProcess(), DTDQMHarvesting.DTDQMHarvesting.initProcess(), DTResidualCalibration.DTResidualCalibration.initProcess(), DTNoiseCalibration.DTNoiseCalibration.initProcess(), DTDQMValidation.DTDQMValidation.initProcess(), DTTTrigValid.DTTTrigValid.initProcess(), and DTCalibrationWorker.DTCalibrationWorker.run().

plottingOptions.BasePlottingOptions.general

Definition at line 13 of file plottingOptions.py.

Referenced by plottingOptions.PlottingOptionsTrackSplitting.__init__(), and plottingOptions.BasePlottingOptions.getRepMap().

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

Definition at line 12 of file plottingOptions.py.

Referenced by cuy.ValElement.__init__(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.inputCommands(), core.autovars.NTupleVariable.makeBranch(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.outputCommands(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.outputEventContent(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.properties(), and core.AutoHandle.AutoHandle.ReallyLoad().