|
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) {
108 size_t layer_size =
layers.size();
110 short position = is_pos_endcap ? 0 : layer_size - 1;
111 short step = is_pos_endcap ? 1 : -1;
112 short hgtd_layer_i = -1;
113 for (
size_t i = 0;
i < layer_size - 1;
i++, position = position +
step) {
117 if (
layer->layerType() != 1) {
128 std::unique_ptr<const Trk::TrackParameters> extrap_result =
nullptr;
139 if (not extrap_result) {
141 result.m_hits.at(hgtd_layer_i) =
nullptr;
142 result.m_truth_primary_hits.at(hgtd_layer_i) =
nullptr;
148 if (hgtd_layer_i == 0) {
149 result.m_extrap_x = extrap_result->position().x();
150 result.m_extrap_y = extrap_result->position().y();
154 << extrap_result->position().x()
155 <<
", y: " << extrap_result->position().y()
156 <<
", z: " << extrap_result->position().z());
158 << extrap_result->momentum().x()
159 <<
", py: " << extrap_result->momentum().y()
160 <<
", pz: " << extrap_result->momentum().z());
165 if (compatible_surfaces.empty()) {
167 result.m_hits.at(hgtd_layer_i) =
nullptr;
168 result.m_truth_primary_hits.at(hgtd_layer_i) =
nullptr;
173 auto extrapolated_params =
176 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state =
180 if (not updated_state) {
181 result.m_hits.at(hgtd_layer_i) =
nullptr;
182 result.m_truth_primary_hits.at(hgtd_layer_i) =
nullptr;
188 last_param = updated_state->trackParameters();
191 std::pair<const HGTD_Cluster*, HGTD::ClusterTruthInfo> truth_info =
195 result.m_hits.at(hgtd_layer_i) = std::move(updated_state);
196 result.m_truth_primary_hits.at(hgtd_layer_i) = truth_info.first;
197 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 272 of file HGTD_IterativeExtensionTool.cxx.
276 std::vector<std::unique_ptr<const Trk::TrackParameters>>
params;
277 params.reserve(surfaces.size());
279 for (
const auto* surface : surfaces) {
280 std::unique_ptr<const Trk::TrackParameters> extrapolated_params =
nullptr;
285 if (not extrapolated_params) {
288 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 331 of file HGTD_IterativeExtensionTool.cxx.
337 std::unique_ptr<const Trk::TrackStateOnSurface> tsos =
nullptr;
339 double lowest_chi2 = -1;
340 for (
const auto* collection : *container) {
342 if (collection->identify() !=
347 "[findBestCompatibleCluster] found collection of given surface");
349 for (
const auto* cluster : *collection) {
351 std::unique_ptr<const Trk::TrackStateOnSurface> candidate =
357 if (not candidate->measurementOnTrack() and
358 not candidate->fitQualityOnSurface()) {
361 double chi2 = candidate->fitQualityOnSurface().chiSquared() /
362 candidate->fitQualityOnSurface().doubleNumberDoF();
369 if (not tsos or
chi2 < lowest_chi2) {
370 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 229 of file HGTD_IterativeExtensionTool.cxx.
232 std::vector<const Trk::Surface*> surfaces;
237 const auto* surface_arr =
layer->surfaceArray();
241 const Trk::Surface* module_surface = surface_arr->object(
243 if (!module_surface) {
246 surfaces.push_back(module_surface);
258 if (!additional_surface) {
262 if (
std::find(surfaces.begin(), surfaces.end(), additional_surface) ==
264 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 204 of file HGTD_IterativeExtensionTool.cxx.
207 track.trackStateOnSurfaces();
214 for (
auto i = tsos->rbegin();
i != tsos->rend(); ++
i) {
215 const auto* curr_last_tsos = *
i;
216 if (not curr_last_tsos) {
220 curr_last_tsos->trackParameters() and
221 curr_last_tsos->measurementOnTrack()) {
222 return curr_last_tsos;
◆ getTruthMatchedCluster()
Definition at line 416 of file HGTD_IterativeExtensionTool.cxx.
422 if (not truth_ptkl or not sim_data) {
431 std::vector<Identifier>
ids;
432 std::for_each(surfaces.begin(), surfaces.end(),
434 ids.push_back(surf->associatedDetectorElementIdentifier());
437 for (
const auto *
const collection : *container) {
444 for (
const auto* cluster : *collection) {
447 cluster, truth_ptkl, sim_data, hs_event);
451 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 383 of file HGTD_IterativeExtensionTool.cxx.
393 std::pair<float, float> corr_time_and_res =
397 std::unique_ptr<HGTD_ClusterOnTrack> cot =
398 std::make_unique<HGTD_ClusterOnTrack>(
401 corr_time_and_res.second, det_el->identifyHash());
405 std::unique_ptr<Trk::TrackParameters>
pars =
m_updator->addToState(
409 auto uniqueQuality= std::unique_ptr<Trk::FitQualityOnSurface>(quality);
411 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 295 of file HGTD_IterativeExtensionTool.cxx.
299 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] start updating");
301 std::unique_ptr<const Trk::TrackStateOnSurface> updated_state =
nullptr;
303 double lowest_chi2 = -1.;
305 for (
const auto& param :
params) {
306 std::unique_ptr<const Trk::TrackStateOnSurface> best_tsos =
309 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] tsos is null");
312 ATH_MSG_DEBUG(
"[updateStateWithBestFittingCluster] tsos found");
314 double chi2 = best_tsos->fitQualityOnSurface().chiSquared() /
315 best_tsos->fitQualityOnSurface().doubleNumberDoF();
317 "[updateStateWithBestFittingCluster] found state with chi2 of "
320 if (!updated_state or
chi2 < lowest_chi2) {
321 updated_state.swap(best_tsos);
326 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.
::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.
InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
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.
std::span< T > BinnedArraySpan
virtual float time() const
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.