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":
97 options[
"TrackSelector"][
"Alignment"].
update({
101 options[
"TrackHitFilter"][
"Tracker"].
update({
104 elif collection ==
"ALCARECOTkAlCosmicsCTF0T":
106 options[
"TrackSelector"][
"HighPurity"] = {}
107 if not cosmicsDecoMode:
108 options[
"TrackHitFilter"][
"Tracker"].
update({
109 "StoNcommands": cms.vstring(
"ALL 18.0")
112 options[
"TrackHitFilter"][
"Tracker"].
update({
116 options[
"TrackHitFilter"][
"Tracker"].
update({
119 options[
"TrackSelector"][
"Alignment"].
update({
123 "applyMultiplicityFilter":
True,
126 elif collection ==
"ALCARECOTkAlMuonIsolated":
127 options[
"TrackSelector"][
"Alignment"].
update({
128 (
"minHitsPerSubDet",
"inPIXEL"): 1,
131 "applyMultiplicityFilter":
True,
132 "maxMultiplicity": 1,
134 elif collection ==
"ALCARECOTkAlZMuMu":
135 options[
"TrackSelector"][
"Alignment"].
update({
140 "applyMultiplicityFilter":
True,
141 "minMultiplicity": 2,
142 "maxMultiplicity": 2,
143 (
"minHitsPerSubDet",
"inPIXEL"): 1,
144 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
145 (
"TwoBodyDecaySelector",
"charge"): 0,
146 (
"TwoBodyDecaySelector",
147 "applyMassrangeFilter"):
not openMassWindow,
148 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
149 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
150 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
152 options[
"TrackHitFilter"][
"Tracker"].
update({
157 print "Unknown input track collection:", collection
167 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
168 (
"TrackRefitter",
"First", {
"method":
"load",
170 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
171 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
172 options[
"TrackSelector"][
"Alignment"].
update(
173 options[
"TrackSelector"][
"HighPurity"])
175 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
176 (
"TrackRefitter",
"First", {
"method":
"load",
178 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
179 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
180 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
181 (
"TrackRefitter",
"Second", {
"method":
"load",
183 if isCosmics: mods = mods[1:]
191 if momentumConstraint
is not None:
192 for mod
in options[
"TrackRefitter"]:
193 options[
"TrackRefitter"][mod].
update({
194 "constraint":
"momentum",
195 "srcConstr": momentumConstraint
206 for mod
in mods[:-1]:
207 src =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
208 options[mod[0]][mod[1]], isCosmics = isCosmics,
210 modules.append(getattr(process, src))
212 if mods[-1][-1][
"method"]
is "load" and \
213 not mods[-1][-1].
get(
"clone",
False):
214 print "Name of the last module needs to be modifiable."
216 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
217 options[mods[-1][0]][mods[-1][1]],
218 isCosmics = isCosmics, **(mods[-1][2]))
219 modules.append(getattr(process, src))
221 moduleSum = modules[0]
222 for mod
in modules[1:]:
224 return cms.Sequence(moduleSum)
239 def _getModule(process, src, modType, moduleName, options, **kwargs):
240 """General function for attaching the module of type `modType` to the
241 cms.Process `process` using `options` for customization and `moduleName` as
242 the name of the new attribute of `process`.
245 - `process`: 'cms.Process' object to which the module is attached.
246 - `src`: cms.InputTag for this module.
247 - `modType`: Type of the requested module.
248 - `options`: Dictionary with customized values for the module's options.
249 - `**kwargs`: Used to supply options at construction time of the module.
252 objTuple = globals()[
"_"+modType](kwargs)
253 method = kwargs.get(
"method")
254 if method
is "import":
255 __import__(objTuple[0])
256 obj = getattr(sys.modules[objTuple[0]], objTuple[1]).
clone(src=src)
257 elif method
is "load":
258 process.load(objTuple[0])
259 if kwargs.get(
"clone",
False):
260 obj = getattr(process, objTuple[1]).
clone(src=src)
262 obj = getattr(process, objTuple[1])
264 moduleName = objTuple[1]
266 print "Unknown method:", method
269 for option
in options:
272 if moduleName
is not objTuple[1]:
273 setattr(process, moduleName, obj)
278 """Returns TrackHitFilter module name.
281 - `kwargs`: Not used in this function.
284 return (
"RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff",
285 "TrackerTrackHitFilter")
289 """Returns TrackSelector module name.
292 - `kwargs`: Not used in this function.
295 return (
"Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi",
296 "AlignmentTrackSelector")
300 """Returns TrackFitter module name.
303 - `kwargs`: Used to supply options at construction time of the object.
306 isCosmics = kwargs.get(
"isCosmics",
False)
308 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff",
309 "ctfWithMaterialTracksCosmics")
311 return (
"RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff",
312 "ctfWithMaterialTracks")
316 """Returns TrackRefitter module name.
319 - `kwargs`: Used to supply options at construction time of the object.
322 isCosmics = kwargs.get(
"isCosmics",
False)
324 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
327 return (
"RecoTracker.TrackProducer.TrackRefitters_cff",
332 """Sets the attribute `attr` of the object `obj` using the value `val`.
333 `attr` can be a string or a tuple of strings, if one wants to set an
334 attribute of an attribute, etc.
337 - `obj`: Object, which must have a '__dict__' attribute.
338 - `attr`: String or tuple of strings describing the attribute's name.
339 - `val`: value of the attribute.
342 if type(attr)
is tuple
and len(attr) > 1:
345 if type(attr)
is tuple: attr = attr[0]
346 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)