CMS 3D CMS Logo

conversionTrackSequence_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 import RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi
4 import RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi
5 
6 # Conversion Track candidate producer
8 # Conversion Track producer ( final fit )
11 
12 ckfTracksFromConversionsTask = cms.Task(conversionTrackCandidates,ckfOutInTracksFromConversions,ckfInOutTracksFromConversions)
13 ckfTracksFromConversions = cms.Sequence(ckfTracksFromConversionsTask)
14 
15 oldegConversionTrackCandidates = conversionTrackCandidates.clone(
16  scHybridBarrelProducer = "correctedHybridSuperClusters",
17  bcBarrelCollection = "hybridSuperClusters:hybridBarrelBasicClusters",
18  scIslandEndcapProducer = "correctedMulti5x5SuperClustersWithPreshower",
19  bcEndcapCollection = "multi5x5SuperClusters:multi5x5EndcapBasicClusters"
20 )
21 ckfOutInTracksFromOldEGConversions = ckfOutInTracksFromConversions.clone(
22  src = 'oldegConversionTrackCandidates:outInTracksFromConversions',
23  producer = 'oldegConversionTrackCandidates',
24  ComponentName = 'ckfOutInTracksFromOldEGConversions'
25 )
26 ckfInOutTracksFromOldEGConversions = ckfInOutTracksFromConversions.clone(
27  src = 'oldegConversionTrackCandidates:inOutTracksFromConversions',
28  producer = 'oldegConversionTrackCandidates',
29  ComponentName = 'ckfInOutTracksFromOldEGConversions'
30 )
31 ckfTracksFromOldEGConversionsTask = cms.Task(oldegConversionTrackCandidates,ckfOutInTracksFromOldEGConversions,ckfInOutTracksFromOldEGConversions)
32 ckfTracksFromOldEGConversions = cms.Sequence(ckfTracksFromOldEGConversionsTask)
33 #producer from general tracks collection, set tracker only, merged arbitrated, merged arbitrated ecal/general flags
34 generalConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
35  TrackProducer = 'generalTracks',
36  setTrackerOnly = True,
37  setArbitratedMergedEcalGeneral = True,
38 )
39 
40 #fastSim
41 from Configuration.Eras.Modifier_fastSim_cff import fastSim
42 # the conversion producer depends on trajectories
43 # so we feed it with the 'before mixing' track collection
44 generalConversionTrackProducerTmp = generalConversionTrackProducer.clone(
45  TrackProducer = 'generalTracksBeforeMixing')
46 
47 # then we need to fix the track references, so that they point to the final track collection, after mixing
48 import FastSimulation.Tracking.ConversionTrackRefFix_cfi
49 _fastSim_conversionTrackRefFix = FastSimulation.Tracking.ConversionTrackRefFix_cfi.fixedConversionTracks.clone(
50  src = "generalConversionTrackProducerTmp")
51 fastSim.toReplaceWith(generalConversionTrackProducer,
52  _fastSim_conversionTrackRefFix)
53 
54 
55 #producer from conversionStep tracks collection, set tracker only, merged arbitrated, merged arbitrated ecal/general flags
56 conversionStepConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
57  TrackProducer = 'conversionStepTracks',
58  setTrackerOnly = True,
59  setArbitratedMergedEcalGeneral = True,
60 )
61 
62 
63 #producer from inout ecal seeded tracks, set arbitratedecalseeded, mergedarbitratedecalgeneral and mergedarbitrated flags
64 inOutConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
65  TrackProducer = 'ckfInOutTracksFromConversions',
66  setArbitratedEcalSeeded = True,
67  setArbitratedMergedEcalGeneral = True,
68 )
69 
70 #producer from outin ecal seeded tracks, set arbitratedecalseeded, mergedarbitratedecalgeneral and mergedarbitrated flags
71 outInConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
72  TrackProducer = 'ckfOutInTracksFromConversions',
73  setArbitratedEcalSeeded = True,
74  setArbitratedMergedEcalGeneral = True,
75 )
76 
77 #producer from gsf tracks, set only mergedarbitrated flag (default behaviour)
78 gsfConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
79  TrackProducer = 'electronGsfTracks',
80  filterOnConvTrackHyp = False,
81 )
82 
83 conversionTrackProducersTask = cms.Task(generalConversionTrackProducer,conversionStepConversionTrackProducer,inOutConversionTrackProducer,outInConversionTrackProducer,gsfConversionTrackProducer)
84 conversionTrackProducers = cms.Sequence(conversionTrackProducersTask)
85 
86 inOutOldEGConversionTrackProducer = inOutConversionTrackProducer.clone(
87  TrackProducer = 'ckfInOutTracksFromOldEGConversions'
88 )
89 outInOldEGConversionTrackProducer = outInConversionTrackProducer.clone(
90  TrackProducer = 'ckfOutInTracksFromOldEGConversions'
91 )
92 oldegConversionTrackProducersTask = cms.Task(inOutOldEGConversionTrackProducer,outInOldEGConversionTrackProducer)
93 oldegConversionTrackProducers = cms.Sequence(oldegConversionTrackProducersTask)
94 #merge generalTracks and conversionStepTracks collections, with arbitration by nhits then chi^2/ndof for ecalseededarbitrated, mergedarbitratedecalgeneral and mergedarbitrated flags
95 generalConversionStepConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
96  TrackProducer1 = 'generalConversionTrackProducer',
97  TrackProducer2 = 'conversionStepConversionTrackProducer',
98  #prefer collection settings:
99  #-1: propagate output/flag from both input collections
100  # 0: propagate output/flag from neither input collection
101  # 1: arbitrate output/flag (remove duplicates by shared hits), give precedence to first input collection
102  # 2: arbitrate output/flag (remove duplicates by shared hits), give precedence to second input collection
103  # 3: arbitrate output/flag (remove duplicates by shared hits), arbitration first by number of hits, second by chisq/ndof
104  arbitratedMergedPreferCollection = 3,
105  arbitratedMergedEcalGeneralPreferCollection = 3,
106 )
107 
108 #merge two ecal-seeded collections, with arbitration by nhits then chi^2/ndof for ecalseededarbitrated, mergedarbitratedecalgeneral and mergedarbitrated flags
109 inOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
110  TrackProducer1 = 'inOutConversionTrackProducer',
111  TrackProducer2 = 'outInConversionTrackProducer',
112  #prefer collection settings:
113  #-1: propagate output/flag from both input collections
114  # 0: propagate output/flag from neither input collection
115  # 1: arbitrate output/flag (remove duplicates by shared hits), give precedence to first input collection
116  # 2: arbitrate output/flag (remove duplicates by shared hits), give precedence to second input collection
117  # 3: arbitrate output/flag (remove duplicates by shared hits), arbitration first by number of hits, second by chisq/ndof
118  arbitratedEcalSeededPreferCollection = 3,
119  arbitratedMergedPreferCollection = 3,
120  arbitratedMergedEcalGeneralPreferCollection = 3,
121 )
122 
123 #merge ecalseeded collections with collection from general tracks
124 #trackeronly flag is forwarded from the generaltrack-based collections
125 #ecalseeded flag is forwarded from the ecal seeded collection
126 #arbitratedmerged flag is set based on shared hit matching, arbitration by nhits then chi^2/ndof
127 #arbitratedmergedecalgeneral flag is set based on shared hit matching, precedence given to generalTracks
128 generalInOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
129  TrackProducer1 = 'inOutOutInConversionTrackMerger',
130  TrackProducer2 = 'generalConversionStepConversionTrackMerger',
131  arbitratedMergedPreferCollection = 3,
132  arbitratedMergedEcalGeneralPreferCollection = 2,
133 )
134 
135 #merge the result of the above with the collection from gsf tracks
136 #trackeronly, arbitratedmergedecalgeneral, and mergedecal flags are forwarded
137 #arbitratedmerged flag set based on overlap removal by shared hits, with precedence given to gsf tracks
138 gsfGeneralInOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
139  TrackProducer1 = 'generalInOutOutInConversionTrackMerger',
140  TrackProducer2 = 'gsfConversionTrackProducer',
141  arbitratedMergedPreferCollection = 2,
142 )
143 
144 #final output collection contains combination of generaltracks, ecal seeded tracks and gsf tracks, with overlaps removed by shared hits
145 #precedence is given first to gsf tracks, then to the combination of ecal seeded and general tracks
146 #overlaps between the ecal seeded track collections and between ecal seeded and general tracks are arbitrated first by nhits then by chi^2/dof
147 #(logic and much of the code is adapted from FinalTrackSelectors)
148 
149 conversionTrackMergersTask = cms.Task(inOutOutInConversionTrackMerger,generalConversionStepConversionTrackMerger,generalInOutOutInConversionTrackMerger,gsfGeneralInOutOutInConversionTrackMerger)
150 conversionTrackMergers = cms.Sequence(conversionTrackMergersTask)
151 
152 inOutOutInOldEGConversionTrackMerger = inOutOutInConversionTrackMerger.clone(
153  TrackProducer1 = 'inOutOldEGConversionTrackProducer',
154  TrackProducer2 = 'outInOldEGConversionTrackProducer'
155 )
156 generalInOutOutInOldEGConversionTrackMerger = generalInOutOutInConversionTrackMerger.clone(
157  TrackProducer1 = 'inOutOutInOldEGConversionTrackMerger'
158 )
159 gsfGeneralInOutOutInOldEGConversionTrackMerger = gsfGeneralInOutOutInConversionTrackMerger.clone(
160  TrackProducer1 = 'generalInOutOutInOldEGConversionTrackMerger'
161 )
162 oldegConversionTrackMergersTask = cms.Task(inOutOutInOldEGConversionTrackMerger,generalInOutOutInOldEGConversionTrackMerger,gsfGeneralInOutOutInOldEGConversionTrackMerger)
163 oldegConversionTrackMergers = cms.Sequence(oldegConversionTrackMergersTask)
164 
165 
166 conversionTrackTask = cms.Task(ckfTracksFromConversionsTask,conversionTrackProducersTask,conversionTrackMergersTask)
167 conversionTrackSequence = cms.Sequence(conversionTrackTask)
168 #merge the general tracks with the collection from gsf tracks
169 #arbitratedmerged flag set based on overlap removal by shared hits, with precedence given to gsf tracks
170 gsfGeneralConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
171  TrackProducer1 = 'generalConversionTrackProducer',
172  TrackProducer2 = 'gsfConversionTrackProducer',
173  arbitratedMergedPreferCollection = 2,
174 )
175 
176 #special sequence for fastsim which skips the ecal-seeded and conversionStep tracks for now
177 conversionTrackTaskNoEcalSeeded = cms.Task(generalConversionTrackProducer,gsfConversionTrackProducer,gsfGeneralConversionTrackMerger)
178 conversionTrackSequenceNoEcalSeeded = cms.Sequence(conversionTrackTaskNoEcalSeeded)
179 
180 _fastSim_conversionTrackTaskNoEcalSeeded = conversionTrackTaskNoEcalSeeded.copy()
181 _fastSim_conversionTrackTaskNoEcalSeeded.replace(generalConversionTrackProducer,cms.Task(generalConversionTrackProducerTmp,generalConversionTrackProducer))
182 fastSim.toReplaceWith(conversionTrackTaskNoEcalSeeded,_fastSim_conversionTrackTaskNoEcalSeeded)