2 import FWCore.ParameterSet.Config
as cms
8 TTRHBuilder =
"WithAngleAndTemplate",
9 usePixelQualityFlag =
True,
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 - `openMassWindow`: Used to configure the TwoBodyDecaySelector for ZMuMu.
31 - `cosmicsDecoMode`: If set to 'True' a lower Signal/Noise cut is used.
32 - `cosmicsZeroTesla`: If set to 'True' a 0T-specific selection is used.
33 - `momentumConstraint`: If you want to apply a momentum constraint for the
34 track refitting, e.g. for CRUZET data, you need
35 to provide here the name of the constraint module.
43 options = {
"TrackHitFilter": {},
48 options[
"TrackSelector"][
"HighPurity"] = {
49 "trackQualities": [
"highPurity"],
55 options[
"TrackSelector"][
"Alignment"] = {
66 options[
"TrackRefitter"][
"First"] = {
67 "NavigationSchool":
"",
69 options[
"TrackRefitter"][
"Second"] = {
70 "NavigationSchool":
"",
71 "TTRHBuilder": TTRHBuilder
73 options[
"TrackHitFilter"][
"Tracker"] = {
74 "useTrajectories":
True,
76 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
77 "keep TOB",
"keep TEC"),
78 "replaceWithInactiveHits":
True,
79 "rejectBadStoNHits":
True,
80 "rejectLowAngleHits":
True,
81 "usePixelQualityFlag": usePixelQualityFlag,
82 "StoNcommands": cms.vstring(
"ALL 12.0"),
83 "TrackAngleCut": 0.087
85 options[
"TrackFitter"][
"HitFilteredTracks"] = {
86 "NavigationSchool":
"",
87 "TTRHBuilder": TTRHBuilder
96 if collection ==
"ALCARECOTkAlMinBias" or collection ==
"generalTracks" or collection ==
"ALCARECOTkAlMinBiasHI" or collection ==
"hiGeneralTracks":
97 options[
"TrackSelector"][
"Alignment"].
update({
101 options[
"TrackHitFilter"][
"Tracker"].
update({
104 elif collection
in (
"ALCARECOTkAlCosmicsCTF0T",
105 "ALCARECOTkAlCosmicsInCollisions"):
107 options[
"TrackSelector"][
"HighPurity"] = {}
108 if not cosmicsDecoMode:
109 options[
"TrackHitFilter"][
"Tracker"].
update({
110 "StoNcommands": cms.vstring(
"ALL 18.0")
113 options[
"TrackHitFilter"][
"Tracker"].
update({
117 options[
"TrackHitFilter"][
"Tracker"].
update({
120 options[
"TrackSelector"][
"Alignment"].
update({
124 "applyMultiplicityFilter":
True,
127 elif collection ==
"ALCARECOTkAlMuonIsolated" or collection ==
"ALCARECOTkAlMuonIsolatedHI" or collection ==
"ALCARECOTkAlMuonIsolatedPA":
128 options[
"TrackSelector"][
"Alignment"].
update({
129 (
"minHitsPerSubDet",
"inPIXEL"): 1,
132 "applyMultiplicityFilter":
True,
133 "maxMultiplicity": 1,
135 elif collection ==
"ALCARECOTkAlZMuMu" or collection ==
"ALCARECOTkAlZMuMuHI" or collection ==
"ALCARECOTkAlZMuMuPA":
136 options[
"TrackSelector"][
"Alignment"].
update({
141 "applyMultiplicityFilter":
True,
142 "minMultiplicity": 2,
143 "maxMultiplicity": 2,
144 (
"minHitsPerSubDet",
"inPIXEL"): 1,
145 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
146 (
"TwoBodyDecaySelector",
"charge"): 0,
147 (
"TwoBodyDecaySelector",
148 "applyMassrangeFilter"):
not openMassWindow,
149 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
150 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
151 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
153 options[
"TrackHitFilter"][
"Tracker"].
update({
158 print "Unknown input track collection:", collection
168 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
169 (
"TrackRefitter",
"First", {
"method":
"load",
171 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
172 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
173 options[
"TrackSelector"][
"Alignment"].
update(
174 options[
"TrackSelector"][
"HighPurity"])
176 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
177 (
"TrackRefitter",
"First", {
"method":
"load",
179 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
180 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
181 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
182 (
"TrackRefitter",
"Second", {
"method":
"load",
184 if isCosmics: mods = mods[1:]
192 if momentumConstraint
is not None:
193 for mod
in options[
"TrackRefitter"]:
194 options[
"TrackRefitter"][mod].
update({
195 "constraint":
"momentum",
196 "srcConstr": momentumConstraint
207 for mod
in mods[:-1]:
208 src =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
209 options[mod[0]][mod[1]], isCosmics = isCosmics,
211 modules.append(getattr(process, src))
213 if mods[-1][-1][
"method"]
is "load" and \
214 not mods[-1][-1].
get(
"clone",
False):
215 print "Name of the last module needs to be modifiable."
217 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
218 options[mods[-1][0]][mods[-1][1]],
219 isCosmics = isCosmics, **(mods[-1][2]))
220 modules.append(getattr(process, src))
222 moduleSum = modules[0]
223 for mod
in modules[1:]:
225 return cms.Sequence(moduleSum)
240 def _getModule(process, src, modType, moduleName, options, **kwargs):
241 """General function for attaching the module of type `modType` to the
242 cms.Process `process` using `options` for customization and `moduleName` as
243 the name of the new attribute of `process`.
246 - `process`: 'cms.Process' object to which the module is attached.
247 - `src`: cms.InputTag for this module.
248 - `modType`: Type of the requested module.
249 - `options`: Dictionary with customized values for the module's options.
250 - `**kwargs`: Used to supply options at construction time of the module.
253 objTuple = globals()[
"_"+modType](kwargs)
254 method = kwargs.get(
"method")
255 if method
is "import":
256 __import__(objTuple[0])
257 obj = getattr(sys.modules[objTuple[0]], objTuple[1]).
clone(src=src)
258 elif method
is "load":
259 process.load(objTuple[0])
260 if kwargs.get(
"clone",
False):
261 obj = getattr(process, objTuple[1]).
clone(src=src)
263 obj = getattr(process, objTuple[1])
265 moduleName = objTuple[1]
267 print "Unknown method:", method
270 for option
in options:
273 if moduleName
is not objTuple[1]:
274 setattr(process, moduleName, obj)
279 """Returns TrackHitFilter module name.
282 - `kwargs`: Not used in this function.
285 return (
"RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff",
286 "TrackerTrackHitFilter")
290 """Returns TrackSelector module name.
293 - `kwargs`: Not used in this function.
296 return (
"Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi",
297 "AlignmentTrackSelector")
301 """Returns TrackFitter module name.
304 - `kwargs`: Used to supply options at construction time of the object.
307 isCosmics = kwargs.get(
"isCosmics",
False)
309 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff",
310 "ctfWithMaterialTracksCosmics")
312 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff",
313 "ctfWithMaterialTracks")
317 """Returns TrackRefitter module name.
320 - `kwargs`: Used to supply options at construction time of the object.
323 isCosmics = kwargs.get(
"isCosmics",
False)
325 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
328 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
333 """Sets the attribute `attr` of the object `obj` using the value `val`.
334 `attr` can be a string or a tuple of strings, if one wants to set an
335 attribute of an attribute, etc.
338 - `obj`: Object, which must have a '__dict__' attribute.
339 - `attr`: String or tuple of strings describing the attribute's name.
340 - `val`: value of the attribute.
343 if type(attr)
is tuple
and len(attr) > 1:
346 if type(attr)
is tuple: attr = attr[0]
347 setattr(obj, attr, val)
static std::string join(char **cmd)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
def _getModule
### Auxiliary functions ###
T get(const Candidate &c)