ATLAS Offline Software
Loading...
Searching...
No Matches
ExpertTrackTimeFromSummaryTool.cxx
Go to the documentation of this file.
1
9
11
12#include <algorithm>
13#include <bit>
14
15using namespace HGTD;
16
18 const std::string& t, const std::string& n, const IInterface* p)
19 : base_class(t, n, p) {}
20
22 ATH_CHECK(AthAlgTool::initialize());
23 return StatusCode::SUCCESS;
24}
25
27 const xAOD::TrackParticle& track_particle) const {
28 // The validTime decoration checks for time consistency and
29 // extensions with chi2 bellow threashold
30 if (m_acc_has_valid_time(track_particle) != 1) {
31 return false;
32 }
33
34 if (m_do_min_nhits and (this->nHits(track_particle) <= 1)) {
35 // if a 2 hit minimum is required, reject the case of a single associated
36 // hit if the track falls into the defined eta region
37 float fabs_eta = std::abs(track_particle.eta());
38 if (fabs_eta > m_min_eta and fabs_eta < m_max_eta) {
39 return false;
40 }
41 }
42
43 // Check if the last measurement of ITk track is close to HGTD
44 bool last_hit_not_on_last_surface =
45 m_acc_summary_info(track_particle) & (1 << m_holes_ptrn_sft);
46 if (m_do_last_hit and last_hit_not_on_last_surface) {
47 return false;
48 }
49
50 return true;
51}
52
54 const xAOD::TrackParticle& track_particle) const {
55 return track_particle.time();
56}
57
59 const xAOD::TrackParticle& track_particle) const {
60 return m_acc_time_resolution(track_particle);
61}
62
64 const xAOD::TrackParticle& track_particle) const {
65 // Get 4-bit word that indicate valid hits after time consistency check
66 uint8_t n_comp =
67 (m_acc_summary_info(track_particle) >> m_comp_ptrn_sft) & 0x0F;
68 return std::popcount(n_comp);
69}
70
72 const xAOD::TrackParticle& track_particle) const {
73 // Get 4-bit word that indicate hits associated with primary particles
74 uint8_t n_primes =
75 (m_acc_summary_info(track_particle) >> m_primes_ptrn_sft) & 0x0F;
76 return std::popcount(n_primes);
77}
78
80 const xAOD::TrackParticle& track_particle) const {
81 if (not expertHasTime(track_particle)) {
82 ATH_MSG_WARNING("[ExpertTrackTimeFromSummaryTool::fracPrimaryHits]"
83 "No available hits, returning -999.");
84 return -999.;
85 }
86 short n_hits = this->nHits(track_particle);
87 if (n_hits > 0) {
88 return (float)this->nPrimaryHits(track_particle) / (float)n_hits;
89 } else {
90 return 0;
91 }
92}
93
95 const xAOD::TrackParticle& track_particle) const {
96 const std::vector<bool>& expected_hits =
97 m_acc_perLayer_expectCluster(track_particle);
98 return std::count(expected_hits.begin(), expected_hits.end(), true);
99}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration.
static const uint32_t nHits
virtual float fracPrimaryHits(const xAOD::TrackParticle &track_particle) const override final
virtual float expertTime(const xAOD::TrackParticle &track_particle) const override final
virtual StatusCode initialize() override final
int nHits(const xAOD::TrackParticle &track_particle) const
Number of HGTD hits that survived the time consistency check, decoded from the HGTD_summaryinfo bitfi...
SG::ConstAccessor< std::vector< bool > > m_acc_perLayer_expectCluster
virtual bool expertHasTime(const xAOD::TrackParticle &track_particle) const override final
int nPrimaryHits(const xAOD::TrackParticle &track_particle) const
Number of HGTD hits associated to a primary particle, decoded from the HGTD_summaryinfo bitfield.
virtual float expertTimeRes(const xAOD::TrackParticle &track_particle) const override final
virtual int numberPotentialPrimaryHits(const xAOD::TrackParticle &track_particle) const override final
ExpertTrackTimeFromSummaryTool(const std::string &, const std::string &, const IInterface *)
float time() const
Returns the time.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
TrackParticle_v1 TrackParticle
Reference the current persistent version: