11#include "GaudiKernel/ITHistSvc.h"
33#define TRKEXTOOLS_MAXUPDATES 100
34#ifndef COVARIANCEUPDATEWITHCHECK
35#define COVARIANCEUPDATEWITHCHECK(cov, sign, value) \
36 cov += (sign > 0 ? value : (value > cov ? 0 : sign * value))
43 declareInterface<IMaterialEffectsUpdator>(
this);
61 <<
". No multiple scattering effects will be taken into account.");
63 return StatusCode::FAILURE;
74 <<
". No energy loss effects will be taken into account.");
76 return StatusCode::FAILURE;
88 return StatusCode::FAILURE;
96 return StatusCode::SUCCESS;
100std::unique_ptr<Trk::TrackParameters>
128 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
131std::unique_ptr<Trk::TrackParameters>
151 double E = std::sqrt(p * p + m * m);
154 double pathcorrection = 1.;
156 double energyLoss = 0;
157 double energyLossSigma = 0;
166 double sigmaQoverP = 0;
167 double sigmaQoverPSq = 0;
170 if (energyLoss > 0) {
181 double qOverPnew = parm->parameters()[
Trk::qOverP];
184 double newP2 = (E + energyLoss) * (E + energyLoss) - m * m;
188 if (E + energyLoss < -m) {
191 newP = std::sqrt(newP2);
192 sigmaQoverP = energyLossSigma / (beta * p * p);
193 sigmaQoverPSq = sigmaQoverP * sigmaQoverP;
194 qOverPnew = parm->
charge() / newP;
201 AmgVector(5) updatedParameters(mpars->parameters());
202 std::optional<
AmgSymMatrix(5)> updatedCovariance = std::nullopt;
206 updatedCovariance = mpars->covariance()
207 ? std::optional<AmgSymMatrix(5)>(*mpars->covariance())
209 double angularVariation = 0;
210 double sigmaDeltaPhiSq = 0;
211 double sigmaDeltaThetaSq = 0;
223 angularVariation / (std::sin(parm->parameters()[
Trk::theta]) * std::sin(parm->parameters()[
Trk::theta]));
224 sigmaDeltaThetaSq = angularVariation;
228 sigmaDeltaPhiSq *= sigmaDeltaPhiSq;
230 sigmaDeltaThetaSq *= sigmaDeltaThetaSq;
236 if (updatedCovariance) {
238 int sign = int(matupmode);
259 double sigmaAngle = std::sqrt(angularVariation);
262 ATH_MSG_VERBOSE(
" deltaP / sigmaQoverP = " << energyLoss <<
" / " << sigmaQoverP);
308std::unique_ptr<Trk::TrackParameters>
325 if (preFactor < 0.01) {
337 pathCorrection *= preFactor;
350 ATH_MSG_VERBOSE(
" [M] pre material update at layer with [r,z] = [ " << layerR <<
", " << layerZ <<
" ] - Index "
352 ATH_MSG_VERBOSE(
" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 <<
" , " << tX0 <<
" (" <<
eta <<
": "
353 << pathCorrection <<
")");
359 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
362std::unique_ptr<Trk::TrackParameters>
382 if (postFactor < 0.01) {
391 pathCorrection *= postFactor;
405 ATH_MSG_VERBOSE(
" [M] post material update, layer with [r,z] = [ " << layerR <<
", " << layerZ <<
" ] - Index "
407 ATH_MSG_VERBOSE(
" thickness/X0 , path/X0 (eta: g.factor) = " << sX0 <<
" , " << tX0 <<
" (" <<
eta <<
": "
408 << pathCorrection <<
")");
414 return updateImpl(cache, parm, *mprop, pathCorrection, dir, particle, matupmode);
418std::unique_ptr<Trk::TrackParameters>
423 double pathcorrection,
437 double E = std::sqrt(p * p + m * m);
448 pathcorrection, dir, particle,
452 double deltaE = energyLoss.
deltaE();
468 double newP2 = (E + deltaE) * (E + deltaE) - m * m;
469 if (E + deltaE < -m) {
475 double deltaP = std::sqrt(newP2) - p;
476 double sigmaQoverP = sigmaDeltaE / std::pow(beta * p, 2);
482 AmgVector(5) updatedParameters(mpars->parameters());
484 std::optional<
AmgSymMatrix(5)> updatedCovariance = std::nullopt;
489 ? std::optional<AmgSymMatrix(5)>(*mpars->covariance())
492 double angularVariation =
493 (
m_doMs) ?
m_msUpdator->sigmaSquare(matprop, updateMomentum, pathcorrection, particle) : 0.;
495 if (updatedCovariance) {
497 int sign = int(matupmode);
499 double sigmaDeltaPhiSq =
500 angularVariation / (std::sin(parm->parameters()[
Trk::theta]) * std::sin(parm->parameters()[
Trk::theta]));
501 double sigmaDeltaThetaSq = angularVariation;
523 double sigmaAngle = std::sqrt(angularVariation);
525 <<
" / " << sigmaAngle);
526 ATH_MSG_VERBOSE(
" deltaP / sigmaQoverP = " << deltaP <<
" / " << sigmaQoverP);
548 l0 = extProperties->
l0();
581 std::move(updatedCovariance)
589std::unique_ptr<Trk::TrackParameters>
594 double pathcorrection,
608 double E = std::sqrt(p * p + m * m);
617 AmgVector(5) updatedParameters(parm.parameters());
625 double deltaE = energyLoss.
deltaE() ;
641 double newP2 = (E + deltaE) * (E + deltaE) - m * m;
642 if (E + deltaE < -m) {
648 double deltaP = std::sqrt(newP2) - p;
649 double sigmaQoverP = sigmaDeltaE / std::pow(beta * p, 2);
654 std::optional<
AmgSymMatrix(5)> updatedCovariance = std::nullopt;
657 updatedCovariance =
AmgSymMatrix(5)(*parm.covariance());
659 double angularVariation =
660 (
m_doMs) ?
m_msUpdator->sigmaSquare(matprop, updateMomentum, pathcorrection, particle) : 0.;
663 int sign = int(matupmode);
665 double sigmaDeltaPhiSq =
666 angularVariation / (std::sin(parm.parameters()[
Trk::theta]) * std::sin(parm.parameters()[
Trk::theta]));
667 double sigmaDeltaThetaSq = angularVariation;
689 double sigmaAngle = std::sqrt(angularVariation);
692 ATH_MSG_VERBOSE(
" deltaP / sigmaQoverP = " << deltaP <<
" / " << sigmaQoverP);
712 l0 = extProperties->
l0();
745 std::move(updatedCovariance)
774 ATH_MSG_DEBUG(
" [-] update material with 'removeNoise' results in negative covariance entries. Skipping update.");
Scalar eta() const
pseudorapidity method
#define ATH_MSG_VERBOSE(x)
#define AmgSymMatrix(dim)
#define COVARIANCEUPDATEWITHCHECK(cov, sign, value)
It is used in the Mapping process ( using MaterialSteps ), the validation and recostruction ( using M...
This class describes energy loss material effects in the ATLAS tracking EDM.
double sigmaDeltaE() const
returns the symmatric error
double deltaE() const
returns the
double validationPhi
theta
double accumulatedElossSigma
const Trk::Layer * validationLayer
int validationSteps
number of validation steps
Base Class for a Detector Layer in the Tracking realm.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const MaterialProperties * fullUpdateMaterialProperties(const TrackParameters &par) const
getting the MaterialProperties back - for full update
virtual bool isOnLayer(const Amg::Vector3D &gp, const BoundaryCheck &bcheck=BoundaryCheck(true)) const
isOnLayer() method, using isOnSurface() with Layer specific tolerance
const LayerIndex & layerIndex() const
get the layerIndex
virtual double postUpdateMaterialFactor(const TrackParameters &, PropDirection) const
getting the MaterialProperties back - for pre-update
virtual double preUpdateMaterialFactor(const TrackParameters &, PropDirection) const
getting the MaterialProperties back - for pre-update
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
const Surface & associatedSurface() const
returns the surface to which these m.eff. are associated.
double thicknessInX0() const
returns the actually traversed material .
represents the full description of deflection and e-loss of a track in material.
const EnergyLoss * energyLoss() const
returns the energy loss object.
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
ToolHandle< IMultipleScatteringUpdator > m_msUpdator
std::unique_ptr< TrackParameters > postUpdateImpl(ICache &cache, const TrackParameters &parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
BooleanProperty m_validationIgnoreUnmeasured
static void validationActionImpl(ICache &cache)
IMaterialEffectsUpdator::ICache ICache
BooleanProperty m_validationMode
BooleanProperty m_landauMode
BooleanProperty m_msgOutputCorrections
ToolHandle< IEnergyLossUpdator > m_eLossUpdator
DoubleProperty m_forcedMomentum
bool checkCovariance(AmgSymMatrix(5) &updated) const
A simple check method for the 'removeNoise' update model.
BooleanProperty m_useMostProbableEloss
std::unique_ptr< TrackParameters > preUpdateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
DoubleProperty m_momentumMax
MaterialEffectsUpdator(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
IntegerProperty m_validationDirection
DoubleProperty m_momentumCut
std::unique_ptr< TrackParameters > updateImpl(ICache &cache, const TrackParameters *parm, const Layer &sf, PropDirection dir=alongMomentum, ParticleHypothesis particle=pion, MaterialUpdateMode matupmode=addNoise) const
ToolHandle< IMaterialMapper > m_materialMapper
BooleanProperty m_forceMomentum
virtual StatusCode initialize() override
AlgTool initailize method.
static void modelActionImpl(ICache &cache, const TrackParameters *parm=nullptr)
BooleanProperty m_msgOutputValidationDirection
BooleanProperty m_doEloss
virtual ~MaterialEffectsUpdator()
Virtual destructor.
Material with information about thickness of material.
float averageRho() const
Return the average density of the material.
float thicknessInX0() const
Return the radiationlength fraction.
float averageA() const
Return the average A of the material [gram/mole].
float averageZ() const
Returns the average Z of the material.
float l0() const
Return the nuclear interaction length.
float x0() const
Return the radiation length.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
double charge() const
Returns the charge.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
double sigmaDeltaPhi() const
returns the
double deltaPhi() const
returns the
double sigmaDeltaTheta() const
returns the
double deltaTheta() const
returns the
virtual double r() const =0
Interface method for the maximal extension or the radius.
virtual ChargedTrackParametersUniquePtr createUniqueTrackParameters(double l1, double l2, double phi, double theat, double qop, std::optional< AmgSymMatrix(5)> cov=std::nullopt) const =0
Use the Surface as a ParametersBase constructor, from local parameters - charged.
virtual double pathCorrection(const Amg::Vector3D &pos, const Amg::Vector3D &mom) const
the pathCorrection for derived classes with thickness - it reflects if the direction projection is po...
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
PropDirection
PropDirection, enum for direction of the propagation.
@ loc2
generic first and second local coordinate
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
MaterialUpdateMode
This is a steering enum to force the material update it can be: (1) addNoise (-1) removeNoise Second ...
ParametersBase< TrackParametersDim, Charged > TrackParameters
hold the test vectors and ease the comparison