2 import FWCore.ParameterSet.Config
as cms
8 TTRHBuilder =
"WithAngleAndTemplate",
9 usePixelQualityFlag =
None,
10 openMassWindow =
False,
11 cosmicsDecoMode =
False,
12 cosmicsZeroTesla =
True,
13 momentumConstraint =
None):
14 """This function returns a cms.Sequence containing as last element the 15 module 'FinalTrackRefitter', which can be used as cms.InputTag for 16 subsequent processing steps. 17 The modules in the sequence are already attached to the given `process` 18 object using the given track collection `collection` and the given 22 - `process`: 'cms.Process' object to which the modules of the sequence will 24 - `collection`: String indicating the input track collection. 25 - `saveCPU`: If set to 'True', some steps are merged to reduce CPU time. 26 Reduces a little the accuracy of the results. 27 This option is currently not recommended. 28 - `TTRHBuilder`: Option used for the Track(Re)Fitter modules. 29 - `usePixelQualityFlag`: Option used for the TrackHitFilter module. 30 Defaults to 'True' but is automatically set to 31 'False' if a `TTRHBuilder` without templates is 33 If this is still wanted for some reason, one can 34 explicitely specify it as 'True'. 35 - `openMassWindow`: Used to configure the TwoBodyDecaySelector for ZMuMu. 36 - `cosmicsDecoMode`: If set to 'True' a lower Signal/Noise cut is used. 37 - `cosmicsZeroTesla`: If set to 'True' a 0T-specific selection is used. 38 - `momentumConstraint`: If you want to apply a momentum constraint for the 39 track refitting, e.g. for CRUZET data, you need 40 to provide here the name of the constraint module. 47 if usePixelQualityFlag
is None:
48 if "Template" not in TTRHBuilder:
49 usePixelQualityFlag =
False 50 print "Using 'TTRHBuilder' without templates:", TTRHBuilder
51 print " --> Turning off pixel quality flag in hit filter." 53 usePixelQualityFlag =
True 60 options = {
"TrackHitFilter": {},
65 options[
"TrackSelector"][
"HighPurity"] = {
66 "trackQualities": [
"highPurity"],
72 options[
"TrackSelector"][
"Alignment"] = {
83 options[
"TrackRefitter"][
"First"] = {
84 "NavigationSchool":
"",
85 "TTRHBuilder": TTRHBuilder
87 options[
"TrackRefitter"][
"Second"] = {
88 "NavigationSchool":
"",
89 "TTRHBuilder": TTRHBuilder
91 options[
"TrackHitFilter"][
"Tracker"] = {
92 "useTrajectories":
True,
94 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
95 "keep TOB",
"keep TEC"),
96 "replaceWithInactiveHits":
True,
97 "rejectBadStoNHits":
True,
98 "rejectLowAngleHits":
True,
99 "usePixelQualityFlag": usePixelQualityFlag,
100 "StoNcommands": cms.vstring(
"ALL 12.0"),
101 "TrackAngleCut": 0.087
103 options[
"TrackFitter"][
"HitFilteredTracks"] = {
104 "NavigationSchool":
"",
105 "TTRHBuilder": TTRHBuilder
114 if collection
in (
"ALCARECOTkAlMinBias",
"generalTracks",
115 "ALCARECOTkAlMinBiasHI",
"hiGeneralTracks"):
116 options[
"TrackSelector"][
"Alignment"].
update({
120 options[
"TrackHitFilter"][
"Tracker"].
update({
123 elif collection
in (
"ALCARECOTkAlCosmicsCTF0T",
124 "ALCARECOTkAlCosmicsInCollisions"):
126 options[
"TrackSelector"][
"HighPurity"] = {}
127 if not cosmicsDecoMode:
128 options[
"TrackHitFilter"][
"Tracker"].
update({
129 "StoNcommands": cms.vstring(
"ALL 18.0")
132 options[
"TrackHitFilter"][
"Tracker"].
update({
136 options[
"TrackHitFilter"][
"Tracker"].
update({
139 options[
"TrackSelector"][
"Alignment"].
update({
143 "applyMultiplicityFilter":
True,
146 elif collection
in (
"ALCARECOTkAlMuonIsolated",
147 "ALCARECOTkAlMuonIsolatedHI",
148 "ALCARECOTkAlMuonIsolatedPA"):
149 options[
"TrackSelector"][
"Alignment"].
update({
150 (
"minHitsPerSubDet",
"inPIXEL"): 1,
153 "applyMultiplicityFilter":
True,
154 "maxMultiplicity": 1,
156 elif collection
in (
"ALCARECOTkAlZMuMu",
157 "ALCARECOTkAlZMuMuHI",
158 "ALCARECOTkAlZMuMuPA"):
159 options[
"TrackSelector"][
"Alignment"].
update({
164 "applyMultiplicityFilter":
True,
165 "minMultiplicity": 2,
166 "maxMultiplicity": 2,
167 (
"minHitsPerSubDet",
"inPIXEL"): 1,
168 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
169 (
"TwoBodyDecaySelector",
"charge"): 0,
170 (
"TwoBodyDecaySelector",
171 "applyMassrangeFilter"):
not openMassWindow,
172 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
173 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
174 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
176 options[
"TrackHitFilter"][
"Tracker"].
update({
179 elif collection ==
"ALCARECOTkAlUpsilonMuMu":
180 options[
"TrackSelector"][
"Alignment"].
update({
185 "applyMultiplicityFilter":
True,
186 "minMultiplicity": 2,
187 "maxMultiplicity": 2,
188 (
"minHitsPerSubDet",
"inPIXEL"): 1,
189 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
190 (
"TwoBodyDecaySelector",
"charge"): 0,
191 (
"TwoBodyDecaySelector",
192 "applyMassrangeFilter"):
not openMassWindow,
193 (
"TwoBodyDecaySelector",
"minXMass"): 9.2,
194 (
"TwoBodyDecaySelector",
"maxXMass"): 9.7,
195 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
197 options[
"TrackHitFilter"][
"Tracker"].
update({
201 print "Unknown input track collection:", collection
211 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
212 (
"TrackRefitter",
"First", {
"method":
"load",
214 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
215 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
216 options[
"TrackSelector"][
"Alignment"].
update(
217 options[
"TrackSelector"][
"HighPurity"])
219 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
220 (
"TrackRefitter",
"First", {
"method":
"load",
222 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
223 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
224 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
225 (
"TrackRefitter",
"Second", {
"method":
"load",
227 if isCosmics: mods = mods[1:]
235 if momentumConstraint
is not None:
236 for mod
in options[
"TrackRefitter"]:
237 options[
"TrackRefitter"][mod].
update({
238 "constraint":
"momentum",
239 "srcConstr": momentumConstraint
247 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
257 for mod
in mods[:-1]:
258 src =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
259 options[mod[0]][mod[1]], isCosmics = isCosmics,
261 modules.append(getattr(process, src))
263 if mods[-1][-1][
"method"]
is "load" and \
264 not mods[-1][-1].
get(
"clone",
False):
265 print "Name of the last module needs to be modifiable." 267 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
268 options[mods[-1][0]][mods[-1][1]],
269 isCosmics = isCosmics, **(mods[-1][2]))
270 modules.append(getattr(process, src))
272 moduleSum = process.offlineBeamSpot
273 for module
in modules: moduleSum += module
275 return cms.Sequence(moduleSum)
290 def _getModule(process, src, modType, moduleName, options, **kwargs):
291 """General function for attaching the module of type `modType` to the 292 cms.Process `process` using `options` for customization and `moduleName` as 293 the name of the new attribute of `process`. 296 - `process`: 'cms.Process' object to which the module is attached. 297 - `src`: cms.InputTag for this module. 298 - `modType`: Type of the requested module. 299 - `options`: Dictionary with customized values for the module's options. 300 - `**kwargs`: Used to supply options at construction time of the module. 303 objTuple = globals()[
"_"+modType](kwargs)
304 method = kwargs.get(
"method")
305 if method
is "import":
306 __import__(objTuple[0])
307 obj = getattr(sys.modules[objTuple[0]], objTuple[1]).
clone(src=src)
308 elif method
is "load":
309 process.load(objTuple[0])
310 if kwargs.get(
"clone",
False):
311 obj = getattr(process, objTuple[1]).
clone(src=src)
313 obj = getattr(process, objTuple[1])
315 moduleName = objTuple[1]
317 print "Unknown method:", method
320 for option
in options:
323 if moduleName
is not objTuple[1]:
324 setattr(process, moduleName, obj)
329 """Returns TrackHitFilter module name. 332 - `kwargs`: Not used in this function. 335 return (
"RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff",
336 "TrackerTrackHitFilter")
340 """Returns TrackSelector module name. 343 - `kwargs`: Not used in this function. 346 return (
"Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi",
347 "AlignmentTrackSelector")
351 """Returns TrackFitter module name. 354 - `kwargs`: Used to supply options at construction time of the object. 357 isCosmics = kwargs.get(
"isCosmics",
False)
359 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff",
360 "ctfWithMaterialTracksCosmics")
362 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff",
363 "ctfWithMaterialTracks")
367 """Returns TrackRefitter module name. 370 - `kwargs`: Used to supply options at construction time of the object. 373 isCosmics = kwargs.get(
"isCosmics",
False)
375 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
378 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
383 """Sets the attribute `attr` of the object `obj` using the value `val`. 384 `attr` can be a string or a tuple of strings, if one wants to set an 385 attribute of an attribute, etc. 388 - `obj`: Object, which must have a '__dict__' attribute. 389 - `attr`: String or tuple of strings describing the attribute's name. 390 - `val`: value of the attribute. 393 if type(attr)
is tuple
and len(attr) > 1:
396 if type(attr)
is tuple: attr = attr[0]
397 setattr(obj, attr, val)
def _customSetattr(obj, attr, val)
def _TrackSelector(kwargs)
def _getModule(process, src, modType, moduleName, options, kwargs)
Auxiliary functions ###
def getSequence(process, collection, saveCPU=False, TTRHBuilder="WithAngleAndTemplate", usePixelQualityFlag=None, openMassWindow=False, cosmicsDecoMode=False, cosmicsZeroTesla=True, momentumConstraint=None)
def _TrackRefitter(kwargs)
def _TrackHitFilter(kwargs)
static std::string join(char **cmd)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
T get(const Candidate &c)