ATLAS Offline Software
MuonD3PDObject.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 
4 from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
5 from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation
6 from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 D3PD = CompFactory.D3PD
10 
11 
12 MuonD3PDObject = \
13  make_SGDataVector_D3PDObject ('DataVector<xAOD::Muon_v1>',
14  D3PDMakerFlags.MuonSGKey,
15  'mu_', 'MuonD3PDObject')
16 
17 MuonD3PDObject.defineBlock (0, 'Kinematics',
19  WriteRect = True,
20  WriteE = True,
21  WriteM = True)
22 MuonD3PDObject.defineBlock (
23  0, 'AllAuthor',
25  Vars = ['allauthor = allAuthors'])
26 
27 MuonD3PDObject.defineBlock (
28  1, 'Authors',
30  Vars = ['author'])
31 MuonD3PDObject.defineBlock (1, 'NumberOfSegments',
33 
34 MuonD3PDObject.defineBlock (
35  1, 'Isolation',
37  Vars = ['etcone20 < float: 0',
38  'etcone30 < float: 0',
39  'etcone40 < float: 0',
40  'ptcone20 < float: 0',
41  'ptcone30 < float: 0',
42  'ptcone40 < float: 0',
43  'scatteringCurvatureSignificance < float: 0',
44  'scatteringNeighbourSignificance < float: 0',
45  'momentumBalanceSignificance < float: 0'])
46 
47 MuonD3PDObject.defineBlock (
48  1, 'CaloEnergyLoss',
50  Vars = ['energyLossType'])
51 MuonD3PDObject.defineBlock (
52  1, 'MuonType',
54  Vars = ['muonType'])
55 
56 MuonD3PDObject.defineBlock (2, 'MuonHitSummary',
58 
59 MuonD3PDObject.defineBlock (
60  2, 'MuonSpectrometerHitSummary',
62  Vars = ['primarySector',
63  'secondarySector',
64  'innerSmallHits',
65  'innerLargeHits',
66  'middleSmallHits',
67  'middleLargeHits',
68  'outerSmallHits',
69  'outerLargeHits',
70  'extendedSmallHits',
71  'extendedLargeHits',
72  'innerSmallHoles',
73  'innerLargeHoles',
74  'middleSmallHoles',
75  'middleLargeHoles',
76  'outerSmallHoles',
77  'outerLargeHoles',
78  'extendedSmallHoles',
79  'extendedLargeHoles',
80  'phiLayer1Hits',
81  'phiLayer2Hits',
82  'phiLayer3Hits',
83  'phiLayer4Hits',
84  'etaLayer1Hits',
85  'etaLayer2Hits',
86  'etaLayer3Hits',
87  'etaLayer4Hits',
88  'phiLayer1Holes',
89  'phiLayer2Holes',
90  'phiLayer3Holes',
91  'phiLayer4Holes',
92  'etaLayer1Holes',
93  'etaLayer2Holes',
94  'etaLayer3Holes',
95  'etaLayer4Holes',
96  ])
97 
98 MuonD3PDObject.defineBlock (
99  4, 'MuonSpectrometerFieldIntegral',
101  Vars = ['MSFieldIntegral = spectrometerFieldIntegral < float: 0'])
102 
103 
104 
107 
108 
109 MuonTPAssoc = SimpleAssociation \
110  (MuonD3PDObject,
112  matched = 'hastrack',
113  blockname = 'TrkInfo')
114 MuonTPAssoc.defineBlock (
115  0, 'Charge',
116  # TrackD3PDMaker
118 TrackParticlePerigeeAssoc = SimpleAssociation \
119  (MuonTPAssoc,
120  # TrackD3PDMaker
122  prefix = 'track',
123  blockname = 'TrackParticlePerigeeAssoc')
124 TrackParticlePerigeeAssoc.defineBlock (1, 'TrkParameters',
125  # TrackD3PDMaker
127 
128 TrackParticleCovarAssoc = SimpleAssociation (TrackParticlePerigeeAssoc,
129  # TrackD3PDMaker
131  blockname = 'TrackParticleCovarAssoc')
132 TrackParticleCovarAssoc.defineBlock (1, 'TrkCovDiag',
133  # TrackD3PDMaker
135  IsTrackPerigee = True,
136  Error = False,
137  DiagCovariance = True)
138 TrackParticleCovarAssoc.defineBlock (2, 'TrkCovOffDiag',
139  # TrackD3PDMaker
141  IsTrackPerigee = True,
142  Error = False,
143  OffDiagCovariance = True)
144 
145 MuonTPAssoc.defineBlock (
146  2, 'TrkFitQuality',
148  Vars = ['chi2 = chiSquared',
149  'ndof = numberDoF'],
150  prefix = 'trackfit')
151 
152 
153 MuonIDTPAssoc = SimpleAssociation \
154  (MuonD3PDObject,
156  blockname = 'TrkInfoInDet',
157  Type = 'InDet')
158 
159 if not D3PDMakerFlags.Muons.doSingleMuons:
160  #
161  # Impact parameter variables. Use the ID track for this.
162  # These are likely not very useful for standalone muons anyway.
163  #
164  from TrackD3PDMaker.TrackParticleImpactParameters \
165  import TrackParticleImpactParameters
166  TrackParticleImpactParameters (MuonIDTPAssoc)
167 
168 
169 MuonPVPerigeeAssoc = SimpleAssociation (
170  MuonTPAssoc,
171  # TrackD3PDMaker
173  suffix = '_exPV',
174  blockname = 'MuonPVPerigeeAssoc')
175 def _trackToVertexHook (c, flags, acc, *args, **kw):
176  from TrackToVertex.TrackToVertexConfig import InDetTrackToVertexCfg
177  c.Associator.TrackToVertexTool = acc.popToolsAndMerge (InDetTrackToVertexCfg (flags))
178  return
179 MuonPVPerigeeAssoc.defineHook (_trackToVertexHook)
180 MuonPVPerigeeAssoc.defineBlock (
181  1, 'ParametersAtPV',
182  # TrackD3PDMaker
184 MuonPVCovarAssoc = SimpleAssociation (
185  MuonPVPerigeeAssoc,
186  # TrackD3PDMaker
188  blockname = 'MuonPVCovarAssoc')
189 MuonPVCovarAssoc.defineBlock (
190  1, 'PrimaryTrackDiagonalCovarianceAtPV',
191  # TrackD3PDMaker
193  IsTrackPerigee = True,
194  Error = True)
195 MuonPVCovarAssoc.defineBlock (
196  1, 'PrimaryTrackOffDiagonalCovarianceAtPV',
197  # TrackD3PDMaker
199  IsTrackPerigee = True,
200  Error = False,
201  OffDiagCovariance = True)
202 
203 MuonCBTPAssoc = SimpleAssociation \
204  (MuonD3PDObject,
206  Type = 'Combined',
207  prefix = 'cb_',
208  blockname = 'CBTrkInfo')
209 MuonCBPVPerigeeAssoc = SimpleAssociation (
210  MuonCBTPAssoc,
211  # TrackD3PDMaker
213  suffix = '_exPV',
214  blockname = 'MuonCBPVPerigeeAssoc')
215 MuonCBPVPerigeeAssoc.defineHook (_trackToVertexHook)
216 MuonCBPVPerigeeAssoc.defineBlock (
217  1, 'CBParametersAtPV',
218  # TrackD3PDMaker
220 
221 MuonIDTPAssoc = SimpleAssociation \
222  (MuonD3PDObject,
224  Type = 'InDet',
225  prefix = 'id_',
226  blockname = 'IDTrkInfo')
227 MuonIDPerigeeAssoc = SimpleAssociation (
228  MuonIDTPAssoc,
229  # TrackD3PDMaker
231  blockname = 'MuonIDPerigeeAssoc')
232 MuonIDPerigeeAssoc.defineBlock (
233  1, 'IDParameters',
234  # TrackD3PDMaker
236 MuonIDPVPerigeeAssoc = SimpleAssociation (
237  MuonIDTPAssoc,
238  # TrackD3PDMaker
240  suffix = '_exPV',
241  blockname = 'MuonIDPVPerigeeAssoc')
242 MuonIDPVPerigeeAssoc.defineHook (_trackToVertexHook)
243 MuonIDPVPerigeeAssoc.defineBlock (
244  1, 'IDParametersAtPV',
245  # TrackD3PDMaker
247 
248 MuonIDPVCovarAssoc = SimpleAssociation (
249  MuonIDPVPerigeeAssoc,
250  # TrackD3PDMaker
252  blockname = 'MuonIDPVCovarAssoc')
253 MuonIDPVCovarAssoc.defineBlock (
254  2, 'IDTrackDiagonalCovarianceAtPV',
255  # TrackD3PDMaker
257  IsTrackPerigee = True,
258  Error = True)
259 MuonIDPVCovarAssoc.defineBlock (
260  3, 'IDTrackOffDiagonalCovarianceAtPV',
261  # TrackD3PDMaker
263  IsTrackPerigee = True,
264  Error = False,
265  OffDiagCovariance = True)
266 
267 
268 MuonMETPAssoc = SimpleAssociation \
269  (MuonD3PDObject,
271  Type = 'MuonSpectrometer',
272  prefix = 'me_',
273  blockname = 'METrkInfo')
274 MuonMEPerigeeAssoc = SimpleAssociation (
275  MuonMETPAssoc,
276  # TrackD3PDMaker
278 MuonMEPerigeeAssoc.defineBlock (
279  1, 'MEParametersAt',
280  # TrackD3PDMaker
282 MuonMEPVPerigeeAssoc = SimpleAssociation (
283  MuonMETPAssoc,
284  # TrackD3PDMaker
286  suffix = '_exPV',
287  blockname = 'MuonMEPVPerigeeAssoc')
288 MuonMEPVPerigeeAssoc.defineHook (_trackToVertexHook)
289 MuonMEPVPerigeeAssoc.defineBlock (
290  1, 'MEParametersAtPV',
291  # TrackD3PDMaker
293 
294 MuonMEPVCovarAssoc = SimpleAssociation (
295  MuonMEPVPerigeeAssoc,
296  # TrackD3PDMaker
298  blockname = 'MuonMEPVCovarAssoc')
299 MuonMEPVCovarAssoc.defineBlock (
300  2, 'METrackDiagonalCovarianceAtPV',
301  # TrackD3PDMaker
303  IsTrackPerigee = True,
304  Error = True)
305 MuonMEPVCovarAssoc.defineBlock (
306  3, 'METrackOffDiagonalCovarianceAtPV',
307  # TrackD3PDMaker
309  IsTrackPerigee = True,
310  Error = False,
311  OffDiagCovariance = True)
312 
313 
314 
317 if D3PDMakerFlags.DoTruth:
318  truthClassification = \
319  MuonD3PDObject.defineBlock (1, 'TruthClassification',
321  def _truthClassificationHook (c, flags, acc, *args, **kw):
322  from TruthD3PDMaker.MCTruthClassifierConfig \
323  import D3PDMCTruthClassifierCfg
324  acc.merge (D3PDMCTruthClassifierCfg (flags))
325  c.Classifier = acc.getPublicTool ('D3PDMCTruthClassifier')
326  return
327  truthClassification.defineHook (_truthClassificationHook)
328 
329  MuonTruthPartAssoc = SimpleAssociation \
330  (MuonD3PDObject,
332  blockname = 'TruthAssoc',
333  DRVar = 'dr')
334  def _truthClassificationAssocHook (c, flags, acc, *args, **kw):
335  from TruthD3PDMaker.MCTruthClassifierConfig \
336  import D3PDMCTruthClassifierCfg
337  acc.merge (D3PDMCTruthClassifierCfg (flags))
338  c.Associator.Classifier = acc.getPublicTool ('D3PDMCTruthClassifier')
339  return
340  MuonTruthPartAssoc.defineHook (_truthClassificationAssocHook)
341  MuonTruthPartAssoc.defineBlock (0, 'TruthKin',
343  WriteE = True,
344  WriteM = False,
345  prefix = 'truth_')
346  MuonTruthPartAssoc.defineBlock (0, 'Truth',
348  PDGIDVariable = 'type',
349  prefix = 'truth_')
350  MuonTruthPartMotherAssoc = SimpleAssociation \
351  (MuonTruthPartAssoc,
353  # TruthD3PDMaker
355  ('MuonTruthPartMotherAssoc2'),
356  blockname = 'MuonTruthPartMotherAssoc',
357  prefix = 'truth_mother')
358  MuonTruthPartMotherAssoc.defineBlock (0, 'MotherTruth',
359  # TruthD3PDMaker
361  PDGIDVariable = 'type')
362  MuonTruthPartAssoc.defineBlock (0, 'TruthAssocIndex',
364  prefix = 'mc_',
365  Target = 'mc_')
366 
367 
D3PD::MuonTrackParticleAssociationTool
Associate from an Muon to its primary TrackParticle.
Definition: MuonTrackParticleAssociationTool.h:34
python.MuonD3PDObject._truthClassificationAssocHook
def _truthClassificationAssocHook(c, flags, acc, *args, **kw)
Definition: MuonD3PDObject.py:334
D3PD::AuxDataFillerTool
Copy aux data to D3PD.
Definition: AuxDataFillerTool.h:35
D3PD::PerigeeFillerTool
Definition: PerigeeFillerTool.h:15
D3PD::CovarianceFillerTool
Block filler tool for error and covariance matrix.
Definition: CovarianceFillerTool.h:31
D3PD::TruthParticleFillerTool
Definition: TruthParticleFillerTool.h:27
D3PD::PerigeeCovarianceAssociationTool
Associate from a Perigee to its ErrorMatrix.
Definition: PerigeeCovarianceAssociationTool.h:28
python.MuonD3PDObject._trackToVertexHook
def _trackToVertexHook(c, flags, acc, *args, **kw)
Definition: MuonD3PDObject.py:175
D3PD::TrackParticlePerigeeAtOOAssociationTool
Associate from a TrackParticle to its default Perigee.
Definition: TrackParticlePerigeeAtOOAssociationTool.h:32
D3PD::MuonTrkHitFillerTool
Definition: MuonTrkHitFillerTool.h:20
D3PD::MuonTruthClassificationFillerTool
Definition: MuonTruthClassificationFillerTool.h:25
D3PD::FirstAssociationTool
Choose the first result from a multiple association.
Definition: FirstAssociationTool.h:39
D3PD::MuonGenParticleAssociationTool
Associate from an electron/photon to a matched GenParticle via classification tool.
Definition: MuonGenParticleAssociationTool.h:37
D3PD::TrackParticleChargeFillerTool
Definition: TrackParticleChargeFillerTool.h:26
python.MuonD3PDObject._truthClassificationHook
def _truthClassificationHook(c, flags, acc, *args, **kw)
Definition: MuonD3PDObject.py:321
D3PD::FourMomFillerTool
Block filler tool for a four-momentum.
Definition: FourMomFillerTool.h:56
D3PD::TruthParticleParentAssociationTool
Associate all particles within a DR cut.
Definition: TruthParticleParentAssociationTool.h:37
D3PD::TrackParticlePerigeeAtPVAssociationTool
Associate from a VxCandidate to its perigee at primary vertex.
Definition: TrackParticlePerigeeAtPVAssociationTool.h:33
D3PD::MuonNumberOfSegmentsFillerTool
Fill number of muon segments.
Definition: MuonNumberOfSegmentsFillerTool.h:33
D3PD::IndexFillerTool
Fill an index of an object within a container.
Definition: IndexFillerTool.h:32