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({
214 raise ValueError(
"Unknown input track collection: {}".
format(collection))
216 if cosmicTrackSplitting
and not isCosmics:
217 raise ValueError(
"Can only do cosmic track splitting for cosmics.")
226 if cosmicTrackSplitting:
227 raise ValueError(
"Can't turn on both saveCPU and cosmicTrackSplitting at the same time")
228 mods = [(
"TrackSelector",
"Alignment", {
"method":
"load"}),
229 (
"TrackRefitter",
"First", {
"method":
"load",
231 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
232 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"})]
233 options[
"TrackSelector"][
"Alignment"].
update(
234 options[
"TrackSelector"][
"HighPurity"])
235 elif cosmicTrackSplitting:
236 mods = [(
"TrackRefitter",
"First", {
"method":
"load",
238 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
239 (
"TrackSplitting",
"TrackSplitting", {
"method":
"load"}),
240 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
241 (
"TrackRefitter",
"Second", {
"method":
"load",
244 mods = [(
"TrackSelector",
"HighPurity", {
"method":
"import"}),
245 (
"TrackRefitter",
"First", {
"method":
"load",
247 (
"TrackHitFilter",
"Tracker", {
"method":
"load"}),
248 (
"TrackFitter",
"HitFilteredTracks", {
"method":
"import"}),
249 (
"TrackSelector",
"Alignment", {
"method":
"load"}),
250 (
"TrackRefitter",
"Second", {
"method":
"load",
252 if isCosmics: mods = mods[1:]
259 if momentumConstraint
is not None:
260 for mod
in options[
"TrackRefitter"]:
261 options[
"TrackRefitter"][mod].
update({
262 "constraint":
"momentum",
263 "srcConstr": momentumConstraint
271 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
282 for mod
in mods[:-1]:
283 src, prevsrc =
_getModule(process, src, mod[0],
"".
join(reversed(mod[:-1])),
284 options[mod[0]][mod[1]], isCosmics = isCosmics, prevsrc = prevsrc,
286 modules.append(getattr(process, src))
288 if mods[-1][-1][
"method"]
is "load" and \
289 not mods[-1][-1].
get(
"clone",
False):
290 print "Name of the last module needs to be modifiable." 292 src =
_getModule(process, src, mods[-1][0],
"FinalTrackRefitter",
293 options[mods[-1][0]][mods[-1][1]],
294 isCosmics = isCosmics, **(mods[-1][2]))
295 modules.append(getattr(process, src))
297 moduleSum = process.offlineBeamSpot
298 for module
in modules: moduleSum += module
300 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)