ATLAS Offline Software
Loading...
Searching...
No Matches
MuonExperimental::Gx2fMaterialProperties Struct Reference

A container to store material properties for each material surface. More...

#include <Chi2Fitter.h>

Collaboration diagram for MuonExperimental::Gx2fMaterialProperties:

Classes

struct  ELossAtSurface
 Auxiliary struct to include the measured energy loss at a surface. More...
struct  ScatteringAtSurface
 Auxiliary struct to describe the material scattering at a surface. More...

Public Member Functions

 Gx2fMaterialProperties (ScatteringAtSurface &&scatterer, ELossAtSurface &&eLoss)
 Constructor to initialize material properties.
constexpr bool materialIsValid () const
 Accessor for the material validity flag.
constexpr std::size_t nDim () const
 Number of dimensions from the material scatterer.
const ScatteringAtSurface & scatterer () const
const ELossAtSurface & energyLoss () const
constexpr double deltaTheta () const
constexpr double deltaPhi () const
constexpr double lostEnergy () const
constexpr double qOverPderiv () const
constexpr double qOverPratio () const
void updateTrackParameters (BoundTrackParameters &trackPars)
 Update the track parameters with the scattering angles and.
void contributionToGx2fSums (Gx2fSystem &extendedSystem, const double theta, const std::size_t firstParamIdx, const Logger &logger) const
void updateParameters (const Eigen::VectorXd &deltaParamsExtended, const std::size_t firstParamIdx)

Private Attributes

ScatteringAtSurface m_scatterer {}
 Description of the scattering angles.
ELossAtSurface m_eloss {}
 Description of the energy loss.
double m_lostEnergy {0.}
 Fitted parameters.
double m_scatTheta {0.}
 Fitted delta theta scattering.
double m_scatPhi {0.}
 Fitted delta phi scattering.
double m_qOverPderiv {0.}
 qOverP derivative with respect to eloss
double m_qOverPratio {1.}

Detailed Description

A container to store material properties for each material surface.

This struct holds the scattering angles, the inverse covariance of the material, and a validity flag indicating whether the material is valid for the scattering process.

Definition at line 62 of file Chi2Fitter.h.

Constructor & Destructor Documentation

◆ Gx2fMaterialProperties()

MuonExperimental::Gx2fMaterialProperties::Gx2fMaterialProperties ( ScatteringAtSurface && scatterer,
ELossAtSurface && eLoss )
inlineexplicit

Constructor to initialize material properties.

Parameters
scatteringAngles_The vector of scattering angles.
invCovarianceMaterial_The inverse covariance of the material.
materialIsValid_A boolean flag indicating whether the material is valid.

Definition at line 158 of file Chi2Fitter.h.

160 : m_scatterer{std::move(scatterer)},
161 m_eloss{std::move(eLoss)},
162 m_lostEnergy{m_eloss.isValid() ? m_eloss.lostEnergy() : 0.} {}
ELossAtSurface m_eloss
Description of the energy loss.
Definition Chi2Fitter.h:208
const ScatteringAtSurface & scatterer() const
Definition Chi2Fitter.h:177
double m_lostEnergy
Fitted parameters.
Definition Chi2Fitter.h:215
ScatteringAtSurface m_scatterer
Description of the scattering angles.
Definition Chi2Fitter.h:206

Member Function Documentation

◆ contributionToGx2fSums()

void MuonExperimental::Gx2fMaterialProperties::contributionToGx2fSums ( Gx2fSystem & extendedSystem,
const double theta,
const std::size_t firstParamIdx,
const Logger & logger ) const

Definition at line 93 of file Chi2Fitter.cxx.

95 {
96 if (m_scatterer.isValid()) {
97 const double invCovTheta = Acts::square(1. / m_scatterer.sigma());
98 const double sinThetaLoc = std::sin(theta);
99 const double invCovPhi = invCovTheta * Acts::square(sinThetaLoc);
100
101 // Phi contribution
102 extendedSystem.aMatrix()(stateIdx, stateIdx) += invCovPhi;
103 extendedSystem.bVector()(stateIdx, 0) -= invCovPhi * deltaPhi();
104 extendedSystem.chi2() += invCovPhi * Acts::square(deltaPhi());
105
106 // Theta Contribution
107 extendedSystem.aMatrix()(stateIdx + 1, stateIdx + 1) += invCovTheta;
108 extendedSystem.bVector()(stateIdx + 1, 0) -= invCovTheta * deltaTheta();
109 extendedSystem.chi2() += invCovTheta * Acts::square(deltaTheta());
110 ACTS_VERBOSE("Scattering contributions in contributionToGx2fSums:\n"
111 << " index: " << stateIdx << "-" << (stateIdx + 1) << " \n"
112 << " invCov: " << invCovPhi << "\n"
113 << " sinThetaLoc: " << sinThetaLoc << "\n"
114 << " Phi:\n"
115 << " scattering angle: " << deltaPhi() << "\n"
116 << " aMatrix contribution: " << invCovPhi << "\n"
117 << " bVector contribution: " << invCovPhi * deltaPhi()
118 << "\n"
119 << " chi2sum contribution: "
120 << invCovPhi * Acts::square(deltaPhi()) << "\n"
121 << " Theta:\n"
122 << " scattering angle: " << deltaTheta() << "\n"
123 << " aMatrix contribution: " << invCovTheta << "\n"
124 << " bVector contribution: "
125 << invCovTheta * deltaTheta() << "\n"
126 << " chi2sum contribution: "
127 << invCovTheta * Acts::square(deltaTheta()));
128 }
129
130 if (m_eloss.isValid()) {
131 const std::size_t eLossIdx = stateIdx + (nDim() - 1ul);
132 extendedSystem.aMatrix()(eLossIdx, eLossIdx) +=
133 Acts::square(1. / m_eloss.lostSigma());
134 extendedSystem.bVector()(eLossIdx, 0) -=
135 Acts::square(1. / m_eloss.lostSigma()) *
136 (m_lostEnergy - m_eloss.lostEnergy());
137 extendedSystem.chi2() += Acts::square(
138 (m_lostEnergy - m_eloss.lostEnergy()) / m_eloss.lostSigma());
139 // The energy loss constraint to require only positive energy loss for the
140 // free parameter
141 constexpr double Nepsilon = Acts::square(1. / 10._keV);
142 if (m_lostEnergy < 10._keV) {
143 ACTS_VERBOSE(
144 "Add penalty term to the chi2 to push the energy loss above zero");
145 extendedSystem.chi2() += Nepsilon * Acts::square(m_lostEnergy);
146 extendedSystem.bVector()(eLossIdx, 0) -= Nepsilon * m_lostEnergy;
147 extendedSystem.aMatrix()(eLossIdx, eLossIdx) += Nepsilon;
148 }
149 ACTS_VERBOSE("Energy loss contributions in contributionToGx2fSums:\n"
150 << " index: " << eLossIdx << " \n"
151 << " measured loss: " << m_eloss.lostEnergy() << "+-"
152 << (m_eloss.lostSigma()) << ", \n"
153 << " currently estimated loss: " << m_lostEnergy << "\n"
154 << " --> chi2 contribution: "
155 << Acts::square((m_lostEnergy - m_eloss.lostEnergy()) /
156 m_eloss.lostSigma())
157 << "\n"
158 << " --> aMatrix contribution: "
159 << Acts::square(1. / m_eloss.lostSigma()) << "\n"
160 << " --> bVector contribution: "
161 << Acts::square(1. / m_eloss.lostSigma()) *
162 (m_lostEnergy - m_eloss.lostEnergy()));
163 }
164}
Scalar theta() const
theta method
constexpr std::size_t nDim() const
Number of dimensions from the material scatterer.
Definition Chi2Fitter.h:172
constexpr double deltaPhi() const
Definition Chi2Fitter.h:183
constexpr double deltaTheta() const
Definition Chi2Fitter.h:181

◆ deltaPhi()

double MuonExperimental::Gx2fMaterialProperties::deltaPhi ( ) const
inlineconstexpr

Definition at line 183 of file Chi2Fitter.h.

183{ return m_scatPhi; }
double m_scatPhi
Fitted delta phi scattering.
Definition Chi2Fitter.h:219

◆ deltaTheta()

double MuonExperimental::Gx2fMaterialProperties::deltaTheta ( ) const
inlineconstexpr

Definition at line 181 of file Chi2Fitter.h.

181{ return m_scatTheta; }
double m_scatTheta
Fitted delta theta scattering.
Definition Chi2Fitter.h:217

◆ energyLoss()

const ELossAtSurface & MuonExperimental::Gx2fMaterialProperties::energyLoss ( ) const
inline

Definition at line 179 of file Chi2Fitter.h.

179{ return m_eloss; }

◆ lostEnergy()

double MuonExperimental::Gx2fMaterialProperties::lostEnergy ( ) const
inlineconstexpr

Definition at line 185 of file Chi2Fitter.h.

185{ return m_lostEnergy; }

◆ materialIsValid()

bool MuonExperimental::Gx2fMaterialProperties::materialIsValid ( ) const
inlineconstexpr

Accessor for the material validity flag.

Returns
True if material is valid for scattering calculations, false for vacuum or zero thickness

Definition at line 166 of file Chi2Fitter.h.

166 {
167 return m_scatterer.isValid() || m_eloss.isValid();
168 }

◆ nDim()

std::size_t MuonExperimental::Gx2fMaterialProperties::nDim ( ) const
inlineconstexpr

Number of dimensions from the material scatterer.

Returns
Number of dimensions from the material scatterer to the parameter vector

Definition at line 172 of file Chi2Fitter.h.

172 {
173 return (m_scatterer.isValid() ? 2ul : 0ul) +
174 (m_eloss.isValid() ? 1ul : 0ul);
175 }

◆ qOverPderiv()

double MuonExperimental::Gx2fMaterialProperties::qOverPderiv ( ) const
inlineconstexpr

Definition at line 187 of file Chi2Fitter.h.

187{ return m_qOverPderiv; }
double m_qOverPderiv
qOverP derivative with respect to eloss
Definition Chi2Fitter.h:221

◆ qOverPratio()

double MuonExperimental::Gx2fMaterialProperties::qOverPratio ( ) const
inlineconstexpr

Definition at line 189 of file Chi2Fitter.h.

◆ scatterer()

const ScatteringAtSurface & MuonExperimental::Gx2fMaterialProperties::scatterer ( ) const
inline

Definition at line 177 of file Chi2Fitter.h.

177{ return m_scatterer; }

◆ updateParameters()

void MuonExperimental::Gx2fMaterialProperties::updateParameters ( const Eigen::VectorXd & deltaParamsExtended,
const std::size_t firstParamIdx )

Definition at line 39 of file Chi2Fitter.cxx.

40 {
41 if (m_scatterer.isValid()) {
42 m_scatPhi += deltaParamsExtended[stateIdx];
43 m_scatTheta += deltaParamsExtended[stateIdx + 1ul];
44 }
45 if (m_eloss.isValid()) {
46 const std::size_t eLossIdx = stateIdx + (nDim() - 1ul);
47 m_lostEnergy += deltaParamsExtended[eLossIdx];
48 }
49}

◆ updateTrackParameters()

void MuonExperimental::Gx2fMaterialProperties::updateTrackParameters ( BoundTrackParameters & trackPars)

Update the track parameters with the scattering angles and.

Parameters
trackParsThe bound track parameters fetched from the stepper which will be fed back to the stepper to adjust the trajectory position

Definition at line 51 of file Chi2Fitter.cxx.

52 {
53 if (m_scatterer.isValid()) {
54 trackPars.parameters()[eBoundPhi] += deltaPhi();
55 trackPars.parameters()[eBoundTheta] += deltaTheta();
56 }
57 if (m_eloss.isValid()) {
58 const ParticleHypothesis& hypot = trackPars.particleHypothesis();
59 const double nextE =
60 fastHypot(hypot.mass(), trackPars.absoluteMomentum()) - m_lostEnergy;
61 const double qOverPBefore = trackPars.parameters()[eBoundQOverP];
62 const double pAfter =
63 (hypot.mass() < nextE) ? fastCathetus(nextE, hypot.mass()) : 0;
64
65 if (pAfter <= Acts::s_epsilon) {
66 // Fitted loss exceeds the available momentum: leave the parameters
67 // untouched, and degrade to no contribution rather than a division by
68 // zero.
69 // ACTS_WARNING("Fitted energy loss exceeds available momentum. "
70 // << "Momentum before: " << trackPars.absoluteMomentum()
71 // << ", fitted loss: " << m_lostEnergy
72 // << ", fitted momentum after: " << pAfter);
73 m_qOverPderiv = 0.;
74 m_qOverPratio = 1.;
75 return;
76 }
77
78 trackPars.parameters()[eBoundQOverP] =
79 hypot.qOverP(pAfter, trackPars.charge());
80 // std::cout<<"Update q/p from " << qOverPBefore << " to " <<
81 // trackPars.parameters()[eBoundQOverP] << std::endl; cache the derivative
82 // of q/p with respect to energy loss for the Gx2f system and the qoverp
83 // ratio before and after
84 // we are gonna need them for the bVecror and aMatrix for measurements
85 // after material surfaces the residuals of which depend on the updated q/p
86 // value after the energy loss
87 m_qOverPderiv = trackPars.charge() / Acts::square(pAfter);
89 Acts::square(trackPars.parameters()[eBoundQOverP] / qOverPBefore);
90 }
91}

Member Data Documentation

◆ m_eloss

ELossAtSurface MuonExperimental::Gx2fMaterialProperties::m_eloss {}
private

Description of the energy loss.

Definition at line 208 of file Chi2Fitter.h.

208{};

◆ m_lostEnergy

double MuonExperimental::Gx2fMaterialProperties::m_lostEnergy {0.}
private

Fitted parameters.

Fitted energy loss at the surface

Definition at line 215 of file Chi2Fitter.h.

215{0.};

◆ m_qOverPderiv

double MuonExperimental::Gx2fMaterialProperties::m_qOverPderiv {0.}
private

qOverP derivative with respect to eloss

Definition at line 221 of file Chi2Fitter.h.

221{0.};

◆ m_qOverPratio

double MuonExperimental::Gx2fMaterialProperties::m_qOverPratio {1.}
private

Definition at line 223 of file Chi2Fitter.h.

223{1.};

◆ m_scatPhi

double MuonExperimental::Gx2fMaterialProperties::m_scatPhi {0.}
private

Fitted delta phi scattering.

Definition at line 219 of file Chi2Fitter.h.

219{0.};

◆ m_scatterer

ScatteringAtSurface MuonExperimental::Gx2fMaterialProperties::m_scatterer {}
private

Description of the scattering angles.

Definition at line 206 of file Chi2Fitter.h.

206{};

◆ m_scatTheta

double MuonExperimental::Gx2fMaterialProperties::m_scatTheta {0.}
private

Fitted delta theta scattering.

Definition at line 217 of file Chi2Fitter.h.

217{0.};

The documentation for this struct was generated from the following files: