1 from array
import array
3 from copy
import deepcopy
4 import FWCore.ParameterSet.Config
as cms
5 import FWCore.PythonUtilities.LumiList
as LumiList
10 return thePSet.parameters_()
13 setattr(thePSet,name,val)
20 outVPSet.append(inPSet)
24 if hasattr(ps1,
"record")
and hasattr(ps2,
"record"):
32 resvpset=overrideVPSet.copy()
33 for iop
in inVPSet.value():
35 if matchrule
is not None:
36 for cps
in overrideVPSet.value():
37 if matchrule(cps,iop):
48 return theString[0].
upper()==
'T' 70 if self.rawopt.lower()!=
"noopts":
76 if self.
flag==
"mbvertex":
79 elif self.
flag==
"zmumu":
80 self.
trkcoll=
"ALCARECOTkAlZMuMu" 82 elif self.
flag==
"ymumu":
83 self.
trkcoll=
"ALCARECOTkAlUpsilonMuMu" 85 elif self.
flag==
"jpsimumu":
86 self.
trkcoll=
"ALCARECOTkAlJpsiMuMu" 88 elif self.
flag==
"cosmics":
89 self.
trkcoll=
"ALCARECOTkAlCosmicsCTF0T" 91 elif self.
flag==
"cdcs":
92 self.
trkcoll=
"ALCARECOTkAlCosmicsInCollisions" 95 raise RuntimeError(
"Flag {} is unimplemented.".
format(self.
flag))
101 optlist=self.rawopt.split(delimiter)
103 olist=sopt.split(optdelimiter)
105 theKey=olist[0].lower()
109 raise RuntimeError(
"Option {} has an invalid number of delimiters {}".
format(sopt,optdelimiter))
114 for key,val
in six.iteritems(self.
optdict):
117 autofind=val.find(
"auto")
119 val=val[0:autofind+4]+
":"+val[autofind+4:]
123 vallist=val.split(
';')
124 for varset
in vallist:
126 specs = varset.split(
'|')
128 namespec=spec.split(
'=')
131 frontierfind=tmpspec.find(
"frontier")
132 sqlitefind=tmpspec.find(
"sqlite_file")
133 if frontierfind>-1
and sqlitefind>-1:
134 raise RuntimeError(
"Inconsistent setting: Cannot specify frontier and sqlite_file at the same time!")
135 elif frontierfind>-1:
136 tmpspec=tmpspec[0:frontierfind+8]+
":"+tmpspec[frontierfind+8:]
138 tmpspec=tmpspec[0:sqlitefind+11]+
":"+tmpspec[sqlitefind+11:]
139 elif namespec[0]==
"connect":
140 if tmpspec.endswith(
".db"):
141 tmpspec =
str(
"sqlite_file:")+tmpspec
142 elif tmpspec.find(
"//")>-1:
143 tmpspec =
str(
"frontier:")+tmpspec
145 tmpspec =
str(
"frontier://")+tmpspec
146 cmsstrspec = cms.string(tmpspec)
149 raise RuntimeError(
"GT specification {} does not have size==2".
format(namespec))
150 gttogetpsets.append(apset)
152 elif key==
"hitfiltercommands":
153 vallist=val.split(
';')
154 for iv
in range(0,len(vallist)):
155 keepdrop_det_pair=vallist[iv].
split(
'=')
156 if len(keepdrop_det_pair)==2:
157 if (keepdrop_det_pair[0]==
"keep" or keepdrop_det_pair[0]==
"drop"):
158 strcmd = keepdrop_det_pair[0]
160 keepdrop_det_pair[1]=keepdrop_det_pair[1].
replace(
'/',
' ')
161 keepdrop_det_pair[1]=keepdrop_det_pair[1].
upper()
163 strcmd = strcmd +
" " + keepdrop_det_pair[1]
164 if not hasattr(self,
"hitfiltercommands"):
166 self.hitfiltercommands.append(strcmd)
168 raise RuntimeError(
"Keep/drop command {} is not keep or drop.".
format(keepdrop_det_pair[0]))
170 raise RuntimeError(
"Keep/drop-det. pair {} does not have size==2 or has a command other than keep or drop.".
format(vallist[iv]))
172 elif (key==
"type" or key==
"datatype" or key==
"datagroup"):
177 print "Data type is not an integer" 179 elif key==
"lumilist":
182 elif key==
"cpe" or key==
"cpetype":
186 elif key==
"trackcollection":
189 elif key==
"overallweight":
194 print "Overall weight is not a float" 196 elif key==
"uniformetaformula":
200 elif (key==
"primaryvertextpye" or key==
"pvtype"):
202 if (val==
"nobs" or val==
"withbs"):
205 raise ValueError(
"PV type can only receive NoBS or WithBS.")
206 elif (key==
"primaryvertexconstraint" or key==
"pvconstraint"):
208 if not hasattr(self,
"PVtype"):
211 elif (key==
"twobodytrackselection" or key==
"twobodydecayselection" or key==
"tbdselection"):
213 if (val==
"zsel" or val==
"y1ssel"):
216 raise ValueError(
"TBD selection can only be Zsel or Y1Ssel at this time.")
219 elif (key==
"twobodytrackconstraint" or key==
"twobodydecayconstraint" or key==
"tbdconstraint"):
221 if (
"momconstr" in val
or "fullconstr" in val):
224 raise ValueError(
"TBD constraint can only be momconstr... or fullconstr...")
229 if (val==
"peak" or val==
"deco"):
232 raise ValueError(
"APV mode can only be peak or deco in cosmics")
236 if (val==
"0t" or val==
"zerotesla" or val==
"3.8t"):
239 raise ValueError(
"B field can only be 0T, ZEROTESLA or 3.8T")
240 elif key==
"usetracksplitting":
243 raise RuntimeError(
"Option {} is not implemented.".
format(key))
245 if len(gttogetpsets)>0:
247 for ps
in gttogetpsets:
253 if (hasattr(self,
"TBDconstraint")
and hasattr(self,
"applyPVConstraint")):
254 raise RuntimeError(
"Options TBDconstraint and applyPVConstraint cannot coexist.")
256 for oc
in optstocheck:
257 if not hasattr(self,oc):
258 raise RuntimeError(
"Option {} needs to specified in {}.".
format(oc, self.
flag))
263 checkcosmics=(self.
flag==
"cosmics" or self.
flag==
"cdcs")
264 checkymumuconstr=(self.
flag==
"ymumu" and hasattr(self,
"TBDconstraint"))
269 "useTrkSplittingInCosmics" def getTrackDefaults(self)
def insertPSetToPSet(inPSet, outPSet)
def matchPSetsByRecord(ps1, ps2)
def replace(string, replacements)
TBDconstraint
Get options common in min.
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.