ATLAS Offline Software
|
#include <MdtSegmentFitter.h>
Classes | |
struct | Config |
struct | LineWithPartials |
Store the partial derivative of the line w.r.t. More... | |
struct | ResidualWithPartials |
Helper struct carrying the residual with its derivatives. More... | |
Public Types | |
using | ParamDefs = SegmentFit::ParamDefs |
using | Parameters = SegmentFit::Parameters |
using | HitType = std::unique_ptr< CalibratedSpacePoint > |
using | HitVec = std::vector< HitType > |
Public Member Functions | |
MdtSegmentFitter (const std::string &name, Config &&config) | |
Standard constructor. More... | |
SegmentFitResult | fitSegment (const EventContext &ctx, HitVec &&calibHits, const Parameters &startPars, const Amg::Transform3D &localToGlobal) const |
void | calculateWireResiduals (const LineWithPartials &line, const CalibratedSpacePoint &spacePoint, ResidualWithPartials &residual) const |
Calculates the residuals together with the corresponding derivatives for a drift-circle measurement. More... | |
void | calculateStripResiduals (const LineWithPartials &line, const CalibratedSpacePoint &spacePoint, ResidualWithPartials &residual) const |
Calculates the residual together with hte correspdonding derivatives for strip measurements. More... | |
bool | msgLvl (const MSG::Level lvl) const |
Test the output level. More... | |
MsgStream & | msg () const |
The standard message stream. More... | |
MsgStream & | msg (const MSG::Level lvl) const |
The standard message stream. More... | |
void | setLevel (MSG::Level lvl) |
Change the current logging level. More... | |
Static Public Member Functions | |
static void | updateLinePartials (const Parameters &fitPars, LineWithPartials &line) |
Updates the line parameters together with its first & second order partial derivatives. More... | |
static Amg::Vector3D | partialPlaneIntersect (const Amg::Vector3D &normal, const double offset, const LineWithPartials &line, const ParamDefs fitPar) |
Calculates the partial derivative of the intersection point between the segment line and the measurement's strip plane. More... | |
Private Types | |
enum | UpdateStatus { UpdateStatus::allOkay = 0, UpdateStatus::outOfBounds = 1, UpdateStatus::noChange = 2 } |
using | MeasCov_t = CalibratedSpacePoint::Covariance_t |
Updates the chi2, its Gradient & Hessian from the measurement residual. More... | |
Private Member Functions | |
bool | recalibrate (const EventContext &ctx, SegmentFitResult &fitResult) const |
Recalibrate the measurements participating in the fit & shift them into the centre-of gravity frame. More... | |
bool | updateHitSummary (SegmentFitResult &fitResult) const |
Brief updates the hit summary from the contributing hits. More... | |
void | updateDriftSigns (const Amg::Vector3D &segPos, const Amg::Vector3D &segDir, SegmentFitResult &fitRes) const |
Update the signs of the measurement. More... | |
void | updateDerivatives (const ResidualWithPartials &fitMeas, const MeasCov_t &measCovariance, AmgVector(5)&gradient, AmgSymMatrix(5)&hessian, double &chi2, int startPar) const |
template<unsigned int nDim> | |
UpdateStatus | updateParameters (Parameters ¤tPars, Parameters &previousPars, Parameters &currGrad, Parameters &prevGrad, const AmgSymMatrix(5)&hessian) const |
Update step of the segment parameters using the Hessian and the gradient. More... | |
template<unsigned int nDim> | |
void | blockCovariance (const AmgSymMatrix(5)&hessian, SegmentFit::Covariance &covariance) const |
void | initMessaging () const |
Initialize our message level and MessageSvc. More... | |
Private Attributes | |
Config | m_cfg {} |
std::string | m_nm |
Message source name. More... | |
boost::thread_specific_ptr< MsgStream > | m_msg_tls |
MsgStream instance (a std::cout like with print-out levels) More... | |
std::atomic< IMessageSvc * > | m_imsg { nullptr } |
MessageSvc pointer. More... | |
std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
Current logging level. More... | |
std::atomic_flag m_initialized | ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
Messaging initialized (initMessaging) More... | |
Definition at line 19 of file MdtSegmentFitter.h.
using MuonR4::MdtSegmentFitter::HitType = std::unique_ptr<CalibratedSpacePoint> |
Definition at line 23 of file MdtSegmentFitter.h.
using MuonR4::MdtSegmentFitter::HitVec = std::vector<HitType> |
Definition at line 24 of file MdtSegmentFitter.h.
Updates the chi2, its Gradient & Hessian from the measurement residual.
Depending on whether the time needs to be taken into account or not the template parameter nDim is either 3 or 2, respectively.
fitMeas | Residual of the prediction from the measurement together with its derivatives |
measCovariance | Covariance matrix of the measurement |
gradient | Reference to the gradient of the chi2 which is updated by the function |
hessian | Reference to the Hessian matrix of the chi2 which is updated by the function |
chi2 | Reference to the chi2 value itself which is updated by the function |
startPar | Number of the maximum fit parameter to consider |
Definition at line 154 of file MdtSegmentFitter.h.
Definition at line 21 of file MdtSegmentFitter.h.
Definition at line 22 of file MdtSegmentFitter.h.
|
strongprivate |
Enumerator | |
---|---|
allOkay | |
outOfBounds | |
noChange |
Definition at line 163 of file MdtSegmentFitter.h.
Standard constructor.
name | Name to be printed in the messaging |
config | Fit configuration parameters |
Definition at line 51 of file MdtSegmentFitter.cxx.
|
private |
Definition at line 638 of file MdtSegmentFitter.cxx.
void MuonR4::MdtSegmentFitter::calculateStripResiduals | ( | const LineWithPartials & | line, |
const CalibratedSpacePoint & | spacePoint, | ||
ResidualWithPartials & | residual | ||
) | const |
Calculates the residual together with hte correspdonding derivatives for strip measurements.
The residual is calculated by a straight line propagation of the segment onto the plane & then taking the absolute disances in the [precision] & [non-precision direction]
line | Current segment line together with the first & second order derivatives |
spacePoint | Reference to the measurement to calculate the residual to |
residual | Output residual object to save the actual residual and the derivatives |
Update the residual accordingly
Definition at line 320 of file MdtSegmentFitter.cxx.
void MuonR4::MdtSegmentFitter::calculateWireResiduals | ( | const LineWithPartials & | line, |
const CalibratedSpacePoint & | spacePoint, | ||
ResidualWithPartials & | residual | ||
) | const |
Calculates the residuals together with the corresponding derivatives for a drift-circle measurement.
The residual is calculated by projecting the hit into the plane perpendicular to the wire. If the hit is a twin-hit the distance along the wire is taken into account as well.
line | Current segment line together with the first & second order derivatives |
spacePoint | Reference to the measurement to calculate the residual to |
residual | Output residual object to save the actual residual and the derivatives |
Fetch the hit position & direction
Cache the scalar product & the lengths as they're appearing in the formulas below more often
Project the segment onto the plane
Calculate the distance from the two reference points
Distance from the segment line to the tube wire
If the tube is a twin-tube, the hit position is no longer arbitrary along the wire. Calculate the distance along the wire towards the point of closest approach.
Cache of the partial derivatives of the projected line parameters w.r.t the fit parameters
Dot product between the angular derivative & the hit-plane normal
Calculate the first derivative of the residual
No variation of the track parameters w.r.t. the time
Loop to include the second order derivatvies
Pure angular derivatives of the residual
Angular & Spatial mixed terms
Definition at line 184 of file MdtSegmentFitter.cxx.
SegmentFitResult MuonR4::MdtSegmentFitter::fitSegment | ( | const EventContext & | ctx, |
HitVec && | calibHits, | ||
const Parameters & | startPars, | ||
const Amg::Transform3D & | localToGlobal | ||
) | const |
Cache of the partial derivatives of the line parameters w.r.t the fit parameters
Partials of the residual w.r.t. the fit parameters
Update the partial derivatives of the direction vector
First step calibrate the hits
Reset chi2
Loop over the hits to calculate the partial derivatives
Which parameters are affected by the residual
The complementary coordinate does not contribute if the measurement is 1D
need to calculate the global time of flight
Loop over hits is done. Symmetrise the Hessian
Check whether the gradient is already sufficiently small
Pure eta segment fit
In the case that the time is fit & that there are no phi measurements -> compress matrix by swaping the time column with whaever the second column is... it's zero
Subtract 1 degree of freedom to take the time into account
Calculate the chi2 per measurement
Sort the measurements by ascending z
Update the covariance
Definition at line 389 of file MdtSegmentFitter.cxx.
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 164 of file AthMessaging.h.
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 179 of file AthMessaging.h.
|
inlineinherited |
Test the output level.
lvl | The message level to test against |
true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
|
inlinestatic |
Calculates the partial derivative of the intersection point between the segment line and the measurement's strip plane.
normal | Normal vector on the measurment's plane pointing in positive z direction |
offset | Offset describing the refrence point of the normal vector |
line | Line describing the segment together with its derivatives |
fitPar | Parameter to which the derivative shall be calculated |
Definition at line 120 of file MdtSegmentFitter.cxx.
|
inlineprivate |
Recalibrate the measurements participating in the fit & shift them into the centre-of gravity frame.
The parsed centerOfGravity position is updated to be the average measurement position weighted by the inverse covariance. Returns true if there're enough degrees of freedom left to fit
ctx | EventContext to fetch the calibration constants |
fitResult | Current fit state |
centerOfGravity | Vector to save the center of gravity position later on. |
invCov | Vector to cache the inverse covariances of the problem. |
Switch off the time fit if too little degrees of freedom are left
Recalibrate the measurements
Definition at line 62 of file MdtSegmentFitter.cxx.
|
inherited |
Change the current logging level.
Use this rather than msg().setLevel() for proper operation with MT.
Definition at line 28 of file AthMessaging.cxx.
|
private |
Definition at line 616 of file MdtSegmentFitter.cxx.
|
inlineprivate |
Update the signs of the measurement.
Definition at line 55 of file MdtSegmentFitter.cxx.
|
inlineprivate |
Brief updates the hit summary from the contributing hits.
Returns fals if there're too little valid hits.
fitResult | Reference to the container containing all the measurements |
Count the phi & time measurements measurements
Mdts are already counted in the measures eta category. Don't count them twice
Definition at line 90 of file MdtSegmentFitter.cxx.
|
static |
Updates the line parameters together with its first & second order partial derivatives.
fitPars | Set of segment parameters in the current iteration |
line | Reference to the line object to be updated |
x_{0} cos (phi) sin (theta) segPos = y_{0} , segDir = sin (phi) sin (theta) 0 cos theta
d segDir cos (phi) cos(theta) dSegDir -sin(phi) sin (theta) -------—= sin (phi) cos(theta) -----— = cos(phi) sin (theta) dTheta - sin (theta) dPhi 0
Definition at line 142 of file MdtSegmentFitter.cxx.
|
private |
Update step of the segment parameters using the Hessian and the gradient.
If the Hessian is definite, the currentParameters are updated according to x_{n+1} = x_{n} - H_{n}^{1} * grad(x_{n}) Otherwise, the method of steepest descent is attempted.
currentPars | Best segment estimator parameters |
previousPars | Segment estimator parameters from the last iteration |
currGrad | Gradient of the chi2 from this iteration |
prevGrad | Gradient of the chi2 from the previous iteration |
hessian | Hessian estimator |
Check that all parameters remain within the parameter boundary window
Definition at line 654 of file MdtSegmentFitter.cxx.
|
mutableprivateinherited |
Messaging initialized (initMessaging)
Definition at line 141 of file AthMessaging.h.
|
private |
Definition at line 91 of file MdtSegmentFitter.h.
|
mutableprivateinherited |
MessageSvc pointer.
Definition at line 135 of file AthMessaging.h.
|
mutableprivateinherited |
Current logging level.
Definition at line 138 of file AthMessaging.h.
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
|
privateinherited |
Message source name.
Definition at line 129 of file AthMessaging.h.