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
51namespace {
52static constexpr unsigned short s_hgtd_layers = 4; // two double sided layers
53} // namespace
54
55namespace HGTD {
56
58
59private:
60 // different shift distances for bitfield definition
61 const short m_recoed_ptrn_sft = 0;
62 //const short m_exp_ptrn_sft = 4;
63 const short m_comp_ptrn_sft = 8;
64 const short m_holes_ptrn_sft = 12;
65 const short m_primes_ptrn_sft = 16;
66
67public:
68 TrackTimeDefAndQualityAlg(const std::string& name, ISvcLocator* pSvcLocator);
70 virtual StatusCode initialize() override final;
71 virtual StatusCode execute(const EventContext& ctx) const override final;
72
74 std::pair<float, float> getRadiusAndZ(const xAOD::TrackParticle& track_particle) const;
75
77 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleContainerKey{
78 this, "TrackParticleContainerName", "InDetTrackParticles",
79 "Name of the TrackParticle container"};
80
82 this, "HGTD_has_extension", m_trackParticleContainerKey, "HGTD_has_extension",
83 "deco with a handle for an extension"};
85 this, "HGTD_cluster_time", m_trackParticleContainerKey, "HGTD_cluster_time",
86 "deco with a handle for cluster time"};
89 this, "HGTD_cluster_truth_class", m_trackParticleContainerKey,
90 "HGTD_cluster_truth_class",
91 "deco with a handle for a truth time"};
92
96 this, "timeResolution", m_trackParticleContainerKey, "timeResolution",
97 "Time resolution assigned to this track"};
99 this, "hasValidTime", m_trackParticleContainerKey, "hasValidTime", "Time assigned to this track is valid"};
102 "HGTD_summaryinfo",
103 "Bitfield for working point definition"};
104
105 Gaudi::Property<bool> m_doActs {this, "doActs", false};
106
107 // TODO: the resolution is fixed to 0.035 ps, should add the resolution
108 // calculation after the irradiation
109 struct Hit {
110 float m_time = 0.;
111 float m_resolution = 0.035;
112 bool m_isprime = false;
113 bool m_isvalid = false;
114 short m_layer = -1;
115 };
116
118 std::array<Hit, s_hgtd_layers> m_hits;
119 uint32_t m_field = 0x0;
120 float m_time;
123 };
124
125 FloatProperty m_chi2_threshold{
126 this, "Chi2Threshold", 1.5,
127 "Quality cut for decision to keep hits compatible in time"};
128 FloatProperty m_deltat_cut{this, "DeltaTCut", 2.0,
129 "Upper limit for a cluster delta t cut"};
130
131 FloatProperty m_default_time{
132 this, "DefaultTime", 0.0,
133 "Default time used for tracks without HGTD timing info"};
134 // time resolution default value, set to +- half a bunch crossing, using flat
135 // distribution
136 FloatProperty m_default_time_res{
137 this, "DefaultTimeRes", 50. / std::sqrt(12.),
138 "Default time resolution used for tracks without HGTD timing info"};
139
140 CleaningResult
141 runTimeConsistencyCuts(const std::vector<float>& times,
142 const std::vector<bool>& has_clusters,
143 const std::vector<int>& hit_classification) const;
144
145 std::array<Hit, s_hgtd_layers>
146 getValidHits(const std::vector<float>& times,
147 const std::vector<bool>& has_clusters,
148 const std::vector<int>& hit_classification) const;
149
157 float calculateChi2(const std::array<Hit, s_hgtd_layers>& hits) const;
158
159 // float calculateChi2(const std::vector<Hit>& hits) const;
160
168 bool passesDeltaT(const std::array<Hit, s_hgtd_layers>& hits) const;
169
178 float meanTime(const std::array<Hit, s_hgtd_layers>& hits) const;
179
183 float trackTimeResolution(const std::array<Hit, s_hgtd_layers>& hits) const;
184
194 short findLayerWithBadChi2(std::array<Hit, s_hgtd_layers> hits) const;
195
203 void setLayerAsInvalid(std::array<Hit, s_hgtd_layers>& hits,
204 short layer) const;
205
215 short getValidPattern(const std::array<Hit, s_hgtd_layers>& hits) const;
216
227 bool lastHitIsOnLastSurface(const xAOD::TrackParticle& track_particle) const;
228
229 const Trk::TrackParameters* getLastHitOnTrack(const Trk::Track& track) const;
230};
231
232} // namespace HGTD
233
234#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.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_time_dec_key
SG::ReadDecorHandleKey< xAOD::TrackParticleContainer > m_layerClusterTruthClassKey
std::array< Hit, s_hgtd_layers > getValidHits(const std::vector< float > &times, const std::vector< bool > &has_clusters, const std::vector< int > &hit_classification) const
CleaningResult runTimeConsistencyCuts(const std::vector< float > &times, const std::vector< bool > &has_clusters, const std::vector< int > &hit_classification) const
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...
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