ATLAS Offline Software
Loading...
Searching...
No Matches
TrackTimeDefAndQualityAlg.h
Go to the documentation of this file.
1
40
41#ifndef HGTD_RECALGS_TRACKTIMEDEFANDQUALITYALG_H
42#define HGTD_RECALGS_TRACKTIMEDEFANDQUALITYALG_H
43
45
50
51#include <array>
52#include <cstdint>
53#include <utility>
54#include <vector>
55#include <cmath>
56
57namespace {
58static constexpr unsigned short s_hgtd_layers = 4; // two double sided layers
59} // namespace
60
61namespace HGTD {
62
64
65private:
66 // different shift distances for bitfield definition
67 const short m_recoed_ptrn_sft = 0;
68 const short m_exp_ptrn_sft = 4;
69 const short m_comp_ptrn_sft = 8;
70 const short m_holes_ptrn_sft = 12;
71 const short m_primes_ptrn_sft = 16;
72
73public:
74 TrackTimeDefAndQualityAlg(const std::string& name, ISvcLocator* pSvcLocator);
76 virtual StatusCode initialize() override final;
77 virtual StatusCode execute(const EventContext& ctx) const override final;
78
80 std::pair<float, float> getRadiusAndZ(const xAOD::TrackParticle& track_particle) const;
81
83 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey{
84 this, "TrackParticleContainerName", "InDetTrackParticles",
85 "Name of the TrackParticle container"};
87 this, "HGTD_has_extension", m_trackParticleContainerKey, "HGTD_has_extension",
88 "deco with a handle for an extension"};
90 this, "HGTD_holes", m_trackParticleContainerKey, "HGTD_holes",
91 "deco with a handle for HGTD holes"};
93 this, "HGTD_cluster_time", m_trackParticleContainerKey, "HGTD_cluster_time",
94 "deco with a handle for cluster time"};
97 this, "HGTD_cluster_truth_class", m_trackParticleContainerKey,
98 "HGTD_cluster_truth_class",
99 "deco with a handle for a truth time"};
100
104 this, "timeResolution", m_trackParticleContainerKey, "timeResolution",
105 "Time resolution assigned to this track"};
107 this, "hasValidTime", m_trackParticleContainerKey, "hasValidTime", "Time assigned to this track is valid"};
110 "HGTD_summaryinfo",
111 "Bitfield for working point definition"};
112
113 // TODO: the resolution is fixed to 0.035 ps, should add the resolution
114 // calculation after the irradiation
115 struct Hit {
116 float m_time = 0.;
117 float m_resolution = 0.035;
118 bool m_isprime = false;
119 bool m_isvalid = false;
120 short m_layer = -1;
121 };
122
124 std::array<Hit, s_hgtd_layers> m_hits{};
125 uint32_t m_field = 0x0;
126 float m_time{};
128 uint8_t m_hasValidTime{};
129 };
130
131 FloatProperty m_chi2_threshold{
132 this, "Chi2Threshold", 1.5,
133 "Quality cut for decision to keep hits compatible in time"};
134 FloatProperty m_deltat_cut{this, "DeltaTCut", 2.0,
135 "Upper limit for a cluster delta t cut"};
136
137 FloatProperty m_default_time{
138 this, "DefaultTime", 0.0,
139 "Default time used for tracks without HGTD timing info"};
140 // time resolution default value, set to +- half a bunch crossing, using flat
141 // distribution
142 FloatProperty m_default_time_res{
143 this, "DefaultTimeRes", 50. / std::sqrt(12.),
144 "Default time resolution used for tracks without HGTD timing info"};
145
146 BooleanProperty m_doActs{this, "doActs", false,
147 "Use ACTS track representation for last-hit extraction"};
148
149 CleaningResult
150 runTimeConsistencyCuts(const std::vector<float>& times,
151 const std::vector<char>& has_clusters,
152 const std::vector<int>& hit_classification) const;
153
154 std::array<Hit, s_hgtd_layers>
155 getValidHits(const std::vector<float>& times,
156 const std::vector<char>& has_clusters,
157 const std::vector<int>& hit_classification) const;
158
166 float calculateChi2(const std::array<Hit, s_hgtd_layers>& hits) const;
167
168 // float calculateChi2(const std::vector<Hit>& hits) const;
169
177 bool passesDeltaT(const std::array<Hit, s_hgtd_layers>& hits) const;
178
187 float meanTime(const std::array<Hit, s_hgtd_layers>& hits) const;
188
192 float trackTimeResolution(const std::array<Hit, s_hgtd_layers>& hits) const;
193
203 short findLayerWithBadChi2(std::array<Hit, s_hgtd_layers> hits) const;
204
212 void setLayerAsInvalid(std::array<Hit, s_hgtd_layers>& hits,
213 short layer) const;
214
224 short getValidPattern(const std::array<Hit, s_hgtd_layers>& hits) const;
225
236 bool lastHitIsOnLastSurface(const xAOD::TrackParticle& track_particle) const;
237
238 const Trk::TrackParameters* getLastHitOnTrack(const Trk::Track& track) const;
239};
240
241} // namespace HGTD
242
243#endif // HGTD_RECALGS_TRACKTIMEDEFANDQUALITYALG_H
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
float calculateChi2(const std::array< Hit, s_hgtd_layers > &hits) const
Calculates the chi2 of the hit times given their resolution.
CleaningResult runTimeConsistencyCuts(const std::vector< float > &times, const std::vector< char > &has_clusters, const std::vector< int > &hit_classification) const
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_time_dec_key
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_holesHGTDKey
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTruthClassKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_time_res_dec_key
std::pair< float, float > getRadiusAndZ(const xAOD::TrackParticle &track_particle) const
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerKey
float meanTime(const std::array< Hit, s_hgtd_layers > &hits) const
Calculates the arithmetic mean of the valid hit times;.
void setLayerAsInvalid(std::array< Hit, s_hgtd_layers > &hits, short layer) const
Given a layer number, the hit sitting on this layer is flagged as invalid.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_hasValidTime_dec_key
float trackTimeResolution(const std::array< Hit, s_hgtd_layers > &hits) const
Calculates the combined resolution.
short findLayerWithBadChi2(std::array< Hit, s_hgtd_layers > hits) const
Identifies time outliers by finding the layer within which a hit contributes negatively to the overal...
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTimeKey
bool lastHitIsOnLastSurface(const xAOD::TrackParticle &track_particle) const
Checks if the last hit on track was found on a pre-specified set of Pixel and Strip layers close to t...
bool passesDeltaT(const std::array< Hit, s_hgtd_layers > &hits) const
Checks two hits for time compatibility.
virtual StatusCode execute(const EventContext &ctx) const override final
short getValidPattern(const std::array< Hit, s_hgtd_layers > &hits) const
Returns the pattern of valid hits in HGTD as a 4-bit bitfield, where a 1 encodes that a valid hit was...
std::array< Hit, s_hgtd_layers > getValidHits(const std::vector< float > &times, const std::vector< char > &has_clusters, const std::vector< int > &hit_classification) const
TrackTimeDefAndQualityAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_summarypattern_dec_key
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_layerHasExtensionKey
const Trk::TrackParameters * getLastHitOnTrack(const Trk::Track &track) const
virtual StatusCode initialize() override final
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
STL class.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
Forward declaration.
ParametersBase< TrackParametersDim, Charged > TrackParameters
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
#define private
Definition testRead.cxx:27