ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trk::FitParameters Class Reference

#include <FitParameters.h>

Collaboration diagram for Trk::FitParameters:

Public Member Functions

 FitParameters (const Perigee &perigee)
 
 FitParameters (double d0, double z0, double cosPhi, double sinPhi, double cotTheta, double ptInv0, const PerigeeSurface &surface)
 
 FitParameters (const FitParameters &parameters)=default
 
 FitParameters (FitParameters &&)=default
 
FitParametersoperator= (const FitParameters &)=default
 
FitParametersoperator= (FitParameters &&)=default
 
 ~FitParameters (void)=default
 
void addAlignment (bool constrained, double localAngle, double localOffset)
 
void addScatterer (double phi, double theta)
 
double alignmentAngle (int alignment) const
 
double alignmentAngleConstraint (int alignment) const
 
double alignmentOffset (int alignment) const
 
double alignmentOffsetConstraint (int alignment) const
 
const SurfaceassociatedSurface (void) const
 
double cosPhi (void) const
 
double cosTheta (void) const
 
double cotTheta (void) const
 
void covariance (Amg::MatrixX *finalCovariance, const Amg::MatrixX *fullCovariance)
 
double d0 (void) const
 
void d0 (double value)
 
double difference (int param) const
 
const Amg::VectorXdifferences (void) const
 
Amg::Vector3D direction (void) const
 
bool extremeMomentum (void) const
 
void extremeMomentum (bool value)
 
const Amg::MatrixXfinalCovariance (void) const
 
int firstAlignmentParameter (void) const
 
void firstAlignmentParameter (int value)
 
int firstScatteringParameter (void) const
 
void firstScatteringParameter (int value)
 
bool fitEnergyDeposit (void) const
 
void fitEnergyDeposit (double minEnergyDeposit)
 
bool fitMomentum (void) const
 
void fitMomentum (bool value)
 
const Amg::MatrixXfullCovariance (void) const
 
TrackSurfaceIntersection intersection (void) const
 
int numberAlignments (void) const
 
void numberAlignments (int numberAlignments)
 
int numberOscillations (void) const
 
int numberParameters (void) const
 
void numberParameters (int numberParameters)
 
int numberScatterers (void) const
 
void numberScatterers (int numberScatterers)
 
void performCutStep (double cutStep)
 
bool phiInstability (void) const
 
double ptInv0 (void) const
 
const Amg::MatrixX parameterDifference (const Amg::VectorX &parameters) const
 
Perigeeperigee (void) const
 
const Amg::Vector3Dposition (void) const
 
void print (MsgStream &log) const
 
void printCovariance (MsgStream &log) const
 
void printVerbose (MsgStream &log) const
 
double qOverP (void) const
 
void qOverP (double value)
 
double qOverP1 (void) const
 
void qOverP1 (double value)
 
void reset (const FitParameters &parameters)
 
void resetOscillations (void)
 
double scattererPhi (int scatterer) const
 
double scattererTheta (int scatterer) const
 
ScatteringAngles scatteringAngles (const FitMeasurement &fitMeasurement, int scatterer=-1) const
 
void setPhiInstability (void)
 
double sinPhi (void) const
 
double sinTheta (void) const
 
PerigeestartingPerigee (void) const
 
TrackParameterstrackParameters (MsgStream &log, const FitMeasurement &measurement, bool withCovariance=false)
 
void update (const Amg::VectorX &differences)
 
void update (Amg::Vector3D position, Amg::Vector3D direction, double qOverP, const Amg::MatrixX &leadingCovariance)
 
const Amg::Vector3Dvertex (void) const
 
double z0 (void) const
 

Private Attributes

std::vector< double > m_alignmentAngle
 
std::vector< double > m_alignmentAngleConstraint
 
std::vector< double > m_alignmentOffset
 
std::vector< double > m_alignmentOffsetConstraint
 
double m_cosPhi
 
double m_cosPhi1
 
double m_cosTheta
 
double m_cosTheta1
 
double m_cotTheta
 
double m_d0
 
Amg::VectorX m_differences {}
 
bool m_eigen {}
 
bool m_extremeMomentum
 
Amg::MatrixXm_finalCovariance
 
int m_firstAlignmentParameter
 
int m_firstScatteringParameter
 
bool m_fitEnergyDeposit
 
bool m_fitMomentum
 
const Amg::MatrixXm_fullCovariance
 
double m_minEnergyDeposit
 
int m_numberAlignments
 
int m_numberOscillations
 
int m_numberParameters
 
int m_numberScatterers
 
double m_oldDifference
 
const Perigeem_perigee
 
bool m_phiInstability
 
Amg::Vector3D m_position
 
double m_qOverP
 
double m_qOverP1
 
std::vector< double > m_scattererPhi
 
std::vector< double > m_scattererTheta
 
double m_sinPhi
 
double m_sinPhi1
 
double m_sinTheta
 
double m_sinTheta1
 
const Surfacem_surface
 
Amg::Vector3D m_vertex
 
double m_z0
 

Detailed Description

Definition at line 29 of file FitParameters.h.

Constructor & Destructor Documentation

◆ FitParameters() [1/4]

Trk::FitParameters::FitParameters ( const Perigee perigee)

Definition at line 28 of file FitParameters.cxx.

30  {},
31  m_extremeMomentum(false),
32  m_finalCovariance(nullptr),
35  m_fitEnergyDeposit(false),
36  m_fitMomentum(true),
37  m_fullCovariance(nullptr),
43  m_oldDifference(0.),
45  m_phiInstability(false),
46  m_qOverP1(0.),
47  m_sinPhi1(0.),
48  m_sinTheta1(0.),
51  m_z0(perigee.position().z()) {
52  Amg::Vector3D momentum = perigee.momentum();
53  double ptInv0 = 1. / momentum.perp();
54  m_cosPhi = ptInv0 * momentum.x();
55  m_sinPhi = ptInv0 * momentum.y();
56  m_cotTheta = ptInv0 * momentum.z();
57  m_sinTheta = 1. / std::sqrt(1. + m_cotTheta * m_cotTheta);
59  m_qOverP = perigee.charge() * ptInv0 * m_sinTheta;
61  m_vertex.y() + m_d0 * m_cosPhi, m_z0);
62 }
63 
64 FitParameters::FitParameters(double d0, double z0, double cosPhi, double sinPhi,

◆ FitParameters() [2/4]

Trk::FitParameters::FitParameters ( double  d0,
double  z0,
double  cosPhi,
double  sinPhi,
double  cotTheta,
double  ptInv0,
const PerigeeSurface surface 
)

Definition at line 66 of file FitParameters.cxx.

67  : m_cosPhi(cosPhi),
68  m_cosPhi1(0.),
69  m_cosTheta1(0.),
71  m_d0(d0),
72  m_extremeMomentum(false),
73  m_finalCovariance(nullptr),
76  m_fitEnergyDeposit(false),
77  m_fitMomentum(true),
78  m_fullCovariance(nullptr),
84  m_oldDifference(0.),
85  m_perigee(nullptr),
86  m_phiInstability(false),
87  m_qOverP1(0.),
89  m_sinPhi1(0.),
90  m_sinTheta1(0.),
91  m_surface(&surface),
92  m_vertex(surface.center()),
93  m_z0(z0) {
94  m_sinTheta = 1. / std::sqrt(1. + m_cotTheta * m_cotTheta);
97  m_z0 = z0;
99  m_vertex.y() + m_d0 * m_cosPhi, m_z0);
100 }
101 
102 

◆ FitParameters() [3/4]

Trk::FitParameters::FitParameters ( const FitParameters parameters)
default

◆ FitParameters() [4/4]

Trk::FitParameters::FitParameters ( FitParameters &&  )
default

◆ ~FitParameters()

Trk::FitParameters::~FitParameters ( void  )
default

Member Function Documentation

◆ addAlignment()

void Trk::FitParameters::addAlignment ( bool  constrained,
double  localAngle,
double  localOffset 
)

Definition at line 105 of file FitParameters.cxx.

◆ addScatterer()

void Trk::FitParameters::addScatterer ( double  phi,
double  theta 
)

Definition at line 116 of file FitParameters.cxx.

120  {

◆ alignmentAngle()

double Trk::FitParameters::alignmentAngle ( int  alignment) const
inline

Definition at line 156 of file FitParameters.h.

156  {
157  return m_alignmentAngle[alignment];
158 }

◆ alignmentAngleConstraint()

double Trk::FitParameters::alignmentAngleConstraint ( int  alignment) const
inline

Definition at line 160 of file FitParameters.h.

160  {
162 }

◆ alignmentOffset()

double Trk::FitParameters::alignmentOffset ( int  alignment) const
inline

Definition at line 164 of file FitParameters.h.

164  {
166 }

◆ alignmentOffsetConstraint()

double Trk::FitParameters::alignmentOffsetConstraint ( int  alignment) const
inline

Definition at line 168 of file FitParameters.h.

168  {
170 }

◆ associatedSurface()

const Surface * Trk::FitParameters::associatedSurface ( void  ) const

Definition at line 122 of file FitParameters.cxx.

◆ cosPhi()

double Trk::FitParameters::cosPhi ( void  ) const
inline

Definition at line 172 of file FitParameters.h.

172  {
173  return m_cosPhi;
174 }

◆ cosTheta()

double Trk::FitParameters::cosTheta ( void  ) const
inline

Definition at line 176 of file FitParameters.h.

176  {
177  return m_cosTheta;
178 }

◆ cotTheta()

double Trk::FitParameters::cotTheta ( void  ) const
inline

Definition at line 180 of file FitParameters.h.

180  {
181  return m_cotTheta;
182 }

◆ covariance()

void Trk::FitParameters::covariance ( Amg::MatrixX finalCovariance,
const Amg::MatrixX fullCovariance 
)

Definition at line 128 of file FitParameters.cxx.

132  {

◆ d0() [1/2]

void Trk::FitParameters::d0 ( double  value)

Definition at line 134 of file FitParameters.cxx.

138  {

◆ d0() [2/2]

double Trk::FitParameters::d0 ( void  ) const
inline

Definition at line 184 of file FitParameters.h.

184  {
185  return m_d0;
186 }

◆ difference()

double Trk::FitParameters::difference ( int  param) const
inline

Use as_const to avoid compiler warning

Definition at line 188 of file FitParameters.h.

188  {
189  if (m_differences.size() == 0) {
190  return 0.;
191  }
193  return std::as_const(m_differences)(param);
194 }

◆ differences()

const Amg::VectorX & Trk::FitParameters::differences ( void  ) const
inline

Definition at line 196 of file FitParameters.h.

196  {
197  return m_differences;
198 }

◆ direction()

Amg::Vector3D Trk::FitParameters::direction ( void  ) const
inline

Definition at line 200 of file FitParameters.h.

200  {
202  m_cosTheta);
203 }

◆ extremeMomentum() [1/2]

void Trk::FitParameters::extremeMomentum ( bool  value)

Definition at line 140 of file FitParameters.cxx.

143  {

◆ extremeMomentum() [2/2]

bool Trk::FitParameters::extremeMomentum ( void  ) const
inline

Definition at line 205 of file FitParameters.h.

205  {
206  return m_extremeMomentum;
207 }

◆ finalCovariance()

const Amg::MatrixX * Trk::FitParameters::finalCovariance ( void  ) const
inline

Definition at line 209 of file FitParameters.h.

209  {
210  return m_finalCovariance;
211 }

◆ firstAlignmentParameter() [1/2]

void Trk::FitParameters::firstAlignmentParameter ( int  value)

◆ firstAlignmentParameter() [2/2]

int Trk::FitParameters::firstAlignmentParameter ( void  ) const
inline

Definition at line 213 of file FitParameters.h.

213  {
215 }

◆ firstScatteringParameter() [1/2]

void Trk::FitParameters::firstScatteringParameter ( int  value)

◆ firstScatteringParameter() [2/2]

int Trk::FitParameters::firstScatteringParameter ( void  ) const
inline

Definition at line 217 of file FitParameters.h.

217  {
219 }

◆ fitEnergyDeposit() [1/2]

void Trk::FitParameters::fitEnergyDeposit ( double  minEnergyDeposit)

Definition at line 145 of file FitParameters.cxx.

148  {

◆ fitEnergyDeposit() [2/2]

bool Trk::FitParameters::fitEnergyDeposit ( void  ) const
inline

Definition at line 221 of file FitParameters.h.

221  {
222  return m_fitEnergyDeposit;
223 }

◆ fitMomentum() [1/2]

void Trk::FitParameters::fitMomentum ( bool  value)

Definition at line 150 of file FitParameters.cxx.

152  {

◆ fitMomentum() [2/2]

bool Trk::FitParameters::fitMomentum ( void  ) const
inline

Definition at line 225 of file FitParameters.h.

225  {
226  return m_fitMomentum;
227 }

◆ fullCovariance()

const Amg::MatrixX * Trk::FitParameters::fullCovariance ( void  ) const
inline

Definition at line 229 of file FitParameters.h.

229  {
230  return m_fullCovariance;
231 }

◆ intersection()

TrackSurfaceIntersection Trk::FitParameters::intersection ( void  ) const

Definition at line 154 of file FitParameters.cxx.

159  {

◆ numberAlignments() [1/2]

void Trk::FitParameters::numberAlignments ( int  numberAlignments)

Definition at line 161 of file FitParameters.cxx.

169  {

◆ numberAlignments() [2/2]

int Trk::FitParameters::numberAlignments ( void  ) const
inline

Definition at line 233 of file FitParameters.h.

233  {
234  return m_numberAlignments;
235 }

◆ numberOscillations()

int Trk::FitParameters::numberOscillations ( void  ) const
inline

Definition at line 237 of file FitParameters.h.

237  {
238  return m_numberOscillations;
239 }

◆ numberParameters() [1/2]

void Trk::FitParameters::numberParameters ( int  numberParameters)

Definition at line 171 of file FitParameters.cxx.

176  {

◆ numberParameters() [2/2]

int Trk::FitParameters::numberParameters ( void  ) const
inline

Definition at line 241 of file FitParameters.h.

241  {
242  return m_numberParameters;
243 }

◆ numberScatterers() [1/2]

void Trk::FitParameters::numberScatterers ( int  numberScatterers)

Definition at line 178 of file FitParameters.cxx.

◆ numberScatterers() [2/2]

int Trk::FitParameters::numberScatterers ( void  ) const
inline

Definition at line 245 of file FitParameters.h.

245  {
246  return m_numberScatterers;
247 }

◆ operator=() [1/2]

FitParameters& Trk::FitParameters::operator= ( const FitParameters )
default

◆ operator=() [2/2]

FitParameters& Trk::FitParameters::operator= ( FitParameters &&  )
default

◆ parameterDifference()

const Amg::MatrixX Trk::FitParameters::parameterDifference ( const Amg::VectorX parameters) const

Definition at line 186 of file FitParameters.cxx.

199  {

◆ performCutStep()

void Trk::FitParameters::performCutStep ( double  cutStep)

Definition at line 201 of file FitParameters.cxx.

209  {
210  cutDifferences(2) = 0.;
211  oldDifferences(2) = (m_differences)(2);
212  }
213 
214  // apply cut
215  update(cutDifferences);
216  m_differences = Amg::VectorX(oldDifferences);
217 
219  m_oldDifference = 0.;
220  // std::cout << " after cutstep " << std::endl;
221 }
222 
223 Perigee* FitParameters::perigee(void) const {

◆ perigee()

Perigee * Trk::FitParameters::perigee ( void  ) const

Definition at line 225 of file FitParameters.cxx.

232  {
233  return new Perigee(m_position, momentum, charge,
234  dynamic_cast<const Trk::PerigeeSurface&>(*m_surface),
235  std::move(covMatrix));
236  } else {
237  return new Perigee(m_position, momentum, charge, m_vertex,
238  std::move(covMatrix));
239  }
240 }
241 
242 bool FitParameters::phiInstability(void) const {

◆ phiInstability()

bool Trk::FitParameters::phiInstability ( void  ) const

Definition at line 244 of file FitParameters.cxx.

246  {

◆ position()

const Amg::Vector3D & Trk::FitParameters::position ( void  ) const
inline

Definition at line 253 of file FitParameters.h.

253  {
254  return m_position;
255 }

◆ print()

void Trk::FitParameters::print ( MsgStream &  log) const

Definition at line 248 of file FitParameters.cxx.

257  {

◆ printCovariance()

void Trk::FitParameters::printCovariance ( MsgStream &  log) const

Definition at line 259 of file FitParameters.cxx.

294  {

◆ printVerbose()

void Trk::FitParameters::printVerbose ( MsgStream &  log) const

Definition at line 296 of file FitParameters.cxx.

297  {
299  log << " dParams ====" << std::setiosflags(std::ios::fixed)
300  << std::setw(10) << std::setprecision(4) << differences(0) << " (0) "
301  << std::setw(10) << std::setprecision(4) << differences(1) << " (1) "
302  << std::setw(10) << std::setprecision(5) << differences(2) << " (2) "
303  << std::setw(10) << std::setprecision(5) << differences(3) << " (3) "
304  << std::setw(13) << std::setprecision(9)
305  << differences(4) * Gaudi::Units::GeV / Gaudi::Units::TeV << " (4) ";
306  if (m_fitEnergyDeposit)
307  log << std::setiosflags(std::ios::fixed) << std::setw(13)
308  << std::setprecision(9)
309  << differences(5) * Gaudi::Units::GeV / Gaudi::Units::TeV << " (5) ";
310  log << std::endl;
311 
312  if (m_numberAlignments) {
313  log << " dAlign ==== ";
314  unsigned param = m_firstAlignmentParameter;
315  for (int scat = 0; scat < m_numberAlignments; ++scat) {
316  ++param;
317  if (scat % 5 == 0 && scat > 0)
318  log << std::endl << " ";
319  log << std::setiosflags(std::ios::fixed) << std::setw(10)
320  << std::setprecision(6) << differences(param);
321  ++param;
322  log << std::setiosflags(std::ios::fixed) << std::setw(10)
323  << std::setprecision(6) << differences(param) << " ("
324  << std::setw(2) << scat << "A) ";
325  }
326  log << std::endl;
327  }
328 
329  if (m_numberScatterers) {
330  log << " dScat ==== ";
331  unsigned param = m_firstScatteringParameter;
332  for (int scat = 0; scat < m_numberScatterers; ++scat) {
333  ++param;
334  if (scat % 5 == 0 && scat > 0)
335  log << std::endl << " ";
336  log << std::setiosflags(std::ios::fixed) << std::setw(10)
337  << std::setprecision(6) << differences(param);
338  ++param;
339  log << std::setiosflags(std::ios::fixed) << std::setw(10)
340  << std::setprecision(6) << differences(param) << " ("
341  << std::setw(2) << scat << "S) ";
342  }
343  log << std::endl;
344  }
345  }
346 
347  log << std::setiosflags(std::ios::fixed | std::ios::right)
348  << " parameters: " << std::setw(12) << std::setprecision(4) << m_d0
349  << " transverse impact " << std::setw(10) << std::setprecision(4)
350  << m_position.z() << " z0 " << std::setw(10) << std::setprecision(6)
351  << std::atan2(m_sinPhi, m_cosPhi) << std::setw(10) << std::setprecision(6)
352  << m_cotTheta << " phi,cotTheta " << std::setw(13)
353  << std::setprecision(9) << m_qOverP / m_sinTheta << " inverse pT "
354  << std::setw(12) << std::setprecision(6)
355  << m_sinTheta / (m_qOverP * Gaudi::Units::GeV) << " signed pT ";
356  if (m_fitEnergyDeposit) {
357  // TODO: should give fitted energy loss
358  log << std::endl
359  << " E before/after energy deposit" << std::setw(12)
360  << std::setprecision(3) << 1. / std::abs(m_qOverP * Gaudi::Units::GeV)
361  << std::setw(12) << std::setprecision(3)
362  << 1. / std::abs(m_qOverP1 * Gaudi::Units::GeV);
363  }
364  if (m_numberAlignments) {
365  log << std::endl << " alignment number, angle, offset: ";
366  for (int align = 0; align < m_numberAlignments; ++align) {
367  log << std::setiosflags(std::ios::fixed) << std::setw(6) << align
368  << std::setw(10) << std::setprecision(6) << m_alignmentAngle[align]
369  << std::setw(10) << std::setprecision(6) << m_alignmentOffset[align];
370  if ((align + 1) % 5 == 0)
371  log << std::endl << " ";
372  }
373  }
374  if (m_numberScatterers) {
375  log << std::endl << " scatterer number, delta(phi), delta(theta): ";
376  for (int scat = 0; scat < m_numberScatterers; ++scat) {
377  log << std::setiosflags(std::ios::fixed) << std::setw(6) << scat
378  << std::setw(10) << std::setprecision(6) << m_scattererPhi[scat]
379  << std::setw(10) << std::setprecision(6) << m_scattererTheta[scat];
380  if ((scat + 1) % 5 == 0)
381  log << std::endl << " ";
382  }
383  }
384  log << std::endl;
385 }
386 
387 void FitParameters::qOverP(double value) {

◆ ptInv0()

double Trk::FitParameters::ptInv0 ( void  ) const
inline

Definition at line 249 of file FitParameters.h.

249  {
250  return m_qOverP / m_sinTheta;
251 }

◆ qOverP() [1/2]

void Trk::FitParameters::qOverP ( double  value)

Definition at line 389 of file FitParameters.cxx.

391  {

◆ qOverP() [2/2]

double Trk::FitParameters::qOverP ( void  ) const
inline

Definition at line 257 of file FitParameters.h.

257  {
258  return m_qOverP;
259 }

◆ qOverP1() [1/2]

void Trk::FitParameters::qOverP1 ( double  value)

Definition at line 393 of file FitParameters.cxx.

395  {

◆ qOverP1() [2/2]

double Trk::FitParameters::qOverP1 ( void  ) const
inline

Definition at line 261 of file FitParameters.h.

261  {
262  return m_qOverP1;
263 }

◆ reset()

void Trk::FitParameters::reset ( const FitParameters parameters)

Definition at line 397 of file FitParameters.cxx.

429  {
430  m_alignmentAngle[s] = parameters.m_alignmentAngle[s];
431  m_alignmentAngleConstraint[s] = parameters.m_alignmentAngleConstraint[s];
432  m_alignmentOffset[s] = parameters.m_alignmentOffset[s];
433  m_alignmentOffsetConstraint[s] = parameters.m_alignmentOffsetConstraint[s];
434  }
435  for (int s = 0; s != m_numberScatterers; ++s) {
436  m_scattererPhi[s] = parameters.m_scattererPhi[s];
437  m_scattererTheta[s] = parameters.m_scattererTheta[s];
438  }
439 
440  // restore difference history
441  if (parameters.m_differences.size() != 0) {
442  m_differences = Amg::VectorX(parameters.m_differences);
443  } else {
445  m_differences.setZero();
446  }
447 
449  m_oldDifference = 0.;
450 }
451 
452 ScatteringAngles FitParameters::scatteringAngles(

◆ resetOscillations()

void Trk::FitParameters::resetOscillations ( void  )
inline

Definition at line 281 of file FitParameters.h.

281  {
283 }

◆ scattererPhi()

double Trk::FitParameters::scattererPhi ( int  scatterer) const
inline

Definition at line 265 of file FitParameters.h.

265  {
266  return m_scattererPhi[scatterer];
267 }

◆ scattererTheta()

double Trk::FitParameters::scattererTheta ( int  scatterer) const
inline

Definition at line 269 of file FitParameters.h.

269  {
270  return m_scattererTheta[scatterer];
271 }

◆ scatteringAngles()

ScatteringAngles Trk::FitParameters::scatteringAngles ( const FitMeasurement fitMeasurement,
int  scatterer = -1 
) const

Definition at line 454 of file FitParameters.cxx.

459  {
460  return {0., 0., scattererSigmaPhi, scattererSigmaTheta};
461  } else {
462  return {m_scattererPhi[scatterer], m_scattererTheta[scatterer],
463  scattererSigmaPhi, scattererSigmaTheta};
464  }
465 }
466 

◆ setPhiInstability()

void Trk::FitParameters::setPhiInstability ( void  )

Definition at line 469 of file FitParameters.cxx.

471  {

◆ sinPhi()

double Trk::FitParameters::sinPhi ( void  ) const
inline

Definition at line 273 of file FitParameters.h.

273  {
274  return m_sinPhi;
275 }

◆ sinTheta()

double Trk::FitParameters::sinTheta ( void  ) const
inline

Definition at line 277 of file FitParameters.h.

277  {
278  return m_sinTheta;
279 }

◆ startingPerigee()

Perigee * Trk::FitParameters::startingPerigee ( void  ) const

Definition at line 473 of file FitParameters.cxx.

483  {

◆ trackParameters()

TrackParameters * Trk::FitParameters::trackParameters ( MsgStream &  log,
const FitMeasurement measurement,
bool  withCovariance = false 
)

Definition at line 484 of file FitParameters.cxx.

486  {
487  log << MSG::WARNING
488  << "FitParameters::trackParameters - measurement lacks Surface"
489  << endmsg;
490  return nullptr;
491  }
492 
493  // 2) a SurfaceIntersection is required
494  if (!measurement.hasIntersection(FittedTrajectory)) {
495  log << MSG::WARNING
496  << "FitParameters::trackParameters - invalid measurement" << endmsg;
497  return nullptr;
498  }
499 
500  // 3) the intersection position has to lie sufficiently close to the Surface
501  const TrackSurfaceIntersection& intersection =
502  measurement.intersection(FittedTrajectory);
503  Amg::Vector2D localPos;
504  if (!measurement.surface()->globalToLocal(
505  intersection.position(), intersection.direction(), localPos)) {
506  log << MSG::WARNING
507  << "FitParameters::trackParameters - globalToLocal failure" << endmsg;
508  return nullptr;
509  }
510 
511  // cache parameters at EnergyDeposit
512  if (measurement.isEnergyDeposit()) {
517  m_qOverP1 = measurement.qOverP();
518  }
519 
520  // propagate full covariance to form localCovariance
521  std::optional<AmgSymMatrix(5)> covMatrix = std::nullopt;
522  if (withCovariance && (measurement.isDrift() || measurement.isCluster() ||
523  measurement.isPerigee())) {
525  double sigma = 1. / measurement.weight();
526  double sigma2 = 1. / measurement.weight2();
527  int lastParameter = measurement.lastParameter();
528  Amg::MatrixX jacobian = Amg::MatrixX::Zero(5, lastParameter);
529  for (int i = 0; i != lastParameter; ++i) {
530  jacobian(0, i) = sigma * measurement.derivative(i);
531  jacobian(1, i) = sigma2 * measurement.derivative2(i);
532  }
533 
534  // phi,theta derivs into jac
535  jacobian(2, 2) = 1.;
536  jacobian(3, 3) = 1.;
538  while (++i < lastParameter) {
539  jacobian(2, i) = 1.;
540  ++i;
541  jacobian(3, i) = 1.;
542  }
543 
544  // only if fit to curvature
545  if (m_fitMomentum && m_qOverP) {
546  double sinTheta = direction.perp();
547  if (m_fitEnergyDeposit && measurement.afterCalo()) {
548  double deltaPhi =
549  (direction.y() * m_cosPhi1 - direction.x() * m_sinPhi1) / sinTheta;
550  double deltaTheta =
552  jacobian(0, 5) *= Gaudi::Units::TeV;
553  jacobian(1, 5) *= Gaudi::Units::TeV;
554  jacobian(2, 5) = deltaPhi / measurement.qOverP();
555  jacobian(3, 5) = deltaTheta / measurement.qOverP();
556  jacobian(4, 5) = measurement.qOverP() / m_qOverP1;
557  } else {
558  double deltaPhi =
559  (direction.y() * m_cosPhi - direction.x() * m_sinPhi) / sinTheta;
560  double deltaTheta =
562  jacobian(0, 4) *= Gaudi::Units::TeV;
563  jacobian(1, 4) *= Gaudi::Units::TeV;
564  jacobian(2, 4) = deltaPhi / measurement.qOverP();
565  jacobian(3, 4) = deltaTheta / measurement.qOverP();
566  jacobian(4, 4) = measurement.qOverP() / m_qOverP;
567  }
568  } else {
569  jacobian(4, 4) = 1.;
570  }
571 
572  // similarity transform
573  covMatrix = AmgSymMatrix(5)(
574  jacobian * m_fullCovariance->block(0, 0, lastParameter, lastParameter) *
575  jacobian.transpose());
576  }
577 
578  double phi = intersection.direction().phi();
579  double theta = intersection.direction().theta();
580  if (measurement.isFlipped()) {
581  if (phi > 0.) {
582  phi -= M_PI;
583  } else {
584  phi += M_PI;
585  }
586  theta = M_PI - theta;
587  }
588 
589  if (!measurement.surface()) {
590  log << MSG::WARNING
591  << "FitParameters::trackParameters - unrecognized surface" << endmsg;
592  return nullptr;
593  }
594  // finally can create the appropriate TrackParameters based on the surface
595  return measurement.surface()
596  ->createUniqueTrackParameters(localPos[locR], localPos[locZ], phi, theta,
597  measurement.qOverP(), std::move(covMatrix))
598  .release();
599 }
600 

◆ update() [1/2]

void Trk::FitParameters::update ( Amg::Vector3D  position,
Amg::Vector3D  direction,
double  qOverP,
const Amg::MatrixX leadingCovariance 
)

Definition at line 672 of file FitParameters.cxx.

672  {
673  // update parameters after leading material corrections
675  m_sinTheta = direction.perp();
676  double sinThetaInv = 1. / m_sinTheta;
677  m_cotTheta = sinThetaInv * m_cosTheta;
678  m_cosPhi = sinThetaInv * direction.x();
679  m_sinPhi = sinThetaInv * direction.y();
680  m_cotTheta = sinThetaInv * direction.z();
681  m_cosTheta = direction.z();
682  m_qOverP = qOverP;
683  m_z0 = position.z();
684  m_d0 = (m_vertex.x() - position.x()) * m_sinPhi -
685  (m_vertex.y() - position.y()) * m_cosPhi;
686 
687  // update covariance
688  // (*m_finalCovariance) += leadingCovariance; // ??
689  for (int i = 0; i != 5; ++i) {
690  for (int j = 0; j != 5; ++j) {
691  (*m_finalCovariance)(i, j) += leadingCovariance(i, j);
692  }
693  }
694 }
695 
696 } // namespace Trk

◆ update() [2/2]

void Trk::FitParameters::update ( const Amg::VectorX differences)

Definition at line 603 of file FitParameters.cxx.

603  {
605  } else {
607  }
610 
611  // misalignment parameters
614  int align = m_firstAlignmentParameter;
615  for (int i = 0; i != m_numberAlignments; ++i) {
616  (*a++) += differences(++align);
617  (*o++) += differences(++align);
618  }
619 
620  // scattering angles
623  int scat = m_firstScatteringParameter;
624  for (int i = 0; i != m_numberScatterers; ++i) {
625  (*p++) += differences(++scat);
626  (*t++) += differences(++scat);
627  }
628 
629  // qOverP, cotTheta
630  if (m_fitMomentum)
633 
634  // impose charge conservation and decreasing energy
635  if (m_fitEnergyDeposit) {
637  double deposit = 1. / std::abs(m_qOverP) - 1. / std::abs(m_qOverP1);
638  if (std::abs(deposit) < std::abs(m_minEnergyDeposit) ||
639  deposit * m_minEnergyDeposit < 0. || m_qOverP * m_qOverP1 < 0.) {
640  m_qOverP = 1. / (1. / std::abs(m_qOverP1) + m_minEnergyDeposit);
641  if (m_qOverP1 < 0.)
642  m_qOverP = -m_qOverP;
643  }
644  }
645 
646  // protect phi against some rounding instabilities
647  double sinDPhi = differences(2);
648  double cosDPhi = 0.;
649  if (std::abs(sinDPhi) < 1.0) {
650  cosDPhi = std::sqrt(1. - sinDPhi * sinDPhi);
651  } else {
652  if (sinDPhi > 0.) {
653  sinDPhi = 1.0;
654  } else {
655  sinDPhi = -1.0;
656  }
657  }
658 
659  double cosPhi = m_cosPhi * cosDPhi - m_sinPhi * sinDPhi;
660  m_sinPhi = m_sinPhi * cosDPhi + m_cosPhi * sinDPhi;
661  m_cosPhi = cosPhi;
662  m_z0 += differences(1);
663  m_d0 += differences(0);
664  m_sinTheta = 1. / std::sqrt(1. + m_cotTheta * m_cotTheta);
667  m_vertex.y() + m_d0 * m_cosPhi, m_z0);
668 }
669 

◆ vertex()

const Amg::Vector3D & Trk::FitParameters::vertex ( void  ) const
inline

Definition at line 285 of file FitParameters.h.

285  {
286  return m_vertex;
287 }

◆ z0()

double Trk::FitParameters::z0 ( void  ) const
inline

Definition at line 289 of file FitParameters.h.

289  {
290  return m_position.z();
291 }

Member Data Documentation

◆ m_alignmentAngle

std::vector<double> Trk::FitParameters::m_alignmentAngle
private

Definition at line 113 of file FitParameters.h.

◆ m_alignmentAngleConstraint

std::vector<double> Trk::FitParameters::m_alignmentAngleConstraint
private

Definition at line 114 of file FitParameters.h.

◆ m_alignmentOffset

std::vector<double> Trk::FitParameters::m_alignmentOffset
private

Definition at line 115 of file FitParameters.h.

◆ m_alignmentOffsetConstraint

std::vector<double> Trk::FitParameters::m_alignmentOffsetConstraint
private

Definition at line 116 of file FitParameters.h.

◆ m_cosPhi

double Trk::FitParameters::m_cosPhi
private

Definition at line 117 of file FitParameters.h.

◆ m_cosPhi1

double Trk::FitParameters::m_cosPhi1
private

Definition at line 118 of file FitParameters.h.

◆ m_cosTheta

double Trk::FitParameters::m_cosTheta
private

Definition at line 119 of file FitParameters.h.

◆ m_cosTheta1

double Trk::FitParameters::m_cosTheta1
private

Definition at line 120 of file FitParameters.h.

◆ m_cotTheta

double Trk::FitParameters::m_cotTheta
private

Definition at line 121 of file FitParameters.h.

◆ m_d0

double Trk::FitParameters::m_d0
private

Definition at line 122 of file FitParameters.h.

◆ m_differences

Amg::VectorX Trk::FitParameters::m_differences {}
private

Definition at line 123 of file FitParameters.h.

◆ m_eigen

bool Trk::FitParameters::m_eigen {}
private

Definition at line 124 of file FitParameters.h.

◆ m_extremeMomentum

bool Trk::FitParameters::m_extremeMomentum
private

Definition at line 125 of file FitParameters.h.

◆ m_finalCovariance

Amg::MatrixX* Trk::FitParameters::m_finalCovariance
private

Definition at line 126 of file FitParameters.h.

◆ m_firstAlignmentParameter

int Trk::FitParameters::m_firstAlignmentParameter
private

Definition at line 127 of file FitParameters.h.

◆ m_firstScatteringParameter

int Trk::FitParameters::m_firstScatteringParameter
private

Definition at line 128 of file FitParameters.h.

◆ m_fitEnergyDeposit

bool Trk::FitParameters::m_fitEnergyDeposit
private

Definition at line 129 of file FitParameters.h.

◆ m_fitMomentum

bool Trk::FitParameters::m_fitMomentum
private

Definition at line 130 of file FitParameters.h.

◆ m_fullCovariance

const Amg::MatrixX* Trk::FitParameters::m_fullCovariance
private

Definition at line 131 of file FitParameters.h.

◆ m_minEnergyDeposit

double Trk::FitParameters::m_minEnergyDeposit
private

Definition at line 132 of file FitParameters.h.

◆ m_numberAlignments

int Trk::FitParameters::m_numberAlignments
private

Definition at line 133 of file FitParameters.h.

◆ m_numberOscillations

int Trk::FitParameters::m_numberOscillations
private

Definition at line 134 of file FitParameters.h.

◆ m_numberParameters

int Trk::FitParameters::m_numberParameters
private

Definition at line 135 of file FitParameters.h.

◆ m_numberScatterers

int Trk::FitParameters::m_numberScatterers
private

Definition at line 136 of file FitParameters.h.

◆ m_oldDifference

double Trk::FitParameters::m_oldDifference
private

Definition at line 137 of file FitParameters.h.

◆ m_perigee

const Perigee* Trk::FitParameters::m_perigee
private

Definition at line 138 of file FitParameters.h.

◆ m_phiInstability

bool Trk::FitParameters::m_phiInstability
private

Definition at line 139 of file FitParameters.h.

◆ m_position

Amg::Vector3D Trk::FitParameters::m_position
private

Definition at line 140 of file FitParameters.h.

◆ m_qOverP

double Trk::FitParameters::m_qOverP
private

Definition at line 141 of file FitParameters.h.

◆ m_qOverP1

double Trk::FitParameters::m_qOverP1
private

Definition at line 142 of file FitParameters.h.

◆ m_scattererPhi

std::vector<double> Trk::FitParameters::m_scattererPhi
private

Definition at line 143 of file FitParameters.h.

◆ m_scattererTheta

std::vector<double> Trk::FitParameters::m_scattererTheta
private

Definition at line 144 of file FitParameters.h.

◆ m_sinPhi

double Trk::FitParameters::m_sinPhi
private

Definition at line 145 of file FitParameters.h.

◆ m_sinPhi1

double Trk::FitParameters::m_sinPhi1
private

Definition at line 146 of file FitParameters.h.

◆ m_sinTheta

double Trk::FitParameters::m_sinTheta
private

Definition at line 147 of file FitParameters.h.

◆ m_sinTheta1

double Trk::FitParameters::m_sinTheta1
private

Definition at line 148 of file FitParameters.h.

◆ m_surface

const Surface* Trk::FitParameters::m_surface
private

Definition at line 149 of file FitParameters.h.

◆ m_vertex

Amg::Vector3D Trk::FitParameters::m_vertex
private

Definition at line 150 of file FitParameters.h.

◆ m_z0

double Trk::FitParameters::m_z0
private

Definition at line 151 of file FitParameters.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::FitParameters::m_perigee
const Perigee * m_perigee
Definition: FitParameters.h:138
Trk::FitParameters::m_cosTheta
double m_cosTheta
Definition: FitParameters.h:119
Trk::FitParameters::m_firstAlignmentParameter
int m_firstAlignmentParameter
Definition: FitParameters.h:127
Trk::FitParameters::m_scattererTheta
std::vector< double > m_scattererTheta
Definition: FitParameters.h:144
Trk::FitParameters::m_alignmentAngle
std::vector< double > m_alignmentAngle
Definition: FitParameters.h:113
Trk::FitParameters::m_numberParameters
int m_numberParameters
Definition: FitParameters.h:135
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
Trk::FitParameters::m_scattererPhi
std::vector< double > m_scattererPhi
Definition: FitParameters.h:143
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
Trk::FitParameters::z0
double z0(void) const
Definition: FitParameters.h:289
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::FitParameters::m_alignmentOffsetConstraint
std::vector< double > m_alignmentOffsetConstraint
Definition: FitParameters.h:116
Trk::FitParameters::m_vertex
Amg::Vector3D m_vertex
Definition: FitParameters.h:150
Trk::FitParameters::m_sinTheta1
double m_sinTheta1
Definition: FitParameters.h:148
Trk::FitParameters::m_cosPhi1
double m_cosPhi1
Definition: FitParameters.h:118
Trk::FitParameters::direction
Amg::Vector3D direction(void) const
Definition: FitParameters.h:200
Trk::FitParameters::m_fitMomentum
bool m_fitMomentum
Definition: FitParameters.h:130
Trk::FitParameters::m_fullCovariance
const Amg::MatrixX * m_fullCovariance
Definition: FitParameters.h:131
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Trk::FitParameters::m_z0
double m_z0
Definition: FitParameters.h:151
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::FitParameters::m_sinPhi
double m_sinPhi
Definition: FitParameters.h:145
Trk::FitParameters::sinTheta
double sinTheta(void) const
Definition: FitParameters.h:277
athena.value
value
Definition: athena.py:124
Trk::FitParameters::m_sinPhi1
double m_sinPhi1
Definition: FitParameters.h:146
python.SystemOfUnits.TeV
int TeV
Definition: SystemOfUnits.py:158
Trk::FitParameters::m_cosTheta1
double m_cosTheta1
Definition: FitParameters.h:120
Trk::locR
@ locR
Definition: ParamDefs.h:44
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::FitParameters::setPhiInstability
void setPhiInstability(void)
Definition: FitParameters.cxx:469
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
Trk::FitParameters::ptInv0
double ptInv0(void) const
Definition: FitParameters.h:249
Trk::FitParameters::perigee
Perigee * perigee(void) const
Definition: FitParameters.cxx:225
Trk::FitParameters::m_minEnergyDeposit
double m_minEnergyDeposit
Definition: FitParameters.h:132
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
Trk::FitParameters::m_qOverP
double m_qOverP
Definition: FitParameters.h:141
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::FitParameters::intersection
TrackSurfaceIntersection intersection(void) const
Definition: FitParameters.cxx:154
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
Trk::FitParameters::m_differences
Amg::VectorX m_differences
Definition: FitParameters.h:123
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::FitParameters::m_fitEnergyDeposit
bool m_fitEnergyDeposit
Definition: FitParameters.h:129
Trk::FitParameters::m_surface
const Surface * m_surface
Definition: FitParameters.h:149
Trk::TrackSurfaceIntersection::position
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
Definition: TrackSurfaceIntersection.h:80
Trk::FitParameters::m_position
Amg::Vector3D m_position
Definition: FitParameters.h:140
Trk::FitParameters::m_numberScatterers
int m_numberScatterers
Definition: FitParameters.h:136
Trk::theta
@ theta
Definition: ParamDefs.h:66
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
xAOD::covMatrix
covMatrix
Definition: TrackMeasurement_v1.cxx:19
Trk::FitParameters::m_d0
double m_d0
Definition: FitParameters.h:122
Trk::FitParameters::update
void update(const Amg::VectorX &differences)
Definition: FitParameters.cxx:603
Trk::FitParameters::position
const Amg::Vector3D & position(void) const
Definition: FitParameters.h:253
Trk::FitParameters::qOverP
double qOverP(void) const
Definition: FitParameters.h:257
Trk::FitParameters::m_cosPhi
double m_cosPhi
Definition: FitParameters.h:117
Trk::FitParameters::cosPhi
double cosPhi(void) const
Definition: FitParameters.h:172
Trk::FitParameters::m_sinTheta
double m_sinTheta
Definition: FitParameters.h:147
Trk::FitParameters::m_alignmentOffset
std::vector< double > m_alignmentOffset
Definition: FitParameters.h:115
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
Trk::FittedTrajectory
@ FittedTrajectory
Definition: ExtrapolationType.h:19
Trk::FitParameters::m_extremeMomentum
bool m_extremeMomentum
Definition: FitParameters.h:125
charge
double charge(const T &p)
Definition: AtlasPID.h:756
Trk::FitParameters::m_numberAlignments
int m_numberAlignments
Definition: FitParameters.h:133
Trk::FitParameters::scatteringAngles
ScatteringAngles scatteringAngles(const FitMeasurement &fitMeasurement, int scatterer=-1) const
Definition: FitParameters.cxx:454
Trk::FitParameters::d0
double d0(void) const
Definition: FitParameters.h:184
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::FitParameters::cotTheta
double cotTheta(void) const
Definition: FitParameters.h:180
Trk::FitParameters::m_oldDifference
double m_oldDifference
Definition: FitParameters.h:137
Trk::TrackSurfaceIntersection::direction
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.
Definition: TrackSurfaceIntersection.h:88
Trk::FitParameters::m_firstScatteringParameter
int m_firstScatteringParameter
Definition: FitParameters.h:128
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::FitParameters::m_alignmentAngleConstraint
std::vector< double > m_alignmentAngleConstraint
Definition: FitParameters.h:114
Trk::FitParameters::m_numberOscillations
int m_numberOscillations
Definition: FitParameters.h:134
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
Trk::FitParameters::sinPhi
double sinPhi(void) const
Definition: FitParameters.h:273
Trk::FitParameters::m_phiInstability
bool m_phiInstability
Definition: FitParameters.h:139
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::FitParameters::m_qOverP1
double m_qOverP1
Definition: FitParameters.h:142
Trk::FitParameters::FitParameters
FitParameters(const Perigee &perigee)
Definition: FitParameters.cxx:28
Trk::FitParameters::addScatterer
void addScatterer(double phi, double theta)
Definition: FitParameters.cxx:116
Trk::FitParameters::m_finalCovariance
Amg::MatrixX * m_finalCovariance
Definition: FitParameters.h:126
Trk::FitParameters::phiInstability
bool phiInstability(void) const
Definition: FitParameters.cxx:244
Trk::alignment
@ alignment
Definition: MeasurementType.h:33
Trk::FitParameters::m_cotTheta
double m_cotTheta
Definition: FitParameters.h:121
Trk::FitParameters::differences
const Amg::VectorX & differences(void) const
Definition: FitParameters.h:196
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32