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 oldegConversionTrackCandidates.scHybridBarrelProducer = cms.InputTag("correctedHybridSuperClusters")
17 oldegConversionTrackCandidates.bcBarrelCollection = cms.InputTag("hybridSuperClusters","hybridBarrelBasicClusters")
18 oldegConversionTrackCandidates.scIslandEndcapProducer = cms.InputTag("correctedMulti5x5SuperClustersWithPreshower")
19 oldegConversionTrackCandidates.bcEndcapCollection = cms.InputTag("multi5x5SuperClusters","multi5x5EndcapBasicClusters")
20 
21 ckfOutInTracksFromOldEGConversions = ckfOutInTracksFromConversions.clone()
22 ckfOutInTracksFromOldEGConversions.src = cms.InputTag('oldegConversionTrackCandidates','outInTracksFromConversions')
23 ckfOutInTracksFromOldEGConversions.producer = cms.string('oldegConversionTrackCandidates')
24 ckfOutInTracksFromOldEGConversions.ComponentName = cms.string('ckfOutInTracksFromOldEGConversions')
25 
26 ckfInOutTracksFromOldEGConversions = ckfInOutTracksFromConversions.clone()
27 ckfInOutTracksFromOldEGConversions.src = cms.InputTag('oldegConversionTrackCandidates','inOutTracksFromConversions')
28 ckfInOutTracksFromOldEGConversions.producer = cms.string('oldegConversionTrackCandidates')
29 ckfInOutTracksFromOldEGConversions.ComponentName = cms.string('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 = cms.string('generalTracks'),
36  setTrackerOnly = cms.bool(True),
37  setArbitratedMergedEcalGeneral = cms.bool(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 = cms.InputTag("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 = cms.string('conversionStepTracks'),
58  setTrackerOnly = cms.bool(True),
59  setArbitratedMergedEcalGeneral = cms.bool(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 = cms.string('ckfInOutTracksFromConversions'),
66  setArbitratedEcalSeeded = cms.bool(True),
67  setArbitratedMergedEcalGeneral = cms.bool(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 = cms.string('ckfOutInTracksFromConversions'),
73  setArbitratedEcalSeeded = cms.bool(True),
74  setArbitratedMergedEcalGeneral = cms.bool(True),
75 )
76 
77 #producer from gsf tracks, set only mergedarbitrated flag (default behaviour)
78 gsfConversionTrackProducer = RecoEgamma.EgammaPhotonProducers.conversionTrackProducer_cfi.conversionTrackProducer.clone(
79  TrackProducer = cms.string('electronGsfTracks'),
80  filterOnConvTrackHyp = cms.bool(False),
81 )
82 
83 conversionTrackProducersTask = cms.Task(generalConversionTrackProducer,conversionStepConversionTrackProducer,inOutConversionTrackProducer,outInConversionTrackProducer,gsfConversionTrackProducer)
84 conversionTrackProducers = cms.Sequence(conversionTrackProducersTask)
85 
86 inOutOldEGConversionTrackProducer = inOutConversionTrackProducer.clone()
87 inOutOldEGConversionTrackProducer.TrackProducer = cms.string('ckfInOutTracksFromOldEGConversions')
88 outInOldEGConversionTrackProducer = outInConversionTrackProducer.clone()
89 outInOldEGConversionTrackProducer.TrackProducer = cms.string('ckfOutInTracksFromOldEGConversions')
90 
91 oldegConversionTrackProducersTask = cms.Task(inOutOldEGConversionTrackProducer,outInOldEGConversionTrackProducer)
92 oldegConversionTrackProducers = cms.Sequence(oldegConversionTrackProducersTask)
93 #merge generalTracks and conversionStepTracks collections, with arbitration by nhits then chi^2/ndof for ecalseededarbitrated, mergedarbitratedecalgeneral and mergedarbitrated flags
94 generalConversionStepConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
95  TrackProducer1 = cms.InputTag('generalConversionTrackProducer'),
96  TrackProducer2 = cms.InputTag('conversionStepConversionTrackProducer'),
97  #prefer collection settings:
98  #-1: propagate output/flag from both input collections
99  # 0: propagate output/flag from neither input collection
100  # 1: arbitrate output/flag (remove duplicates by shared hits), give precedence to first input collection
101  # 2: arbitrate output/flag (remove duplicates by shared hits), give precedence to second input collection
102  # 3: arbitrate output/flag (remove duplicates by shared hits), arbitration first by number of hits, second by chisq/ndof
103  arbitratedMergedPreferCollection = cms.int32(3),
104  arbitratedMergedEcalGeneralPreferCollection = cms.int32(3),
105 )
106 
107 #merge two ecal-seeded collections, with arbitration by nhits then chi^2/ndof for ecalseededarbitrated, mergedarbitratedecalgeneral and mergedarbitrated flags
108 inOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
109  TrackProducer1 = cms.InputTag('inOutConversionTrackProducer'),
110  TrackProducer2 = cms.InputTag('outInConversionTrackProducer'),
111  #prefer collection settings:
112  #-1: propagate output/flag from both input collections
113  # 0: propagate output/flag from neither input collection
114  # 1: arbitrate output/flag (remove duplicates by shared hits), give precedence to first input collection
115  # 2: arbitrate output/flag (remove duplicates by shared hits), give precedence to second input collection
116  # 3: arbitrate output/flag (remove duplicates by shared hits), arbitration first by number of hits, second by chisq/ndof
117  arbitratedEcalSeededPreferCollection = cms.int32(3),
118  arbitratedMergedPreferCollection = cms.int32(3),
119  arbitratedMergedEcalGeneralPreferCollection = cms.int32(3),
120 )
121 
122 #merge ecalseeded collections with collection from general tracks
123 #trackeronly flag is forwarded from the generaltrack-based collections
124 #ecalseeded flag is forwarded from the ecal seeded collection
125 #arbitratedmerged flag is set based on shared hit matching, arbitration by nhits then chi^2/ndof
126 #arbitratedmergedecalgeneral flag is set based on shared hit matching, precedence given to generalTracks
127 generalInOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
128  TrackProducer1 = cms.InputTag('inOutOutInConversionTrackMerger'),
129  TrackProducer2 = cms.InputTag('generalConversionStepConversionTrackMerger'),
130  arbitratedMergedPreferCollection = cms.int32(3),
131  arbitratedMergedEcalGeneralPreferCollection = cms.int32(2),
132 )
133 
134 #merge the result of the above with the collection from gsf tracks
135 #trackeronly, arbitratedmergedecalgeneral, and mergedecal flags are forwarded
136 #arbitratedmerged flag set based on overlap removal by shared hits, with precedence given to gsf tracks
137 gsfGeneralInOutOutInConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
138  TrackProducer1 = cms.InputTag('generalInOutOutInConversionTrackMerger'),
139  TrackProducer2 = cms.InputTag('gsfConversionTrackProducer'),
140  arbitratedMergedPreferCollection = cms.int32(2),
141 )
142 
143 #final output collection contains combination of generaltracks, ecal seeded tracks and gsf tracks, with overlaps removed by shared hits
144 #precedence is given first to gsf tracks, then to the combination of ecal seeded and general tracks
145 #overlaps between the ecal seeded track collections and between ecal seeded and general tracks are arbitrated first by nhits then by chi^2/dof
146 #(logic and much of the code is adapted from FinalTrackSelectors)
147 
148 conversionTrackMergersTask = cms.Task(inOutOutInConversionTrackMerger,generalConversionStepConversionTrackMerger,generalInOutOutInConversionTrackMerger,gsfGeneralInOutOutInConversionTrackMerger)
149 conversionTrackMergers = cms.Sequence(conversionTrackMergersTask)
150 
151 inOutOutInOldEGConversionTrackMerger = inOutOutInConversionTrackMerger.clone()
152 inOutOutInOldEGConversionTrackMerger.TrackProducer1 = cms.InputTag('inOutOldEGConversionTrackProducer')
153 inOutOutInOldEGConversionTrackMerger.TrackProducer2 = cms.InputTag('outInOldEGConversionTrackProducer')
154 
155 generalInOutOutInOldEGConversionTrackMerger = generalInOutOutInConversionTrackMerger.clone()
156 generalInOutOutInOldEGConversionTrackMerger.TrackProducer1 = cms.InputTag('inOutOutInOldEGConversionTrackMerger')
157 
158 gsfGeneralInOutOutInOldEGConversionTrackMerger = gsfGeneralInOutOutInConversionTrackMerger.clone()
159 gsfGeneralInOutOutInOldEGConversionTrackMerger.TrackProducer1 = cms.InputTag('generalInOutOutInOldEGConversionTrackMerger')
160 
161 oldegConversionTrackMergersTask = cms.Task(inOutOutInOldEGConversionTrackMerger,generalInOutOutInOldEGConversionTrackMerger,gsfGeneralInOutOutInOldEGConversionTrackMerger)
162 oldegConversionTrackMergers = cms.Sequence(oldegConversionTrackMergersTask)
163 
164 
165 conversionTrackTask = cms.Task(ckfTracksFromConversionsTask,conversionTrackProducersTask,conversionTrackMergersTask)
166 conversionTrackSequence = cms.Sequence(conversionTrackTask)
167 #merge the general tracks with the collection from gsf tracks
168 #arbitratedmerged flag set based on overlap removal by shared hits, with precedence given to gsf tracks
169 gsfGeneralConversionTrackMerger = RecoEgamma.EgammaPhotonProducers.conversionTrackMerger_cfi.conversionTrackMerger.clone(
170  TrackProducer1 = cms.InputTag('generalConversionTrackProducer'),
171  TrackProducer2 = cms.InputTag('gsfConversionTrackProducer'),
172  arbitratedMergedPreferCollection = cms.int32(2),
173 )
174 
175 #special sequence for fastsim which skips the ecal-seeded and conversionStep tracks for now
176 conversionTrackTaskNoEcalSeeded = cms.Task(generalConversionTrackProducer,gsfConversionTrackProducer,gsfGeneralConversionTrackMerger)
177 conversionTrackSequenceNoEcalSeeded = cms.Sequence(conversionTrackTaskNoEcalSeeded)
178 
179 _fastSim_conversionTrackTaskNoEcalSeeded = conversionTrackTaskNoEcalSeeded.copy()
180 _fastSim_conversionTrackTaskNoEcalSeeded.replace(generalConversionTrackProducer,cms.Task(generalConversionTrackProducerTmp,generalConversionTrackProducer))
181 fastSim.toReplaceWith(conversionTrackTaskNoEcalSeeded,_fastSim_conversionTrackTaskNoEcalSeeded)