|
ATLAS Offline Software
|
AlgTool to calculate the residual and pull of a measurement and the related track state independently of the detector type.
More...
#include <ResidualPullCalculator.h>
|
| ResidualPullCalculator (const std::string &type, const std::string &name, const IInterface *parent) |
| constructor More...
|
|
| ~ResidualPullCalculator () |
|
virtual StatusCode | initialize () override final |
| initialize More...
|
|
virtual StatusCode | finalize () override final |
|
virtual std::optional< Trk::ResidualPull > | residualPull (const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override final |
| This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual and pull for the given measurement and track state. More...
|
|
virtual std::optional< Trk::ResidualPull > | residualPull (const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType, const std::vector< const Trk::AlignmentEffectsOnTrack * > &) const override final |
| This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual and pull for the given measurement and track state, and the Alignment effects. More...
|
|
virtual std::array< double, 5 > | residuals (const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override final |
| This function is a light-weight version of the function above, designed for track fitters where speed is critical. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
AlgTool to calculate the residual and pull of a measurement and the related track state independently of the detector type.
The Trk::ResidualPullCalculator is an AlgTool to calculate the residual and pull of a measurement and the related track state independent of the detector type. For sub-detectors like the SCT which need more attention a special tool in the detector-realm is called (to avoid dependencies on sub-detector code; only runtime-dependencies are created).
The residuals and pulls are calculated according to the formulas given in the description of Trk::ResidualPull.
Definition at line 46 of file ResidualPullCalculator.h.
◆ StoreGateSvc_t
◆ ResidualPullCalculator()
Trk::ResidualPullCalculator::ResidualPullCalculator |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~ResidualPullCalculator()
Trk::ResidualPullCalculator::~ResidualPullCalculator |
( |
| ) |
|
|
inline |
◆ calcPull()
calc pull in 1 dimension
Definition at line 449 of file ResidualPullCalculator.cxx.
455 double CovarianceSum = 0.0;
457 CovarianceSum = locMesCov + locTrkCov;
459 CovarianceSum = locMesCov - locTrkCov;
460 }
else CovarianceSum = locMesCov;
462 if (CovarianceSum <= 0.0) {
463 ATH_MSG_DEBUG(
"instable calculation: total covariance is non-positive, MeasCov = "<<
464 locMesCov<<
", TrkCov = "<<locTrkCov<<
", resType = "<<resType);
467 return residual/sqrt(CovarianceSum);
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ finalize()
StatusCode Trk::ResidualPullCalculator::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ initialize()
StatusCode Trk::ResidualPullCalculator::initialize |
( |
| ) |
|
|
finaloverridevirtual |
initialize
Definition at line 47 of file ResidualPullCalculator.cxx.
57 ATH_MSG_DEBUG (
"No residual calculator for SCT given, will ignore SCT measurements!");
65 ATH_MSG_DEBUG (
"No residual calculator for RPC given, will ignore RPC measurements!");
73 ATH_MSG_DEBUG (
"No residual calculator for TGC given, will ignore TGC measurements!");
76 return StatusCode::SUCCESS;
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
const InterfaceID & Trk::IResidualPullCalculator::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
Interface ID, declared here, and defined below.
Definition at line 84 of file IResidualPullCalculator.h.
85 return IID_IResidualPullCalculator;
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ residualPull() [1/2]
This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual and pull for the given measurement and track state.
The track state can be an unbiased one (which can be retrieved by the Trk::IUpdator), a biased one (which contains the measurement), or a truth state. The enum residualTyp must be set according to this, otherwise the pulls will be wrong. Residuals differ in all three cases; please be aware of this.
This function determines the sub-detector type itself by using the ID helper
Implements Trk::IResidualPullCalculator.
Definition at line 177 of file ResidualPullCalculator.cxx.
183 if (!measurement || !trkPar)
return std::nullopt;
186 bool pullIsValid = trkPar->covariance();
191 measType =
helper.defineType(measurement);
194 std::vector<double>
residual(dimOfLocPars);
195 std::vector<double>
pull(dimOfLocPars);
198 ParamDefsAccessor PDA;
199 unsigned int iColRow=0;
201 ATH_MSG_VERBOSE (
"Calculating residual for type " << measType <<
" dimension " << dimOfLocPars);
249 ATH_MSG_WARNING (
"No SCT ResidualPullCalculator given, cannot calculate residual and pull for SCT measurement!");
259 ATH_MSG_WARNING (
"No RPC ResidualPullCalculator given, cannot calculate residual and pull for RPC measurement!");
269 ATH_MSG_WARNING (
"No TGC ResidualPullCalculator given, cannot calculate residual and pull for TGC measurement!");
280 for (
unsigned int i=0;
i<5; ++
i) {
284 - trkPar->parameters()[iPar];
287 measurement->
localCovariance()(PDA.pardef[iColRow],PDA.pardef[iColRow]),
288 (*trkPar->covariance())(PDA.pardef[iColRow],PDA.pardef[iColRow]),
299 residual.resize(HEPresidual.rows());
300 pull.resize(HEPresidual.rows());
301 for (
int i = 0;
i < HEPresidual.rows();
i++) {
306 return std::make_optional<Trk::ResidualPull>(
307 std::move(
residual), std::move(
pull), pullIsValid, resType,
◆ residualPull() [2/2]
This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual and pull for the given measurement and track state, and the Alignment effects.
The track state can be an unbiased one (which can be retrieved by the Trk::IUpdator), a biased one (which contains the measurement), or a truth state. The enum residualTyp must be set according to this, otherwise the pulls will be wrong. Residuals differ in all three cases; please be aware of this.
This function determines the sub-detector type itself by using the ID helper
Reimplemented from Trk::IResidualPullCalculator.
Definition at line 314 of file ResidualPullCalculator.cxx.
326 measType =
helper.defineType(measurement);
344 << " measurement->localParameters()[
Trk::
loc1] "
345 << measurement->localParameters()[
Trk::
loc1] << " resi "
350 for (
const auto & aeot : aeots ){
351 ATH_MSG_VERBOSE(
" ResidualPullCalculator aeots deltaTranslation " << aeot->deltaTranslation() <<
" angle " << aeot->deltaAngle());
353 Trk::DistanceSolution solution = aeot->associatedSurface().straightLineDistanceEstimate(originalTrkPar->position(),originalTrkPar->momentum().unit());
358 aeot->associatedSurface().center().x(),
359 originalTrkPar->position().y() -
360 aeot->associatedSurface().center().y(),
361 originalTrkPar->position().z() -
362 aeot->associatedSurface().center().z());
363 if (displacementVector.dot(originalTrkPar->momentum().unit()) < 0)
368 double distanceX =
distance*originalTrkPar->momentum().unit().x();
369 double distanceY =
distance*originalTrkPar->momentum().unit().y();
370 const double originalPhi=originalTrkPar->momentum().phi();
371 double distanceR =
std::cos(originalPhi)*distanceX +
std::sin(originalPhi)*distanceY;
373 << originalTrkPar->position().x() <<
" y "
374 << originalTrkPar->position().y() <<
" z "
375 << originalTrkPar->position().z());
377 << aeot->associatedSurface().center().x() <<
" y "
378 << aeot->associatedSurface().center().y() <<
" z "
379 << aeot->associatedSurface().center().z());
385 driftDirection = driftDirection.unit();
387 ATH_MSG_VERBOSE(
" sensorDirection x " << sensorDirection.x() <<
" y " << sensorDirection.y() <<
" z " << sensorDirection.z() );
388 ATH_MSG_VERBOSE(
" driftDirection x " << driftDirection.x() <<
" y " << driftDirection.y() <<
" z " << driftDirection.z() );
392 double projection = driftDirection.z();
394 const double originalTheta=originalTrkPar->momentum().theta();
395 const double sinOriginalTheta=
std::sin(originalTheta);
396 double factor = (distanceR/sinOriginalTheta)/sinOriginalTheta;
397 const Surface& surface = aeot->associatedSurface();
398 ATH_MSG_VERBOSE(
" fabs(surface.normal().z()) " << std::fabs(surface.normal().z()) );
399 if(std::fabs(surface.normal().z()) > 0.5) {
401 projection = (driftDirection.x()*surface.center().x() + driftDirection.y()*surface.center().y()) /
402 surface.center().perp();
411 localPos[0] += projection*aeot->deltaTranslation() - projection*factor*aeot->deltaAngle();
419 double projection = aeot->associatedSurface().normal().dot(originalTrkPar->momentum().unit());
420 localPos[0] += aeot->deltaTranslation()*projection +
distance*aeot->deltaAngle();
424 <<
" proj " << projection <<
" new localPos "
425 << localPos[0] <<
" simple " << localPosSimple[0]);
434 const AmgSymMatrix(5)* originalCov = trkPar->covariance();
442 return residualPull(measurement, trkPar.get(), resType, detType );
◆ residuals()
This function is a light-weight version of the function above, designed for track fitters where speed is critical.
The user has to provide a std::array of size 5, which gets filled with the residuals.
Implements Trk::IResidualPullCalculator.
Definition at line 88 of file ResidualPullCalculator.cxx.
94 std::array<double,5>
residuals{-999.,-999.,-999.,-999.,-999};
98 measType =
helper.defineType(measurement);
131 ATH_MSG_WARNING (
"No SCT ResidualPullCalculator given, cannot calculate residual and pull for SCT measurement!");
140 ATH_MSG_WARNING (
"No RPC ResidualPullCalculator given, cannot calculate residual and pull for RPC measurement!");
149 ATH_MSG_WARNING (
"No TGC ResidualPullCalculator given, cannot calculate residual and pull for TGC measurement!");
158 ParamDefsAccessor PDA;
161 for (
unsigned int i=0;
i<5; ++
i) {
165 - trkPar->parameters()[iPar];
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detStore
◆ m_evtStore
◆ m_idHelper
◆ m_RPCresidualTool
◆ m_SCTresidualTool
◆ m_TGCresidualTool
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
const Amg::MatrixX & expansionMatrix() const
Expansion matrix from 5x5 to the [dimension()]x[dimension()].
double currentDistance(bool signedDist=false) const
Current distance to surface (spatial), signed (along/opposite to surface normal) if input argument tr...
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
int parameterKey() const
Identifier key for matrix expansion/reduction.
ToolHandle< IResidualPullCalculator > m_TGCresidualTool
the ResidualPullCalculator for the TGC
Eigen::Matrix< double, 2, 1 > Vector2D
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
@ Unbiased
RP with track state that has measurement not included.
bool contains(ParamDefs par) const
The simple check for the clients whether the parameter is contained.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
std::unique_ptr< T_Obj > uniqueClone(const T_Obj *obj)
virtual std::array< double, 5 > residuals(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override final
This function is a light-weight version of the function above, designed for track fitters where speed...
@ loc2
generic first and second local coordinate
#define ATH_MSG_VERBOSE(x)
bool const RAWDATA *ch2 const
void updateParameters(const AmgVector(DIM) &, const AmgSymMatrix(DIM) &)
Update parameters and covariance , passing covariance by ref.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
AmgSymMatrix(5) &GXFTrackState
MeasurementType
enum describing the flavour of MeasurementBase
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
double calcPull(const double residual, const double locMesCov, const double locTrkCov, const Trk::ResidualPull::ResidualType &resType) const
calc pull in 1 dimension
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Ensure that the ATLAS eigen extensions are properly loaded.
ResidualPullCalculator(const std::string &type, const std::string &name, const IInterface *parent)
constructor
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
classifies a MeasurementBase into one of the known inherited flavours or one of the detector types fo...
ParametersBase< TrackParametersDim, Charged > TrackParameters
Eigen::Matrix< double, 3, 1 > Vector3D
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
int dimension() const
Dimension of this localParameters() vector.
@ Biased
RP with track state including the hit.
virtual std::optional< Trk::ResidualPull > residualPull(const Trk::MeasurementBase *measurement, const Trk::TrackParameters *trkPar, const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType) const override final
This function returns (creates!) a Trk::ResidualPull object, which contains the values of residual an...
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
const AtlasDetectorID * m_idHelper
Used to know the sub-det from PRD->identify().
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
ToolHandle< IResidualPullCalculator > m_RPCresidualTool
the ResidualPullCalculator for the RPC
ToolHandle< IResidualPullCalculator > m_SCTresidualTool
the ResidualPullCalculator for the SCT