20 """This function returns a cms.Sequence containing as last element the 21 module 'FinalTrackRefitter', which can be used as cms.InputTag for 22 subsequent processing steps. 23 The modules in the sequence are already attached to the given `process` 24 object using the given track collection `collection` and the given 28 - `process`: 'cms.Process' object to which the modules of the sequence will 30 - `collection`: String indicating the input track collection. 31 - `saveCPU`: If set to 'True', some steps are merged to reduce CPU time. 32 Reduces a little the accuracy of the results. 33 This option is currently not recommended. 34 - `TTRHBuilder`: Option used for the Track(Re)Fitter modules. 35 - `usePixelQualityFlag`: Option used for the TrackHitFilter module. 36 Defaults to 'True' but is automatically set to 37 'False' if a `TTRHBuilder` without templates is 39 If this is still wanted for some reason, one can 40 explicitely specify it as 'True'. 41 - `openMassWindow`: Used to configure the TwoBodyDecaySelector for ZMuMu. 42 - `cosmicsDecoMode`: If set to 'True' a lower Signal/Noise cut is used. 43 - `cosmicsZeroTesla`: If set to 'True' a 0T-specific selection is used. 44 - `momentumConstraint`: If you want to apply a momentum constraint for the 45 track refitting, e.g. for CRUZET data, you need 46 to provide here the name of the constraint module. 47 - `cosmicTrackSplitting`: If set to 'True' cosmic tracks are split before the 48 second track refitter. 49 - `isPVValidation`: If set to 'True' most of the selection cuts are overridden 50 to allow unbiased selection of tracks for vertex refitting 51 - `use_d0cut`: If 'True' (default), apply a cut |d0| < 50. 60 if usePixelQualityFlag
is None:
61 if "Template" not in TTRHBuilder:
62 usePixelQualityFlag =
False 63 customlog(
"Using 'TTRHBuilder' without templates %s" % TTRHBuilder)
64 customlog(
" --> Turning off pixel quality flag in hit filter.")
66 usePixelQualityFlag =
True 73 options = {
"TrackHitFilter": {},
79 options[
"TrackSelector"][
"HighPurity"] = {
80 "trackQualities": [
"highPurity"],
86 options[
"TrackSelector"][
"Alignment"] = {
97 options[
"TrackRefitter"][
"First"] = {
98 "NavigationSchool":
"",
99 "TTRHBuilder": TTRHBuilder,
101 options[
"TrackRefitter"][
"Second"] = {
102 "NavigationSchool":
"",
103 "TTRHBuilder": TTRHBuilder,
105 options[
"TrackHitFilter"][
"Tracker"] = {
106 "useTrajectories":
True,
108 "commands": cms.vstring(
"keep PXB",
"keep PXE",
"keep TIB",
"keep TID",
109 "keep TOB",
"keep TEC"),
110 "replaceWithInactiveHits":
True,
111 "rejectBadStoNHits":
True,
112 "rejectLowAngleHits":
True,
113 "usePixelQualityFlag": usePixelQualityFlag,
114 "StoNcommands": cms.vstring(
"ALL 12.0"),
115 "TrackAngleCut": 0.087,
117 options[
"TrackFitter"][
"HitFilteredTracks"] = {
118 "NavigationSchool":
"",
119 "TTRHBuilder": TTRHBuilder,
121 options[
"geopro"][
""] = {
125 options[
"TrackRefitter"][
"Second"] = {
126 "AlgorithmName" : cms.string(
'undefAlgorithm'),
127 "Fitter" : cms.string(
'G4eFitterSmoother'),
128 "GeometricInnerState" : cms.bool(
False),
129 "MeasurementTracker" : cms.string(
''),
130 "MeasurementTrackerEvent" : cms.InputTag(
"MeasurementTrackerEvent"),
131 "NavigationSchool" : cms.string(
'SimpleNavigationSchool'),
132 "Propagator" : cms.string(
'Geant4ePropagator'),
133 "TTRHBuilder" : cms.string(
'WithAngleAndTemplate'),
134 "TrajectoryInEvent" : cms.bool(
True),
135 "beamSpot" : cms.InputTag(
"offlineBeamSpot"),
136 "constraint" : cms.string(
''),
137 "src" : cms.InputTag(
"AlignmentTrackSelector"),
138 "srcConstr" : cms.InputTag(
""),
139 "useHitsSplitting" : cms.bool(
False),
140 "usePropagatorForPCA" : cms.bool(
True)
148 if collection
in (
"ALCARECOTkAlMinBias",
"generalTracks",
149 "ALCARECOTkAlMinBiasHI",
"hiGeneralTracks",
150 "ALCARECOTkAlJetHT",
"ALCARECOTkAlDiMuonVertexTracks",
152 options[
"TrackSelector"][
"Alignment"].
update({
156 options[
"TrackHitFilter"][
"Tracker"].
update({
159 elif collection
in (
"ALCARECOTkAlCosmicsCTF0T",
160 "ALCARECOTkAlCosmicsCosmicTF0T",
161 "ALCARECOTkAlCosmicsInCollisions"):
163 options[
"TrackSelector"][
"HighPurity"] = {}
164 if not cosmicsDecoMode:
165 options[
"TrackHitFilter"][
"Tracker"].
update({
166 "StoNcommands": cms.vstring(
"ALL 18.0")
169 options[
"TrackHitFilter"][
"Tracker"].
update({
173 options[
"TrackHitFilter"][
"Tracker"].
update({
176 options[
"TrackSelector"][
"Alignment"].
update({
180 "applyMultiplicityFilter":
True,
183 if cosmicTrackSplitting:
184 options[
"TrackSplitting"] = {}
185 options[
"TrackSplitting"][
"TrackSplitting"] = {}
187 options[
"TrackSelector"][
"Alignment"].
update({
191 elif collection
in (
"ALCARECOTkAlMuonIsolated",
192 "ALCARECOTkAlMuonIsolatedHI",
193 "ALCARECOTkAlMuonIsolatedPA"):
194 options[
"TrackSelector"][
"Alignment"].
update({
195 (
"minHitsPerSubDet",
"inPIXEL"): 1,
198 "applyMultiplicityFilter":
True,
199 "maxMultiplicity": 1,
201 elif collection
in (
"ALCARECOTkAlZMuMu",
202 "ALCARECOTkAlZMuMuHI",
203 "ALCARECOTkAlZMuMuPA",
204 "ALCARECOTkAlDiMuon"):
205 options[
"TrackSelector"][
"Alignment"].
update({
210 "applyMultiplicityFilter":
True,
211 "minMultiplicity": 2,
212 "maxMultiplicity": 2,
213 (
"minHitsPerSubDet",
"inPIXEL"): 1,
214 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
215 (
"TwoBodyDecaySelector",
"charge"): 0,
216 (
"TwoBodyDecaySelector",
217 "applyMassrangeFilter"):
not openMassWindow,
218 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
219 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
220 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
222 options[
"TrackHitFilter"][
"Tracker"].
update({
225 elif collection ==
"ALCARECOTkAlUpsilonMuMu":
226 options[
"TrackSelector"][
"Alignment"].
update({
231 "applyMultiplicityFilter":
True,
232 "minMultiplicity": 2,
233 "maxMultiplicity": 2,
234 (
"minHitsPerSubDet",
"inPIXEL"): 1,
235 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
236 (
"TwoBodyDecaySelector",
"charge"): 0,
237 (
"TwoBodyDecaySelector",
238 "applyMassrangeFilter"):
not openMassWindow,
239 (
"TwoBodyDecaySelector",
"minXMass"): 9.2,
240 (
"TwoBodyDecaySelector",
"maxXMass"): 9.7,
241 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
243 options[
"TrackHitFilter"][
"Tracker"].
update({
246 elif collection ==
"ALCARECOTkAlJpsiMuMu":
247 options[
"TrackSelector"][
"Alignment"].
update({
252 "applyMultiplicityFilter":
True,
253 "minMultiplicity": 2,
254 "maxMultiplicity": 2,
255 (
"minHitsPerSubDet",
"inPIXEL"): 1,
256 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
257 (
"TwoBodyDecaySelector",
"charge"): 0,
258 (
"TwoBodyDecaySelector",
259 "applyMassrangeFilter"):
not openMassWindow,
260 (
"TwoBodyDecaySelector",
"minXMass"): 2.7,
261 (
"TwoBodyDecaySelector",
"maxXMass"): 3.4,
262 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
264 options[
"TrackHitFilter"][
"Tracker"].
update({
268 raise ValueError(
"Unknown input track collection: {}".
format(collection))
270 if cosmicTrackSplitting
and not isCosmics:
271 raise ValueError(
"Can only do cosmic track splitting for cosmics.")
280 if cosmicTrackSplitting:
281 raise ValueError(
"Can't turn on both saveCPU and cosmicTrackSplitting at the same time")
282 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
283 (
"TrackRefitter",
"First", {
"method":
"load",
285 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
286 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
287 options[
"TrackSelector"][
"Alignment"].
update(
288 options[
"TrackSelector"][
"HighPurity"])
289 elif cosmicTrackSplitting:
290 mods = [(
"TrackRefitter",
"First", {
"method":
"load",
292 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
293 (
"TrackSplitting",
"TrackSplitting", {
"method":
"load"}),
294 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
295 (
"TrackRefitter",
"Second", {
"method":
"load",
298 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
299 (
"TrackRefitter",
"First", {
"method":
"load",
301 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
302 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
303 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
305 (
"TrackRefitter",
"Second", {
"method":
"load",
307 if isCosmics: mods = mods[1:]
309 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
310 (
"TrackRefitter",
"First", {
"method":
"load",
312 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
313 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
314 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
315 (
"TrackRefitter",
"Second", {
"method":
"load",
317 if isCosmics: mods = mods[1:]
324 options[
"TrackSelector"][
"HighPurity"].
update({
325 "trackQualities": [],
328 options[
"TrackSelector"][
"Alignment"].
update({
343 if momentumConstraint
is not None:
344 for mod
in options[
"TrackRefitter"]:
345 momconstrspecs = momentumConstraint.split(
',')
346 if len(momconstrspecs)==1:
347 options[
"TrackRefitter"][mod].
update({
348 "constraint":
"momentum",
349 "srcConstr": momconstrspecs[0]
352 options[
"TrackRefitter"][mod].
update({
353 "constraint": momconstrspecs[1],
354 "srcConstr": momconstrspecs[0]
362 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
371 for mod
in mods[:-1]:
372 src, prevsrc =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
373 options[mod[0]][mod[1]], isCosmics = isCosmics, prevsrc = prevsrc,
375 modules.append(getattr(process, src))
377 if mods[-1][-1][
"method"] ==
"load" and \
378 not mods[-1][-1].get(
"clone",
False):
379 customlog(
"Name of the last module needs to be modifiable.")
383 customlog(
"Here we must include geopro first")
384 process.load(
'Configuration.StandardSequences.GeometryDB_cff')
385 process.load(
"TrackPropagation.Geant4e.geantRefit_cff")
386 modules.append(getattr(process,
"geopro"))
388 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
389 options[mods[-1][0]][mods[-1][1]],
390 isCosmics = isCosmics, **(mods[-1][2]))
391 modules.append(getattr(process, src))
393 moduleSum = process.offlineBeamSpot
396 moduleSum += getattr(process,
"MeasurementTrackerEvent")
398 for module
in modules:
400 if hasattr(module,
"srcConstr"):
401 strSrcConstr = module.srcConstr.getModuleLabel()
403 procsrcconstr = getattr(process,strSrcConstr)
404 if hasattr(procsrcconstr,
"src"):
405 if procsrcconstr.src != module.src:
409 moduleSum += procsrcconstr
410 elif hasattr(procsrcconstr,
"srcTrk"):
411 if procsrcconstr.srcTrk != module.src:
415 procsrcconstrsrcvtx = getattr(process,procsrcconstr.srcVtx.getModuleLabel())
416 if type(procsrcconstrsrcvtx)
is cms.EDFilter:
417 procsrcconstrsrcvtxprefilter = getattr(process,procsrcconstrsrcvtx.src.getModuleLabel())
418 moduleSum += procsrcconstrsrcvtxprefilter
419 moduleSum += procsrcconstrsrcvtx
420 moduleSum += procsrcconstr
424 return cms.Sequence(moduleSum)
def _getModule(process, src, modType, moduleName, options, kwargs)
Auxiliary functions ###
static std::string join(char **cmd)