3 import globalDictionaries
5 from helperFunctions
import getCommandOutput2, replaceByMap
6 from TkAlExceptions
import AllInOneError
10 def __init__(self, config, valType, addDefaults = {}, addMandatories=[], addneedpackages=[]):
18 "cmssw" : os.environ[
"CMSSW_BASE"],
19 "publicationstatus" :
"",
21 "customrighttitle" :
"",
24 "legendoptions":
"all",
26 defaults.update(addDefaults)
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)
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.")
44 os.listdir(self.
cmssw)
48 if self.
cmssw == os.environ[
"CMSSW_BASE"]:
52 command = (
"cd '" + self.
cmssw +
"' && eval `scramv1 ru -sh 2> /dev/null`"
53 ' && echo "$CMSSW_BASE\n$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
55 self.
cmssw = commandoutput[0]
59 for package
in needpackages:
61 pkgpath = os.path.join(placetolook,
"src", package)
62 if os.path.exists(pkgpath):
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"
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)
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")
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:
91 knownOpts = defaults.keys()+mandatories
93 config.checkInput(
"plots:"+self.
type,
94 knownSimpleOptions = knownOpts,
95 ignoreOptions = ignoreOpts)
100 "workdir": os.path.join(self.
general[
"workdir"],
102 "datadir": self.
general[
"datadir"],
103 "logdir": self.
general[
"logdir"],
104 "CMSSW_BASE": self.
cmssw,
111 def __init__(self, config, addDefaults = {}, addMandatories=[], addneedpackages=[]):
113 "outliercut":
"-1.0",
114 "subdetector":
"none",
116 defaults.update(addDefaults)
118 mandatories += addMandatories
119 needpackages = [
"Alignment/CommonAlignmentProducer"]
120 needpackages += addneedpackages
121 BasePlottingOptions.__init__(self, config,
"split", defaults, mandatories, needpackages)
123 if self.
general[
"subdetector"]
not in validsubdets:
124 raise AllInOneError(
"'%s' is not a valid subdetector!\n" % self.
general[
"subdetector"] +
"The options are: " +
", ".
join(validsubdets))
127 filename =
replaceByMap(
".oO[Alignment/CommonAlignmentProducer]Oo./python/AlignmentTrackSelector_cfi.py", self.
getRepMap())
128 with open(filename)
as f:
129 trackselector = f.read()
131 minhitspersubdet = trackselector.split(
"minHitsPerSubDet")[1].
split(
"(",1)[1]
135 for character
in minhitspersubdet:
137 parenthesesdepth += 1
139 parenthesesdepth -= 1
140 if parenthesesdepth < 0:
143 minhitspersubdet = minhitspersubdet[0:i]
145 results = minhitspersubdet.split(
",")
147 for i
in range(len(results)):
148 results[i] = results[i].
split(
"=")[0].strip().
replace(
"in",
"", 1)
150 results.append(
"none")
152 return [a
for a
in results
if a]
155 def __init__(self, config, addDefaults = {}, addMandatories=[], addneedpackages=[]):
158 "switchONfit":
"false",
164 defaults.update(addDefaults)
166 mandatories += addMandatories
167 needpackages = [
"MuonAnalysis/MomentumScaleCalibration"]
168 needpackages += addneedpackages
169 BasePlottingOptions.__init__(self, config,
"zmumu", defaults, mandatories, needpackages)
172 def __init__(self, config, addDefaults = {}, addMandatories=[], addneedpackages=[]):
174 "DMRMethod":
"median,rmsNorm",
177 "OfflineTreeBaseDir":
"TrackHitFilter",
178 "SurfaceShapes":
"coarse",
181 defaults.update(addDefaults)
183 mandatories += addMandatories
184 BasePlottingOptions.__init__(self, config,
"offline", defaults, mandatories, addneedpackages)
187 def __init__(self, config, addDefaults = {}, addMandatories=[], addneedpackages=[]):
189 "autoLimits":
"false",
191 "stdResiduals":
"true",
196 "m_dxyPhiNormMax":
"0.5",
197 "m_dzPhiNormMax":
"0.5",
198 "m_dxyEtaNormMax":
"0.5",
199 "m_dzEtaNormMax":
"0.5",
204 "w_dxyPhiNormMax":
"1.8",
205 "w_dzPhiNormMax":
"1.8",
206 "w_dxyEtaNormMax":
"1.8",
207 "w_dzEtaNormMax":
"1.8",
209 defaults.update(addDefaults)
211 mandatories += addMandatories
212 BasePlottingOptions.__init__(self, config,
"primaryvertex", defaults, mandatories, addneedpackages)
215 plottingOptionsClasses = {
216 "offline": PlottingOptionsOffline,
217 "split": PlottingOptionsTrackSplitting,
218 "zmumu": PlottingOptionsZMuMu,
219 "primaryvertex": PlottingOptionsPrimaryVertex
222 if valType
not in globalDictionaries.plottingOptions:
223 globalDictionaries.plottingOptions[valType] = plottingOptionsClasses[valType](config)
224 return globalDictionaries.plottingOptions[valType].getRepMap()
static std::string join(char **cmd)
def replaceByMap
— Helpers —############################