ATLAS Offline Software
MuonCombinedDebuggerTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MuonCombinedDebuggerTool
7 // AlgTool to dump ROOT TTree with debugging information to tune muon combined
8 // fit preselection
10 
12 
13 #include <TTree.h>
14 
15 #include "AthLinks/ElementLink.h"
16 #include "GaudiKernel/ConcurrencyFlags.h"
23 
24 namespace MuonCombined {
25 
26  MuonCombinedDebuggerTool::MuonCombinedDebuggerTool(const std::string& type, const std::string& name, const IInterface* parent) :
27  AthAlgTool(type, name, parent), m_histSvc("THistSvc", name), m_recoTree(nullptr) {
28  declareInterface<MuonCombinedDebuggerTool>(this);
29  }
30 
32  ATH_MSG_INFO("initialize " << name() << " for debugging purposes of the muon reconstruction");
33  ATH_CHECK(m_matchQuality.retrieve());
34  ATH_CHECK(m_truthToTrack.retrieve());
35  ATH_CHECK(m_histSvc.retrieve());
37  ATH_MSG_FATAL("Detected more than one thread, namaely "
39  << ", to run this tool. Which should never happen as the results will be a total desaster");
40  return StatusCode::FAILURE;
41  }
42  bookBranches();
43  return StatusCode::SUCCESS;
44  }
45 
47  if (m_recoTree) {
48  ATH_MSG_WARNING("bookBranches() must be called once only! No tree booked!");
49  return;
50  }
51 
52  m_recoTree = new TTree("reco", "reco");
53 
54  if (m_histSvc->regTree("/RECODEBUG/reco", m_recoTree).isFailure()) ATH_MSG_WARNING("problems registering TTree to THistSvc!");
55 
56  m_recoTree->Branch("eventNumber", &m_eventNumber, "eventNumber/I");
57 
58  // m_recoTree->Branch("mstrack_truth_nprecLayers", &m_mstrack_truth_nprecLayers);
59  // m_recoTree->Branch("mstrack_nprecLayers", &m_mstrack_nprecLayers);
60 
61  m_recoTree->Branch("mstrack_has_truth", &m_mstrack_has_truth);
62  m_recoTree->Branch("mstrack_has_truth_par", &m_mstrack_has_truth_par);
63  m_recoTree->Branch("mstrack_has_sa", &m_mstrack_has_sa);
64 
65  m_recoTree->Branch("mstrack_truth_id", &m_mstrack_truth_pdgid); // TODO Update variable name to be consistent
66  m_recoTree->Branch("mstrack_truth_barcode", &m_mstrack_truth_barcode); // FIXME barcode-based
67  m_recoTree->Branch("mstrack_truth_sur_x", &m_mstrack_truth_sur_x);
68  m_recoTree->Branch("mstrack_truth_sur_y", &m_mstrack_truth_sur_y);
69  m_recoTree->Branch("mstrack_truth_sur_z", &m_mstrack_truth_sur_z);
70  m_recoTree->Branch("mstrack_truth_d0", &m_mstrack_truth_d0);
71  m_recoTree->Branch("mstrack_truth_z0", &m_mstrack_truth_z0);
72  m_recoTree->Branch("mstrack_truth_phi0", &m_mstrack_truth_phi0);
73  m_recoTree->Branch("mstrack_truth_theta", &m_mstrack_truth_theta);
74  m_recoTree->Branch("mstrack_truth_qOverP", &m_mstrack_truth_qOverP);
75 
76  m_recoTree->Branch("mstrack_sur_x", &m_mstrack_sur_x);
77  m_recoTree->Branch("mstrack_sur_y", &m_mstrack_sur_y);
78  m_recoTree->Branch("mstrack_sur_z", &m_mstrack_sur_z);
79  m_recoTree->Branch("mstrack_d0", &m_mstrack_d0);
80  m_recoTree->Branch("mstrack_z0", &m_mstrack_z0);
81  m_recoTree->Branch("mstrack_phi0", &m_mstrack_phi0);
82  m_recoTree->Branch("mstrack_theta", &m_mstrack_theta);
83  m_recoTree->Branch("mstrack_qOverP", &m_mstrack_qOverP);
84  m_recoTree->Branch("mstrack_cov_d0", &m_mstrack_cov_d0);
85  m_recoTree->Branch("mstrack_cov_z0", &m_mstrack_cov_z0);
86  m_recoTree->Branch("mstrack_cov_phi0", &m_mstrack_cov_phi0);
87  m_recoTree->Branch("mstrack_cov_theta", &m_mstrack_cov_theta);
88  m_recoTree->Branch("mstrack_cov_qOverP", &m_mstrack_cov_qOverP);
89 
90  m_recoTree->Branch("mstrack_sa_sur_x", &m_mstrack_sa_sur_x);
91  m_recoTree->Branch("mstrack_sa_sur_y", &m_mstrack_sa_sur_y);
92  m_recoTree->Branch("mstrack_sa_sur_z", &m_mstrack_sa_sur_z);
93  m_recoTree->Branch("mstrack_sa_d0", &m_mstrack_sa_d0);
94  m_recoTree->Branch("mstrack_sa_z0", &m_mstrack_sa_z0);
95  m_recoTree->Branch("mstrack_sa_phi0", &m_mstrack_sa_phi0);
96  m_recoTree->Branch("mstrack_sa_theta", &m_mstrack_sa_theta);
97  m_recoTree->Branch("mstrack_sa_qOverP", &m_mstrack_sa_qOverP);
98  m_recoTree->Branch("mstrack_sa_cov_d0", &m_mstrack_sa_cov_d0);
99  m_recoTree->Branch("mstrack_sa_cov_z0", &m_mstrack_sa_cov_z0);
100  m_recoTree->Branch("mstrack_sa_cov_phi0", &m_mstrack_sa_cov_phi0);
101  m_recoTree->Branch("mstrack_sa_cov_theta", &m_mstrack_sa_cov_theta);
102  m_recoTree->Branch("mstrack_sa_cov_qOverP", &m_mstrack_sa_cov_qOverP);
103 
104  m_recoTree->Branch("idtrack_truth_id", &m_idtrack_truth_pdgid); // TODO Update variable name to be consistent
105  m_recoTree->Branch("idtrack_truth_barcode", &m_idtrack_truth_barcode); // FIXME barcode-based
106  m_recoTree->Branch("idtrack_has_truth", &m_idtrack_has_truth);
107  m_recoTree->Branch("idtrack_has_truth_par", &m_idtrack_has_truth_par);
108  m_recoTree->Branch("idtrack_truth_sur_x", &m_idtrack_truth_sur_x);
109  m_recoTree->Branch("idtrack_truth_sur_y", &m_idtrack_truth_sur_y);
110  m_recoTree->Branch("idtrack_truth_sur_z", &m_idtrack_truth_sur_z);
111  m_recoTree->Branch("idtrack_truth_d0", &m_idtrack_truth_d0);
112  m_recoTree->Branch("idtrack_truth_z0", &m_idtrack_truth_z0);
113  m_recoTree->Branch("idtrack_truth_phi0", &m_idtrack_truth_phi0);
114  m_recoTree->Branch("idtrack_truth_theta", &m_idtrack_truth_theta);
115  m_recoTree->Branch("idtrack_truth_qOverP", &m_idtrack_truth_qOverP);
116 
117  m_recoTree->Branch("idtrack_sur_x", &m_idtrack_sur_x);
118  m_recoTree->Branch("idtrack_sur_y", &m_idtrack_sur_y);
119  m_recoTree->Branch("idtrack_sur_z", &m_idtrack_sur_z);
120  m_recoTree->Branch("idtrack_d0", &m_idtrack_d0);
121  m_recoTree->Branch("idtrack_z0", &m_idtrack_z0);
122  m_recoTree->Branch("idtrack_phi0", &m_idtrack_phi0);
123  m_recoTree->Branch("idtrack_theta", &m_idtrack_theta);
124  m_recoTree->Branch("idtrack_qOverP", &m_idtrack_qOverP);
125  m_recoTree->Branch("idtrack_cov_d0", &m_idtrack_cov_d0);
126  m_recoTree->Branch("idtrack_cov_z0", &m_idtrack_cov_z0);
127  m_recoTree->Branch("idtrack_cov_phi0", &m_idtrack_cov_phi0);
128  m_recoTree->Branch("idtrack_cov_theta", &m_idtrack_cov_theta);
129  m_recoTree->Branch("idtrack_cov_qOverP", &m_idtrack_cov_qOverP);
130 
131  m_recoTree->Branch("ms_id_ichi2", &m_ms_id_ichi2);
132  m_recoTree->Branch("ms_id_indf", &m_ms_id_indf);
133  m_recoTree->Branch("ms_id_iprob", &m_ms_id_iprob);
134  m_recoTree->Branch("ms_id_ochi2", &m_ms_id_ochi2);
135  m_recoTree->Branch("ms_id_ondf", &m_ms_id_ondf);
136  m_recoTree->Branch("ms_id_oprob", &m_ms_id_oprob);
137  }
138 
140  const InDetCandidateCollection& inDetCandidates) {
141  fillMsBranches(muonCandidates);
142  fillIdBranches(inDetCandidates);
143  fillMsIdBranches(muonCandidates, inDetCandidates);
144  if (m_recoTree->Fill() == -1) { ATH_MSG_WARNING("problems writing reco debugging ttree!"); }
145  }
146 
148  const InDetCandidateCollection& inDetCandidates) {
149  m_ms_id_ochi2.clear();
150  m_ms_id_ondf.clear();
151  m_ms_id_oprob.clear();
152  m_ms_id_ichi2.clear();
153  m_ms_id_indf.clear();
154  m_ms_id_iprob.clear();
155  m_ms_id_ochi2.resize(muonCandidates.size());
156  m_ms_id_ondf.resize(muonCandidates.size());
157  m_ms_id_oprob.resize(muonCandidates.size());
158  m_ms_id_ichi2.resize(muonCandidates.size());
159  m_ms_id_indf.resize(muonCandidates.size());
160  m_ms_id_iprob.resize(muonCandidates.size());
161 
162  unsigned int imu = 0;
163  const EventContext& ctx = Gaudi::Hive::currentContext();
164  for (const auto* muonCandidate : muonCandidates) {
165  bool hasExtr = muonCandidate->extrapolatedTrack();
166 
167  for (const auto* inDetCandidate : inDetCandidates) {
168  // matching chi2s
169  double outerMatchChi2 = m_matchQuality->outerMatchChi2(*inDetCandidate->indetTrackParticle().track(),
170  muonCandidate->muonSpectrometerTrack(), ctx);
171  int outerMatchDoF =
172  m_matchQuality->outerMatchDOF(*inDetCandidate->indetTrackParticle().track(), muonCandidate->muonSpectrometerTrack());
173  double outerMatchProb = m_matchQuality->outerMatchProbability(*inDetCandidate->indetTrackParticle().track(),
174  muonCandidate->muonSpectrometerTrack(), ctx);
175  double innerMatchChi2 = -1;
176  int innerMatchDoF = -1;
177  double innerMatchProb = -1;
178  if (hasExtr) {
179  innerMatchChi2 = m_matchQuality->innerMatchChi2(*inDetCandidate->indetTrackParticle().track(),
180  *muonCandidate->extrapolatedTrack(), ctx);
181  innerMatchDoF =
182  m_matchQuality->innerMatchDOF(*inDetCandidate->indetTrackParticle().track(), *muonCandidate->extrapolatedTrack());
183  innerMatchProb = m_matchQuality->innerMatchProbability(*inDetCandidate->indetTrackParticle().track(),
184  *muonCandidate->extrapolatedTrack(), ctx);
185  }
186 
187  m_ms_id_ochi2[imu].push_back(outerMatchChi2);
188  m_ms_id_ondf[imu].push_back(outerMatchDoF);
189  m_ms_id_oprob[imu].push_back(outerMatchProb);
190  if (hasExtr) {
191  m_ms_id_ichi2[imu].push_back(innerMatchChi2);
192  m_ms_id_indf[imu].push_back(innerMatchDoF);
193  m_ms_id_iprob[imu].push_back(innerMatchProb);
194  } else {
195  m_ms_id_ichi2[imu].push_back(-1);
196  m_ms_id_indf[imu].push_back(-1);
197  m_ms_id_iprob[imu].push_back(-1);
198  }
199  }
200  imu++;
201  }
202  }
203 
205  // truth
206  m_idtrack_truth_pdgid.clear();
207  m_idtrack_truth_barcode.clear();
208  m_idtrack_has_truth.clear();
209  m_idtrack_has_truth_par.clear();
210  m_idtrack_truth_sur_x.clear();
211  m_idtrack_truth_sur_y.clear();
212  m_idtrack_truth_sur_z.clear();
213  m_idtrack_truth_d0.clear();
214  m_idtrack_truth_z0.clear();
215  m_idtrack_truth_phi0.clear();
216  m_idtrack_truth_theta.clear();
217  m_idtrack_truth_qOverP.clear();
218 
219  // id track
220  m_idtrack_sur_x.clear();
221  m_idtrack_sur_y.clear();
222  m_idtrack_sur_z.clear();
223  m_idtrack_d0.clear();
224  m_idtrack_z0.clear();
225  m_idtrack_phi0.clear();
226  m_idtrack_theta.clear();
227  m_idtrack_qOverP.clear();
228  m_idtrack_cov_d0.clear();
229  m_idtrack_cov_z0.clear();
230  m_idtrack_cov_phi0.clear();
231  m_idtrack_cov_theta.clear();
232  m_idtrack_cov_qOverP.clear();
233 
234  for (const auto* inDetCandidate : inDetCandidates) {
235  // id track
236  m_idtrack_sur_x.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->associatedSurface().center().x());
237  m_idtrack_sur_y.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->associatedSurface().center().y());
238  m_idtrack_sur_z.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->associatedSurface().center().z());
239  m_idtrack_d0.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->parameters()[Trk::d0]);
240  m_idtrack_z0.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->parameters()[Trk::z0]);
241  m_idtrack_phi0.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->parameters()[Trk::phi0]);
242  m_idtrack_theta.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->parameters()[Trk::theta]);
243  m_idtrack_qOverP.push_back(inDetCandidate->indetTrackParticle().track()->perigeeParameters()->parameters()[Trk::qOverP]);
244  const AmgSymMatrix(5)* covid = inDetCandidate->indetTrackParticle().track()->perigeeParameters()->covariance();
245  if (covid) {
246  m_idtrack_cov_d0.push_back((*covid)(Trk::d0, Trk::d0));
247  m_idtrack_cov_z0.push_back((*covid)(Trk::z0, Trk::z0));
248  m_idtrack_cov_phi0.push_back((*covid)(Trk::phi0, Trk::phi0));
249  m_idtrack_cov_theta.push_back((*covid)(Trk::theta, Trk::theta));
250  m_idtrack_cov_qOverP.push_back((*covid)(Trk::qOverP, Trk::qOverP));
251  } else {
252  m_idtrack_cov_d0.push_back(-1);
253  m_idtrack_cov_z0.push_back(-1);
254  m_idtrack_cov_phi0.push_back(-1);
255  m_idtrack_cov_theta.push_back(-1);
256  m_idtrack_cov_qOverP.push_back(-1);
257  }
258 
259  // truth
261  truthParticleLinkAcc("truthParticleLink");
262  if (truthParticleLinkAcc.isAvailable(inDetCandidate->indetTrackParticle())) {
264  truthParticleLinkAcc(inDetCandidate->indetTrackParticle());
265  if (truthLink.isValid()) {
266  m_idtrack_has_truth.push_back(1);
267  m_idtrack_truth_pdgid.push_back((*truthLink)->pdgId());
268  m_idtrack_truth_barcode.push_back(HepMC::barcode(*truthLink)); // FIXME barcode-based
269  const Trk::TrackParameters* perigee = m_truthToTrack->makePerigeeParameters(*truthLink);
270  if (perigee) {
271  m_idtrack_has_truth_par.push_back(1);
272  m_idtrack_truth_sur_x.push_back(perigee->associatedSurface().center().x());
273  m_idtrack_truth_sur_y.push_back(perigee->associatedSurface().center().y());
274  m_idtrack_truth_sur_z.push_back(perigee->associatedSurface().center().z());
275  m_idtrack_truth_d0.push_back(perigee->parameters()[Trk::d0]);
276  m_idtrack_truth_z0.push_back(perigee->parameters()[Trk::z0]);
277  m_idtrack_truth_phi0.push_back(perigee->parameters()[Trk::phi0]);
278  m_idtrack_truth_theta.push_back(perigee->parameters()[Trk::theta]);
279  m_idtrack_truth_qOverP.push_back(perigee->parameters()[Trk::qOverP]);
280  } else {
281  m_idtrack_has_truth_par.push_back(0);
282  m_idtrack_truth_sur_x.push_back(-1);
283  m_idtrack_truth_sur_y.push_back(-1);
284  m_idtrack_truth_sur_z.push_back(-1);
285  m_idtrack_truth_d0.push_back(-1);
286  m_idtrack_truth_z0.push_back(-1);
287  m_idtrack_truth_phi0.push_back(-1);
288  m_idtrack_truth_theta.push_back(-1);
289  m_idtrack_truth_qOverP.push_back(-1);
290  }
291  } else {
292  m_idtrack_has_truth.push_back(0);
293  m_idtrack_has_truth_par.push_back(0);
294  m_idtrack_truth_pdgid.push_back(0); // FIXME Create a constant for undefined PDGID?
295  m_idtrack_truth_barcode.push_back(HepMC::UNDEFINED_ID); // FIXME barcode-based
296  m_idtrack_truth_sur_x.push_back(-1);
297  m_idtrack_truth_sur_y.push_back(-1);
298  m_idtrack_truth_sur_z.push_back(-1);
299  m_idtrack_truth_d0.push_back(-1);
300  m_idtrack_truth_z0.push_back(-1);
301  m_idtrack_truth_phi0.push_back(-1);
302  m_idtrack_truth_theta.push_back(-1);
303  m_idtrack_truth_qOverP.push_back(-1);
304  }
305  } else {
306  m_idtrack_has_truth.push_back(0);
307  m_idtrack_has_truth_par.push_back(0);
308  m_idtrack_truth_pdgid.push_back(0); // FIXME Create a constant for undefined PDGID?
309  m_idtrack_truth_barcode.push_back(HepMC::UNDEFINED_ID); // FIXME barcode-based
310  m_idtrack_truth_sur_x.push_back(-1);
311  m_idtrack_truth_sur_y.push_back(-1);
312  m_idtrack_truth_sur_z.push_back(-1);
313  m_idtrack_truth_d0.push_back(-1);
314  m_idtrack_truth_z0.push_back(-1);
315  m_idtrack_truth_phi0.push_back(-1);
316  m_idtrack_truth_theta.push_back(-1);
317  m_idtrack_truth_qOverP.push_back(-1);
318  }
319  }
320  }
321 
323  // ms track
324  m_mstrack_sur_x.clear();
325  m_mstrack_sur_y.clear();
326  m_mstrack_sur_z.clear();
327  m_mstrack_d0.clear();
328  m_mstrack_z0.clear();
329  m_mstrack_phi0.clear();
330  m_mstrack_theta.clear();
331  m_mstrack_qOverP.clear();
332  m_mstrack_cov_d0.clear();
333  m_mstrack_cov_z0.clear();
334  m_mstrack_cov_phi0.clear();
335  m_mstrack_cov_theta.clear();
336  m_mstrack_cov_qOverP.clear();
337 
338  // sa track
339  m_mstrack_has_sa.clear();
340  m_mstrack_sa_sur_x.clear();
341  m_mstrack_sa_sur_y.clear();
342  m_mstrack_sa_sur_z.clear();
343  m_mstrack_sa_d0.clear();
344  m_mstrack_sa_z0.clear();
345  m_mstrack_sa_phi0.clear();
346  m_mstrack_sa_theta.clear();
347  m_mstrack_sa_qOverP.clear();
348  m_mstrack_sa_cov_d0.clear();
349  m_mstrack_sa_cov_z0.clear();
350  m_mstrack_sa_cov_phi0.clear();
351  m_mstrack_sa_cov_theta.clear();
352  m_mstrack_sa_cov_qOverP.clear();
353 
354  // truth
355  m_mstrack_has_truth.clear();
356  m_mstrack_has_truth_par.clear();
357  m_mstrack_truth_pdgid.clear();
358  m_mstrack_truth_barcode.clear();
359  m_mstrack_truth_sur_x.clear();
360  m_mstrack_truth_sur_y.clear();
361  m_mstrack_truth_sur_z.clear();
362  m_mstrack_truth_d0.clear();
363  m_mstrack_truth_z0.clear();
364  m_mstrack_truth_phi0.clear();
365  m_mstrack_truth_theta.clear();
366  m_mstrack_truth_qOverP.clear();
367 
368  for (const auto* muonCandidate : muonCandidates) {
369  bool hasExtr = muonCandidate->extrapolatedTrack();
370  const Trk::TrackParameters* muonPars = hasExtr ? muonCandidate->extrapolatedTrack()->perigeeParameters()
371  : muonCandidate->muonSpectrometerTrack().perigeeParameters();
372  if (!muonPars) {
373  ATH_MSG_WARNING("MuonCandidate without Perigee, skipping");
374  return;
375  }
376 
377  // ms track
378  m_mstrack_sur_x.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->associatedSurface().center().x());
379  m_mstrack_sur_y.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->associatedSurface().center().y());
380  m_mstrack_sur_z.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->associatedSurface().center().z());
381  m_mstrack_d0.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->parameters()[Trk::d0]);
382  m_mstrack_z0.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->parameters()[Trk::z0]);
383  m_mstrack_phi0.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->parameters()[Trk::phi0]);
384  m_mstrack_theta.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->parameters()[Trk::theta]);
385  m_mstrack_qOverP.push_back(muonCandidate->muonSpectrometerTrack().perigeeParameters()->parameters()[Trk::qOverP]);
386  const AmgSymMatrix(5)* cov = muonCandidate->muonSpectrometerTrack().perigeeParameters()->covariance();
387  if (cov) {
388  m_mstrack_cov_d0.push_back((*cov)(Trk::d0, Trk::d0));
389  m_mstrack_cov_z0.push_back((*cov)(Trk::z0, Trk::z0));
390  m_mstrack_cov_phi0.push_back((*cov)(Trk::phi0, Trk::phi0));
393  } else {
394  m_mstrack_cov_d0.push_back(-1);
395  m_mstrack_cov_z0.push_back(-1);
396  m_mstrack_cov_phi0.push_back(-1);
397  m_mstrack_cov_theta.push_back(-1);
398  m_mstrack_cov_qOverP.push_back(-1);
399  }
400 
401  // sa track
402  m_mstrack_has_sa.push_back(hasExtr);
403  if (hasExtr) {
404  m_mstrack_sa_sur_x.push_back(muonPars->associatedSurface().center().x());
405  m_mstrack_sa_sur_y.push_back(muonPars->associatedSurface().center().y());
406  m_mstrack_sa_sur_z.push_back(muonPars->associatedSurface().center().z());
407  m_mstrack_sa_d0.push_back(muonPars->parameters()[Trk::d0]);
408  m_mstrack_sa_z0.push_back(muonPars->parameters()[Trk::z0]);
409  m_mstrack_sa_phi0.push_back(muonPars->parameters()[Trk::phi0]);
410  m_mstrack_sa_theta.push_back(muonPars->parameters()[Trk::theta]);
411  m_mstrack_sa_qOverP.push_back(muonPars->parameters()[Trk::qOverP]);
412  const AmgSymMatrix(5)* cov = muonPars->covariance();
413  if (cov) {
414  m_mstrack_sa_cov_d0.push_back((*cov)(Trk::d0, Trk::d0));
415  m_mstrack_sa_cov_z0.push_back((*cov)(Trk::z0, Trk::z0));
419  }
420  } else {
421  m_mstrack_sa_sur_x.push_back(-1);
422  m_mstrack_sa_sur_y.push_back(-1);
423  m_mstrack_sa_sur_z.push_back(-1);
424  m_mstrack_sa_d0.push_back(-1);
425  m_mstrack_sa_z0.push_back(-1);
426  m_mstrack_sa_phi0.push_back(-1);
427  m_mstrack_sa_theta.push_back(-1);
428  m_mstrack_sa_qOverP.push_back(-1);
429  m_mstrack_sa_cov_d0.push_back(-1);
430  m_mstrack_sa_cov_z0.push_back(-1);
431  m_mstrack_sa_cov_phi0.push_back(-1);
432  m_mstrack_sa_cov_theta.push_back(-1);
433  m_mstrack_sa_cov_qOverP.push_back(-1);
434  }
435 
436  // truth
438  truthParticleLinkAcc("truthParticleLink");
439  if (truthParticleLinkAcc.isAvailable(**muonCandidate->muonSpectrometerTrackLink())) {
441  truthParticleLinkAcc(**muonCandidate->muonSpectrometerTrackLink());
442  if (truthLink.isValid()) {
443  m_mstrack_has_truth.push_back(1);
444  m_mstrack_truth_pdgid.push_back((*truthLink)->pdgId());
445  m_mstrack_truth_barcode.push_back(HepMC::barcode(*truthLink)); // FIXME barcode-based
446  const Trk::TrackParameters* perigee = m_truthToTrack->makePerigeeParameters(*truthLink);
447  if (perigee) {
448  m_mstrack_has_truth_par.push_back(1);
449  m_mstrack_truth_sur_x.push_back(perigee->associatedSurface().center().x());
450  m_mstrack_truth_sur_y.push_back(perigee->associatedSurface().center().y());
451  m_mstrack_truth_sur_z.push_back(perigee->associatedSurface().center().z());
452  m_mstrack_truth_d0.push_back(perigee->parameters()[Trk::d0]);
453  m_mstrack_truth_z0.push_back(perigee->parameters()[Trk::z0]);
454  m_mstrack_truth_phi0.push_back(perigee->parameters()[Trk::phi0]);
455  m_mstrack_truth_theta.push_back(perigee->parameters()[Trk::theta]);
456  m_mstrack_truth_qOverP.push_back(perigee->parameters()[Trk::qOverP]);
457  } else {
458  m_mstrack_has_truth_par.push_back(0);
459  m_mstrack_truth_sur_x.push_back(-1);
460  m_mstrack_truth_sur_y.push_back(-1);
461  m_mstrack_truth_sur_z.push_back(-1);
462  m_mstrack_truth_d0.push_back(-1);
463  m_mstrack_truth_z0.push_back(-1);
464  m_mstrack_truth_phi0.push_back(-1);
465  m_mstrack_truth_theta.push_back(-1);
466  m_mstrack_truth_qOverP.push_back(-1);
467  }
468  } else { // no truth link available
469  m_mstrack_has_truth.push_back(0);
470  m_mstrack_has_truth_par.push_back(0);
471  m_mstrack_truth_pdgid.push_back(0); // FIXME Create a constant for undefined PDGID?
472  m_mstrack_truth_barcode.push_back(HepMC::UNDEFINED_ID); // FIXME barcode-based
473  m_mstrack_truth_sur_x.push_back(-1);
474  m_mstrack_truth_sur_y.push_back(-1);
475  m_mstrack_truth_sur_z.push_back(-1);
476  m_mstrack_truth_d0.push_back(-1);
477  m_mstrack_truth_z0.push_back(-1);
478  m_mstrack_truth_phi0.push_back(-1);
479  m_mstrack_truth_theta.push_back(-1);
480  m_mstrack_truth_qOverP.push_back(-1);
481  }
482  } else { // no truth link available
483  m_mstrack_has_truth.push_back(0);
484  m_mstrack_has_truth_par.push_back(0);
485  m_mstrack_truth_pdgid.push_back(0); // FIXME Create a constant for undefined PDGID?
486  m_mstrack_truth_barcode.push_back(HepMC::UNDEFINED_ID); // FIXME barcode-based
487  m_mstrack_truth_sur_x.push_back(-1);
488  m_mstrack_truth_sur_y.push_back(-1);
489  m_mstrack_truth_sur_z.push_back(-1);
490  m_mstrack_truth_d0.push_back(-1);
491  m_mstrack_truth_z0.push_back(-1);
492  m_mstrack_truth_phi0.push_back(-1);
493  m_mstrack_truth_theta.push_back(-1);
494  m_mstrack_truth_qOverP.push_back(-1);
495  }
496  }
497  }
498 
499 } // namespace MuonCombined
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_cov_phi0
std::vector< double > m_mstrack_sa_cov_phi0
Definition: MuonCombinedDebuggerTool.h:94
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_cov_z0
std::vector< double > m_mstrack_cov_z0
Definition: MuonCombinedDebuggerTool.h:78
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_phi0
std::vector< double > m_mstrack_phi0
Definition: MuonCombinedDebuggerTool.h:74
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sur_y
std::vector< double > m_mstrack_sur_y
Definition: MuonCombinedDebuggerTool.h:70
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_cov_d0
std::vector< double > m_mstrack_sa_cov_d0
Definition: MuonCombinedDebuggerTool.h:92
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_qOverP
std::vector< double > m_idtrack_qOverP
Definition: MuonCombinedDebuggerTool.h:118
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_sur_z
std::vector< double > m_idtrack_sur_z
Definition: MuonCombinedDebuggerTool.h:113
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_theta
std::vector< double > m_idtrack_theta
Definition: MuonCombinedDebuggerTool.h:117
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_theta
std::vector< double > m_idtrack_truth_theta
Definition: MuonCombinedDebuggerTool.h:108
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_cov_d0
std::vector< double > m_idtrack_cov_d0
Definition: MuonCombinedDebuggerTool.h:119
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_cov_phi0
std::vector< double > m_idtrack_cov_phi0
Definition: MuonCombinedDebuggerTool.h:121
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_cov_z0
std::vector< double > m_mstrack_sa_cov_z0
Definition: MuonCombinedDebuggerTool.h:93
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_has_sa
std::vector< int > m_mstrack_has_sa
Definition: MuonCombinedDebuggerTool.h:83
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_sur_z
std::vector< double > m_mstrack_truth_sur_z
Definition: MuonCombinedDebuggerTool.h:62
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_indf
std::vector< std::vector< int > > m_ms_id_indf
Definition: MuonCombinedDebuggerTool.h:129
MuonCombined::MuonCombinedDebuggerTool::bookBranches
void bookBranches()
Definition: MuonCombinedDebuggerTool.cxx:46
TruthParticleContainer.h
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_ichi2
std::vector< std::vector< double > > m_ms_id_ichi2
Definition: MuonCombinedDebuggerTool.h:128
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_theta
std::vector< double > m_mstrack_sa_theta
Definition: MuonCombinedDebuggerTool.h:90
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_barcode
std::vector< int > m_idtrack_truth_barcode
Definition: MuonCombinedDebuggerTool.h:101
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_phi0
std::vector< double > m_mstrack_truth_phi0
Definition: MuonCombinedDebuggerTool.h:65
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_cov_qOverP
std::vector< double > m_idtrack_cov_qOverP
Definition: MuonCombinedDebuggerTool.h:123
Trk::z0
@ z0
Definition: ParamDefs.h:64
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_sur_x
std::vector< double > m_mstrack_sa_sur_x
Definition: MuonCombinedDebuggerTool.h:84
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_barcode
std::vector< int > m_mstrack_truth_barcode
Definition: MuonCombinedDebuggerTool.h:59
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_cov_z0
std::vector< double > m_idtrack_cov_z0
Definition: MuonCombinedDebuggerTool.h:120
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_qOverP
std::vector< double > m_mstrack_qOverP
Definition: MuonCombinedDebuggerTool.h:76
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_pdgid
std::vector< int > m_mstrack_truth_pdgid
Definition: MuonCombinedDebuggerTool.h:58
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_z0
std::vector< double > m_mstrack_sa_z0
Definition: MuonCombinedDebuggerTool.h:88
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_ondf
std::vector< std::vector< int > > m_ms_id_ondf
Definition: MuonCombinedDebuggerTool.h:126
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_qOverP
std::vector< double > m_mstrack_sa_qOverP
Definition: MuonCombinedDebuggerTool.h:91
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_sur_y
std::vector< double > m_idtrack_truth_sur_y
Definition: MuonCombinedDebuggerTool.h:103
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_sur_x
std::vector< double > m_mstrack_truth_sur_x
Definition: MuonCombinedDebuggerTool.h:60
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_sur_z
std::vector< double > m_idtrack_truth_sur_z
Definition: MuonCombinedDebuggerTool.h:104
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_has_truth_par
std::vector< int > m_mstrack_has_truth_par
Definition: MuonCombinedDebuggerTool.h:57
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_z0
std::vector< double > m_idtrack_z0
Definition: MuonCombinedDebuggerTool.h:115
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_has_truth_par
std::vector< int > m_idtrack_has_truth_par
Definition: MuonCombinedDebuggerTool.h:99
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_cov_phi0
std::vector< double > m_mstrack_cov_phi0
Definition: MuonCombinedDebuggerTool.h:79
MuonCombined::MuonCombinedDebuggerTool::fillMsIdBranches
void fillMsIdBranches(const MuonCandidateCollection &muonCandidates, const InDetCandidateCollection &inDetCandidates)
Definition: MuonCombinedDebuggerTool.cxx:147
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_sur_z
std::vector< double > m_mstrack_sa_sur_z
Definition: MuonCombinedDebuggerTool.h:86
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_qOverP
std::vector< double > m_idtrack_truth_qOverP
Definition: MuonCombinedDebuggerTool.h:109
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_d0
std::vector< double > m_mstrack_d0
Definition: MuonCombinedDebuggerTool.h:72
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_cov_qOverP
std::vector< double > m_mstrack_sa_cov_qOverP
Definition: MuonCombinedDebuggerTool.h:96
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_sur_y
std::vector< double > m_mstrack_sa_sur_y
Definition: MuonCombinedDebuggerTool.h:85
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_has_truth
std::vector< int > m_idtrack_has_truth
Definition: MuonCombinedDebuggerTool.h:98
Trk::theta
@ theta
Definition: ParamDefs.h:66
MuonCombined::MuonCombinedDebuggerTool::fillBranches
void fillBranches(const MuonCandidateCollection &muonCandidates, const InDetCandidateCollection &inDetCandidates)
Definition: MuonCombinedDebuggerTool.cxx:139
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_cov_d0
std::vector< double > m_mstrack_cov_d0
Definition: MuonCombinedDebuggerTool.h:77
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_theta
std::vector< double > m_mstrack_truth_theta
Definition: MuonCombinedDebuggerTool.h:66
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_pdgid
std::vector< int > m_idtrack_truth_pdgid
Definition: MuonCombinedDebuggerTool.h:100
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_z0
std::vector< double > m_mstrack_z0
Definition: MuonCombinedDebuggerTool.h:73
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_qOverP
std::vector< double > m_mstrack_truth_qOverP
Definition: MuonCombinedDebuggerTool.h:67
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_cov_theta
std::vector< double > m_idtrack_cov_theta
Definition: MuonCombinedDebuggerTool.h:122
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_sur_y
std::vector< double > m_mstrack_truth_sur_y
Definition: MuonCombinedDebuggerTool.h:61
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonCombined::MuonCombinedDebuggerTool::m_recoTree
TTree * m_recoTree
Definition: MuonCombinedDebuggerTool.h:53
Trk::ParametersBase
Definition: ParametersBase.h:55
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
InDetCandidate.h
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_d0
std::vector< double > m_mstrack_truth_d0
Definition: MuonCombinedDebuggerTool.h:63
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_sur_x
std::vector< double > m_idtrack_truth_sur_x
Definition: MuonCombinedDebuggerTool.h:102
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sur_z
std::vector< double > m_mstrack_sur_z
Definition: MuonCombinedDebuggerTool.h:71
MuonCombinedDebuggerTool.h
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:56
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_has_truth
std::vector< int > m_mstrack_has_truth
Definition: MuonCombinedDebuggerTool.h:56
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_phi0
std::vector< double > m_idtrack_phi0
Definition: MuonCombinedDebuggerTool.h:116
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::d0
@ d0
Definition: ParamDefs.h:63
MagicNumbers.h
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_d0
std::vector< double > m_mstrack_sa_d0
Definition: MuonCombinedDebuggerTool.h:87
MuonCombined::MuonCombinedDebuggerTool::initialize
StatusCode initialize() override
Definition: MuonCombinedDebuggerTool.cxx:31
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_oprob
std::vector< std::vector< double > > m_ms_id_oprob
Definition: MuonCombinedDebuggerTool.h:127
MuonCandidate.h
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_phi0
std::vector< double > m_idtrack_truth_phi0
Definition: MuonCombinedDebuggerTool.h:107
MuonCombined::MuonCombinedDebuggerTool::m_matchQuality
ToolHandle< Rec::IMuonMatchQuality > m_matchQuality
Definition: MuonCombinedDebuggerTool.h:48
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_cov_qOverP
std::vector< double > m_mstrack_cov_qOverP
Definition: MuonCombinedDebuggerTool.h:81
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_z0
std::vector< double > m_idtrack_truth_z0
Definition: MuonCombinedDebuggerTool.h:106
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_truth_z0
std::vector< double > m_mstrack_truth_z0
Definition: MuonCombinedDebuggerTool.h:64
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_sur_y
std::vector< double > m_idtrack_sur_y
Definition: MuonCombinedDebuggerTool.h:112
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_ochi2
std::vector< std::vector< double > > m_ms_id_ochi2
Definition: MuonCombinedDebuggerTool.h:125
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sur_x
std::vector< double > m_mstrack_sur_x
Definition: MuonCombinedDebuggerTool.h:69
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_truth_d0
std::vector< double > m_idtrack_truth_d0
Definition: MuonCombinedDebuggerTool.h:105
python.BackTrackingConfig.numThreads
int numThreads
Definition: BackTrackingConfig.py:61
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_cov_theta
std::vector< double > m_mstrack_cov_theta
Definition: MuonCombinedDebuggerTool.h:80
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_d0
std::vector< double > m_idtrack_d0
Definition: MuonCombinedDebuggerTool.h:114
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonCombined::MuonCombinedDebuggerTool::fillMsBranches
void fillMsBranches(const MuonCandidateCollection &muonCandidates)
Definition: MuonCombinedDebuggerTool.cxx:322
MuonCombined
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
Definition: IMuonSystemExtensionTool.h:23
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_phi0
std::vector< double > m_mstrack_sa_phi0
Definition: MuonCombinedDebuggerTool.h:89
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
MuonCombined::MuonCombinedDebuggerTool::MuonCombinedDebuggerTool
MuonCombinedDebuggerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuonCombinedDebuggerTool.cxx:26
MuonCombined::MuonCombinedDebuggerTool::m_eventNumber
int m_eventNumber
Definition: MuonCombinedDebuggerTool.h:54
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_sa_cov_theta
std::vector< double > m_mstrack_sa_cov_theta
Definition: MuonCombinedDebuggerTool.h:95
MuonCombined::MuonCombinedDebuggerTool::fillIdBranches
void fillIdBranches(const InDetCandidateCollection &inDetCandidates)
Definition: MuonCombinedDebuggerTool.cxx:204
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
MuonCombined::MuonCombinedDebuggerTool::m_truthToTrack
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
Definition: MuonCombinedDebuggerTool.h:49
AthAlgTool
Definition: AthAlgTool.h:26
MuonCombined::MuonCombinedDebuggerTool::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: MuonCombinedDebuggerTool.h:51
TruthParticle.h
MuonCombined::MuonCombinedDebuggerTool::m_ms_id_iprob
std::vector< std::vector< double > > m_ms_id_iprob
Definition: MuonCombinedDebuggerTool.h:130
MuonCombined::MuonCombinedDebuggerTool::m_mstrack_theta
std::vector< double > m_mstrack_theta
Definition: MuonCombinedDebuggerTool.h:75
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::phi0
@ phi0
Definition: ParamDefs.h:65
MuonCombined::MuonCombinedDebuggerTool::m_idtrack_sur_x
std::vector< double > m_idtrack_sur_x
Definition: MuonCombinedDebuggerTool.h:111