16 """This function returns a cms.Sequence containing as last element the 17 module 'FinalTrackRefitter', which can be used as cms.InputTag for 18 subsequent processing steps. 19 The modules in the sequence are already attached to the given `process` 20 object using the given track collection `collection` and the given 24 - `process`: 'cms.Process' object to which the modules of the sequence will 26 - `collection`: String indicating the input track collection. 27 - `saveCPU`: If set to 'True', some steps are merged to reduce CPU time. 28 Reduces a little the accuracy of the results. 29 This option is currently not recommended. 30 - `TTRHBuilder`: Option used for the Track(Re)Fitter modules. 31 - `usePixelQualityFlag`: Option used for the TrackHitFilter module. 32 Defaults to 'True' but is automatically set to 33 'False' if a `TTRHBuilder` without templates is 35 If this is still wanted for some reason, one can 36 explicitely specify it as 'True'. 37 - `openMassWindow`: Used to configure the TwoBodyDecaySelector for ZMuMu. 38 - `cosmicsDecoMode`: If set to 'True' a lower Signal/Noise cut is used. 39 - `cosmicsZeroTesla`: If set to 'True' a 0T-specific selection is used. 40 - `momentumConstraint`: If you want to apply a momentum constraint for the 41 track refitting, e.g. for CRUZET data, you need 42 to provide here the name of the constraint module. 43 - `cosmicTrackSplitting`: If set to 'True' cosmic tracks are split before the 44 second track refitter. 45 - `use_d0cut`: If 'True' (default), apply a cut |d0| < 50. 52 if usePixelQualityFlag
is None:
53 if "Template" not in TTRHBuilder:
54 usePixelQualityFlag =
False 55 print "Using 'TTRHBuilder' without templates:", TTRHBuilder
56 print " --> Turning off pixel quality flag in hit filter." 58 usePixelQualityFlag =
True 65 options = {
"TrackHitFilter": {},
70 options[
"TrackSelector"][
"HighPurity"] = {
71 "trackQualities": [
"highPurity"],
77 options[
"TrackSelector"][
"Alignment"] = {
88 options[
"TrackRefitter"][
"First"] = {
89 "NavigationSchool":
"",
90 "TTRHBuilder": TTRHBuilder,
92 options[
"TrackRefitter"][
"Second"] = {
93 "NavigationSchool":
"",
94 "TTRHBuilder": TTRHBuilder,
96 options[
"TrackHitFilter"][
"Tracker"] = {
97 "useTrajectories":
True,
99 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
100 "keep TOB",
"keep TEC"),
101 "replaceWithInactiveHits":
True,
102 "rejectBadStoNHits":
True,
103 "rejectLowAngleHits":
True,
104 "usePixelQualityFlag": usePixelQualityFlag,
105 "StoNcommands": cms.vstring(
"ALL 12.0"),
106 "TrackAngleCut": 0.087,
108 options[
"TrackFitter"][
"HitFilteredTracks"] = {
109 "NavigationSchool":
"",
110 "TTRHBuilder": TTRHBuilder,
119 if collection
in (
"ALCARECOTkAlMinBias",
"generalTracks",
120 "ALCARECOTkAlMinBiasHI",
"hiGeneralTracks"):
121 options[
"TrackSelector"][
"Alignment"].
update({
125 options[
"TrackHitFilter"][
"Tracker"].
update({
128 elif collection
in (
"ALCARECOTkAlCosmicsCTF0T",
129 "ALCARECOTkAlCosmicsInCollisions"):
131 options[
"TrackSelector"][
"HighPurity"] = {}
132 if not cosmicsDecoMode:
133 options[
"TrackHitFilter"][
"Tracker"].
update({
134 "StoNcommands": cms.vstring(
"ALL 18.0")
137 options[
"TrackHitFilter"][
"Tracker"].
update({
141 options[
"TrackHitFilter"][
"Tracker"].
update({
144 options[
"TrackSelector"][
"Alignment"].
update({
148 "applyMultiplicityFilter":
True,
151 if cosmicTrackSplitting:
152 options[
"TrackSplitting"] = {}
153 options[
"TrackSplitting"][
"TrackSplitting"] = {}
155 options[
"TrackSelector"][
"Alignment"].
update({
159 elif collection
in (
"ALCARECOTkAlMuonIsolated",
160 "ALCARECOTkAlMuonIsolatedHI",
161 "ALCARECOTkAlMuonIsolatedPA"):
162 options[
"TrackSelector"][
"Alignment"].
update({
163 (
"minHitsPerSubDet",
"inPIXEL"): 1,
166 "applyMultiplicityFilter":
True,
167 "maxMultiplicity": 1,
169 elif collection
in (
"ALCARECOTkAlZMuMu",
170 "ALCARECOTkAlZMuMuHI",
171 "ALCARECOTkAlZMuMuPA"):
172 options[
"TrackSelector"][
"Alignment"].
update({
177 "applyMultiplicityFilter":
True,
178 "minMultiplicity": 2,
179 "maxMultiplicity": 2,
180 (
"minHitsPerSubDet",
"inPIXEL"): 1,
181 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
182 (
"TwoBodyDecaySelector",
"charge"): 0,
183 (
"TwoBodyDecaySelector",
184 "applyMassrangeFilter"):
not openMassWindow,
185 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
186 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
187 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
189 options[
"TrackHitFilter"][
"Tracker"].
update({
192 elif collection ==
"ALCARECOTkAlUpsilonMuMu":
193 options[
"TrackSelector"][
"Alignment"].
update({
198 "applyMultiplicityFilter":
True,
199 "minMultiplicity": 2,
200 "maxMultiplicity": 2,
201 (
"minHitsPerSubDet",
"inPIXEL"): 1,
202 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
203 (
"TwoBodyDecaySelector",
"charge"): 0,
204 (
"TwoBodyDecaySelector",
205 "applyMassrangeFilter"):
not openMassWindow,
206 (
"TwoBodyDecaySelector",
"minXMass"): 9.2,
207 (
"TwoBodyDecaySelector",
"maxXMass"): 9.7,
208 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
210 options[
"TrackHitFilter"][
"Tracker"].
update({
213 elif collection ==
"ALCARECOTkAlJpsiMuMu":
214 options[
"TrackSelector"][
"Alignment"].
update({
219 "applyMultiplicityFilter":
True,
220 "minMultiplicity": 2,
221 "maxMultiplicity": 2,
222 (
"minHitsPerSubDet",
"inPIXEL"): 1,
223 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
224 (
"TwoBodyDecaySelector",
"charge"): 0,
225 (
"TwoBodyDecaySelector",
226 "applyMassrangeFilter"):
not openMassWindow,
227 (
"TwoBodyDecaySelector",
"minXMass"): 2.7,
228 (
"TwoBodyDecaySelector",
"maxXMass"): 3.4,
229 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
231 options[
"TrackHitFilter"][
"Tracker"].
update({
235 raise ValueError(
"Unknown input track collection: {}".
format(collection))
237 if cosmicTrackSplitting
and not isCosmics:
238 raise ValueError(
"Can only do cosmic track splitting for cosmics.")
247 if cosmicTrackSplitting:
248 raise ValueError(
"Can't turn on both saveCPU and cosmicTrackSplitting at the same time")
249 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
250 (
"TrackRefitter",
"First", {
"method":
"load",
252 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
253 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
254 options[
"TrackSelector"][
"Alignment"].
update(
255 options[
"TrackSelector"][
"HighPurity"])
256 elif cosmicTrackSplitting:
257 mods = [(
"TrackRefitter",
"First", {
"method":
"load",
259 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
260 (
"TrackSplitting",
"TrackSplitting", {
"method":
"load"}),
261 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
262 (
"TrackRefitter",
"Second", {
"method":
"load",
265 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
266 (
"TrackRefitter",
"First", {
"method":
"load",
268 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
269 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
270 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
271 (
"TrackRefitter",
"Second", {
"method":
"load",
273 if isCosmics: mods = mods[1:]
280 if momentumConstraint
is not None:
281 for mod
in options[
"TrackRefitter"]:
282 momconstrspecs = momentumConstraint.split(
',')
283 if len(momconstrspecs)==1:
284 options[
"TrackRefitter"][mod].
update({
285 "constraint":
"momentum",
286 "srcConstr": momconstrspecs[0]
289 options[
"TrackRefitter"][mod].
update({
290 "constraint": momconstrspecs[1],
291 "srcConstr": momconstrspecs[0]
299 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
310 for mod
in mods[:-1]:
311 src, prevsrc =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
312 options[mod[0]][mod[1]], isCosmics = isCosmics, prevsrc = prevsrc,
314 modules.append(getattr(process, src))
316 if mods[-1][-1][
"method"]
is "load" and \
317 not mods[-1][-1].
get(
"clone",
False):
318 print "Name of the last module needs to be modifiable." 320 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
321 options[mods[-1][0]][mods[-1][1]],
322 isCosmics = isCosmics, **(mods[-1][2]))
323 modules.append(getattr(process, src))
325 moduleSum = process.offlineBeamSpot
326 for module
in modules:
328 if hasattr(module,
"srcConstr"):
329 strSrcConstr = module.srcConstr.getModuleLabel()
331 procsrcconstr = getattr(process,strSrcConstr)
332 if procsrcconstr.src != module.src:
336 moduleSum += procsrcconstr
340 return cms.Sequence(moduleSum)
def _getModule(process, src, modType, moduleName, options, kwargs)
Auxiliary functions ###
static std::string join(char **cmd)
T get(const Candidate &c)