ATLAS Offline Software
DetailedIDNtupleTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 #include "TrkTrack/Track.h"
10 
11 //for Amg::error helper function:
13 
16 
17 
21 
24 #include "AtlasHepMC/GenParticle.h"
25 #include "AtlasHepMC/GenVertex.h"
26 
28 
30 
31 #include "TFile.h"
32 #include "TTree.h"
33 #include "TMath.h"
34 #include <cmath>
35 
36 
37 namespace InDet {
38 //________________________________________________________________________
39  DetailedIDNtupleTool::DetailedIDNtupleTool(const std::string& type, const std::string& name, const IInterface* parent)
41  , m_trackSumTool("Trk::TrackSummaryTool/TrackSummaryTool", this)
42  , m_alignModuleTool{}
43  , m_storeNormalRefittedOnly{false}
44  , m_storeConstrainedOnly{true}
45  , m_storeTruth{true}
46  , m_matchProbability{0.8}
47  , m_file{}
48  , m_tree{}
49  , m_trackCollection{"Tracks"}
50  , m_tracksTruthName{"TrackTruthCollection"} {
51  declareInterface<Trk::IFillNtupleTool>(this);
52 
53  declareProperty("FileName", m_filename = "IDAlign.root");
54  declareProperty("FilePath", m_filepath = "./");
55  declareProperty("TrackCollection", m_trackCollection);
56  declareProperty("TracksTruthName", m_tracksTruthName);
57  declareProperty("TrackSummaryTool", m_trackSumTool);
58  declareProperty("AlignModuleTool", m_alignModuleTool);
59  declareProperty("MatchProbability", m_matchProbability);
60  declareProperty("StoreTruth", m_storeTruth);
61  declareProperty("MatchProbability", m_matchProbability);
62  declareProperty("StoreNormalRefittedOnly", m_storeNormalRefittedOnly);
63  declareProperty("StoreConstrainedOnly", m_storeConstrainedOnly);
64  }
65 
66 //________________________________________________________________________
68  }
69 
70 //________________________________________________________________________
72  ATH_MSG_DEBUG("initialize() of DetailedIDNtupleTool");
73  ATH_MSG_DEBUG("creating file with name " << m_filepath << m_filename);
74 
75  if (!m_tree) initializeNtuple();
76  ATH_CHECK(m_truthToTrack.retrieve());
77 
78  /* Retrieve extrapolator tool */
79  ATH_CHECK(m_extrapolator.retrieve());
80 
81  // get AlignModuleTool
82  if (m_alignModuleTool.empty()) {
83  ATH_MSG_FATAL("m_alignModuleTool is empty in DetailedIDNtupleTool::initialize()");
84  return StatusCode::FAILURE;
85  } else {
86  ATH_CHECK(m_alignModuleTool.retrieve());
87  }
88  return StatusCode::SUCCESS;
89  }
90 
91 //________________________________________________________________________
93  if (m_file && m_file->IsOpen()) {
94  m_file->cd();
95  if (m_tree) m_tree->Write();
96  }
97  return StatusCode::SUCCESS;
98  }
99 
100 //________________________________________________________________________
102  ATH_MSG_DEBUG("finalize() of DetailedIDNtupleTool");
103  return StatusCode::SUCCESS;
104  }
105 
106 //________________________________________________________________________
107  void DetailedIDNtupleTool::dumpTrack(int /* itrk*/, const Trk::AlignTrack* alignTrack) {
108  ATH_MSG_DEBUG("In dumpTrack()");
109  Trk::AlignTrack::AlignTrackType type = alignTrack->type();
110  const EventContext& ctx = Gaudi::Hive::currentContext();
111  // if hope to dump all the tracks, should set:
112  // m_storeNormalRefittedOnly = false, m_storeConstrainedOnly=false
115  return;
116  }
117 
118  // get run and event numbers
119  ATH_MSG_DEBUG("Retrieving event info.");
120  const xAOD::EventInfo* eventInfo;
121  if (evtStore()->retrieve(eventInfo).isFailure()) {
122  ATH_MSG_ERROR("Could not retrieve event info.");
123  } else {
124  m_runNumber = eventInfo->runNumber();
125  m_evtNumber = eventInfo->eventNumber();
126  }
127 
128  // initialize variables
129  constexpr double invalidParameterValue{-999.};
130  m_d0 = invalidParameterValue;
131  m_z0 = invalidParameterValue;
132  m_phi0 = invalidParameterValue;
133  m_theta = invalidParameterValue;
134  m_qoverp = invalidParameterValue;
135  m_pt = invalidParameterValue;
136  m_eta = invalidParameterValue;
137  constexpr double invalidChiSq{-1e12};
138  m_chi2 = invalidChiSq;
139  m_chi2prob = invalidChiSq;
140  constexpr int invalidDegreesOfFreedom{-999};
141 
142  m_ndof = invalidDegreesOfFreedom;
143  m_xvtx = invalidParameterValue;
144  m_yvtx = invalidParameterValue;
145  m_zvtx = invalidParameterValue;
146 
147  m_err_d0 = invalidParameterValue;
148  m_err_z0 = invalidParameterValue;
149  m_err_phi0 = invalidParameterValue;
150  m_err_theta = invalidParameterValue;
151  m_err_qoverp = invalidParameterValue;
152  m_toRef_d0 = invalidParameterValue;
153  m_toRef_z0 = invalidParameterValue;
154  m_toRef_phi0 = invalidParameterValue;
155  m_toRef_theta = invalidParameterValue;
156  m_toRef_qoverp = invalidParameterValue;
157 
158 
159  m_original_d0 = invalidParameterValue;
160  m_original_z0 = invalidParameterValue;
161  m_original_phi0 = invalidParameterValue;
162  m_original_theta = invalidParameterValue;
163  m_original_qoverp = invalidParameterValue;
164  m_original_pt =invalidParameterValue;
165  m_original_eta = -999.;
166  m_original_chi2 = invalidChiSq;
167  m_original_chi2prob = invalidChiSq;
168  m_original_ndof = invalidDegreesOfFreedom;
169  m_original_xvtx = invalidParameterValue;
170  m_original_yvtx = invalidParameterValue;
171  m_original_zvtx = invalidParameterValue;
172 
173  m_original_err_d0 = invalidParameterValue;
174  m_original_err_z0 = invalidParameterValue;
175  m_original_err_phi0 = invalidParameterValue;
176  m_original_err_theta = invalidParameterValue;
177  m_original_err_qoverp = invalidParameterValue;;
178  m_original_toRef_d0 = invalidParameterValue;
179  m_original_toRef_z0 = invalidParameterValue;
180  m_original_toRef_phi0 = invalidParameterValue;
181  m_original_toRef_theta =invalidParameterValue;
182  m_original_toRef_qoverp = invalidParameterValue;;
183 
184  m_truth_d0 = invalidParameterValue;
185  m_truth_z0 = invalidParameterValue;
186  m_truth_phi0 = invalidParameterValue;
187  m_truth_theta = invalidParameterValue;
188  m_truth_qoverp = invalidParameterValue;
189  m_truth_pt = invalidParameterValue;
190  m_truth_eta = invalidParameterValue;;
191  m_truth_prod_x = invalidParameterValue;
192  m_truth_prod_y = invalidParameterValue;
193  m_truth_prod_z = invalidParameterValue;;
194 
195 
196 
197  const Trk::Perigee* aMeasPer = (alignTrack->perigeeParameters());
198 
199  if (not aMeasPer) {
200  ATH_MSG_ERROR("Could not get Trk::Perigee of the alignTrack");
201  return;
202  } else {
203  m_d0 = aMeasPer->parameters()[Trk::d0];
204  m_z0 = aMeasPer->parameters()[Trk::z0];
205  m_phi0 = aMeasPer->parameters()[Trk::phi0];
206  m_theta = aMeasPer->parameters()[Trk::theta];
207  m_qoverp = aMeasPer->parameters()[Trk::qOverP];
208 
209  const AmgSymMatrix(5) * locCov = aMeasPer->covariance();
210  m_err_d0 = Amg::error(*locCov, Trk::d0);
211  m_err_z0 = Amg::error(*locCov, Trk::z0);
212  m_err_phi0 = Amg::error(*locCov, Trk::phi0);
213  m_err_theta = Amg::error(*locCov, Trk::theta);
214  m_err_qoverp = Amg::error(*locCov, Trk::qOverP);
215 
216  m_pt =
217  std::sqrt((aMeasPer->momentum().x()) * (aMeasPer->momentum().x()) + (aMeasPer->momentum().y()) *
218  (aMeasPer->momentum().y()));
219  m_eta = aMeasPer->eta();
220 
221  m_xvtx = aMeasPer->position().x();
222  m_yvtx = aMeasPer->position().y();
223  m_zvtx = aMeasPer->position().z();
224 
225 
226 
227  // get fit quality and chi2 probability of track
228  const Trk::FitQuality* fitQual = alignTrack->fitQuality();
229  if (not fitQual) ATH_MSG_ERROR("No fit quality assigned to the track");
230  else {
231  if (fitQual->chiSquared() > 0. && fitQual->numberDoF() > 0) {
232  m_chi2 = fitQual->chiSquared();
233  m_ndof = fitQual->numberDoF();
234  m_chi2prob = TMath::Prob(m_chi2, m_ndof);
235 
236  ATH_MSG_DEBUG(" - chi2 : " << m_chi2);
237  ATH_MSG_DEBUG(" - ndof : " << m_ndof);
238  ATH_MSG_DEBUG(" - chi2/ndof : " << m_chi2 / (double) m_ndof);
239  ATH_MSG_DEBUG(" - chi2 propability : " << m_chi2prob);
240  }
241  }
242  }
243 
244  const Trk::MeasurementBase* measbase = *(alignTrack->measurementsOnTrack()->begin());
245  Amg::Vector3D refPoint = measbase->associatedSurface().center();
246  const Trk::VertexOnTrack* vot = dynamic_cast<const Trk::VertexOnTrack*> (measbase);
247  if (!vot) {
248  ATH_MSG_ERROR(" Seems the pseudo-measuremnt in the alignTrack not exist!");
249  ATH_MSG_ERROR(" this pseudo-measurement has been rejected as outlier in the refitting!");
250  return;
251  } else {
252  ATH_MSG_DEBUG(" VoT get from the alignTrack:" << *vot);
253  }
254 
255  ATH_MSG_DEBUG(" the pseudo-measurement position: " << refPoint);
256  const Trk::Track* originalTrack = alignTrack->originalTrack();
257 
258  const Trk::Perigee* originalMeasPer = originalTrack->perigeeParameters();
259  if (!originalMeasPer) {
260  ATH_MSG_ERROR("No original track!");
261  } else {
262  m_original_d0 = originalMeasPer->parameters()[Trk::d0];
263  m_original_z0 = originalMeasPer->parameters()[Trk::z0];
264  m_original_phi0 = originalMeasPer->parameters()[Trk::phi0];
265  m_original_theta = originalMeasPer->parameters()[Trk::theta];
266  m_original_qoverp = originalMeasPer->parameters()[Trk::qOverP];
267 
268  const AmgSymMatrix(5) * locError = originalMeasPer->covariance();
269  m_original_err_d0 = Amg::error(*locError, Trk::d0);
270  m_original_err_z0 = Amg::error(*locError, Trk::z0);
274 
277 
278  m_original_xvtx = originalMeasPer->position().x();
279  m_original_yvtx = originalMeasPer->position().y();
280  m_original_zvtx = originalMeasPer->position().z();
281 
282  // get fit quality and chi2 probability of original Track
283  const Trk::FitQuality* originalFitQual = originalTrack->fitQuality();
284  if (not originalFitQual) ATH_MSG_ERROR("No fit quality assigned to the track");
285  else {
286  if (originalFitQual->chiSquared() > 0. && originalFitQual->numberDoF() > 0) {
287  m_original_chi2 = originalFitQual->chiSquared();
288  m_original_ndof = originalFitQual->numberDoF();
290 
291  ATH_MSG_DEBUG(" - original chi2 : " << m_original_chi2);
292  ATH_MSG_DEBUG(" - original ndof : " << m_original_ndof);
293  ATH_MSG_DEBUG(" - original chi2/ndof : " << m_original_chi2 / (double) m_original_ndof);
294  ATH_MSG_DEBUG(" - original chi2 propability : " << m_original_chi2prob);
295  }
296  }
297 
298 
299  const Trk::PerigeeSurface persf(refPoint);
300  const Trk::Perigee* originalPerigeeAtRef =
301  dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateTrack(ctx, *originalTrack, persf).release());
302  if (!originalPerigeeAtRef) {
303  const Trk::Perigee* originalTrackPerigee = originalTrack->perigeeParameters();
304  if (originalTrackPerigee && ((originalTrackPerigee->associatedSurface())) == persf) {
305  ATH_MSG_DEBUG("Perigee of Track is already expressed to given vertex, a copy is returned.");
306  originalPerigeeAtRef = originalTrackPerigee->clone();
307  } else ATH_MSG_DEBUG("Extrapolation to Perigee failed, NULL pointer is returned.");
308  }
309 
310  if (originalPerigeeAtRef) {
311  std::unique_ptr<const Trk::Perigee > originalMeasPerAtRef(originalPerigeeAtRef);
312  m_original_toRef_d0 = originalMeasPerAtRef->parameters()[Trk::d0];
313  m_original_toRef_z0 = originalMeasPerAtRef->parameters()[Trk::z0];
314  m_original_toRef_phi0 = originalMeasPerAtRef->parameters()[Trk::phi0];
315  m_original_toRef_theta = originalMeasPerAtRef->parameters()[Trk::theta];
316  m_original_toRef_qoverp = originalMeasPerAtRef->parameters()[Trk::qOverP];
317  }
318 
319  const Trk::Perigee* PerigeeAtRef =
320  dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateTrack(ctx, *alignTrack, persf).release());
321  if (!PerigeeAtRef) {
322  const Trk::Perigee* alignTrackPerigee = alignTrack->perigeeParameters();
323  if (alignTrackPerigee && ((alignTrackPerigee->associatedSurface())) == persf) {
324  ATH_MSG_DEBUG("Perigee of AlignTrack is already expressed to given vertex, a copy is returned.");
325  PerigeeAtRef = alignTrackPerigee->clone();
326  } else ATH_MSG_DEBUG("Extrapolation to Perigee failed, NULL pointer is returned.");
327  }
328 
329  //post-eigen, can simply use the TrackParameters * returned by m_extrapolator->extrapolate?
330  if (PerigeeAtRef) {
331  std::unique_ptr<const Trk::Perigee > MeasPerAtRef((PerigeeAtRef));
332  m_toRef_d0 = MeasPerAtRef->parameters()[Trk::d0];
333  m_toRef_z0 = MeasPerAtRef->parameters()[Trk::z0];
334  m_toRef_phi0 = MeasPerAtRef->parameters()[Trk::phi0];
335  m_toRef_theta = MeasPerAtRef->parameters()[Trk::theta];
336  m_toRef_qoverp = MeasPerAtRef->parameters()[Trk::qOverP];
337  }
338  }
339 
341  if (m_storeTruth) retrieveTruthInfo(alignTrack);
342 
343 
344  m_file->cd();
345  m_tree->Fill();
346  ATH_MSG_DEBUG("tree filled");
347 
348  return;
349  }
350 
352  // although we select tracks using the TrackSelectionTool, we still need to get a complete TrackCollection
353  // from StoreGate for use in the track-truth map, otherwise the track-truth matching is screwed up
354 
355  const TrackCollection* RecCollection = nullptr;
356 
357  if (evtStore()->retrieve(RecCollection, m_trackCollection).isFailure()) {
358  ATH_MSG_WARNING("Track collection \"" << m_trackCollection << "\" not found.");
359  return false;
360  }
361  if (RecCollection) {
363  "Retrieved " << m_trackCollection << " with size " << RecCollection->size() <<
364  " reconstructed tracks from storegate");
365  } else {
366  ATH_MSG_WARNING("RecCollection is null pointer in DetailedIDNtupleTool::retrieveTruthInfo");
367  return false;
368  }
369 
370  // get TrackTruthCollection
371  const TrackTruthCollection* TruthMap = nullptr;
372  if (StatusCode::SUCCESS != evtStore()->retrieve(TruthMap, m_tracksTruthName)) {
373  ATH_MSG_DEBUG("Cannot find " << m_tracksTruthName);
374  return false;
375  }
376 
378  "Track Truth Collection with name " << m_tracksTruthName << " with size " << TruthMap->size() <<
379  " found in StoreGate");
380 
381  bool flag = false;
382  // get fit quality and chi2 probability of track
383  const Trk::Perigee* startPerigee = alignTrack->perigeeParameters();
384  const Trk::Perigee* measPer = startPerigee;
385 
386  if (measPer == nullptr) {
387  ATH_MSG_DEBUG("No measured perigee parameters assigned to the track");
388  return false;
389  }
390 
391  if (TruthMap) {
393  tracklink.setElement(const_cast<Trk::Track*>(alignTrack->originalTrack()));
394  tracklink.setStorableObject(*RecCollection);
395  const ElementLink<TrackCollection> tracklink2 = tracklink;
396 
397  TrackTruthCollection::const_iterator found = TruthMap->find(tracklink2);
398  if ((found != TruthMap->end()) && (found->second.probability() > m_matchProbability)) {
399  TrackTruth trtruth = found->second;
400  const HepMcParticleLink& HMPL = trtruth.particleLink();
401 
402  if (HMPL.isValid()) {
403 #ifdef HEPMC3
404  HepMC::ConstGenParticlePtr genparptr = HMPL.scptr();
405 #else
406  const HepMC::GenParticle* genparptr = HMPL.cptr();
407 #endif
408 
409  if (genparptr) {
410  if (genparptr->production_vertex()) {
411  if (genparptr->pdg_id() == 0) {
412  ATH_MSG_INFO("PDG ID is zero in DetailedIDNtupleTool::retrieveTruthInfo");
413  } else {
414  const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(genparptr);
415  if (!generatedTrackPerigee) ATH_MSG_WARNING("Unable to extrapolate genparticle to perigee!");
416  else {
417  flag = true;
418  m_truth_qoverpt = generatedTrackPerigee->parameters()[Trk::qOverP] / std::sin(
419  generatedTrackPerigee->parameters()[Trk::theta]);
420  m_truth_qoverp = generatedTrackPerigee->parameters()[Trk::qOverP];
421  m_truth_phi0 = generatedTrackPerigee->parameters()[Trk::phi0];
422  m_truth_d0 = generatedTrackPerigee->parameters()[Trk::d0];
423  m_truth_z0 = generatedTrackPerigee->parameters()[Trk::z0];
424  m_truth_theta = generatedTrackPerigee->parameters()[Trk::theta];
425  m_truth_eta = generatedTrackPerigee->eta();
426  m_truth_prod_x = genparptr->production_vertex()->position().x();
427  m_truth_prod_y = genparptr->production_vertex()->position().y();
428  m_truth_prod_z = genparptr->production_vertex()->position().z();
429 
430  delete generatedTrackPerigee;
431  m_truth_pt = 1. / std::abs(m_truth_qoverpt);
432  m_truth_charge = 1;
433  if (m_truth_qoverpt < 0) m_truth_charge = -1;
434  if (m_truth_phi0 < 0) m_truth_phi0 += 2 * M_PI;
435  ATH_MSG_DEBUG("Found matched truth track with phi, PT = " << m_truth_phi0 << ", " << m_truth_pt);
436  }
437  }
438  }
439  }
440  }
441  }
442  }
443 
444  return flag;
445  }
446 
447 //I think this is never used!
449  const Trk::TrackParameters* aMeasPer {};
450 
451  for (const auto i:*(alignTrack->trackStateOnSurfaces())) {
453  aMeasPer = (i->trackParameters());
454  break;
455  }
456  }
457  if (not aMeasPer) {
458  ATH_MSG_ERROR("Could not get Trk::MeasuredPerigee of the alignTrack");
459  }
460  return aMeasPer;
461  }
462 
464  }
465 
466 //________________________________________________________________________
468  }
469 
471  }
472 
473 //________________________________________________________________________
475  }
476 
477 //________________________________________________________________________
479  //m_file = new TFile((m_filepath+m_filename).c_str(), "RECREATE");
480  m_file->cd();
481  m_tree = new TTree("IDAlign", "Inner Detector Alignment Ntuple");
482 
483  m_tree->Branch("run", &m_runNumber, "run/I");
484  m_tree->Branch("evt", &m_evtNumber, "evt/I");
485 
486  m_tree->Branch("xvtx", &m_xvtx, "xvtx/D");
487  m_tree->Branch("yvtx", &m_yvtx, "yvtx/D");
488  m_tree->Branch("zvtx", &m_zvtx, "zvtx/D");
489  m_tree->Branch("d0", &m_d0, "d0/D");
490  m_tree->Branch("z0", &m_z0, "z0/D");
491  m_tree->Branch("phi0", &m_phi0, "phi0/D");
492  m_tree->Branch("theta", &m_theta, "theta/D");
493  m_tree->Branch("qoverp", &m_qoverp, "qoverp/D");
494  m_tree->Branch("pt", &m_pt, "pt/D");
495  m_tree->Branch("eta", &m_eta, "eta/D");
496  m_tree->Branch("chi2", &m_chi2, "chi2/D");
497  m_tree->Branch("ndof", &m_ndof, "ndof/I");
498  m_tree->Branch("chi2prob", &m_chi2prob, "chi2prob/D");
499  m_tree->Branch("err_d0", &m_err_d0, "err_d0/D");
500  m_tree->Branch("err_z0", &m_err_z0, "err_z0/D");
501  m_tree->Branch("err_phi0", &m_err_phi0, "err_phi0/D");
502  m_tree->Branch("err_theta", &m_err_theta, "err_theta/D");
503  m_tree->Branch("err_qoverp", &m_err_qoverp, "err_qoverp/D");
504 
505  if (m_storeTruth) {
506  m_tree->Branch("m_truth_prod_x", &m_truth_prod_x, "truth_prod_x/D");
507  m_tree->Branch("m_truth_prod_y", &m_truth_prod_y, "truth_prod_y/D");
508  m_tree->Branch("m_truth_prod_z", &m_truth_prod_z, "truth_prod_z/D");
509  m_tree->Branch("truth_d0", &m_truth_d0, "truth_d0/D");
510  m_tree->Branch("truth_z0", &m_truth_z0, "truth_z0/D");
511  m_tree->Branch("truth_phi0", &m_truth_phi0, "truth_phi0/D");
512  m_tree->Branch("truth_theta", &m_truth_theta, "truth_theta/D");
513  m_tree->Branch("truth_qoverp", &m_truth_qoverp, "truth_qoverp/D");
514  m_tree->Branch("truth_pt", &m_truth_pt, "truth_pt/D");
515  m_tree->Branch("truth_eta", &m_truth_eta, "truth_eta/D");
516  }
517 
518  m_tree->Branch("original_xvtx", &m_original_xvtx, "original_xvtx/D");
519  m_tree->Branch("original_yvtx", &m_original_yvtx, "original_yvtx/D");
520  m_tree->Branch("original_zvtx", &m_original_zvtx, "original_zvtx/D");
521  m_tree->Branch("original_d0", &m_original_d0, "original_d0/D");
522  m_tree->Branch("original_z0", &m_original_z0, "original_z0/D");
523  m_tree->Branch("original_phi0", &m_original_phi0, "original_phi0/D");
524  m_tree->Branch("original_theta", &m_original_theta, "original_theta/D");
525  m_tree->Branch("original_qoverp", &m_original_qoverp, "original_qoverp/D");
526  m_tree->Branch("original_pt", &m_original_pt, "original_pt/D");
527  m_tree->Branch("original_eta", &m_original_eta, "original_eta/D");
528  m_tree->Branch("original_chi2", &m_original_chi2, "original_chi2/D");
529  m_tree->Branch("original_ndof", &m_original_ndof, "original_ndof/I");
530  m_tree->Branch("original_chi2prob", &m_original_chi2prob, "original_chi2prob/D");
531 
532  m_tree->Branch("original_err_d0", &m_original_err_d0, "original_err_d0/D");
533  m_tree->Branch("original_err_z0", &m_original_err_z0, "original_err_z0/D");
534  m_tree->Branch("original_err_phi0", &m_original_err_phi0, "original_err_phi0/D");
535  m_tree->Branch("original_err_theta", &m_original_err_theta, "original_err_theta/D");
536  m_tree->Branch("original_err_qoverp", &m_original_err_qoverp, "original_err_qoverp/D");
537 
538  m_tree->Branch("toRef_d0", &m_toRef_d0, "toRef_d0/D");
539  m_tree->Branch("toRef_z0", &m_toRef_z0, "toRef_z0/D");
540  m_tree->Branch("toRef_phi0", &m_toRef_phi0, "toRef_phi0/D");
541  m_tree->Branch("toRef_theta", &m_toRef_theta, "toRef_theta/D");
542  m_tree->Branch("toRef_qoverp", &m_toRef_qoverp, "toRef_qoverp/D");
543  m_tree->Branch("original_toRef_d0", &m_original_toRef_d0, "original_toRef_d0/D");
544  m_tree->Branch("original_toRef_z0", &m_original_toRef_z0, "original_toRef_z0/D");
545  m_tree->Branch("original_toRef_phi0", &m_original_toRef_phi0, "original_toRef_phi0/D");
546  m_tree->Branch("original_toRef_theta", &m_original_toRef_theta, "original_toRef_theta/D");
547  m_tree->Branch("original_toRef_qoverp", &m_original_toRef_qoverp, "original_toRef_qoverp/D");
548 
549  return;
550  }
551 } // end namespace
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDet::DetailedIDNtupleTool::m_storeConstrainedOnly
bool m_storeConstrainedOnly
onlystore the AlignTrack which is normally refitted
Definition: DetailedIDNtupleTool.h:82
InDet::DetailedIDNtupleTool::m_original_chi2prob
double m_original_chi2prob
Definition: DetailedIDNtupleTool.h:116
InDet::DetailedIDNtupleTool::m_original_err_z0
double m_original_err_z0
Definition: DetailedIDNtupleTool.h:119
ITrackSummaryTool.h
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
InDet::DetailedIDNtupleTool::storeHitmap
void storeHitmap()
stores hitmap for writing to ntuple
Definition: DetailedIDNtupleTool.cxx:463
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDet::DetailedIDNtupleTool::fillSummary
void fillSummary()
fills ntuple with event and track summary information
Definition: DetailedIDNtupleTool.cxx:470
Trk::Track::fitQuality
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
InDet::DetailedIDNtupleTool::m_filepath
std::string m_filepath
path to ntuple file
Definition: DetailedIDNtupleTool.h:90
InDet::DetailedIDNtupleTool::finalize
StatusCode finalize()
Definition: DetailedIDNtupleTool.cxx:101
InDet::DetailedIDNtupleTool::initialize
StatusCode initialize()
Definition: DetailedIDNtupleTool.cxx:71
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
TrackStateDefs.h
Trk::Track::trackStateOnSurfaces
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
InDet::DetailedIDNtupleTool::m_theta
double m_theta
Definition: DetailedIDNtupleTool.h:165
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::DetailedIDNtupleTool::m_chi2prob
double m_chi2prob
Definition: DetailedIDNtupleTool.h:171
GenVertex.h
InDet::DetailedIDNtupleTool::m_original_ndof
int m_original_ndof
Definition: DetailedIDNtupleTool.h:115
EventPrimitivesHelpers.h
InDet::DetailedIDNtupleTool::m_original_pt
double m_original_pt
Definition: DetailedIDNtupleTool.h:111
InDet::DetailedIDNtupleTool::m_storeTruth
bool m_storeTruth
retrieve the truth information
Definition: DetailedIDNtupleTool.h:83
InDet::DetailedIDNtupleTool::m_original_d0
double m_original_d0
Definition: DetailedIDNtupleTool.h:106
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDet::DetailedIDNtupleTool::m_original_yvtx
double m_original_yvtx
Definition: DetailedIDNtupleTool.h:103
InDet::DetailedIDNtupleTool::m_original_err_d0
double m_original_err_d0
Definition: DetailedIDNtupleTool.h:118
InDet::DetailedIDNtupleTool::m_chi2
double m_chi2
Definition: DetailedIDNtupleTool.h:169
InDet::DetailedIDNtupleTool::m_pt
double m_pt
Definition: DetailedIDNtupleTool.h:167
Trk::z0
@ z0
Definition: ParamDefs.h:64
InDet::DetailedIDNtupleTool::m_runNumber
int m_runNumber
Definition: DetailedIDNtupleTool.h:97
InDet::DetailedIDNtupleTool::m_truth_charge
double m_truth_charge
Definition: DetailedIDNtupleTool.h:133
Trk::AlignTrack::AlignTrackType
AlignTrackType
Definition: AlignTrack.h:45
InDet::DetailedIDNtupleTool::m_truth_prod_y
double m_truth_prod_y
Definition: DetailedIDNtupleTool.h:135
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
InDet::DetailedIDNtupleTool::DetailedIDNtupleTool
DetailedIDNtupleTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: DetailedIDNtupleTool.cxx:39
GenParticle.h
InDet::DetailedIDNtupleTool::m_original_qoverp
double m_original_qoverp
Definition: DetailedIDNtupleTool.h:110
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
InDet::DetailedIDNtupleTool::m_truth_z0
double m_truth_z0
Definition: DetailedIDNtupleTool.h:126
Track.h
m_file
std::unique_ptr< TFile > m_file
description: this is a custom writer for the old-school drivers that don't use an actual writer
Definition: OutputStreamData.cxx:52
InDet::DetailedIDNtupleTool::m_truth_eta
double m_truth_eta
Definition: DetailedIDNtupleTool.h:129
InDet::DetailedIDNtupleTool::m_original_zvtx
double m_original_zvtx
Definition: DetailedIDNtupleTool.h:104
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
InDet::DetailedIDNtupleTool::m_err_theta
double m_err_theta
Definition: DetailedIDNtupleTool.h:156
InDet::DetailedIDNtupleTool::m_truth_pt
double m_truth_pt
Definition: DetailedIDNtupleTool.h:130
InDet::DetailedIDNtupleTool::m_filename
std::string m_filename
name of ntuple file
Definition: DetailedIDNtupleTool.h:89
InDet::DetailedIDNtupleTool::m_err_phi0
double m_err_phi0
Definition: DetailedIDNtupleTool.h:155
AlignTrack.h
TrackTruthCollection
Definition: TrackTruthCollection.h:21
InDet::DetailedIDNtupleTool::m_qoverp
double m_qoverp
Definition: DetailedIDNtupleTool.h:166
InDet::DetailedIDNtupleTool::m_truth_phi0
double m_truth_phi0
Definition: DetailedIDNtupleTool.h:127
InDet::DetailedIDNtupleTool::m_original_toRef_phi0
double m_original_toRef_phi0
Definition: DetailedIDNtupleTool.h:141
InDet::DetailedIDNtupleTool::m_xvtx
double m_xvtx
Definition: DetailedIDNtupleTool.h:159
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::AlignTrack::BeamspotConstrained
@ BeamspotConstrained
refitted with beamspot constraint
Definition: AlignTrack.h:49
InDet::DetailedIDNtupleTool::m_original_toRef_z0
double m_original_toRef_z0
Definition: DetailedIDNtupleTool.h:140
InDet::DetailedIDNtupleTool::m_original_err_theta
double m_original_err_theta
Definition: DetailedIDNtupleTool.h:121
TrackTruthCollection.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::DetailedIDNtupleTool::m_extrapolator
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
track extrapolator
Definition: DetailedIDNtupleTool.h:79
Trk::theta
@ theta
Definition: ParamDefs.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::DetailedIDNtupleTool::m_toRef_d0
double m_toRef_d0
Definition: DetailedIDNtupleTool.h:146
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::DetailedIDNtupleTool::m_err_z0
double m_err_z0
Definition: DetailedIDNtupleTool.h:154
VertexOnTrack.h
master.flag
bool flag
Definition: master.py:29
InDet::DetailedIDNtupleTool::m_file
TFile * m_file
Definition: DetailedIDNtupleTool.h:86
InDet::DetailedIDNtupleTool::m_err_d0
double m_err_d0
Definition: DetailedIDNtupleTool.h:153
InDet::DetailedIDNtupleTool::fillNtuple
StatusCode fillNtuple()
writes trees and histograms to ntuple
Definition: DetailedIDNtupleTool.cxx:92
test_pyathena.parent
parent
Definition: test_pyathena.py:15
InDet::DetailedIDNtupleTool::m_original_chi2
double m_original_chi2
Definition: DetailedIDNtupleTool.h:114
InDet::DetailedIDNtupleTool::m_phi0
double m_phi0
Definition: DetailedIDNtupleTool.h:164
InDet::DetailedIDNtupleTool::retrieveTruthInfo
bool retrieveTruthInfo(const Trk::AlignTrack *trk)
Definition: DetailedIDNtupleTool.cxx:351
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::DetailedIDNtupleTool::m_original_phi0
double m_original_phi0
Definition: DetailedIDNtupleTool.h:108
InDet::DetailedIDNtupleTool::m_storeNormalRefittedOnly
bool m_storeNormalRefittedOnly
only store the AlignTrack which is normally refitted
Definition: DetailedIDNtupleTool.h:81
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
DetailedIDNtupleTool.h
InDet::DetailedIDNtupleTool::m_err_qoverp
double m_err_qoverp
Definition: DetailedIDNtupleTool.h:157
DataVector< Trk::Track >
InDet::DetailedIDNtupleTool::dumpTrack
void dumpTrack(int itrk, const Trk::AlignTrack *alignTrack)
fills track information to ntuple
Definition: DetailedIDNtupleTool.cxx:107
InDet::DetailedIDNtupleTool::m_yvtx
double m_yvtx
Definition: DetailedIDNtupleTool.h:160
TrackTruth::particleLink
const HepMcParticleLink & particleLink() const
Definition: TrackTruth.h:26
Trk::VertexOnTrack
Definition: VertexOnTrack.h:45
InDet::DetailedIDNtupleTool::m_original_err_phi0
double m_original_err_phi0
Definition: DetailedIDNtupleTool.h:120
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
InDet::DetailedIDNtupleTool::m_zvtx
double m_zvtx
Definition: DetailedIDNtupleTool.h:161
TrackTruth.h
InDet::DetailedIDNtupleTool::m_original_toRef_d0
double m_original_toRef_d0
Definition: DetailedIDNtupleTool.h:139
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::MeasurementBase::associatedSurface
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
Trk::d0
@ d0
Definition: ParamDefs.h:63
RIO_OnTrack.h
Amg::error
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Definition: EventPrimitivesHelpers.h:40
AlignModule.h
InDet::DetailedIDNtupleTool::m_truth_qoverpt
double m_truth_qoverpt
Definition: DetailedIDNtupleTool.h:132
InDet::DetailedIDNtupleTool::m_original_toRef_theta
double m_original_toRef_theta
Definition: DetailedIDNtupleTool.h:142
InDet::DetailedIDNtupleTool::m_original_z0
double m_original_z0
Definition: DetailedIDNtupleTool.h:107
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::AlignTrack::originalTrack
const Track * originalTrack() const
retrieve pointer to original track
Definition: AlignTrack.h:90
InDet::DetailedIDNtupleTool::perigeeParameter
const Trk::TrackParameters * perigeeParameter(const Trk::AlignTrack *track) const
Definition: DetailedIDNtupleTool.cxx:448
Trk::AlignTrack
Definition: AlignTrack.h:41
EventInfo.h
InDet::DetailedIDNtupleTool::m_eta
double m_eta
Definition: DetailedIDNtupleTool.h:168
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
InDet::DetailedIDNtupleTool::m_toRef_z0
double m_toRef_z0
Definition: DetailedIDNtupleTool.h:147
InDet::DetailedIDNtupleTool::m_truth_theta
double m_truth_theta
Definition: DetailedIDNtupleTool.h:128
Trk::Track::measurementsOnTrack
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:178
InDet::DetailedIDNtupleTool::~DetailedIDNtupleTool
virtual ~DetailedIDNtupleTool()
Definition: DetailedIDNtupleTool.cxx:67
TrackTruth
MC particle associated with a reco track + the quality of match.
Definition: TrackTruth.h:14
InDet::DetailedIDNtupleTool::m_tree
TTree * m_tree
Definition: DetailedIDNtupleTool.h:87
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
InDet::DetailedIDNtupleTool::showStatistics
void showStatistics()
write statistics out to log file
Definition: DetailedIDNtupleTool.cxx:474
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::AlignTrack::NormalRefitted
@ NormalRefitted
normally refitted, without adding any pseudo-measurement
Definition: AlignTrack.h:48
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDet::DetailedIDNtupleTool::m_alignModuleTool
ToolHandle< Trk::IAlignModuleTool > m_alignModuleTool
Pointer to AlignmModuleTool.
Definition: DetailedIDNtupleTool.h:75
InDet::DetailedIDNtupleTool::m_original_eta
double m_original_eta
Definition: DetailedIDNtupleTool.h:113
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
InDet::DetailedIDNtupleTool::m_truthToTrack
PublicToolHandle< Trk::ITruthToTrack > m_truthToTrack
the truth to track Tool
Definition: DetailedIDNtupleTool.h:77
InDet::DetailedIDNtupleTool::m_toRef_phi0
double m_toRef_phi0
Definition: DetailedIDNtupleTool.h:148
InDet::DetailedIDNtupleTool::m_d0
double m_d0
Definition: DetailedIDNtupleTool.h:162
IAlignModuleTool.h
InDet::DetailedIDNtupleTool::m_truth_prod_x
double m_truth_prod_x
Definition: DetailedIDNtupleTool.h:134
Trk::ParametersBase::eta
double eta() const
Access method for pseudorapidity - from momentum.
InDet::DetailedIDNtupleTool::fillHitmap
void fillHitmap()
fills ntuple with hit information
Definition: DetailedIDNtupleTool.cxx:467
InDet::DetailedIDNtupleTool::m_truth_prod_z
double m_truth_prod_z
Definition: DetailedIDNtupleTool.h:136
InDet::DetailedIDNtupleTool::m_original_xvtx
double m_original_xvtx
Definition: DetailedIDNtupleTool.h:102
InDet::DetailedIDNtupleTool::initializeNtuple
void initializeNtuple()
Definition: DetailedIDNtupleTool.cxx:478
InDet::DetailedIDNtupleTool::m_truth_qoverp
double m_truth_qoverp
Definition: DetailedIDNtupleTool.h:131
InDet::DetailedIDNtupleTool::m_evtNumber
int m_evtNumber
Definition: DetailedIDNtupleTool.h:98
InDet::DetailedIDNtupleTool::m_trackCollection
std::string m_trackCollection
Definition: DetailedIDNtupleTool.h:92
InDet::DetailedIDNtupleTool::m_original_theta
double m_original_theta
Definition: DetailedIDNtupleTool.h:109
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
InDet::DetailedIDNtupleTool::m_matchProbability
double m_matchProbability
the probabililty cut in the truth matching
Definition: DetailedIDNtupleTool.h:84
FitQuality.h
InDet::DetailedIDNtupleTool::m_original_toRef_qoverp
double m_original_toRef_qoverp
Definition: DetailedIDNtupleTool.h:143
InDet::DetailedIDNtupleTool::m_z0
double m_z0
Definition: DetailedIDNtupleTool.h:163
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::ParametersT::clone
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
InDet::DetailedIDNtupleTool::m_tracksTruthName
std::string m_tracksTruthName
Definition: DetailedIDNtupleTool.h:93
InDet::DetailedIDNtupleTool::m_original_err_qoverp
double m_original_err_qoverp
Definition: DetailedIDNtupleTool.h:122
InDet::DetailedIDNtupleTool::m_toRef_theta
double m_toRef_theta
Definition: DetailedIDNtupleTool.h:149
InDet::DetailedIDNtupleTool::m_truth_d0
double m_truth_d0
Definition: DetailedIDNtupleTool.h:125
Trk::phi0
@ phi0
Definition: ParamDefs.h:65
InDet::DetailedIDNtupleTool::m_toRef_qoverp
double m_toRef_qoverp
Definition: DetailedIDNtupleTool.h:150
GenParticle
@ GenParticle
Definition: TruthClasses.h:30
Trk::AlignTrack::type
AlignTrackType type() const
get and set the refit type
Definition: AlignTrack.h:96
InDet::DetailedIDNtupleTool::m_ndof
int m_ndof
Definition: DetailedIDNtupleTool.h:170