ATLAS Offline Software
Loading...
Searching...
No Matches
SimpleIDNtupleTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
6
8//Eigen stuff
10//
11#include "TrkTrack/Track.h"
14
16
18
21
27
29
30#include "TFile.h"
31#include "TTree.h"
32#include "TMath.h"
33#include <cmath>
34
35
36namespace InDet {
37//________________________________________________________________________
38 SimpleIDNtupleTool::SimpleIDNtupleTool(const std::string& type, const std::string& name, const IInterface* parent)
39 : AthAlgTool(type, name, parent)
40 , m_particleCreator("Trk::TrackParticleCreatorTool/TrackParticleCreatorTool", this)
42 , m_idHelper{}
43 , m_file{}
44 , m_tree(nullptr)
45 , m_runNumber{}
46 , m_evtNumber{}
47 , m_xvtx{}
48 , m_yvtx{}
49 , m_zvtx{}
50 , m_d0{}
51 , m_z0{}
52 , m_phi0{}
53 , m_theta{}
54 , m_qoverp{}
55 , m_pt{}
56 , m_eta{}
57 , m_chi2{}
58 , m_ndof{}
59 , m_chi2prob{}
60 , m_nhits{}
61 , m_nhitstrt{}
62 , m_nhitssct{}
63 , m_nhitspix{}
64 , m_nshared{}
65 , m_nshsct{}
66 , m_nshpix{}
67 , m_nholes{}
68 , m_nhsct{}
69 , m_nhpix{}
70 , m_hit_rho{}
71 , m_hit_phi{}
72 , m_hit_z{}
73 , m_hit_cotth{}
74 , m_hit_eta{}
75 , m_hit_xloc{}
76 , m_hit_yloc{}
77 , m_hit_zloc{}
78 , m_hit_drd{}
79 , m_hit_sig{}
80 , m_hit_resx{}
82 , m_hit_resy{}
84 , m_hit_tpar_x{}
85 , m_hit_tpar_y{}
86 , m_hit_det{}
87 , m_hit_type{}
106 , m_max_hits{150}
107 , m_storeDerivatives{false} {
108 declareInterface<Trk::IFillNtupleTool>(this);
109 declareProperty("TrackParticleCreatorTool", m_particleCreator, "tool to build TrackParticle");
110 declareProperty("AlignModuleTool", m_alignModuleTool);
111 declareProperty("MaxHits", m_max_hits);
112 declareProperty("StoreDerivatives", m_storeDerivatives);
113 }
114
115//________________________________________________________________________
117 if (m_hit_rho) {
118 delete [] m_hit_rho;
119 delete [] m_hit_phi;
120 delete [] m_hit_z;
121 delete [] m_hit_cotth;
122 delete [] m_hit_eta;
123 delete [] m_hit_xloc;
124 delete [] m_hit_yloc;
125 delete [] m_hit_zloc;
126 delete [] m_hit_drd;
127 delete [] m_hit_sig;
128 delete [] m_hit_tpar_x;
129 delete [] m_hit_tpar_y;
130 delete [] m_hit_resx;
131 delete [] m_hit_resx_err;
132 delete [] m_hit_resy;
133 delete [] m_hit_resy_err;
134 delete [] m_hit_det;
135 delete [] m_hit_type;
136
138 delete [] m_hit_derivx_transx;
139 delete [] m_hit_derivx_transy;
140 delete [] m_hit_derivx_transz;
141 delete [] m_hit_derivx_rotx;
142 delete [] m_hit_derivx_roty;
143 delete [] m_hit_derivx_rotz;
144 delete [] m_hit_derivx_bowx;
145 delete [] m_hit_derivx_bowy;
146 delete [] m_hit_derivx_bowz;
147 delete [] m_hit_derivy_transx;
148 delete [] m_hit_derivy_transy;
149 delete [] m_hit_derivy_transz;
150 delete [] m_hit_derivy_rotx;
151 delete [] m_hit_derivy_roty;
152 delete [] m_hit_derivy_rotz;
153 delete [] m_hit_derivy_bowx;
154 delete [] m_hit_derivy_bowy;
155 delete [] m_hit_derivy_bowz;
156 }
157 }
158 }
159
160//________________________________________________________________________
162 ATH_MSG_DEBUG("initialize() of SimpleIDNtupleTool");
163
164 // retrieve TRT ID helper
165 ATH_CHECK(detStore()->retrieve(m_idHelper, "TRT_ID"));
166
167 // get TrackParticleCreatorTool
168 ATH_CHECK(m_particleCreator.retrieve());
169
170 // get AlignModuleTool
171 if (m_alignModuleTool.empty() || m_alignModuleTool.retrieve().isFailure()) {
172 ATH_MSG_FATAL("Failed to retrieve tool " << m_alignModuleTool);
173 return StatusCode::FAILURE;
174 }
175 ATH_MSG_INFO("Retrieved tool " << m_alignModuleTool);
176
177 return StatusCode::SUCCESS;
178 }
179
180//________________________________________________________________________
182 if (m_file && m_file->IsOpen()) {
183 m_file->cd();
184 if (m_tree) m_tree->Write();
185 else ATH_MSG_WARNING("Variable m_tree not set, nothing to write.");
186 } else ATH_MSG_WARNING("Variable m_file not set or not pointing to open output file.");
187 return StatusCode::SUCCESS;
188 }
189
190//________________________________________________________________________
192 ATH_MSG_DEBUG("finalize() of SimpleIDNtupleTool");
193
194 return StatusCode::SUCCESS;
195 }
196
197//________________________________________________________________________
198 void SimpleIDNtupleTool::dumpTrack(int itrk, const Trk::AlignTrack* alignTrack) {
199 ATH_MSG_DEBUG("In dumpTrack()");
200
201 if (!m_tree) initializeNtuple();
202
203 // get run and event numbers
204 ATH_MSG_DEBUG("Retrieving event info.");
205 const xAOD::EventInfo* eventInfo;
206 if (evtStore()->retrieve(eventInfo).isFailure()) ATH_MSG_ERROR("Could not retrieve event info.");
207 else {
208 m_runNumber = eventInfo->runNumber();
209 m_evtNumber = eventInfo->eventNumber();
210 }
211
212 // initialize variables
213 constexpr double invalidParameterValue{-999.};
214 m_d0 = invalidParameterValue;
215 m_z0 = invalidParameterValue;
216 m_phi0 = invalidParameterValue;
217 m_theta = invalidParameterValue;
218 m_qoverp = invalidParameterValue;;
219 m_pt = invalidParameterValue;
220 m_eta = invalidParameterValue;
221 m_xvtx = invalidParameterValue;
222 m_yvtx = invalidParameterValue;
223 m_zvtx = invalidParameterValue;;
224
225 constexpr int initialiseNHits{0};
226 m_nhitspix = initialiseNHits;
227 m_nhitssct = initialiseNHits;
228 m_nhitstrt = initialiseNHits;
229 m_nshared = initialiseNHits;
230 m_nshpix = initialiseNHits;
231 m_nshsct = initialiseNHits;
232 m_nholes = initialiseNHits;
233 m_nhpix = initialiseNHits;
234 m_nhsct = initialiseNHits;
235
236 constexpr double invalidChiSq(-1e12);
237 constexpr int invalidDegreesOfFreedom{-999};
238 m_chi2 = invalidChiSq;
239 m_chi2prob = invalidChiSq;
240 m_ndof = invalidDegreesOfFreedom;
241
242 const Trk::Perigee* aMeasPer = (alignTrack->perigeeParameters());
243 if (not aMeasPer) ATH_MSG_ERROR("Could not get Trk::MeasuredPerigee");
244 else {
245 m_d0 = aMeasPer->parameters()[Trk::d0];
246 m_z0 = aMeasPer->parameters()[Trk::z0];
247 m_phi0 = aMeasPer->parameters()[Trk::phi0];
248 m_theta = aMeasPer->parameters()[Trk::theta];
249 m_qoverp = aMeasPer->parameters()[Trk::qOverP];
250 ATH_MSG_DEBUG(itrk << ". " << " Track Parameters (d0, z0, phi0, theta, q/p)");
251 ATH_MSG_DEBUG(" " << m_d0 << ", " << m_z0 << ", " << m_phi0 << ", " << m_theta << ", " << m_qoverp);
252 m_pt = std::sqrt((aMeasPer->momentum().x()) * (aMeasPer->momentum().x())
253 + (aMeasPer->momentum().y()) * (aMeasPer->momentum().y()));
254 m_eta = aMeasPer->eta();
255 m_xvtx = aMeasPer->position().x();
256 m_yvtx = aMeasPer->position().y();
257 m_zvtx = aMeasPer->position().z();
258
259 xAOD::TrackParticle* trackPart = m_particleCreator->createParticle(*alignTrack);
260 uint8_t iSummaryValue(0); // Dummy counter to retrieve summary values
261
262 if (not trackPart) ATH_MSG_ERROR("Could not get xAOD::TrackParticle");
263 else {
264 // hits
265 m_nhitspix = trackPart->summaryValue(iSummaryValue, xAOD::numberOfPixelHits) ? iSummaryValue : 0;
266 m_nhitssct = trackPart->summaryValue(iSummaryValue, xAOD::numberOfSCTHits) ? iSummaryValue : 0;
267 m_nhitstrt = trackPart->summaryValue(iSummaryValue, xAOD::numberOfTRTHits) ? iSummaryValue : 0;
268
269 ATH_MSG_DEBUG(" -- number of Pixel hits : " << m_nhitspix);
270 ATH_MSG_DEBUG(" -- number of SCT hits : " << m_nhitssct);
271 ATH_MSG_DEBUG(" -- number of TRT hits : " << m_nhitstrt);
272
273 // shared hits
274 m_nshpix = trackPart->summaryValue(iSummaryValue, xAOD::numberOfPixelSharedHits) ? iSummaryValue : 0;
275 m_nshsct = trackPart->summaryValue(iSummaryValue, xAOD::numberOfSCTSharedHits) ? iSummaryValue : 0;
277
278 if (m_nshpix < 0) m_nshpix = 0;
279 if (m_nshsct < 0) m_nshsct = 0;
280 if (m_nshared < 0) m_nshared = 0;
281
282 ATH_MSG_DEBUG(" - number of shared hits : " << m_nshared);
283 ATH_MSG_DEBUG(" -- number of Pixel shared hits : " << m_nshpix);
284 ATH_MSG_DEBUG(" -- number of SCT shared hits : " << m_nshsct);
285
286 // holes
287 m_nhpix = trackPart->summaryValue(iSummaryValue, xAOD::numberOfPixelHoles) ? iSummaryValue : 0;
288 m_nhsct = trackPart->summaryValue(iSummaryValue, xAOD::numberOfSCTHoles) ? iSummaryValue : 0;
290
291 if (m_nhpix < 0) m_nhpix = 0;
292 if (m_nhsct < 0) m_nhsct = 0;
293 if (m_nholes < 0) m_nholes = 0;
294
295 ATH_MSG_DEBUG(" - number of Pixel holes : " << m_nhpix);
296 ATH_MSG_DEBUG(" -- number of SCT holes : " << m_nhsct);
297 ATH_MSG_DEBUG(" -- number of holes : " << m_nholes);
298 }
299
300 // get fit quality and chi2 probability of track
301 const Trk::FitQuality* fitQual = alignTrack->fitQuality();
302 if (not fitQual) ATH_MSG_ERROR("No fit quality assigned to the track");
303 else {
304 if (fitQual->chiSquared() > 0. && fitQual->numberDoF() > 0) {
305 m_chi2 = fitQual->chiSquared();
306 m_ndof = fitQual->numberDoF();
307 m_chi2prob = TMath::Prob(m_chi2, m_ndof);
308
309 ATH_MSG_DEBUG(" - chi2 : " << m_chi2);
310 ATH_MSG_DEBUG(" - ndof : " << m_ndof);
311 ATH_MSG_DEBUG(" - chi2/ndof : " << m_chi2 / (double) m_ndof);
312 ATH_MSG_DEBUG(" - chi2 propability : " << m_chi2prob);
313 }
314 }
315 }
316
317 // store information for all hits on this track, including
318 // scattering centers
319 const Trk::AlignTSOSCollection* alignTSOSCollection = alignTrack->alignTSOSCollection();
320 int nhitsTotal = alignTSOSCollection->size();
321 if (nhitsTotal > m_max_hits) nhitsTotal = m_max_hits;
322
323
324 fillHits(alignTrack);
325
326
327 m_file->cd();
328 m_tree->Fill();
329 ATH_MSG_DEBUG("tree filled");
330
331 ++itrk;
332 return;
333 }
334
335//________________________________________________________________________
337 ATH_MSG_DEBUG("In fillHits()");
338
339 // store information for all hits on this track
340 // initialize ntuple variables
341 for (int i = 0; i < m_max_hits; i++) {
342 m_hit_rho[i] = -999.;
343 m_hit_phi[i] = -999.;
344 m_hit_z[i] = -999.;
345 m_hit_cotth[i] = -999.;
346 m_hit_eta[i] = -999.;
347 m_hit_xloc[i] = -999.;
348 m_hit_yloc[i] = -999.;
349 m_hit_zloc[i] = -999.;
350 m_hit_drd[i] = -999.;
351 m_hit_sig[i] = -999.;
352
353 m_hit_tpar_x[i] = -999.;
354 m_hit_tpar_y[i] = -999.;
355
356 m_hit_resx[i] = -999.;
357 m_hit_resx_err[i] = -999.;
358 m_hit_resy[i] = -999.;
359 m_hit_resy_err[i] = -999.;
360
361 m_hit_det[i] = -999;
362 m_hit_type[i] = -999;
363
364 if (m_storeDerivatives) {
365 m_hit_derivx_transx[i] = -999.;
366 m_hit_derivx_transy[i] = -999.;
367 m_hit_derivx_transz[i] = -999.;
368 m_hit_derivx_rotx[i] = -999.;
369 m_hit_derivx_roty[i] = -999.;
370 m_hit_derivx_rotz[i] = -999.;
371 m_hit_derivx_bowx[i] = -999.;
372 m_hit_derivx_bowy[i] = -999.;
373 m_hit_derivx_bowz[i] = -999.;
374
375 m_hit_derivy_transx[i] = -999.;
376 m_hit_derivy_transy[i] = -999.;
377 m_hit_derivy_transz[i] = -999.;
378 m_hit_derivy_rotx[i] = -999.;
379 m_hit_derivy_roty[i] = -999.;
380 m_hit_derivy_rotz[i] = -999.;
381 m_hit_derivy_bowx[i] = -999.;
382 m_hit_derivy_bowy[i] = -999.;
383 m_hit_derivy_bowz[i] = -999.;
384 }
385 }
386
387 const Trk::AlignTSOSCollection* alignTSOSCollection = alignTrack->alignTSOSCollection();
388 m_nhits = alignTSOSCollection->size();
389 ATH_MSG_DEBUG("have " << m_nhits << " hits on alignTrack in total");
390
391 int nhits = 0;
392
393 DataVector<Trk::AlignTSOS>::const_iterator atsit = alignTSOSCollection->begin();
394 DataVector<Trk::AlignTSOS>::const_iterator atsit_end = alignTSOSCollection->end();
395 for (; atsit != atsit_end; ++atsit) {
396 const Trk::AlignTSOS* atsos = *atsit;
397 ATH_MSG_DEBUG("in loop over AlignTSOS, nhits=" << nhits);
398 if (nhits == m_max_hits) break;
399
400 if (!atsos->type(Trk::TrackStateOnSurface::Measurement)) continue;
401
402 m_hit_det[nhits] = atsos->measType();
403 ATH_MSG_DEBUG("measurement type: " << atsos->dumpMeasType());
404
405
406 // get RIO
407 const Trk::RIO_OnTrack* rio = atsos->rio();
408 ATH_MSG_DEBUG("have RIO");
409 Amg::Vector3D pos = rio->globalPosition();
410
411 double locPosX(0.);
412 if (rio->localParameters().contains(Trk::locX)) locPosX = rio->localParameters()[Trk::locX];
413 double locPosY(0.);
414 if (rio->localParameters().contains(Trk::locY)) locPosY = rio->localParameters()[Trk::locY];
415 double locPosZ(0.);
416 if (rio->localParameters().contains(Trk::locZ)) locPosZ = rio->localParameters()[Trk::locZ];
417
418 double error = Amg::error(rio->localCovariance(), Trk::locX);
419 ATH_MSG_DEBUG("error: " << error);
420
421 Identifier id = rio->identify();
422
423
424 m_hit_xloc[nhits] = locPosX;
425 m_hit_yloc[nhits] = locPosY;
426 m_hit_zloc[nhits] = locPosZ;
427
428 m_hit_rho[nhits] = pos.perp();
429 m_hit_phi[nhits] = pos.phi();
430 m_hit_z[nhits] = pos.z();
431 m_hit_sig[nhits] = error;
432
433 // get residual x
434 std::vector<Trk::Residual>::const_iterator ires = atsos->firstResidual();
435
436 m_hit_resx[nhits] = ires->residual();
437 m_hit_resx_err[nhits] = ires->error();
438
439 // get residual y if applicable
440 if (atsos->nResDim() > 1) {
441 ++ires;
442 m_hit_resy[nhits] = ires->residual();
443 m_hit_resy_err[nhits] = ires->error();
444 }
445
446 // get local track parameters
447 const Trk::TrackParameters* trackPars = nullptr;
448 if (atsos->firstResidual()->residualType() == Trk::HitOnly) trackPars = atsos->trackParameters();
449 else trackPars = atsos->unbiasedTrackPars();
450
451 m_hit_tpar_x[nhits] = trackPars->parameters()[Trk::locX];
452 m_hit_tpar_y[nhits] = trackPars->parameters()[Trk::locY];
453
454
455 if (m_idHelper->is_barrel(id)) {
456 m_hit_cotth[nhits] = 0.;
457 m_hit_eta[nhits] = 0.;
458 } else {
459 m_hit_cotth[nhits] = 1. / std::tan(pos.theta());
460 double etaval = -std::log(std::tan(std::atan(1. / std::abs(m_hit_cotth[nhits])) / 2.));
461 if (m_hit_cotth[nhits] < 0.) etaval *= -1.;
462 m_hit_eta[nhits] = etaval;
463 }
464 if (atsos->measType() != Trk::TrackState::TRT) m_hit_drd[nhits] = locPosX;
465
466 // fill derivatives
467 if (m_storeDerivatives) {
468 //const std::vector<CLHEP::HepVector> * derivs = atsos->derivatives();
469 const std::vector<Amg::VectorX>* derivs = atsos->derivatives();
470 if (derivs) {
471 int npar = derivs->at(0).rows();
472
473 const DataVector<Trk::AlignPar>* alignPars = m_alignModuleTool->getAlignPars(atsos->module());
474 int naPar = alignPars->size();
475
476 if (npar != naPar) ATH_MSG_WARNING("number of derivatives on AlignTSOS doesn't match the one on AlignModule");
477
478 else {
479 for (int i = 0; i < npar; i++) {
480 double derivative = (*derivs)[0][i];
481 Trk::AlignModule::TransformParameters ptype = alignPars->at(i)->paramType();
482 switch (ptype) {
484 m_hit_derivx_transx[nhits] = derivative;
485 break;
486
488 m_hit_derivx_transy[nhits] = derivative;
489 break;
490
492 m_hit_derivx_transz[nhits] = derivative;
493 break;
494
496 m_hit_derivx_rotx[nhits] = derivative;
497 break;
498
500 m_hit_derivx_roty[nhits] = derivative;
501 break;
502
504 m_hit_derivx_rotz[nhits] = derivative;
505 break;
506
508 m_hit_derivx_bowx[nhits] = derivative;
509 break;
510
512 m_hit_derivx_bowy[nhits] = derivative;
513 break;
514
516 m_hit_derivx_bowz[nhits] = derivative;
517 break;
518
519 default:
520 ATH_MSG_WARNING("Unknown parameter type " << ptype);
521 }
522 }
523 if (atsos->nResDim() > 1) {
524 for (int i = 0; i < npar; i++) {
525 double derivative = (*derivs)[1][i];
526 Trk::AlignModule::TransformParameters ptype = alignPars->at(i)->paramType();
527 switch (ptype) {
529 m_hit_derivy_transx[nhits] = derivative;
530 break;
531
533 m_hit_derivy_transy[nhits] = derivative;
534 break;
535
537 m_hit_derivy_transz[nhits] = derivative;
538 break;
539
541 m_hit_derivy_rotx[nhits] = derivative;
542 break;
543
545 m_hit_derivy_roty[nhits] = derivative;
546 break;
547
549 m_hit_derivy_rotz[nhits] = derivative;
550 break;
551
553 m_hit_derivy_bowx[nhits] = derivative;
554 break;
555
557 m_hit_derivy_bowy[nhits] = derivative;
558 break;
559
561 m_hit_derivy_bowz[nhits] = derivative;
562 break;
563
564 default:
565 ATH_MSG_WARNING("Unknown parameter type " << ptype);
566 }
567 }
568 }
569 }
570 }
571 } // end of storing derivatives
572
573 ++nhits;
574
575 if (nhits >= m_max_hits) {
576 ATH_MSG_WARNING("Number of hits on track more that maximum: " << m_nhits << " > " << m_max_hits << " "
577 << "Some hits will not be stored.");
578 break;
579 }
580 } //atsos
581
582 ATH_MSG_DEBUG("done with loop over TSOS");
583 }
584
585//________________________________________________________________________
588
589//________________________________________________________________________
592
593//________________________________________________________________________
596
597//________________________________________________________________________
600
601//________________________________________________________________________
603 m_hit_rho = new double[m_max_hits];
604 m_hit_phi = new double[m_max_hits];
605 m_hit_z = new double[m_max_hits];
606 m_hit_cotth = new double[m_max_hits];
607 m_hit_eta = new double[m_max_hits];
608 m_hit_xloc = new double[m_max_hits];
609 m_hit_yloc = new double[m_max_hits];
610 m_hit_zloc = new double[m_max_hits];
611 m_hit_drd = new double[m_max_hits];
612 m_hit_sig = new double[m_max_hits];
613
614 m_hit_tpar_x = new double[m_max_hits];
615 m_hit_tpar_y = new double[m_max_hits];
616
617 m_hit_resx = new double[m_max_hits];
618 m_hit_resx_err = new double[m_max_hits];
619 m_hit_resy = new double[m_max_hits];
620 m_hit_resy_err = new double[m_max_hits];
621
622 m_hit_det = new int[m_max_hits];
623 m_hit_type = new int[m_max_hits];
624
625 m_file->cd();
626 m_tree = new TTree("IDAlign", "Inner Detector Alignment Ntuple");
627
628 m_tree->Branch("run", &m_runNumber, "run/I");
629 m_tree->Branch("evt", &m_evtNumber, "evt/I");
630
631 m_tree->Branch("xvtx", &m_xvtx, "xvtx/D");
632 m_tree->Branch("yvtx", &m_yvtx, "yvtx/D");
633 m_tree->Branch("zvtx", &m_zvtx, "zvtx/D");
634 m_tree->Branch("d0", &m_d0, "d0/D");
635 m_tree->Branch("z0", &m_z0, "z0/D");
636 m_tree->Branch("phi0", &m_phi0, "phi0/D");
637 m_tree->Branch("theta", &m_theta, "theta/D");
638 m_tree->Branch("qoverp", &m_qoverp, "qoverp/D");
639 m_tree->Branch("pt", &m_pt, "pt/D");
640 m_tree->Branch("eta", &m_eta, "eta/D");
641 m_tree->Branch("chi2", &m_chi2, "chi2/D");
642 m_tree->Branch("ndof", &m_ndof, "ndof/I");
643 m_tree->Branch("chi2prob", &m_chi2prob, "chi2prob/D");
644
645 m_tree->Branch("nhits", &m_nhits, "nhits/I");
646 m_tree->Branch("nhitstrt", &m_nhitstrt, "nhitstrt/I");
647 m_tree->Branch("nhitssct", &m_nhitssct, "nhitssct/I");
648 m_tree->Branch("nhitspix", &m_nhitspix, "nhitspix/I");
649 m_tree->Branch("nshared", &m_nshared, "nshared/I");
650 m_tree->Branch("nshsct", &m_nshsct, "nshsct/I");
651 m_tree->Branch("nshpix", &m_nshpix, "nshpix/I");
652 m_tree->Branch("nholes", &m_nholes, "nholes/I");
653 m_tree->Branch("nhsct", &m_nhsct, "nhsct/I");
654 m_tree->Branch("nhpix", &m_nhpix, "nhpix/I");
655
656 m_tree->Branch("hit_rho", m_hit_rho, "hit_rho[nhits]/D");
657 m_tree->Branch("hit_phi", m_hit_phi, "hit_phi[nhits]/D");
658 m_tree->Branch("hit_z", m_hit_z, "hit_z[nhits]/D");
659 m_tree->Branch("hit_cotth", m_hit_cotth, "hit_cotth[nhits]/D");
660 m_tree->Branch("hit_eta", m_hit_eta, "hit_eta[nhits]/D");
661 m_tree->Branch("hit_xloc", m_hit_xloc, "hit_xloc[nhits]/D");
662 m_tree->Branch("hit_yloc", m_hit_yloc, "hit_yloc[nhits]/D");
663 m_tree->Branch("hit_zloc", m_hit_zloc, "hit_zloc[nhits]/D");
664 m_tree->Branch("hit_drd", m_hit_drd, "hit_drd[nhits]/D");
665 m_tree->Branch("hit_sig", m_hit_sig, "hit_sig[nhits]/D");
666
667 m_tree->Branch("hit_tpar_x", m_hit_tpar_x, "hit_tpar_x[nhits]/D");
668 m_tree->Branch("hit_tpar_y", m_hit_tpar_y, "hit_tpar_y[nhits]/D");
669
670 m_tree->Branch("hit_resx", m_hit_resx, "hit_resx[nhits]/D");
671 m_tree->Branch("hit_resx_err", m_hit_resx_err, "hit_resx_err[nhits]/D");
672 m_tree->Branch("hit_resy", m_hit_resy, "hit_resy[nhits]/D");
673 m_tree->Branch("hit_resy_err", m_hit_resy_err, "hit_resy_err[nhits]/D");
674
675 m_tree->Branch("hit_det", m_hit_det, "hit_det[nhits]/I");
676 m_tree->Branch("hit_type", m_hit_type, "hit_type[nhits]/I");
677
678 if (m_storeDerivatives) {
679 m_hit_derivx_transx = new double[m_max_hits];
680 m_hit_derivx_transy = new double[m_max_hits];
681 m_hit_derivx_transz = new double[m_max_hits];
682 m_hit_derivx_rotx = new double[m_max_hits];
683 m_hit_derivx_roty = new double[m_max_hits];
684 m_hit_derivx_rotz = new double[m_max_hits];
685 m_hit_derivx_bowx = new double[m_max_hits];
686 m_hit_derivx_bowy = new double[m_max_hits];
687 m_hit_derivx_bowz = new double[m_max_hits];
688 m_hit_derivy_transx = new double[m_max_hits];
689 m_hit_derivy_transy = new double[m_max_hits];
690 m_hit_derivy_transz = new double[m_max_hits];
691 m_hit_derivy_rotx = new double[m_max_hits];
692 m_hit_derivy_roty = new double[m_max_hits];
693 m_hit_derivy_rotz = new double[m_max_hits];
694 m_hit_derivy_bowx = new double[m_max_hits];
695 m_hit_derivy_bowy = new double[m_max_hits];
696 m_hit_derivy_bowz = new double[m_max_hits];
697
698 m_tree->Branch("derivx_transx", m_hit_derivx_transx, "derivx_transx[nhits]/D");
699 m_tree->Branch("derivx_transy", m_hit_derivx_transy, "derivx_transy[nhits]/D");
700 m_tree->Branch("derivx_transz", m_hit_derivx_transz, "derivx_transz[nhits]/D");
701 m_tree->Branch("derivx_rotx", m_hit_derivx_rotx, "derivx_rotx[nhits]/D");
702 m_tree->Branch("derivx_roty", m_hit_derivx_roty, "derivx_roty[nhits]/D");
703 m_tree->Branch("derivx_rotz", m_hit_derivx_rotz, "derivx_rotz[nhits]/D");
704 m_tree->Branch("derivx_bowx", m_hit_derivx_bowx, "derivx_bowx[nhits]/D");
705 m_tree->Branch("derivx_bowy", m_hit_derivx_bowy, "derivx_bowy[nhits]/D");
706 m_tree->Branch("derivx_bowz", m_hit_derivx_bowz, "derivx_bowz[nhits]/D");
707 m_tree->Branch("derivy_transx", m_hit_derivy_transx, "derivy_transx[nhits]/D");
708 m_tree->Branch("derivy_transy", m_hit_derivy_transy, "derivy_transy[nhits]/D");
709 m_tree->Branch("derivy_transz", m_hit_derivy_transz, "derivy_transz[nhits]/D");
710 m_tree->Branch("derivy_rotx", m_hit_derivy_rotx, "derivy_rotx[nhits]/D");
711 m_tree->Branch("derivy_roty", m_hit_derivy_roty, "derivy_roty[nhits]/D");
712 m_tree->Branch("derivy_rotz", m_hit_derivy_rotz, "derivy_rotz[nhits]/D");
713 m_tree->Branch("derivy_bowx", m_hit_derivy_bowx, "derivy_bowx[nhits]/D");
714 m_tree->Branch("derivy_bowy", m_hit_derivy_bowy, "derivy_bowy[nhits]/D");
715 m_tree->Branch("derivy_bowz", m_hit_derivy_bowz, "derivy_bowz[nhits]/D");
716 }
717 return;
718 }
719} // end namespace
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the TRT subdetector.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
Derived DataVector<T>.
Definition DataVector.h:795
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const T * at(size_type n) const
Access an element, as an rvalue.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
double * m_hit_derivy_rotx
derivatives of Y-residual wrt.
double * m_hit_tpar_y
track parameter locY
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
Pointer to track particle creator tool.
int * m_hit_det
detector type for the hit
int m_nhitstrt
number of TRT hits on track (ntrthits in ntuple)
virtual void dumpTrack(int itrk, const Trk::AlignTrack *alignTrack) override
fills track information to ntuple
double m_eta
eta of perigee of reconstructed track (eta in ntuple)
virtual void storeHitmap() override
stores hitmap for writing to ntuple
ToolHandle< Trk::IAlignModuleTool > m_alignModuleTool
Pointer to AlignmModuleTool.
double * m_hit_tpar_x
track parameter locX
double * m_hit_derivy_roty
derivatives of Y-residual wrt.
virtual StatusCode finalize() override
virtual StatusCode fillNtuple() override
writes trees and histograms to ntuple
double * m_hit_derivx_transx
derivatives of X-residual wrt.
double * m_hit_phi
phi angle of hit (hit_phi in ntuple)
SimpleIDNtupleTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual void fillSummary() override
fills ntuple with event and track summary information
double * m_hit_derivx_rotx
derivatives of X-residual wrt.
int m_nhitssct
number of SCT hits on track (nscthits in ntuple)
double * m_hit_derivx_bowz
derivatives of X-residual wrt.
int m_ndof
number of degrees of freedom of the track fit (ndof in ntuple)
double * m_hit_derivy_bowx
derivatives of Y-residual wrt.
double * m_hit_derivx_transz
derivatives of X-residual wrt.
double * m_hit_derivy_rotz
derivatives of Y-residual wrt.
double * m_hit_derivx_bowx
derivatives of X-residual wrt.
double * m_hit_drd
drift distance to wire for hit (hit_drd in ntuple)
int m_nhpix
number of Pixel holes on track (nhpix in ntuple)
double * m_hit_resy
Y-residual of the hit.
double * m_hit_resy_err
Y-residual error of the hit.
double * m_hit_derivx_roty
derivatives of X-residual wrt.
virtual StatusCode initialize() override
virtual void fillHitmap() override
fills ntuple with hit information
double * m_hit_rho
radius of hit (hit_rho in ntuple)
double m_pt
pt perigee parameter of reconstructed track (pt in ntuple)
virtual void showStatistics() override
write statistics out to log file
double * m_hit_resx_err
X-residual error of the hit.
double * m_hit_derivx_transy
derivatives of X-residual wrt.
double * m_hit_yloc
local y coord of hit (hit_yloc in ntuple)
double * m_hit_cotth
cot(theta) of hit (hit_cotth in ntuple)
double m_phi0
phi perigee parameter of reconstructed track (phi0 in ntuple)
double * m_hit_derivx_rotz
derivatives of X-residual wrt.
double m_yvtx
y coord of track perigee (yvtx in ntuple)
int m_max_hits
max number of hits on track stored in ntuple
double * m_hit_xloc
local x coord of hit (hit_xloc in ntuple)
double * m_hit_z
z coord of hit (hit_z in ntuple)
double m_theta
theta perigee parameter of reconstructed track (theta in ntuple)
double * m_hit_derivy_transx
derivatives of Y-residual wrt.
double * m_hit_eta
eta angle of hit (hit_eta in ntuple)
double * m_hit_sig
hit error (hit_sig in ntuple)
int m_nhitspix
number of Pixel hits on track (ntrthits in ntuple)
double m_chi2prob
Chi2 probability of the track fit (chi2prob in ntuple)
double m_zvtx
z coord of track perigee (zvtx in ntuple)
int m_nshpix
number of shared Pixel hits on track (nshpix in ntuple)
double m_z0
z0 perigee parameter of reconstructed track (z0 in ntuple)
double * m_hit_derivy_bowz
derivatives of Y-residual wrt.
double m_chi2
Chi2 of the track fit (chi2 in ntuple)
void fillHits(const Trk::AlignTrack *alignTrack)
fills hit information to ntuple
double m_xvtx
x coord of track perigee (xvtx in ntuple)
double * m_hit_derivx_bowy
derivatives of X-residual wrt.
int m_nhsct
number of SCT holes on track (nhsct in ntuple)
int m_nshared
number of shared hits on track (nshared in ntuple)
int m_nhits
number of hits on track [including scattering centers] (nhits in ntuple)
double * m_hit_derivy_transy
derivatives of Y-residual wrt.
int m_nshsct
number of shared SCT hits on track (nshsct in ntuple)
double * m_hit_resx
X-residual of the hit.
int m_nholes
number of holes on track (nholes in ntuple)
double * m_hit_derivy_bowy
derivatives of Y-residual wrt.
double * m_hit_zloc
local z coord of hit (hit_zloc in ntuple)
double m_qoverp
Q over p perigee parameter of reconstructed track (qoverp in ntuple)
double m_d0
d0 perigee parameter of reconstructed track (d0 in ntuple)
double * m_hit_derivy_transz
derivatives of Y-residual wrt.
TransformParameters
enum to keep track of transformation coordinates
Definition AlignModule.h:54
const RIO_OnTrack * rio() const
returns RIO_OnTrack or leading RIO of CompetingRIOsOnTrack (assigned by c'tor)
const TrackParameters * unbiasedTrackPars() const
returns pointer to unbiased track parameters if present
Definition AlignTSOS.h:134
const std::vector< Amg::VectorX > * derivatives() const
returns pointer to vector of derivatives
Definition AlignTSOS.h:140
int nResDim() const
returns number of measurement residual + scatterer residual dimensions
Definition AlignTSOS.h:77
std::vector< Residual >::const_iterator firstResidual() const
returns first Residual iterator
Definition AlignTSOS.h:104
const AlignModule * module() const
accessor method for AlignModule to which tsos belongs
Definition AlignTSOS.h:69
std::string dumpMeasType() const
returns string corresponding to the measurement type
TrackState::MeasurementType measType() const
returns measurement type enum
Definition AlignTSOS.h:80
const AlignTSOSCollection * alignTSOSCollection() const
returns collection of alignTSOS
Definition AlignTrack.h:267
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
bool contains(ParamDefs par) const
The simple check for the clients whether the parameter is contained.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
double eta() const
Access method for pseudorapidity - from momentum.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Identifier identify() const
return the identifier -extends MeasurementBase
virtual const Amg::Vector3D & globalPosition() const override=0
Interface method to get the global Position.
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
bool type(const TrackStateOnSurfaceType type) const
Use this method to find out if the TSoS is of a certain type: i.e.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
const Perigee * perigeeParameters() const
return Perigee.
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
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 ...
Eigen::Matrix< double, 3, 1 > Vector3D
Primary Vertex Finder.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
DataVector< AlignTSOS > AlignTSOSCollection
Definition AlignTrack.h:37
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ locZ
local cylindrical
Definition ParamDefs.h:42
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].