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"],
54 options[
"TrackSelector"][
"Alignment"] = {
65 options[
"TrackRefitter"][
"First"] = {
66 "NavigationSchool":
"",
68 options[
"TrackRefitter"][
"Second"] = {
69 "NavigationSchool":
"",
70 "TTRHBuilder": TTRHBuilder
72 options[
"TrackHitFilter"][
"Tracker"] = {
73 "useTrajectories":
True,
75 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
76 "keep TOB",
"keep TEC"),
77 "replaceWithInactiveHits":
True,
78 "rejectBadStoNHits":
True,
79 "rejectLowAngleHits":
True,
80 "usePixelQualityFlag": usePixelQualityFlag,
81 "StoNcommands": cms.vstring(
"ALL 12.0"),
84 options[
"TrackFitter"][
"HitFilteredTracks"] = {
85 "NavigationSchool":
"",
86 "TTRHBuilder": TTRHBuilder
95 if collection
is "ALCARECOTkAlMinBias":
96 options[
"TrackSelector"][
"Alignment"].
update({
99 elif collection
is "ALCARECOTkAlCosmicsCTF0T":
101 options[
"TrackSelector"][
"HighPurity"] = {}
102 if not cosmicsDecoMode:
103 options[
"TrackHitFilter"][
"Tracker"].
update({
104 "StoNcommands": cms.vstring(
"ALL 18.0")
107 options[
"TrackHitFilter"][
"Tracker"].
update({
108 "TrackAngleCut": 0.087
111 options[
"TrackHitFilter"][
"Tracker"].
update({
112 "TrackAngleCut": 0.087
114 options[
"TrackSelector"][
"Alignment"].
update({
119 elif collection
is "ALCARECOTkAlMuonIsolated":
120 options[
"TrackSelector"][
"Alignment"].
update({
121 (
"minHitsPerSubDet",
"inPIXEL"): 1,
123 elif collection
is "ALCARECOTkAlZMuMu":
124 options[
"TrackSelector"][
"Alignment"].
update({
129 "applyMultiplicityFilter":
True,
130 "minMultiplicity": 2,
131 "maxMultiplicity": 2,
132 (
"minHitsPerSubDet",
"inPIXEL"): 1,
133 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
134 (
"TwoBodyDecaySelector",
135 "applyMassrangeFilter"):
not openMassWindow,
136 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
137 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8
141 print "Unknown input track collection:", collection
151 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
152 (
"TrackRefitter",
"First", {
"method":
"load",
154 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
155 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
156 options[
"TrackSelector"][
"Alignment"].
update(
157 options[
"TrackSelector"][
"HighPurity"])
159 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
160 (
"TrackRefitter",
"First", {
"method":
"load",
162 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
163 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
164 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
165 (
"TrackRefitter",
"Second", {
"method":
"load",
167 if isCosmics: mods = mods[1:]
175 if momentumConstraint
is not None:
176 for mod
in options[
"TrackRefitter"]:
177 options[
"TrackRefitter"][mod].
update({
178 "constraint":
"momentum",
179 "srcConstr": momentumConstraint
190 for mod
in mods[:-1]:
191 src =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
192 options[mod[0]][mod[1]], isCosmics = isCosmics,
194 modules.append(getattr(process, src))
196 if mods[-1][-1][
"method"]
is "load" and \
197 not mods[-1][-1].
get(
"clone",
False):
198 print "Name of the last module needs to be modifiable."
200 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
201 options[mods[-1][0]][mods[-1][1]],
202 isCosmics = isCosmics, **(mods[-1][2]))
203 modules.append(getattr(process, src))
205 moduleSum = modules[0]
206 for mod
in modules[1:]:
208 return cms.Sequence(moduleSum)
223 def _getModule(process, src, modType, moduleName, options, **kwargs):
224 """General function for attaching the module of type `modType` to the
225 cms.Process `process` using `options` for customization and `moduleName` as
226 the name of the new attribute of `process`.
229 - `process`: 'cms.Process' object to which the module is attached.
230 - `src`: cms.InputTag for this module.
231 - `modType`: Type of the requested module.
232 - `options`: Dictionary with customized values for the module's options.
233 - `**kwargs`: Used to supply options at construction time of the module.
236 objTuple = globals()[
"_"+modType](kwargs)
237 method = kwargs.get(
"method")
238 if method
is "import":
239 __import__(objTuple[0])
240 obj = getattr(sys.modules[objTuple[0]], objTuple[1]).
clone(src=src)
241 elif method
is "load":
242 process.load(objTuple[0])
243 if kwargs.get(
"clone",
False):
244 obj = getattr(process, objTuple[1]).
clone(src=src)
246 obj = getattr(process, objTuple[1])
248 moduleName = objTuple[1]
250 print "Unknown method:", method
253 for option
in options:
256 if moduleName
is not objTuple[1]:
257 setattr(process, moduleName, obj)
262 """Returns TrackHitFilter module name.
265 - `kwargs`: Not used in this function.
268 return (
"RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff",
269 "TrackerTrackHitFilter")
273 """Returns TrackSelector module name.
276 - `kwargs`: Not used in this function.
279 return (
"Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi",
280 "AlignmentTrackSelector")
284 """Returns TrackFitter module name.
287 - `kwargs`: Used to supply options at construction time of the object.
290 isCosmics = kwargs.get(
"isCosmics",
False)
292 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff",
293 "ctfWithMaterialTracksCosmics")
295 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff",
296 "ctfWithMaterialTracks")
300 """Returns TrackRefitter module name.
303 - `kwargs`: Used to supply options at construction time of the object.
306 isCosmics = kwargs.get(
"isCosmics",
False)
308 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
311 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
316 """Sets the attribute `attr` of the object `obj` using the value `val`.
317 `attr` can be a string or a tuple of strings, if one wants to set an
318 attribute of an attribute, etc.
321 - `obj`: Object, which must have a '__dict__' attribute.
322 - `attr`: String or tuple of strings describing the attribute's name.
323 - `val`: value of the attribute.
326 if type(attr)
is tuple
and len(attr) > 1:
329 if type(attr)
is tuple: attr = attr[0]
330 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)