ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_IterativeExtensionTool Class Reference

#include <HGTD_IterativeExtensionTool.h>

Inheritance diagram for HGTD_IterativeExtensionTool:
Collaboration diagram for HGTD_IterativeExtensionTool:

Public Member Functions

 HGTD_IterativeExtensionTool (const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize () override final
virtual HGTD::ExtensionObject extendTrackToHGTD (const EventContext &ctx, const xAOD::TrackParticle &track_ptkl, const HGTD_ClusterContainer *container, const HepMC::GenEvent *hs_event=nullptr, const InDetSimDataCollection *sim_data=nullptr) const override final
 Finds the (up to) four measurements in HGTD that can be associated to the track.

Private Member Functions

const Trk::TrackStateOnSurfacegetLastHitOnTrack (const Trk::Track &track) const
 Retrieve the last hit on track stored in the Trk::Track.
std::vector< std::unique_ptr< const Trk::TrackParameters > > extrapolateToSurfaces (const EventContext &ctx, const Trk::TrackParameters &param, const std::vector< const Trk::Surface * > &surfaces) const
 After the compatible surfaces have been selected, the extrapolation is repeated to each of them.
std::unique_ptr< const Trk::TrackStateOnSurfaceupdateStateWithBestFittingCluster (const Trk::Track *track, const std::vector< std::unique_ptr< const Trk::TrackParameters > > &params, const HGTD_ClusterContainer *container) const
 Finds the overall best fitting cluster by keeping the one that gave the lowest chi2 after testing each surface and returning it.
std::unique_ptr< const Trk::TrackStateOnSurfacefindBestCompatibleCluster (const Trk::Track *track, const Trk::TrackParameters *param, const HGTD_ClusterContainer *container) const
 Find the cluster on a given surface that has the best chi2 passing the cut.
std::unique_ptr< const Trk::TrackStateOnSurfaceupdateState (const Trk::Track *track, const Trk::TrackParameters *param, const HGTD_Cluster *cluster) const
 Calls the TOF correction tool to build an HGTD_ClusterOnTrack with a calibrated time and resolution and then calls the Kalman updator tools to update the track state.
std::pair< const HGTD_Cluster *, HGTD::ClusterTruthInfogetTruthMatchedCluster (const std::vector< const Trk::Surface * > &surfaces, const HGTD_ClusterContainer *container, const xAOD::TruthParticle *truth_ptkl, const HepMC::GenEvent *hs_event, const InDetSimDataCollection *sim_data) const

Static Private Member Functions

static std::vector< const Trk::Surface * > getCompatibleSurfaces (const Trk::TrackParameters &param, const Trk::Layer *layer)
 Select all within the vincinity of the point of extrapolation.

Private Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator
ToolHandle< Trk::IUpdatorm_updator
ToolHandle< IHGTD_TOFcorrectionToolm_tof_corr_tool
ToolHandle< IHGTD_ClusterTruthToolm_truth_tool
const HGTD_DetectorManagerm_hgtd_det_mgr {nullptr}
const HGTD_IDm_hgtd_id_helper {nullptr}
FloatProperty m_chi2_cut
 Track extensions are only kept if the chi2/ndof is lower than the defined cut.
IntegerProperty m_particle_hypot
 Particle hypothesis used for the extrapolation.

Detailed Description

Definition at line 42 of file HGTD_IterativeExtensionTool.h.

Constructor & Destructor Documentation

◆ HGTD_IterativeExtensionTool()

HGTD_IterativeExtensionTool::HGTD_IterativeExtensionTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 29 of file HGTD_IterativeExtensionTool.cxx.

32 : base_class(t, n, p) {}

Member Function Documentation

◆ extendTrackToHGTD()

HGTD::ExtensionObject HGTD_IterativeExtensionTool::extendTrackToHGTD ( const EventContext & ctx,
const xAOD::TrackParticle & track_ptkl,
const HGTD_ClusterContainer * container,
const HepMC::GenEvent * hs_event = nullptr,
const InDetSimDataCollection * sim_data = nullptr ) const
finaloverridevirtual

Finds the (up to) four measurements in HGTD that can be associated to the track.

The Track itself is not altered during this process. Since HGTD contains four active layers per endcap, four hits is the maximum. An extension can be of hole-type

Parameters
[in]trackTrack reconstructed in ITk.
Returns
Array of compatible HGTD hits in the form of HGTD_ClusterOnTrack.

Definition at line 52 of file HGTD_IterativeExtensionTool.cxx.

55 {
56
57 ATH_MSG_DEBUG("Start extending");
58
59 const Trk::Track* track = track_ptkl.track();
60
61 HGTD::ExtensionObject result;
62
63 // get last hit on track in ITk as a starting point for the extrapolation
64 const Trk::TrackStateOnSurface* last_hit = getLastHitOnTrack(*track);
65 const Trk::TrackParameters* last_param = last_hit->trackParameters();
66
67 ATH_MSG_DEBUG("last param x: " << last_param->position().x()
68 << ", y: " << last_param->position().y()
69 << ", z: " << last_param->position().z());
70 ATH_MSG_DEBUG("last param px: " << last_param->momentum().x()
71 << ", py: " << last_param->momentum().y()
72 << ", pz: " << last_param->momentum().z());
73
74 const xAOD::TruthParticle* truth_ptkl =
76
77 // get the tracking geometry
78 const Trk::TrackingGeometry* trk_geom = m_extrapolator->trackingGeometry();
79 if (not trk_geom) {
80 ATH_MSG_DEBUG("trackingGeometry returns null");
81 return result;
82 }
83
84 bool is_pos_endcap = last_param->eta() > 0;
85
86 // get the target volume
87 const Trk::TrackingVolume* hgtd_trk_volume = trk_geom->trackingVolume(
88 is_pos_endcap ? "HGTD::PositiveEndcap" : "HGTD::NegativeEndcap");
89
90 if (not hgtd_trk_volume) {
91 ATH_MSG_DEBUG("trackingVolume returns null");
92 return result;
93 }
94
95 const Trk::BinnedArray<Trk::Layer>* confined_layers =
96 hgtd_trk_volume->confinedLayers();
97 // careful, this array is not ordered from inside out (only in pos endcap)
98 if (not confined_layers) {
99 ATH_MSG_DEBUG("confinedLayers returns null");
100 return result;
101 }
102
103 // get the layers, traverse depending on endcap used
104 // since they are not in ascending z order!!
105 std::span<Trk::Layer const * const> layers = confined_layers->arrayObjects();
106 size_t layer_size = layers.size();
107
108 short position = is_pos_endcap ? 0 : layer_size - 1;
109 short step = is_pos_endcap ? 1 : -1;
110 short hgtd_layer_i = -1; // start at -1 since the ++ happens at the beginning
111 for (size_t i = 0; i < layer_size - 1; i++, position = position + step) {
112
113 const Trk::Layer* layer = layers[position];
114 // only use it, if it is an active one
115 if (layer->layerType() != 1) {
116 continue;
117 }
118 hgtd_layer_i++;
119
120 const Trk::Surface& surf_obj = layer->surfaceRepresentation();
121 ATH_MSG_DEBUG("extrapolation surface z: " << surf_obj.center().z());
122
123 // if it is a good surface, extrapolate to this surface
124 // uses same particle hypothesis used for the track itself
125 // TODO: BoundaryCheck set to false as in 20.20 -> what does this do?
126 std::unique_ptr<const Trk::TrackParameters> extrap_result = nullptr;
127
128 Trk::ParticleHypothesis part = track->info().particleHypothesis();
129 if (part == Trk::undefined) {
130 part = static_cast<Trk::ParticleHypothesis>(m_particle_hypot.value());
131 }
132 extrap_result = m_extrapolator->extrapolate(
133 ctx, *last_param, surf_obj, Trk::PropDirection::alongMomentum, false,
134 part);
135
136 //
137 if (not extrap_result) {
138 ATH_MSG_WARNING("Extrapolator returned null");
139 result.m_hits.at(hgtd_layer_i) = nullptr;
140 result.m_truth_primary_hits.at(hgtd_layer_i) = nullptr;
141 result.m_truth_primary_info.at(hgtd_layer_i) = HGTD::ClusterTruthInfo();
142 continue;
143 }
144
145 // get the extrapolation position info only on the first layer
146 if (hgtd_layer_i == 0) {
147 result.m_extrap_x = extrap_result->position().x();
148 result.m_extrap_y = extrap_result->position().y();
149 }
150
151 ATH_MSG_DEBUG("extrap. params x: "
152 << extrap_result->position().x()
153 << ", y: " << extrap_result->position().y()
154 << ", z: " << extrap_result->position().z());
155 ATH_MSG_DEBUG("extrap. params px: "
156 << extrap_result->momentum().x()
157 << ", py: " << extrap_result->momentum().y()
158 << ", pz: " << extrap_result->momentum().z());
159
160 // find active surfaces in the vincinity
161 auto compatible_surfaces = getCompatibleSurfaces(*extrap_result, layer);
162
163 if (compatible_surfaces.empty()) {
164 ATH_MSG_WARNING("No compatible surfaces for position");
165 result.m_hits.at(hgtd_layer_i) = nullptr;
166 result.m_truth_primary_hits.at(hgtd_layer_i) = nullptr;
167 result.m_truth_primary_info.at(hgtd_layer_i) = HGTD::ClusterTruthInfo();
168 continue;
169 }
170
171 auto extrapolated_params =
172 extrapolateToSurfaces(ctx, *last_param, compatible_surfaces);
173
174 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state =
175 updateStateWithBestFittingCluster(track, extrapolated_params,
176 container);
177
178 if (not updated_state) {
179 result.m_hits.at(hgtd_layer_i) = nullptr;
180 result.m_truth_primary_hits.at(hgtd_layer_i) = nullptr;
181 result.m_truth_primary_info.at(hgtd_layer_i) = HGTD::ClusterTruthInfo();
182 continue;
183 }
184 // if the state was updated with a measurement, the it becomes the new last
185 // parameter
186 last_param = updated_state->trackParameters();
187 // store the last track state to be returned
188
189 std::pair<const HGTD_Cluster*, HGTD::ClusterTruthInfo> truth_info =
190 getTruthMatchedCluster(compatible_surfaces, container, truth_ptkl,
191 hs_event, sim_data);
192
193 result.m_hits.at(hgtd_layer_i) = std::move(updated_state);
194 result.m_truth_primary_hits.at(hgtd_layer_i) = truth_info.first;
195 result.m_truth_primary_info.at(hgtd_layer_i) = truth_info.second;
196 }
197
198 return result;
199}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ToolHandle< Trk::IExtrapolator > m_extrapolator
static std::vector< const Trk::Surface * > getCompatibleSurfaces(const Trk::TrackParameters &param, const Trk::Layer *layer)
Select all within the vincinity of the point of extrapolation.
const Trk::TrackStateOnSurface * getLastHitOnTrack(const Trk::Track &track) const
Retrieve the last hit on track stored in the Trk::Track.
std::vector< std::unique_ptr< const Trk::TrackParameters > > extrapolateToSurfaces(const EventContext &ctx, const Trk::TrackParameters &param, const std::vector< const Trk::Surface * > &surfaces) const
After the compatible surfaces have been selected, the extrapolation is repeated to each of them.
std::unique_ptr< const Trk::TrackStateOnSurface > updateStateWithBestFittingCluster(const Trk::Track *track, const std::vector< std::unique_ptr< const Trk::TrackParameters > > &params, const HGTD_ClusterContainer *container) const
Finds the overall best fitting cluster by keeping the one that gave the lowest chi2 after testing eac...
std::pair< const HGTD_Cluster *, HGTD::ClusterTruthInfo > getTruthMatchedCluster(const std::vector< const Trk::Surface * > &surfaces, const HGTD_ClusterContainer *container, const xAOD::TruthParticle *truth_ptkl, const HepMC::GenEvent *hs_event, const InDetSimDataCollection *sim_data) const
IntegerProperty m_particle_hypot
Particle hypothesis used for the extrapolation.
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.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.
@ layer
Definition HitInfo.h:79
@ alongMomentum
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ extrapolateToSurfaces()

std::vector< std::unique_ptr< const Trk::TrackParameters > > HGTD_IterativeExtensionTool::extrapolateToSurfaces ( const EventContext & ctx,
const Trk::TrackParameters & param,
const std::vector< const Trk::Surface * > & surfaces ) const
private

After the compatible surfaces have been selected, the extrapolation is repeated to each of them.

Parameters
[in]paramThe last track parameter before extrapolation.
[in]surfacesTarget layer of the extrapolation.
Returns
Vector of the updated track parameters.

FIXME Is this really necessary to call the extrapolation on each target surface?

Definition at line 270 of file HGTD_IterativeExtensionTool.cxx.

272 {
273
274 std::vector<std::unique_ptr<const Trk::TrackParameters>> params;
275 params.reserve(surfaces.size());
276
277 for (const auto* surface : surfaces) {
278 std::unique_ptr<const Trk::TrackParameters> extrapolated_params = nullptr;
279
280 extrapolated_params = m_extrapolator->extrapolate(
281 ctx, param, *surface, Trk::alongMomentum, false,
282 static_cast<Trk::ParticleHypothesis>(m_particle_hypot.value()));
283 if (not extrapolated_params) {
284 continue;
285 }
286 params.push_back(std::move(extrapolated_params));
287 }
288
289 return params;
290}

◆ findBestCompatibleCluster()

std::unique_ptr< const Trk::TrackStateOnSurface > HGTD_IterativeExtensionTool::findBestCompatibleCluster ( const Trk::Track * track,
const Trk::TrackParameters * param,
const HGTD_ClusterContainer * container ) const
private

Find the cluster on a given surface that has the best chi2 passing the cut.

Is called within updateStateWithBestFittingCluster.

Definition at line 329 of file HGTD_IterativeExtensionTool.cxx.

331 {
332
333 ATH_MSG_DEBUG("[findBestCompatibleCluster] start");
334
335 std::unique_ptr<const Trk::TrackStateOnSurface> tsos = nullptr;
336
337 double lowest_chi2 = -1;
338 for (const auto* collection : *container) {
339 // find the one collection that can be associated to the surface
340 if (collection->identify() !=
342 continue;
343 }
345 "[findBestCompatibleCluster] found collection of given surface");
346 // test the clusters on this surface for compatibility, keep the best
347 for (const auto* cluster : *collection) {
348 // update the track parameters with the found cluster
349 std::unique_ptr<const Trk::TrackStateOnSurface> candidate =
350 updateState(track, param, cluster);
351
352 if (not candidate) {
353 continue;
354 }
355 if (not candidate->measurementOnTrack() and
356 not candidate->fitQualityOnSurface()) {
357 continue;
358 }
359 double chi2 = candidate->fitQualityOnSurface().chiSquared() /
360 candidate->fitQualityOnSurface().doubleNumberDoF();
361 ATH_MSG_DEBUG("found cluster with chi2 of " << chi2);
362 // apply cut on the chi2
363 if (chi2 > m_chi2_cut) {
364 continue;
365 }
366 // make sure only one TSOS is kept
367 if (not tsos or chi2 < lowest_chi2) {
368 tsos.swap(candidate);
369 lowest_chi2 = chi2;
370 }
371 }
372 // per trackparameter, there is only one fitting surface
373 // break after having found it
374 break;
375 }
376
377 return tsos; // no need to std::move thanks to Return Value Optimization (RVO)
378}
FloatProperty m_chi2_cut
Track extensions are only kept if the chi2/ndof is lower than the defined cut.
std::unique_ptr< const Trk::TrackStateOnSurface > updateState(const Trk::Track *track, const Trk::TrackParameters *param, const HGTD_Cluster *cluster) const
Calls the TOF correction tool to build an HGTD_ClusterOnTrack with a calibrated time and resolution a...
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
double chi2(TH1 *h0, TH1 *h1)

◆ getCompatibleSurfaces()

std::vector< const Trk::Surface * > HGTD_IterativeExtensionTool::getCompatibleSurfaces ( const Trk::TrackParameters & param,
const Trk::Layer * layer )
staticprivate

Select all within the vincinity of the point of extrapolation.

Parameters
[in]paramThe already extrapolated track parameter.
[in]layerTarget layer of the extrapolation.
Returns
Vector of compatible surfaces that represent modules.

FIXME exchange the loop with the neighbour functionality (wherever that is)

Definition at line 227 of file HGTD_IterativeExtensionTool.cxx.

228 {
229
230 std::vector<const Trk::Surface*> surfaces;
231
232 // point of extrapolation as global position
233 const Amg::Vector3D& position = param.position();
234 // get the surface at the point of extrapolation
235 const auto* surface_arr = layer->surfaceArray(); // these are the modules
236 if (!surface_arr) {
237 return surfaces;
238 }
239 const Trk::Surface* module_surface = surface_arr->object(
240 position); // from this binned object, get the module closeby
241 if (!module_surface) {
242 return surfaces;
243 }
244 surfaces.push_back(module_surface);
245
246 // pick up additional surfaces in a 4cm radius
247 // TODO REPLACE THIS BY NEIGHBOUR FUNCTIONALITY IN FUTURE!!
248 short steps = 16;
249 float delta_angle = 6.2831853 / (float)steps;
250 float angle = 0.;
251 float radius = 20.0;
252 for (short i = 0; i < steps; i++, angle = angle + delta_angle) {
253 Amg::Vector3D delta(radius * std::cos(angle), radius * std::sin(angle), 0);
254 Amg::Vector3D result = position + delta;
255 const Trk::Surface* additional_surface = surface_arr->object(result);
256 if (!additional_surface) {
257 continue;
258 }
259 // check if surface was added to avoid duplicates
260 if (std::find(surfaces.begin(), surfaces.end(), additional_surface) ==
261 surfaces.end()) {
262 surfaces.push_back(additional_surface);
263 }
264 }
265
266 return surfaces;
267}
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Eigen::Matrix< double, 3, 1 > Vector3D

◆ getLastHitOnTrack()

const Trk::TrackStateOnSurface * HGTD_IterativeExtensionTool::getLastHitOnTrack ( const Trk::Track & track) const
private

Retrieve the last hit on track stored in the Trk::Track.

Parameters
[in]trackTrack reconstructed in ITk.
Returns
The last hit on track, i.e. the closest one to HGTD.

FIXME: returns a const*, but the Track manages this TSOS. Could I return rather const&? But: I want to check if type is OK... should I return an "empty" TSOS if nothing passes the requirements?

Definition at line 202 of file HGTD_IterativeExtensionTool.cxx.

202 {
203
204 const Trk::TrackStates* tsos =
205 track.trackStateOnSurfaces();
206 if (not tsos) {
207 ATH_MSG_ERROR("Failed to retrieve track state on surfaces");
208 return nullptr;
209 }
210 // loop over the associated hits in ITk in reverse order, since we want to
211 // select the one closest to HGTD to start the extrapolation
212 for (auto i = tsos->rbegin(); i != tsos->rend(); ++i) {
213 const auto* curr_last_tsos = *i;
214 if (not curr_last_tsos) {
215 continue;
216 }
217 if (curr_last_tsos->type(Trk::TrackStateOnSurface::Measurement) and
218 curr_last_tsos->trackParameters() and
219 curr_last_tsos->measurementOnTrack()) {
220 return curr_last_tsos;
221 }
222 }
223 return nullptr;
224}
#define ATH_MSG_ERROR(x)
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ getTruthMatchedCluster()

std::pair< const HGTD_Cluster *, HGTD::ClusterTruthInfo > HGTD_IterativeExtensionTool::getTruthMatchedCluster ( const std::vector< const Trk::Surface * > & surfaces,
const HGTD_ClusterContainer * container,
const xAOD::TruthParticle * truth_ptkl,
const HepMC::GenEvent * hs_event,
const InDetSimDataCollection * sim_data ) const
private

Definition at line 414 of file HGTD_IterativeExtensionTool.cxx.

418 {
419
420 if (not truth_ptkl or not sim_data) {
421 if (not truth_ptkl)
422 ATH_MSG_DEBUG("truth_ptkl is null");
423 if (not sim_data)
424 ATH_MSG_DEBUG("sim_data is null");
425
426 return {nullptr, HGTD::ClusterTruthInfo()};
427 }
428
429 std::vector<Identifier> ids;
430 std::for_each(surfaces.begin(), surfaces.end(),
431 [&](const Trk::Surface* surf) {
432 ids.push_back(surf->associatedDetectorElementIdentifier());
433 });
434
435 for (const auto *const collection : *container) {
436 // if the ID corresponding to this collection is not in the list, skip
437
438 if (std::find(ids.begin(), ids.end(), collection->identify()) ==
439 ids.end()) {
440 continue;
441 }
442 for (const auto* cluster : *collection) {
443
444 HGTD::ClusterTruthInfo truth_info = m_truth_tool->classifyCluster(
445 cluster, truth_ptkl, sim_data, hs_event);
446 // return cluster and truth info if the hit is matched to the truth
447 // particle
449 return {cluster, truth_info};
450 }
451 }
452 }
453 // no matched cluster found
454 return {nullptr, HGTD::ClusterTruthInfo()};
455}
ToolHandle< IHGTD_ClusterTruthTool > m_truth_tool

◆ initialize()

StatusCode HGTD_IterativeExtensionTool::initialize ( )
finaloverridevirtual

Definition at line 34 of file HGTD_IterativeExtensionTool.cxx.

34 {
35 StatusCode sc = AthAlgTool::initialize();
36
37 ATH_CHECK(m_extrapolator.retrieve());
38
39 ATH_CHECK(m_updator.retrieve());
40
41 ATH_CHECK(m_tof_corr_tool.retrieve());
42
43 ATH_CHECK(m_truth_tool.retrieve());
44
45 // get HGTD Detector Description Manager and HGTD Helper
48
49 return sc;
50}
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
ToolHandle< IHGTD_TOFcorrectionTool > m_tof_corr_tool
const HGTD_DetectorManager * m_hgtd_det_mgr
ToolHandle< Trk::IUpdator > m_updator
::StatusCode StatusCode
StatusCode definition for legacy code.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ updateState()

std::unique_ptr< const Trk::TrackStateOnSurface > HGTD_IterativeExtensionTool::updateState ( const Trk::Track * track,
const Trk::TrackParameters * param,
const HGTD_Cluster * cluster ) const
private

Calls the TOF correction tool to build an HGTD_ClusterOnTrack with a calibrated time and resolution and then calls the Kalman updator tools to update the track state.

Definition at line 381 of file HGTD_IterativeExtensionTool.cxx.

382 {
383 ATH_MSG_DEBUG("[updateState] calling the updator");
384
385 // FIXME: the HGTD_Cluster should know its detector element here. needs
386 // to be set up in the converter at some point!!
387 const auto* det_el = m_hgtd_det_mgr->getDetectorElement(cluster->identify());
388
389 // apply the time of flight correction before setting the time and resolution
390 // in the HGTD_ClusterOnTrack
391 std::pair<float, float> corr_time_and_res =
392 m_tof_corr_tool->correctTimeAndResolution(
393 *track, *cluster, cluster->time(), cluster->timeResolution());
394
395 std::unique_ptr<HGTD_ClusterOnTrack> cot =
396 std::make_unique<HGTD_ClusterOnTrack>(
397 cluster, Trk::LocalParameters(cluster->localPosition()),
398 Amg::MatrixX(cluster->localCovariance()), corr_time_and_res.first,
399 corr_time_and_res.second, det_el->identifyHash());
400
401 Trk::FitQualityOnSurface* quality = nullptr;
402
403 std::unique_ptr<Trk::TrackParameters> pars = m_updator->addToState(
404 *param, cot->localParameters(), cot->localCovariance(), quality);
405 //Here one could fix the addToState intefaces to
406 //avoid them allocating memory for Fit Quality On Surface
407 auto uniqueQuality= std::unique_ptr<Trk::FitQualityOnSurface>(quality);
408 auto QoS = uniqueQuality? *uniqueQuality : Trk::FitQualityOnSurface{};
409 return std::make_unique<const Trk::TrackStateOnSurface>(QoS, std::move(cot),
410 std::move(pars));
411}
virtual float time() const
virtual float timeResolution() const
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.

◆ updateStateWithBestFittingCluster()

std::unique_ptr< const Trk::TrackStateOnSurface > HGTD_IterativeExtensionTool::updateStateWithBestFittingCluster ( const Trk::Track * track,
const std::vector< std::unique_ptr< const Trk::TrackParameters > > & params,
const HGTD_ClusterContainer * container ) const
private

Finds the overall best fitting cluster by keeping the one that gave the lowest chi2 after testing each surface and returning it.

Definition at line 293 of file HGTD_IterativeExtensionTool.cxx.

296 {
297 ATH_MSG_DEBUG("[updateStateWithBestFittingCluster] start updating");
298
299 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state = nullptr;
300
301 double lowest_chi2 = -1.;
302 // all compatible surfaces are tested for the best fitting cluster
303 for (const auto& param : params) {
304 std::unique_ptr<const Trk::TrackStateOnSurface> best_tsos =
305 findBestCompatibleCluster(track, param.get(), container);
306 if (not best_tsos) {
307 ATH_MSG_DEBUG("[updateStateWithBestFittingCluster] tsos is null");
308 continue;
309 }
310 ATH_MSG_DEBUG("[updateStateWithBestFittingCluster] tsos found");
311
312 double chi2 = best_tsos->fitQualityOnSurface().chiSquared() /
313 best_tsos->fitQualityOnSurface().doubleNumberDoF();
315 "[updateStateWithBestFittingCluster] found state with chi2 of "
316 << chi2);
317 // make sure only one TSOS is kept
318 if (!updated_state or chi2 < lowest_chi2) {
319 updated_state.swap(best_tsos);
320 lowest_chi2 = chi2;
321 }
322 }
323
324 return updated_state; // no need to std::move thanks to Return Value
325 // Optimization (RVO)
326}
std::unique_ptr< const Trk::TrackStateOnSurface > findBestCompatibleCluster(const Trk::Track *track, const Trk::TrackParameters *param, const HGTD_ClusterContainer *container) const
Find the cluster on a given surface that has the best chi2 passing the cut.

Member Data Documentation

◆ m_chi2_cut

FloatProperty HGTD_IterativeExtensionTool::m_chi2_cut
private
Initial value:
{this, "Chi2Cut", 5.0,
"Quality cut for decision to keep track extension"}

Track extensions are only kept if the chi2/ndof is lower than the defined cut.

Definition at line 172 of file HGTD_IterativeExtensionTool.h.

172 {this, "Chi2Cut", 5.0,
173 "Quality cut for decision to keep track extension"};

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> HGTD_IterativeExtensionTool::m_extrapolator
private
Initial value:
{
this, "ExtrapolatorTool", "Trk::Extrapolator/AtlasExtrapolator",
"Tool for extrapolating the track to the HGTD surfaces"}

Definition at line 149 of file HGTD_IterativeExtensionTool.h.

149 {
150 this, "ExtrapolatorTool", "Trk::Extrapolator/AtlasExtrapolator",
151 "Tool for extrapolating the track to the HGTD surfaces"};

◆ m_hgtd_det_mgr

const HGTD_DetectorManager* HGTD_IterativeExtensionTool::m_hgtd_det_mgr {nullptr}
private

Definition at line 165 of file HGTD_IterativeExtensionTool.h.

165{nullptr};

◆ m_hgtd_id_helper

const HGTD_ID* HGTD_IterativeExtensionTool::m_hgtd_id_helper {nullptr}
private

Definition at line 166 of file HGTD_IterativeExtensionTool.h.

166{nullptr};

◆ m_particle_hypot

IntegerProperty HGTD_IterativeExtensionTool::m_particle_hypot
private
Initial value:
{
this, "ParticleHypothesis", Trk::ParticleHypothesis::pion,
"The hypothesis of the track's particle type"}

Particle hypothesis used for the extrapolation.

Definition at line 178 of file HGTD_IterativeExtensionTool.h.

178 {
179 this, "ParticleHypothesis", Trk::ParticleHypothesis::pion,
180 "The hypothesis of the track's particle type"};

◆ m_tof_corr_tool

ToolHandle<IHGTD_TOFcorrectionTool> HGTD_IterativeExtensionTool::m_tof_corr_tool
private
Initial value:
{
this, "TOFCorrTool", "StraightLineTOFcorrectionTool",
"Tool for correcting for time of flight"}

Definition at line 157 of file HGTD_IterativeExtensionTool.h.

157 {
158 this, "TOFCorrTool", "StraightLineTOFcorrectionTool",
159 "Tool for correcting for time of flight"};

◆ m_truth_tool

ToolHandle<IHGTD_ClusterTruthTool> HGTD_IterativeExtensionTool::m_truth_tool
private
Initial value:
{
this, "ClusterTruthTool", "HGTD::ClusterTruthTool/ClusterTruthTool",
"Tool for classifying HGTD clusters with truth information"}

Definition at line 161 of file HGTD_IterativeExtensionTool.h.

161 {
162 this, "ClusterTruthTool", "HGTD::ClusterTruthTool/ClusterTruthTool",
163 "Tool for classifying HGTD clusters with truth information"};

◆ m_updator

ToolHandle<Trk::IUpdator> HGTD_IterativeExtensionTool::m_updator
private
Initial value:
{
this, "UpdatorTool", "Trk::KalmanUpdator/KalmanUpdator",
"Tool for updating the track parameters accounting for new measurements"}

Definition at line 153 of file HGTD_IterativeExtensionTool.h.

153 {
154 this, "UpdatorTool", "Trk::KalmanUpdator/KalmanUpdator",
155 "Tool for updating the track parameters accounting for new measurements"};

The documentation for this class was generated from the following files: