16def InDetCommonCfg(flags, **kwargs):
17 """Main config for common ID track decorations"""
18
19 acc = ComponentAccumulator()
20 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
21
22 have_PV_container = (
23 flags.Beam.Type is not BeamType.Cosmics and
24 (any('PrimaryVertices' in elements for elements
25 in flags.Input.TypedCollections)))
26 if not have_PV_container and kwargs['DoVertexFinding']:
27 have_PV_container = (
28 any('PixelRDOs' in elements for elements
29 in flags.Input.TypedCollections) or
30 any('SCT_RDOs' in elements for elements in
31 flags.Input.TypedCollections))
32
33 if have_PV_container:
34
35
36
37 from DerivationFrameworkInDet.InDetToolsConfig import (
38 InDetTrackSelectionToolWrapperCfg)
39 DFCommonTrackSelection = acc.getPrimaryAndMerge(
40 InDetTrackSelectionToolWrapperCfg(
41 flags,
42 name = "DFCommonTrackSelection",
43 CutLevel = "TightPrimary",
44 DecorationName = "DFCommonTightPrimary"))
45
46 if kwargs['AddPseudoTracks']:
47 from DerivationFrameworkInDet.InDetToolsConfig import (
48 PseudoTrackSelectorCfg)
49 PseudoTrackSelectorTool = acc.getPrimaryAndMerge(
50 PseudoTrackSelectorCfg(
51 flags,
52 name = "PseudoTrackSelectorTool",
53 RecoTrackParticleLocation = "InDetTrackParticles",
54 PseudoTrackParticleLocation = "InDetPseudoTrackParticles",
55 OutputRecoReplacedWithPseudo = "InDetReplacedWithPseudoTrackParticles",
56 OutputRecoReplacedWithPseudoFromB = "InDetReplacedWithPseudoFromBTrackParticles",
57 OutputRecoReplacedWithPseudoNotFromB = "InDetReplacedWithPseudoNotFromBTrackParticles",
58 OutputRecoPlusPseudo = "InDetPlusPseudoTrackParticles",
59 OutputRecoPlusPseudoFromB = "InDetPlusPseudoFromBTrackParticles",
60 OutputRecoPlusPseudoNotFromB = "InDetPlusPseudoNotFromBTrackParticles",
61 OutputRecoNoFakes = "InDetNoFakesTrackParticles",
62 OutputRecoNoFakesFromB = "InDetNoFakesFromBTrackParticles",
63 OutputRecoNoFakesNotFromB = "InDetNoFakesNotFromBTrackParticles"))
64
65 acc.addEventAlgo(CommonAugmentation(
66 "InDetSelectedPseudo",
67 AugmentationTools=[PseudoTrackSelectorTool]))
68
69
70
71
72 from DerivationFrameworkInDet.InDetToolsConfig import (
73 TrackParametersAtPVCfg)
74 DFCommonZ0AtPV = acc.getPrimaryAndMerge(TrackParametersAtPVCfg(
75 flags,
76 name = "DFCommonZ0AtPV",
77 TrackParticleContainerName = "InDetTrackParticles",
78 VertexContainerName = "PrimaryVertices",
79 Z0SGEntryName = "DFCommonInDetTrackZ0AtPV"))
80
81
82
83
84 from InDetConfig.InDetHardScatterSelectionToolConfig import (
85 InDetHardScatterSelectionToolCfg)
86 DFCommonHSSelectionTool = acc.popToolsAndMerge(
87 InDetHardScatterSelectionToolCfg(flags,
88 name="DFCommonHSSelectionTool"))
89 acc.addPublicTool(DFCommonHSSelectionTool)
90
91 from DerivationFrameworkInDet.InDetToolsConfig import HardScatterVertexDecoratorCfg
92 acc.merge(HardScatterVertexDecoratorCfg(flags))
93
94
95
96
97 from InDetConfig.InDetUsedInFitTrackDecoratorToolConfig import (
98 InDetUsedInFitTrackDecoratorToolCfg)
99 DFCommonUsedInFitDecoratorTool = acc.popToolsAndMerge(
100 InDetUsedInFitTrackDecoratorToolCfg(
101 flags,
102 name = "DFCommonUsedInFitDecoratorTool",
103 AMVFVerticesDecoName = "TTVA_AMVFVertices",
104 AMVFWeightsDecoName = "TTVA_AMVFWeights",
105 TrackContainer = "InDetTrackParticles",
106 VertexContainer = "PrimaryVertices"))
107 acc.addPublicTool(DFCommonUsedInFitDecoratorTool)
108
109 from DerivationFrameworkInDet.InDetToolsConfig import (
110 UsedInVertexFitTrackDecoratorCfg)
111 DFCommonUsedInFitDecorator = acc.getPrimaryAndMerge(
112 UsedInVertexFitTrackDecoratorCfg(
113 flags,
114 name="DFCommonUsedInFitDecorator",
115 UsedInFitDecoratorTool=DFCommonUsedInFitDecoratorTool))
116
117 if kwargs['AddPseudoTracks']:
118 PseudoTrackContainers = [
119 "InDetPseudoTrackParticles",
120 "InDetReplacedWithPseudoTrackParticles",
121 "InDetReplacedWithPseudoFromBTrackParticles",
122 "InDetReplacedWithPseudoNotFromBTrackParticles",
123 "InDetPlusPseudoTrackParticles",
124 "InDetPlusPseudoFromBTrackParticles",
125 "InDetPlusPseudoNotFromBTrackParticles",
126 "InDetNoFakesTrackParticles",
127 "InDetNoFakesFromBTrackParticles",
128 "InDetNoFakesNotFromBTrackParticles"
129 ]
130 PseudoTrackDecorators = []
131 for t in PseudoTrackContainers:
132 InDetDecorator = acc.popToolsAndMerge(
133 InDetUsedInFitTrackDecoratorToolCfg(
134 flags,
135 name="DFCommonUsedInFitDecoratorTool" +
136 t.replace(
'InDetPseudo',
'Pseudo').
replace(
137 'InDet',
'Reco').
replace(
'TrackParticles',
''),
138 AMVFVerticesDecoName="TTVA_AMVFVertices",
139 AMVFWeightsDecoName="TTVA_AMVFWeights",
140 TrackContainer=t,
141 VertexContainer="PrimaryVertices"))
142 DerivDecorator = acc.getPrimaryAndMerge(
143 UsedInVertexFitTrackDecoratorCfg(
144 flags,
145 name="DFCommonUsedInFitDecorator" +
146 t.replace(
'InDetPseudo',
'Pseudo').
replace(
147 'InDet',
'Reco').
replace(
'TrackParticles',
''),
148 UsedInFitDecoratorTool=InDetDecorator))
149 PseudoTrackDecorators.append(DerivDecorator)
150
151
152 if (kwargs['DecoLRTTTVA'] and kwargs['DoR3LargeD0'] and
153 kwargs['StoreSeparateLargeD0Container']):
154
155
156
157
158 DFCommonUsedInFitDecoratorToolLRT = acc.popToolsAndMerge(
159 InDetUsedInFitTrackDecoratorToolCfg(
160 flags,
161 name = "DFCommonUsedInFitDecoratorToolLRT",
162 AMVFVerticesDecoName = "TTVA_AMVFVertices",
163 AMVFWeightsDecoName = "TTVA_AMVFWeights",
164 TrackContainer = "InDetLargeD0TrackParticles",
165 VertexContainer = "PrimaryVertices"))
166
167 DFCommonUsedInFitDecoratorLRT = acc.getPrimaryAndMerge(
168 UsedInVertexFitTrackDecoratorCfg(
169 flags,
170 name="DFCommonUsedInFitDecoratorLRT",
171 UsedInFitDecoratorTool=DFCommonUsedInFitDecoratorToolLRT))
172
173
174
175 for tool in [DFCommonTrackSelection,
176 DFCommonZ0AtPV,
177 DFCommonUsedInFitDecorator,
178 DFCommonUsedInFitDecoratorLRT]:
179 acc.addEventAlgo(CommonAugmentation("InDetCommonKernel"+tool.name,
180 AugmentationTools=[tool]))
181 else:
182 AugTools = [DFCommonTrackSelection,
183 DFCommonZ0AtPV,
184 DFCommonUsedInFitDecorator]
185 if kwargs['AddPseudoTracks']:
186 AugTools += PseudoTrackDecorators
187 for tool in AugTools:
188 acc.addEventAlgo(CommonAugmentation("InDetCommonKernel"+tool.name,
189 AugmentationTools=[tool]))
190
191
192 if (kwargs['MergeLRT'] and kwargs['DoR3LargeD0'] and
193 kwargs['StoreSeparateLargeD0Container']):
194
195
196
197 from DerivationFrameworkInDet.InDetToolsConfig import InDetLRTMergeCfg
198 acc.merge(InDetLRTMergeCfg(flags))
199
200 return acc
std::string replace(std::string s, const std::string &s2, const std::string &s3)