CMS 3D CMS Logo

iterativeTkConfig.py
Go to the documentation of this file.
1 # This file is the authoritative source of the order of tracking
2 # iterations. It is used in RECO, DQM, and VALIDATION. Note that here
3 # InitialStepPreSplitting is not counted as an iteration.
4 import FWCore.ParameterSet.Config as cms
5 
6 _defaultEraName = ""
7 _nonDefaultEraNames = ["trackingLowPU", "trackingPhase1", "trackingPhase1QuadProp", "trackingPhase2PU140"]
8 
9 # name, postfix, era
10 _defaultEra = (_defaultEraName, "", None)
11 _nonDefaultEras = [
12  (_name, "_"+_name, getattr(__import__('Configuration.Eras.Modifier_'+_name+'_cff',globals(),locals(),[_name],0),_name)) \
13  for _name in _nonDefaultEraNames
14 ]
15 
16 _allEras = [_defaultEra] + _nonDefaultEras
17 
18 
19 _iterations = [
20  "InitialStep",
21  "DetachedTripletStep",
22  "LowPtTripletStep",
23  "PixelPairStep",
24  "MixedTripletStep",
25  "PixelLessStep",
26  "TobTecStep",
27  "JetCoreRegionalStep",
28 ]
29 _iterations_trackingLowPU = [
30  "InitialStep",
31  "LowPtTripletStep",
32  "PixelPairStep",
33  "DetachedTripletStep",
34  "MixedTripletStep",
35  "PixelLessStep",
36  "TobTecStep",
37 ]
38 _iterations_trackingPhase1 = [
39  "InitialStep",
40  "LowPtQuadStep",
41  "HighPtTripletStep",
42  "LowPtTripletStep",
43  "DetachedQuadStep",
44  "DetachedTripletStep",
45  "PixelPairStep",
46  "MixedTripletStep",
47  "PixelLessStep",
48  "TobTecStep",
49  "JetCoreRegionalStep",
50 ]
51 _iterations_trackingPhase1QuadProp = _iterations_trackingPhase1
52 _iterations_trackingPhase2PU140 = [
53  "InitialStep",
54  "HighPtTripletStep",
55  "LowPtQuadStep",
56  "LowPtTripletStep",
57  "DetachedQuadStep",
58  "PixelPairStep",
59 ]
60 _iterations_muonSeeded = [
61  "MuonSeededStepInOut",
62  "MuonSeededStepOutIn",
63 ]
64 #Phase2
65 _iterations_muonSeeded_trackingPhase2PU140 = [
66  "MuonSeededStepInOut",
67  "MuonSeededStepOutIn",
68 ]
69 _multipleSeedProducers = {
70  "MixedTripletStep": ["A", "B"],
71  "TobTecStep": ["Pair", "Tripl"],
72 }
73 _multipleSeedProducers_trackingLowPU = {
74  "MixedTripletStep": ["A", "B"],
75 }
76 _multipleSeedProducers_trackingPhase1 = {
77  "PixelPairStep": ["A", "B"],
78  "MixedTripletStep": ["A", "B"],
79  "TobTecStep": ["Pair", "Tripl"],
80 }
81 _multipleSeedProducers_trackingPhase1QuadProp = _multipleSeedProducers_trackingPhase1
82 _multipleSeedProducers_trackingPhase2PU140 = {}
83 _oldStyleHasSelector = set([
84  "InitialStep",
85  "HighPtTripletStep",
86  "LowPtQuadStep",
87  "LowPtTripletStep",
88  "PixelPairStep",
89  "PixelLessStep",
90  "TobTecStep",
91 ])
92 
93 from RecoLocalTracker.SubCollectionProducers.trackClusterRemover_cfi import trackClusterRemover as _trackClusterRemover
94 _trackClusterRemoverBase = _trackClusterRemover.clone(
95  maxChi2 = 9.0,
96  pixelClusters = "siPixelClusters",
97  stripClusters = "siStripClusters",
98  TrackQuality = 'highPurity',
99  minNumberOfLayersWithMeasBeforeFiltering = 0,
100 )
101 
102 #Phase2 : configuring the phase2 track Cluster Remover
103 from RecoLocalTracker.SubCollectionProducers.phase2trackClusterRemover_cfi import phase2trackClusterRemover as _phase2trackClusterRemover
104 _trackClusterRemoverBase_trackingPhase2PU140 = _phase2trackClusterRemover.clone(
105  maxChi2 = 9.0,
106  phase2pixelClusters = "siPixelClusters",
107  phase2OTClusters = "siPhase2Clusters",
108  TrackQuality = 'highPurity',
109  minNumberOfLayersWithMeasBeforeFiltering = 0,
110 )
111 
112 def _modulePrefix(iteration):
113  return iteration[0].lower()+iteration[1:]
114 
115 def _clusterRemover(iteration):
116  return _modulePrefix(iteration)+"Clusters"
117 
118 def _tracks(iteration):
119  return _modulePrefix(iteration)+"Tracks"
120 
121 def _classifier(iteration, oldStyle=False, oldStyleQualityMasks=False):
122  pre = _modulePrefix(iteration)
123  if oldStyle:
124  if iteration in _oldStyleHasSelector:
125  return pre+"Selector:" + ("QualityMasks" if oldStyleQualityMasks else pre)
126  else:
127  return pre
128  else:
129  return pre+":QualityMasks"
130 
131 def allEras():
132  return _allEras
133 
135  return _nonDefaultEras
136 
137 def createEarlySequence(eraName, postfix, modDict):
138  seq = cms.Sequence()
139  for it in globals()["_iterations"+postfix]:
140  seq += modDict[it]
141  return seq
142 
143 def iterationAlgos(postfix, includeSequenceName=False):
144  muonVariable = "_iterations_muonSeeded"+postfix
145  iterations = globals()["_iterations"+postfix] + globals().get(muonVariable, _iterations_muonSeeded)
146 
147  if includeSequenceName:
148  return [(_modulePrefix(i), i) for i in iterations]
149  else:
150  return [_modulePrefix(i) for i in iterations]
151 
152 def _seedOrTrackProducers(postfix, typ):
153  ret = []
154  iters = globals()["_iterations"+postfix]
155  if typ == "Seeds":
156  multipleSeedProducers = globals()["_multipleSeedProducers"+postfix]
157  else:
158  multipleSeedProducers = None
159  for i in iters:
160  seeder = _modulePrefix(i)+typ
161  if multipleSeedProducers is not None and i in multipleSeedProducers:
162  ret.extend([seeder+m for m in multipleSeedProducers[i]])
163  else:
164  ret.append(seeder)
165 
166  for i in globals().get("_iterations_muonSeeded"+postfix, _iterations_muonSeeded):
167  ret.append(_modulePrefix(i).replace("Step", typ))
168 
169  return ret
170 
171 def seedProducers(postfix):
172  return _seedOrTrackProducers(postfix, "Seeds")
173 
174 def trackProducers(postfix):
175  return _seedOrTrackProducers(postfix, "Tracks")
176 
177 def clusterRemoverForIter(iteration, eraName="", postfix="", module=None):
178  if module is None:
179  module = _trackClusterRemoverBase.clone()
180  if eraName == "trackingPhase2PU140":
181  module = globals().get("_trackClusterRemoverBase"+postfix, _trackClusterRemoverBase)
182 
183  iters = globals()["_iterations"+postfix]
184  try:
185  ind = iters.index(iteration)
186  except ValueError:
187  # if the iteration is not active in era, just return the same
188  return module
189 
190  if ind == 0:
191  raise Exception("Iteration %s is the first iteration in era %s, asking cluster remover configuration does not make sense" % (iteration, eraName))
192  prevIter = iters[ind-1]
193 
194  customize = dict(
195  trajectories = _tracks(prevIter),
196  oldClusterRemovalInfo = _clusterRemover(prevIter) if ind >= 2 else "", # 1st iteration does not have cluster remover
197  )
198  if eraName in ["trackingPhase2PU140"]:
199  customize["overrideTrkQuals"] = _classifier(prevIter, oldStyle=True) # old-style selector
200  elif eraName == "trackingLowPU":
201  customize["overrideTrkQuals"] = _classifier(prevIter, oldStyle=True, oldStyleQualityMasks=True) # old-style selector with 'QualityMasks' instance label
202  else:
203  customize["trackClassifier"] = _classifier(prevIter)
204 
205  return module.clone(**customize)
def clusterRemoverForIter(iteration, eraName="", postfix="", module=None)
def iterationAlgos(postfix, includeSequenceName=False)
def _seedOrTrackProducers(postfix, typ)
def replace(string, replacements)
def createEarlySequence(eraName, postfix, modDict)
def _clusterRemover(iteration)
def trackProducers(postfix)
def seedProducers(postfix)
def _classifier(iteration, oldStyle=False, oldStyleQualityMasks=False)
def _modulePrefix(iteration)
T get(const Candidate &c)
Definition: component.h:55
def _tracks(iteration)