 |
ATLAS Offline Software
|
#include <HGTD_IterativeExtensionTool.h>
|
const Trk::TrackStateOnSurface * | getLastHitOnTrack (const Trk::Track &track) const |
| Retrieve the last hit on track stored in the Trk::Track. More...
|
|
std::vector< std::unique_ptr< const Trk::TrackParameters > > | extrapolateToSurfaces (const EventContext &ctx, const Trk::TrackParameters ¶m, const std::vector< const Trk::Surface * > &surfaces) const |
| After the compatible surfaces have been selected, the extrapolation is repeated to each of them. More...
|
|
std::unique_ptr< const Trk::TrackStateOnSurface > | updateStateWithBestFittingCluster (const Trk::Track *track, const std::vector< std::unique_ptr< const Trk::TrackParameters >> ¶ms, 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. More...
|
|
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. More...
|
|
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 and then calls the Kalman updator tools to update the track state. More...
|
|
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 |
|
◆ HGTD_IterativeExtensionTool()
HGTD_IterativeExtensionTool::HGTD_IterativeExtensionTool |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ extendTrackToHGTD()
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
-
- Returns
- Array of compatible HGTD hits in the form of HGTD_ClusterOnTrack.
Definition at line 52 of file HGTD_IterativeExtensionTool.cxx.
68 <<
", y: " << last_param->
position().y()
69 <<
", z: " << last_param->
position().z());
71 <<
", py: " << last_param->
momentum().y()
72 <<
", pz: " << last_param->
momentum().z());
84 bool is_pos_endcap = last_param->
eta() > 0;
88 is_pos_endcap ?
"HGTD::PositiveEndcap" :
"HGTD::NegativeEndcap");
90 if (not hgtd_trk_volume) {
96 hgtd_trk_volume->confinedLayers();
98 if (not confined_layers) {
105 std::span<Trk::Layer const * const>
layers = confined_layers->arrayObjects();
106 size_t layer_size =
layers.size();
108 short position = is_pos_endcap ? 0 : layer_size - 1;
109 short step = is_pos_endcap ? 1 : -1;
110 short hgtd_layer_i = -1;
111 for (
size_t i = 0;
i < layer_size - 1;
i++, position = position +
step) {
115 if (
layer->layerType() != 1) {
126 std::unique_ptr<const Trk::TrackParameters> extrap_result =
nullptr;
137 if (not extrap_result) {
139 result.m_hits.at(hgtd_layer_i) =
nullptr;
140 result.m_truth_primary_hits.at(hgtd_layer_i) =
nullptr;
146 if (hgtd_layer_i == 0) {
147 result.m_extrap_x = extrap_result->position().x();
148 result.m_extrap_y = extrap_result->position().y();
152 << extrap_result->position().x()
153 <<
", y: " << extrap_result->position().y()
154 <<
", z: " << extrap_result->position().z());
156 << extrap_result->momentum().x()
157 <<
", py: " << extrap_result->momentum().y()
158 <<
", pz: " << extrap_result->momentum().z());
163 if (compatible_surfaces.empty()) {
165 result.m_hits.at(hgtd_layer_i) =
nullptr;
166 result.m_truth_primary_hits.at(hgtd_layer_i) =
nullptr;
171 auto extrapolated_params =
174 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state =
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;
186 last_param = updated_state->trackParameters();
189 std::pair<const HGTD_Cluster*, HGTD::ClusterTruthInfo> truth_info =
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;
◆ extrapolateToSurfaces()
After the compatible surfaces have been selected, the extrapolation is repeated to each of them.
- Parameters
-
[in] | param | The last track parameter before extrapolation. |
[in] | surfaces | Target 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.
274 std::vector<std::unique_ptr<const Trk::TrackParameters>>
params;
275 params.reserve(surfaces.size());
277 for (
const auto* surface : surfaces) {
278 std::unique_ptr<const Trk::TrackParameters> extrapolated_params =
nullptr;
283 if (not extrapolated_params) {
286 params.push_back(std::move(extrapolated_params));
◆ findBestCompatibleCluster()
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.
335 std::unique_ptr<const Trk::TrackStateOnSurface> tsos =
nullptr;
337 double lowest_chi2 = -1;
338 for (
const auto* collection : *container) {
340 if (collection->identify() !=
345 "[findBestCompatibleCluster] found collection of given surface");
347 for (
const auto* cluster : *collection) {
349 std::unique_ptr<const Trk::TrackStateOnSurface> candidate =
355 if (not candidate->measurementOnTrack() and
356 not candidate->fitQualityOnSurface()) {
359 double chi2 = candidate->fitQualityOnSurface().chiSquared() /
360 candidate->fitQualityOnSurface().doubleNumberDoF();
367 if (not tsos or
chi2 < lowest_chi2) {
368 tsos.swap(candidate);
◆ getCompatibleSurfaces()
Select all within the vincinity of the point of extrapolation.
- Parameters
-
[in] | param | The already extrapolated track parameter. |
[in] | layer | Target 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.
230 std::vector<const Trk::Surface*> surfaces;
235 const auto* surface_arr =
layer->surfaceArray();
239 const Trk::Surface* module_surface = surface_arr->object(
241 if (!module_surface) {
244 surfaces.push_back(module_surface);
256 if (!additional_surface) {
260 if (
std::find(surfaces.begin(), surfaces.end(), additional_surface) ==
262 surfaces.push_back(additional_surface);
◆ getLastHitOnTrack()
Retrieve the last hit on track stored in the Trk::Track.
- Parameters
-
- 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.
205 track.trackStateOnSurfaces();
212 for (
auto i = tsos->rbegin();
i != tsos->rend(); ++
i) {
213 const auto* curr_last_tsos = *
i;
214 if (not curr_last_tsos) {
218 curr_last_tsos->trackParameters() and
219 curr_last_tsos->measurementOnTrack()) {
220 return curr_last_tsos;
◆ getTruthMatchedCluster()
Definition at line 414 of file HGTD_IterativeExtensionTool.cxx.
420 if (not truth_ptkl or not sim_data) {
429 std::vector<Identifier>
ids;
430 std::for_each(surfaces.begin(), surfaces.end(),
432 ids.push_back(surf->associatedDetectorElementIdentifier());
435 for (
const auto *
const collection : *container) {
442 for (
const auto* cluster : *collection) {
445 cluster, truth_ptkl, sim_data, hs_event);
449 return {cluster, truth_info};
◆ initialize()
StatusCode HGTD_IterativeExtensionTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
◆ updateState()
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.
391 std::pair<float, float> corr_time_and_res =
395 std::unique_ptr<HGTD_ClusterOnTrack> cot =
396 std::make_unique<HGTD_ClusterOnTrack>(
399 corr_time_and_res.second, det_el->identifyHash());
403 std::unique_ptr<Trk::TrackParameters>
pars =
m_updator->addToState(
407 auto uniqueQuality= std::unique_ptr<Trk::FitQualityOnSurface>(
quality);
409 return std::make_unique<const Trk::TrackStateOnSurface>(QoS, std::move(cot),
◆ updateStateWithBestFittingCluster()
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.
297 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] start updating");
299 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state =
nullptr;
301 double lowest_chi2 = -1.;
303 for (
const auto& param :
params) {
304 std::unique_ptr<const Trk::TrackStateOnSurface> best_tsos =
307 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] tsos is null");
310 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] tsos found");
312 double chi2 = best_tsos->fitQualityOnSurface().chiSquared() /
313 best_tsos->fitQualityOnSurface().doubleNumberDoF();
315 "[updateStateWithBestFittingCluster] found state with chi2 of "
318 if (!updated_state or
chi2 < lowest_chi2) {
319 updated_state.swap(best_tsos);
324 return updated_state;
◆ 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.
◆ m_extrapolator
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.
◆ m_hgtd_det_mgr
◆ m_hgtd_id_helper
const HGTD_ID* HGTD_IterativeExtensionTool::m_hgtd_id_helper {nullptr} |
|
private |
◆ m_particle_hypot
IntegerProperty HGTD_IterativeExtensionTool::m_particle_hypot |
|
private |
Initial value:{
"The hypothesis of the track's particle type"}
Particle hypothesis used for the extrapolation.
Definition at line 178 of file HGTD_IterativeExtensionTool.h.
◆ m_tof_corr_tool
Initial value:{
this, "TOFCorrTool", "StraightLineTOFcorrectionTool",
"Tool for correcting for time of flight"}
Definition at line 157 of file HGTD_IterativeExtensionTool.h.
◆ m_truth_tool
Initial value:{
this, "ClusterTruthTool", "HGTD::ClusterTruthTool/ClusterTruthTool",
"Tool for classifying HGTD clusters with truth information"}
Definition at line 161 of file HGTD_IterativeExtensionTool.h.
◆ m_updator
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.
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
std::string find(const std::string &s)
return a remapped string
const Amg::Vector3D & position() const
Access method for the position.
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
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const Amg::Vector3D & center() const
Returns the center position of the Surface.
const InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
::StatusCode StatusCode
StatusCode definition for legacy code.
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Class describing a truth particle in the MC record.
double chi2(TH1 *h0, TH1 *h1)
ClusterTruthOrigin origin
virtual float timeResolution() const
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Identifier identify() const
return the identifier
represents the track state (measurement, material, fit parameters and quality) at a surface.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
const Amg::Vector2D & localPosition() const
return the local position reference
Eigen::Matrix< double, 3, 1 > Vector3D
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::Vector3D & momentum() const
Access method for the momentum.
#define ATH_MSG_WARNING(x)
double eta() const
Access method for pseudorapidity - from momentum.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
virtual float time() const
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.