8 TTRHBuilder =
"WithAngleAndTemplate",
9 usePixelQualityFlag =
True,
10 openMassWindow =
False,
11 cosmicsDecoMode =
False,
12 momentumConstraint =
None):
13 """This function returns a cms.Sequence containing as last element the
14 module 'FinalTrackRefitter', which can be used as cms.InputTag for
15 subsequent processing steps.
16 The modules in the sequence are already attached to the given `process`
17 object using the given track collection `collection` and the given
21 - `process`: 'cms.Process' object to which the modules of the sequence will
23 - `collection`: String indicating the input track collection.
24 - `saveCPU`: If set to 'True', some steps are merged to reduce CPU time.
25 Reduces a little the accuracy of the results.
26 This option is currently not recommended.
27 - `TTRHBuilder`: Option used for the Track(Re)Fitter modules.
28 - `usePixelQualityFlag`: Option used for the TrackHitFilter module.
29 - `openMassWindow`: Used to configure the TwoBodyDecaySelector for ZMuMu.
30 - `cosmicsDecoMode`: If set to 'True' a lower Signal/Noise cut is used.
31 - `momentumConstraint`: If you want to apply a momentum constraint for the
32 track refitting, e.g. for CRUZET data, you need
33 to provide here the name of the constraint module.
41 options = {
"TrackHitFilter": {},
46 options[
"TrackSelector"][
"HighPurity"] = {
47 "trackQualities": [
"highPurity"],
52 options[
"TrackSelector"][
"Alignment"] = {
63 options[
"TrackRefitter"][
"First"] = {
64 "NavigationSchool":
"",
66 options[
"TrackRefitter"][
"Second"] = {
67 "NavigationSchool":
"",
68 "TTRHBuilder": TTRHBuilder
70 options[
"TrackHitFilter"][
"Tracker"] = {
71 "useTrajectories":
True,
73 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
74 "keep TOB",
"keep TEC"),
75 "replaceWithInactiveHits":
True,
76 "rejectBadStoNHits":
True,
77 "rejectLowAngleHits":
True,
78 "usePixelQualityFlag": usePixelQualityFlag,
79 "StoNcommands": cms.vstring(
"ALL 12.0"),
80 "TrackAngleCut": 0.087
82 options[
"TrackFitter"][
"HitFilteredTracks"] = {
83 "TTRHBuilder": TTRHBuilder
92 if collection
is "ALCARECOTkAlMinBias":
93 options[
"TrackSelector"][
"Alignment"].
update({
96 elif collection
is "ALCARECOTkAlCosmicsCTF0T":
98 options[
"TrackSelector"][
"HighPurity"] = {}
99 if not cosmicsDecoMode:
100 options[
"TrackHitFilter"][
"Tracker"].
update({
101 "StoNcommands": cms.vstring(
"ALL 18.0")
103 options[
"TrackSelector"][
"Alignment"].
update({
108 elif collection
is "ALCARECOTkAlMuonIsolated":
109 options[
"TrackSelector"][
"Alignment"].
update({
110 (
"minHitsPerSubDet",
"inPIXEL"): 1,
112 elif collection
is "ALCARECOTkAlZMuMu":
113 options[
"TrackSelector"][
"Alignment"].
update({
118 "applyMultiplicityFilter":
True,
119 "minMultiplicity": 2,
120 "maxMultiplicity": 2,
121 (
"minHitsPerSubDet",
"inPIXEL"): 1,
122 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
123 (
"TwoBodyDecaySelector",
124 "applyMassrangeFilter"):
not openMassWindow,
125 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
126 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8
130 print "Unknown input track collection:", collection
140 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
141 (
"TrackRefitter",
"First", {
"method":
"load",
143 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
144 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
145 options[
"TrackSelector"][
"Alignment"].
update(
146 options[
"TrackSelector"][
"HighPurity"])
148 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
149 (
"TrackRefitter",
"First", {
"method":
"load",
151 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
152 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
153 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
154 (
"TrackRefitter",
"Second", {
"method":
"load",
156 if isCosmics: mods = mods[1:]
164 if momentumConstraint
is not None:
165 for mod
in options[
"TrackRefitter"]:
166 options[
"TrackRefitter"][mod].
update({
167 "constraint":
"momentum",
168 "srcConstr": momentumConstraint
179 for mod
in mods[:-1]:
180 src =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
181 options[mod[0]][mod[1]], isCosmics = isCosmics,
183 modules.append(getattr(process, src))
185 if mods[-1][-1][
"method"]
is "load" and \
186 not mods[-1][-1].
get(
"clone",
False):
187 print "Name of the last module needs to be modifiable."
189 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
190 options[mods[-1][0]][mods[-1][1]],
191 isCosmics = isCosmics, **(mods[-1][2]))
192 modules.append(getattr(process, src))
194 moduleSum = modules[0]
195 for mod
in modules[1:]:
197 return cms.Sequence(moduleSum)
212 def _getModule(process, src, modType, moduleName, options, **kwargs):
213 """General function for attaching the module of type `modType` to the
214 cms.Process `process` using `options` for customization and `moduleName` as
215 the name of the new attribute of `process`.
218 - `process`: 'cms.Process' object to which the module is attached.
219 - `src`: cms.InputTag for this module.
220 - `modType`: Type of the requested module.
221 - `options`: Dictionary with customized values for the module's options.
222 - `**kwargs`: Used to supply options at construction time of the module.
225 objTuple = globals()[
"_"+modType](kwargs)
226 method = kwargs.get(
"method")
227 if method
is "import":
228 __import__(objTuple[0])
229 obj = getattr(sys.modules[objTuple[0]], objTuple[1]).
clone(src=src)
230 elif method
is "load":
231 process.load(objTuple[0])
232 if kwargs.get(
"clone",
False):
233 obj = getattr(process, objTuple[1]).
clone(src=src)
235 obj = getattr(process, objTuple[1])
237 moduleName = objTuple[1]
239 print "Unknown method:", method
242 for option
in options:
245 if moduleName
is not objTuple[1]:
246 setattr(process, moduleName, obj)
251 """Returns TrackHitFilter module name.
254 - `kwargs`: Not used in this function.
257 return (
"RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff",
258 "TrackerTrackHitFilter")
262 """Returns TrackSelector module name.
265 - `kwargs`: Not used in this function.
268 return (
"Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi",
269 "AlignmentTrackSelector")
273 """Returns TrackFitter module name.
276 - `kwargs`: Used to supply options at construction time of the object.
279 isCosmics = kwargs.get(
"isCosmics",
False)
281 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff",
282 "ctfWithMaterialTracksCosmics")
284 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff",
285 "ctfWithMaterialTracks")
289 """Returns TrackRefitter module name.
292 - `kwargs`: Used to supply options at construction time of the object.
295 isCosmics = kwargs.get(
"isCosmics",
False)
297 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
300 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
305 """Sets the attribute `attr` of the object `obj` using the value `val`.
306 `attr` can be a string or a tuple of strings, if one wants to set an
307 attribute of an attribute, etc.
310 - `obj`: Object, which must have a '__dict__' attribute.
311 - `attr`: String or tuple of strings describing the attribute's name.
312 - `val`: value of the attribute.
315 if type(attr)
is tuple
and len(attr) > 1:
318 if type(attr)
is tuple: attr = attr[0]
319 setattr(obj, attr, val)
static std::string join(char **cmd)
def _getModule
### Auxiliary functions ###
T get(const Candidate &c)