LDMX Software
tracking::sim::LdmxMeasurementCalibrator Class Reference

Public Member Functions

 LdmxMeasurementCalibrator ()=default
 Construct an invalid calibrator. Required to allow copying.
 
 LdmxMeasurementCalibrator (const std::vector< ldmx::Measurement > &measurements)
 
template<typename traj_t >
void calibrate (const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::SourceLink &genericSourceLink, typename traj_t::TrackStateProxy trackState) const
 Find the measurement corresponding to the source link.
 
template<typename traj_t >
void calibrate1d (const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::SourceLink &genericSourceLink, typename traj_t::TrackStateProxy trackState) const
 Find the measurement corresponding to the source link.
 
void test (const Acts::GeometryContext &, const acts_examples::IndexSourceLink &sourceLink) const
 

Private Attributes

const std::vector< ldmx::Measurement > * m_measurements_ = nullptr
 

Detailed Description

Definition at line 41 of file MeasurementCalibrator.h.

Constructor & Destructor Documentation

◆ LdmxMeasurementCalibrator()

tracking::sim::LdmxMeasurementCalibrator::LdmxMeasurementCalibrator ( const std::vector< ldmx::Measurement > & measurements)
inline

Definition at line 47 of file MeasurementCalibrator.h.

48 {
49 m_measurements_ = &measurements;
50 }

Member Function Documentation

◆ calibrate()

template<typename traj_t >
void tracking::sim::LdmxMeasurementCalibrator::calibrate ( const Acts::GeometryContext & ,
const Acts::CalibrationContext & ,
const Acts::SourceLink & genericSourceLink,
typename traj_t::TrackStateProxy trackState ) const
inline

Find the measurement corresponding to the source link.

Uses a 2D measurement, cov-matrix and projection

Template Parameters
parameters_tTrack parameters type
Parameters
gctxThe geometry context (unused)
trackStateThe track state to calibrate

Definition at line 59 of file MeasurementCalibrator.h.

62 {
64 genericSourceLink.get<acts_examples::IndexSourceLink>()};
65 assert(m_measurements_ and
66 "Undefined measurement container in LdmxMeasurementCalibrator");
67 assert((source_link.index() < m_measurements_->size()) and
68 "Source link index is outside the container bounds in "
69 "LdmxMeasurementCalibrator");
70
71 auto meas = m_measurements_->at(source_link.index());
72 Acts::Vector2 local_pos{meas.getLocalPosition()[0],
73 meas.getLocalPosition()[1]};
74 trackState.allocateCalibrated(2);
75 auto ts_cal{trackState.template calibrated<2>()};
76 auto ts_cal_cov{trackState.template calibratedCovariance<2>()};
77 ts_cal.setZero();
78 ts_cal.template head<2>() = local_pos;
79 Acts::SquareMatrix2 local_cov;
80 local_cov.setZero();
81 local_cov(0, 0) = meas.getLocalCovariance()[0];
82 local_cov(1, 1) = meas.getLocalCovariance()[1];
83 ts_cal_cov.setZero();
84 // make tsCalCov 2x2 block the local_cov we just set
85 ts_cal_cov.block(0, 0, 2, 2) = local_cov;
86
87 Acts::ActsMatrix<2, 6> projector;
88 projector.setZero();
89 projector(0, 0) = 1.;
90 projector(1, 1) = 1.;
91
92 trackState.setProjector(projector);
93 trackState.setUncalibratedSourceLink(genericSourceLink);
94 }

Referenced by ecal::EcalTrackFinderProcessor::produce(), and tracking::reco::CKFProcessor::produce().

◆ calibrate1d()

template<typename traj_t >
void tracking::sim::LdmxMeasurementCalibrator::calibrate1d ( const Acts::GeometryContext & ,
const Acts::CalibrationContext & ,
const Acts::SourceLink & genericSourceLink,
typename traj_t::TrackStateProxy trackState ) const
inline

Find the measurement corresponding to the source link.

Uses a 1D measurement, cov-matrix and projection

Template Parameters
parameters_tTrack parameters type
Parameters
gctxThe geometry context (unused)
trackStateThe track state to calibrate

Definition at line 103 of file MeasurementCalibrator.h.

106 {
108 genericSourceLink.get<acts_examples::IndexSourceLink>()};
109
110 assert(m_measurements_ and
111 "Undefined measurement container in LdmxMeasurementCalibrator");
112 assert((source_link.index() < m_measurements_->size()) and
113 "Source link index is outside the container bounds in "
114 "LdmxMeasurementCalibrator");
115
116 auto meas = m_measurements_->at(source_link.index());
117
118 trackState.allocateCalibrated(1);
119 auto ts_cal{trackState.template calibrated<1>()};
120 auto ts_cal_cov{trackState.template calibratedCovariance<1>()};
121
122 ts_cal.setZero();
123 ts_cal(0) = (meas.getLocalPosition())[0];
124 ts_cal_cov.setZero();
125 ts_cal_cov(0, 0) = (meas.getLocalCovariance())[0];
126
127 Acts::ActsMatrix<2, 6> projector;
128 projector.setZero();
129 projector(0, 0) = 1.;
130 projector(1, 1) = 1.;
131 trackState.setProjector(projector.row(0));
132 trackState.setUncalibratedSourceLink(genericSourceLink);
133 }

Referenced by tracking::reco::CKFProcessor::produce(), and tracking::reco::GSFProcessor::produce().

◆ test()

void tracking::sim::LdmxMeasurementCalibrator::test ( const Acts::GeometryContext & ,
const acts_examples::IndexSourceLink & sourceLink ) const
inline

Definition at line 138 of file MeasurementCalibrator.h.

139 {
140 auto meas = m_measurements_->at(sourceLink.index());
141
142 Acts::Vector3 global_pos{meas.getGlobalPosition()[0],
143 meas.getGlobalPosition()[1],
144 meas.getGlobalPosition()[2]};
145 std::cout << "Measurement global_position::\n" << global_pos << std::endl;
146
147 Acts::Vector2 local_pos{meas.getLocalPosition()[0],
148 meas.getLocalPosition()[1]};
149 std::cout << "Measurement local_position::\n" << local_pos << std::endl;
150 }

Member Data Documentation

◆ m_measurements_

const std::vector<ldmx::Measurement>* tracking::sim::LdmxMeasurementCalibrator::m_measurements_ = nullptr
private

Definition at line 154 of file MeasurementCalibrator.h.


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