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"):
151 options[
"TrackSelector"][
"Alignment"].
update({
155 options[
"TrackHitFilter"][
"Tracker"].
update({
158 elif collection
in (
"ALCARECOTkAlCosmicsCTF0T",
159 "ALCARECOTkAlCosmicsInCollisions"):
161 options[
"TrackSelector"][
"HighPurity"] = {}
162 if not cosmicsDecoMode:
163 options[
"TrackHitFilter"][
"Tracker"].
update({
164 "StoNcommands": cms.vstring(
"ALL 18.0")
167 options[
"TrackHitFilter"][
"Tracker"].
update({
171 options[
"TrackHitFilter"][
"Tracker"].
update({
174 options[
"TrackSelector"][
"Alignment"].
update({
178 "applyMultiplicityFilter":
True,
181 if cosmicTrackSplitting:
182 options[
"TrackSplitting"] = {}
183 options[
"TrackSplitting"][
"TrackSplitting"] = {}
185 options[
"TrackSelector"][
"Alignment"].
update({
189 elif collection
in (
"ALCARECOTkAlMuonIsolated",
190 "ALCARECOTkAlMuonIsolatedHI",
191 "ALCARECOTkAlMuonIsolatedPA"):
192 options[
"TrackSelector"][
"Alignment"].
update({
193 (
"minHitsPerSubDet",
"inPIXEL"): 1,
196 "applyMultiplicityFilter":
True,
197 "maxMultiplicity": 1,
199 elif collection
in (
"ALCARECOTkAlZMuMu",
200 "ALCARECOTkAlZMuMuHI",
201 "ALCARECOTkAlZMuMuPA",
202 "ALCARECOTkAlDiMuon"):
203 options[
"TrackSelector"][
"Alignment"].
update({
208 "applyMultiplicityFilter":
True,
209 "minMultiplicity": 2,
210 "maxMultiplicity": 2,
211 (
"minHitsPerSubDet",
"inPIXEL"): 1,
212 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
213 (
"TwoBodyDecaySelector",
"charge"): 0,
214 (
"TwoBodyDecaySelector",
215 "applyMassrangeFilter"):
not openMassWindow,
216 (
"TwoBodyDecaySelector",
"minXMass"): 85.8,
217 (
"TwoBodyDecaySelector",
"maxXMass"): 95.8,
218 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
220 options[
"TrackHitFilter"][
"Tracker"].
update({
223 elif collection ==
"ALCARECOTkAlUpsilonMuMu":
224 options[
"TrackSelector"][
"Alignment"].
update({
229 "applyMultiplicityFilter":
True,
230 "minMultiplicity": 2,
231 "maxMultiplicity": 2,
232 (
"minHitsPerSubDet",
"inPIXEL"): 1,
233 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
234 (
"TwoBodyDecaySelector",
"charge"): 0,
235 (
"TwoBodyDecaySelector",
236 "applyMassrangeFilter"):
not openMassWindow,
237 (
"TwoBodyDecaySelector",
"minXMass"): 9.2,
238 (
"TwoBodyDecaySelector",
"maxXMass"): 9.7,
239 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
241 options[
"TrackHitFilter"][
"Tracker"].
update({
244 elif collection ==
"ALCARECOTkAlJpsiMuMu":
245 options[
"TrackSelector"][
"Alignment"].
update({
250 "applyMultiplicityFilter":
True,
251 "minMultiplicity": 2,
252 "maxMultiplicity": 2,
253 (
"minHitsPerSubDet",
"inPIXEL"): 1,
254 (
"TwoBodyDecaySelector",
"applyChargeFilter"):
True,
255 (
"TwoBodyDecaySelector",
"charge"): 0,
256 (
"TwoBodyDecaySelector",
257 "applyMassrangeFilter"):
not openMassWindow,
258 (
"TwoBodyDecaySelector",
"minXMass"): 2.7,
259 (
"TwoBodyDecaySelector",
"maxXMass"): 3.4,
260 (
"TwoBodyDecaySelector",
"daughterMass"): 0.105
262 options[
"TrackHitFilter"][
"Tracker"].
update({
266 raise ValueError(
"Unknown input track collection: {}".
format(collection))
268 if cosmicTrackSplitting
and not isCosmics:
269 raise ValueError(
"Can only do cosmic track splitting for cosmics.")
278 if cosmicTrackSplitting:
279 raise ValueError(
"Can't turn on both saveCPU and cosmicTrackSplitting at the same time")
280 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
281 (
"TrackRefitter",
"First", {
"method":
"load",
283 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
284 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
285 options[
"TrackSelector"][
"Alignment"].
update(
286 options[
"TrackSelector"][
"HighPurity"])
287 elif cosmicTrackSplitting:
288 mods = [(
"TrackRefitter",
"First", {
"method":
"load",
290 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
291 (
"TrackSplitting",
"TrackSplitting", {
"method":
"load"}),
292 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
293 (
"TrackRefitter",
"Second", {
"method":
"load",
296 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
297 (
"TrackRefitter",
"First", {
"method":
"load",
299 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
300 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
301 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
303 (
"TrackRefitter",
"Second", {
"method":
"load",
305 if isCosmics: mods = mods[1:]
307 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
308 (
"TrackRefitter",
"First", {
"method":
"load",
310 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
311 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
312 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
313 (
"TrackRefitter",
"Second", {
"method":
"load",
315 if isCosmics: mods = mods[1:]
322 options[
"TrackSelector"][
"HighPurity"].
update({
323 "trackQualities": [],
326 options[
"TrackSelector"][
"Alignment"].
update({
341 if momentumConstraint
is not None:
342 for mod
in options[
"TrackRefitter"]:
343 momconstrspecs = momentumConstraint.split(
',')
344 if len(momconstrspecs)==1:
345 options[
"TrackRefitter"][mod].
update({
346 "constraint":
"momentum",
347 "srcConstr": momconstrspecs[0]
350 options[
"TrackRefitter"][mod].
update({
351 "constraint": momconstrspecs[1],
352 "srcConstr": momconstrspecs[0]
360 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
369 for mod
in mods[:-1]:
370 src, prevsrc =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
371 options[mod[0]][mod[1]], isCosmics = isCosmics, prevsrc = prevsrc,
373 modules.append(getattr(process, src))
375 if mods[-1][-1][
"method"] ==
"load" and \
376 not mods[-1][-1].get(
"clone",
False):
377 customlog(
"Name of the last module needs to be modifiable.")
381 customlog(
"Here we must include geopro first")
382 process.load(
'Configuration.StandardSequences.GeometryDB_cff')
383 process.load(
"TrackPropagation.Geant4e.geantRefit_cff")
384 modules.append(getattr(process,
"geopro"))
386 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
387 options[mods[-1][0]][mods[-1][1]],
388 isCosmics = isCosmics, **(mods[-1][2]))
389 modules.append(getattr(process, src))
391 moduleSum = process.offlineBeamSpot
394 moduleSum += getattr(process,
"MeasurementTrackerEvent")
396 for module
in modules:
398 if hasattr(module,
"srcConstr"):
399 strSrcConstr = module.srcConstr.getModuleLabel()
401 procsrcconstr = getattr(process,strSrcConstr)
402 if hasattr(procsrcconstr,
"src"):
403 if procsrcconstr.src != module.src:
407 moduleSum += procsrcconstr
408 elif hasattr(procsrcconstr,
"srcTrk"):
409 if procsrcconstr.srcTrk != module.src:
413 procsrcconstrsrcvtx = getattr(process,procsrcconstr.srcVtx.getModuleLabel())
414 if type(procsrcconstrsrcvtx)
is cms.EDFilter:
415 procsrcconstrsrcvtxprefilter = getattr(process,procsrcconstrsrcvtx.src.getModuleLabel())
416 moduleSum += procsrcconstrsrcvtxprefilter
417 moduleSum += procsrcconstrsrcvtx
418 moduleSum += procsrcconstr
422 return cms.Sequence(moduleSum)
def _getModule(process, src, modType, moduleName, options, kwargs)
Auxiliary functions ###
static std::string join(char **cmd)