1 from __future__
import print_function
2 from array
import array
4 from copy
import deepcopy
5 import FWCore.ParameterSet.Config
as cms
6 import FWCore.PythonUtilities.LumiList
as LumiList
11 return thePSet.parameters_()
14 setattr(thePSet,name,val)
21 outVPSet.append(inPSet)
25 if hasattr(ps1,
"record")
and hasattr(ps2,
"record"):
33 resvpset=overrideVPSet.copy()
34 for iop
in inVPSet.value():
36 if matchrule
is not None:
37 for cps
in overrideVPSet.value():
38 if matchrule(cps,iop):
49 return theString[0].
upper()==
'T' 71 if self.rawopt.lower()!=
"noopts":
77 if self.
flag==
"mbvertex":
80 elif self.
flag==
"zmumu":
81 self.
trkcoll=
"ALCARECOTkAlZMuMu" 83 elif self.
flag==
"ymumu":
84 self.
trkcoll=
"ALCARECOTkAlUpsilonMuMu" 86 elif self.
flag==
"jpsimumu":
87 self.
trkcoll=
"ALCARECOTkAlJpsiMuMu" 89 elif self.
flag==
"cosmics":
90 self.
trkcoll=
"ALCARECOTkAlCosmicsCTF0T" 92 elif self.
flag==
"cdcs":
93 self.
trkcoll=
"ALCARECOTkAlCosmicsInCollisions" 96 raise RuntimeError(
"Flag {} is unimplemented.".
format(self.
flag))
102 optlist=self.rawopt.split(delimiter)
104 olist=sopt.split(optdelimiter)
106 theKey=olist[0].lower()
110 raise RuntimeError(
"Option {} has an invalid number of delimiters {}".
format(sopt,optdelimiter))
115 for key,val
in six.iteritems(self.
optdict):
118 autofind=val.find(
"auto")
120 val=val[0:autofind+4]+
":"+val[autofind+4:]
124 vallist=val.split(
';')
125 for varset
in vallist:
127 specs = varset.split(
'|')
129 namespec=spec.split(
'=')
132 frontierfind=tmpspec.find(
"frontier")
133 sqlitefind=tmpspec.find(
"sqlite_file")
134 if frontierfind>-1
and sqlitefind>-1:
135 raise RuntimeError(
"Inconsistent setting: Cannot specify frontier and sqlite_file at the same time!")
136 elif frontierfind>-1:
137 tmpspec=tmpspec[0:frontierfind+8]+
":"+tmpspec[frontierfind+8:]
139 tmpspec=tmpspec[0:sqlitefind+11]+
":"+tmpspec[sqlitefind+11:]
140 elif namespec[0]==
"connect":
141 if tmpspec.endswith(
".db"):
142 tmpspec =
str(
"sqlite_file:")+tmpspec
143 elif tmpspec.find(
"//")>-1:
144 tmpspec =
str(
"frontier:")+tmpspec
146 tmpspec =
str(
"frontier://")+tmpspec
147 cmsstrspec = cms.string(tmpspec)
150 raise RuntimeError(
"GT specification {} does not have size==2".
format(namespec))
151 gttogetpsets.append(apset)
153 elif key==
"hitfiltercommands":
154 vallist=val.split(
';')
155 for iv
in range(0,len(vallist)):
156 keepdrop_det_pair=vallist[iv].
split(
'=')
157 if len(keepdrop_det_pair)==2:
158 if (keepdrop_det_pair[0]==
"keep" or keepdrop_det_pair[0]==
"drop"):
159 strcmd = keepdrop_det_pair[0]
161 keepdrop_det_pair[1]=keepdrop_det_pair[1].
replace(
'/',
' ')
162 keepdrop_det_pair[1]=keepdrop_det_pair[1].
upper()
164 strcmd = strcmd +
" " + keepdrop_det_pair[1]
165 if not hasattr(self,
"hitfiltercommands"):
167 self.hitfiltercommands.append(strcmd)
169 raise RuntimeError(
"Keep/drop command {} is not keep or drop.".
format(keepdrop_det_pair[0]))
171 raise RuntimeError(
"Keep/drop-det. pair {} does not have size==2 or has a command other than keep or drop.".
format(vallist[iv]))
173 elif (key==
"type" or key==
"datatype" or key==
"datagroup"):
178 print(
"Data type is not an integer")
180 elif key==
"lumilist":
183 elif key==
"cpe" or key==
"cpetype":
187 elif key==
"trackcollection":
190 elif key==
"overallweight":
195 print(
"Overall weight is not a float")
197 elif key==
"uniformetaformula":
201 elif (key==
"primaryvertextype" or key==
"pvtype"):
203 if (val==
"nobs" or val==
"withbs"):
206 raise ValueError(
"PV type can only receive NoBS or WithBS.")
207 elif (key==
"primaryvertexconstraint" or key==
"pvconstraint"):
209 if not hasattr(self,
"PVtype"):
212 elif (key==
"twobodytrackselection" or key==
"twobodydecayselection" or key==
"tbdselection"):
214 if (val==
"zsel" or val==
"y1ssel"):
217 raise ValueError(
"TBD selection can only be Zsel or Y1Ssel at this time.")
220 elif (key==
"twobodytrackconstraint" or key==
"twobodydecayconstraint" or key==
"tbdconstraint"):
222 if (
"momconstr" in val
or "fullconstr" in val):
225 raise ValueError(
"TBD constraint can only be momconstr... or fullconstr...")
230 if (val==
"peak" or val==
"deco"):
233 raise ValueError(
"APV mode can only be peak or deco in cosmics")
237 if (val==
"0t" or val==
"zerotesla" or val==
"3.8t"):
240 raise ValueError(
"B field can only be 0T, ZEROTESLA or 3.8T")
241 elif key==
"usetracksplitting":
244 raise RuntimeError(
"Option {} is not implemented.".
format(key))
246 if len(gttogetpsets)>0:
248 for ps
in gttogetpsets:
254 if (hasattr(self,
"TBDconstraint")
and hasattr(self,
"applyPVConstraint")):
255 raise RuntimeError(
"Options TBDconstraint and applyPVConstraint cannot coexist.")
257 for oc
in optstocheck:
258 if not hasattr(self,oc):
259 raise RuntimeError(
"Option {} needs to specified in {}.".
format(oc, self.
flag))
264 checkcosmics=(self.
flag==
"cosmics" or self.
flag==
"cdcs")
265 checkymumuconstr=(self.
flag==
"ymumu" and hasattr(self,
"TBDconstraint"))
270 "useTrkSplittingInCosmics" def getTrackDefaults(self)
def insertPSetToPSet(inPSet, outPSet)
def matchPSetsByRecord(ps1, ps2)
def replace(string, replacements)
TBDconstraint
Get options common in min.
S & print(S &os, JobReport::InputFile const &f)
def mergeVPSets(inVPSet, overrideVPSet, matchrule=None)
def insertPSetToVPSet(inPSet, outVPSet)
def insertValToPSet(name, val, thePSet)
def doCheckOptions(self, optstocheck)
def interpretOptions(self)
def parseBoolString(theString)
def __init__(self, strflag, stropt)
APVmode
Options for cosmics Get APV mode.