Belle II Software  release-08-01-10
ModuleAlignment Class Reference

Alignment of a TOP module. More...

#include <ModuleAlignment.h>

Collaboration diagram for ModuleAlignment:

Public Member Functions

 ModuleAlignment (PDFConstructor::EPDFOption opt=PDFConstructor::c_Rough)
 Constructor. More...
 
void setModuleID (int moduleID)
 Sets module ID. More...
 
void setSteps (double position, double angle, double time)
 Sets steps for numerical calculation of derivatives. More...
 
void setParameters (const std::vector< double > &parInit)
 Sets initial values of parameters (overwrites current parameters!) Order is: translations in x, y, z, rotation angles around x, y, z, module T0. More...
 
void fixParameter (const std::string &name)
 Fixes parameter with its name given as argument. More...
 
void releaseParameter (const std::string &name)
 Release fixed parameter. More...
 
void releaseAllParameters ()
 Release all fixed parameters.
 
int iterate (TOPTrack &track, const Const::ChargedStable &hypothesis)
 Run a single alignment iteration, on success update alignment parameters. More...
 
void reset ()
 Reset the object.
 
int getModuleID () const
 Returns module ID. More...
 
const std::vector< std::string > & getParameterNames () const
 Returns alignment parameter names. More...
 
const std::vector< double > & getParams () const
 Returns alignment parameters. More...
 
std::vector< float > getParameters () const
 Returns alignment parameters. More...
 
std::vector< float > getErrors () const
 Returns errors on alignment parameters. More...
 
const TMatrixDSym & getErrorMatrix () const
 Returns error matrix of alignment parameters Order is: translations in x, y, z, rotation angles around x, y, z, module T0. More...
 
int getNumTracks () const
 Returns track counter. More...
 
int getNumUsedTracks () const
 Returns number of tracks used in current result. More...
 
bool isValid () const
 Checks if the results are valid. More...
 
int getNumOfPhotons () const
 Returns number of photons used for log likelihood calculation. More...
 

Private Member Functions

double getLogL (const std::vector< double > &par, bool &ok)
 Returns log likelihood for given parameters Note: it changes helix parameters of TOPTrack object (m_track) More...
 
bool derivatives (std::vector< double > &first, TMatrixDSym &second)
 Calculates numerically first and second derivatives of log likelihood against the parameters. More...
 
int invertMatrixU ()
 Inverts matrix m_U using Cholesky decomposition. More...
 

Private Attributes

int m_moduleID = 0
 module ID
 
PDFConstructor::EPDFOption m_opt = PDFConstructor::c_Rough
 PDF option.
 
std::vector< std::string > m_parNames
 parameter names
 
std::vector< double > m_parInit
 initial parameter values
 
std::vector< double > m_par
 current parameter values
 
std::vector< double > m_steps
 step sizes
 
std::vector< double > m_maxDpar
 maximal parameter changes in one iteration
 
std::vector< bool > m_fixed
 true if parameter is fixed
 
TMatrixDSym m_COV
 covariance matrix
 
int m_numTracks = 0
 track counter
 
int m_numUsedTracks = 0
 number of tracks used
 
int m_numPhotons = 0
 number of photons used for log likelihood calculation
 
bool m_valid = false
 validity of results
 
TMatrixDSym m_U
 matrix (neg. More...
 
TOPTrackm_track = 0
 track parameters at TOP
 
Const::ChargedStable m_hypothesis = Const::muon
 particle hypothesis
 

Detailed Description

Alignment of a TOP module.

Definition at line 30 of file ModuleAlignment.h.

Constructor & Destructor Documentation

◆ ModuleAlignment()

Constructor.

Parameters
optPDF construction option

Definition at line 25 of file ModuleAlignment.cc.

25  : m_opt(opt)
26  {
27  m_parNames.push_back("x");
28  m_parNames.push_back("y");
29  m_parNames.push_back("z");
30  m_parNames.push_back("alpha");
31  m_parNames.push_back("beta");
32  m_parNames.push_back("gamma");
33  m_parNames.push_back("t0");
34  unsigned numPar = m_parNames.size();
35  m_parInit.resize(numPar, 0);
36  m_par = m_parInit;
37  m_steps.resize(numPar, 0);
38  m_fixed.resize(numPar, false);
39  m_COV.ResizeTo(numPar, numPar);
40  m_U.ResizeTo(numPar, numPar);
41  setSteps(1.0, 0.01, 0.05);
42  }
TMatrixDSym m_U
matrix (neg.
TMatrixDSym m_COV
covariance matrix
std::vector< double > m_steps
step sizes
std::vector< bool > m_fixed
true if parameter is fixed
std::vector< std::string > m_parNames
parameter names
std::vector< double > m_par
current parameter values
void setSteps(double position, double angle, double time)
Sets steps for numerical calculation of derivatives.
std::vector< double > m_parInit
initial parameter values
PDFConstructor::EPDFOption m_opt
PDF option.

Member Function Documentation

◆ derivatives()

bool derivatives ( std::vector< double > &  first,
TMatrixDSym &  second 
)
private

Calculates numerically first and second derivatives of log likelihood against the parameters.

Parameters
firsta vector of first derivatives [out]
seconda matrix of second derivatives [out]
Returns
status (true on success)

Definition at line 141 of file ModuleAlignment.cc.

◆ fixParameter()

void fixParameter ( const std::string &  name)
inline

Fixes parameter with its name given as argument.

Parameters
nameparameter name

Definition at line 70 of file ModuleAlignment.h.

71  {
72  for (unsigned i = 0; i < m_parNames.size(); i++) {
73  if (name == m_parNames[i]) {
74  m_fixed[i] = true;
75  return;
76  }
77  }
78  B2ERROR("TOP::ModuleAlignment::fixParameter: invalid parameter name '" << name << "'");
79  }

◆ getErrorMatrix()

const TMatrixDSym& getErrorMatrix ( ) const
inline

Returns error matrix of alignment parameters Order is: translations in x, y, z, rotation angles around x, y, z, module T0.

Returns
error matrix

Definition at line 155 of file ModuleAlignment.h.

◆ getErrors()

std::vector< float > getErrors ( ) const

Returns errors on alignment parameters.

Order is: translations in x, y, z, rotation angles around x, y, z, module T0

Returns
errors in single precision

Definition at line 109 of file ModuleAlignment.cc.

◆ getLogL()

double getLogL ( const std::vector< double > &  par,
bool &  ok 
)
private

Returns log likelihood for given parameters Note: it changes helix parameters of TOPTrack object (m_track)

Parameters
parparameters
okstatus [out]
Returns
log likelihood

Definition at line 119 of file ModuleAlignment.cc.

◆ getModuleID()

int getModuleID ( ) const
inline

Returns module ID.

Returns
module ID

Definition at line 121 of file ModuleAlignment.h.

◆ getNumOfPhotons()

int getNumOfPhotons ( ) const
inline

Returns number of photons used for log likelihood calculation.

Returns
number of photons

Definition at line 179 of file ModuleAlignment.h.

◆ getNumTracks()

int getNumTracks ( ) const
inline

Returns track counter.

Returns
number of tracks

Definition at line 161 of file ModuleAlignment.h.

◆ getNumUsedTracks()

int getNumUsedTracks ( ) const
inline

Returns number of tracks used in current result.

Returns
number of tracks

Definition at line 167 of file ModuleAlignment.h.

◆ getParameterNames()

const std::vector<std::string>& getParameterNames ( ) const
inline

Returns alignment parameter names.

Returns
parameter names

Definition at line 127 of file ModuleAlignment.h.

◆ getParameters()

std::vector< float > getParameters ( ) const

Returns alignment parameters.

Order is: translations in x, y, z, rotation angles around x, y, z, module T0

Returns
parameters in single precision

Definition at line 102 of file ModuleAlignment.cc.

◆ getParams()

const std::vector<double>& getParams ( ) const
inline

Returns alignment parameters.

Order is: translations in x, y, z, rotation angles around x, y, z, module T0

Returns
parameters in double precision

Definition at line 134 of file ModuleAlignment.h.

◆ invertMatrixU()

int invertMatrixU ( )
private

Inverts matrix m_U using Cholesky decomposition.

Returns
error status (0 = OK, > 0 matrix not pos. definite)

Definition at line 198 of file ModuleAlignment.cc.

◆ isValid()

bool isValid ( ) const
inline

Checks if the results are valid.

Returns
true if results valid

Definition at line 173 of file ModuleAlignment.h.

◆ iterate()

int iterate ( TOPTrack track,
const Const::ChargedStable hypothesis 
)

Run a single alignment iteration, on success update alignment parameters.

Parameters
tracktrack parameters
hypothesisparticle hypothesis
Returns
error status (0 = OK, < 0 no track hit, > 0 matrix not positive definite)

Definition at line 56 of file ModuleAlignment.cc.

◆ releaseParameter()

void releaseParameter ( const std::string &  name)
inline

Release fixed parameter.

Parameters
nameparameter name

Definition at line 85 of file ModuleAlignment.h.

◆ setModuleID()

void setModuleID ( int  moduleID)
inline

Sets module ID.

Parameters
moduleIDmodule ID

Definition at line 43 of file ModuleAlignment.h.

◆ setParameters()

void setParameters ( const std::vector< double > &  parInit)
inline

Sets initial values of parameters (overwrites current parameters!) Order is: translations in x, y, z, rotation angles around x, y, z, module T0.

Parameters
parInitinitial values

Definition at line 58 of file ModuleAlignment.h.

◆ setSteps()

void setSteps ( double  position,
double  angle,
double  time 
)

Sets steps for numerical calculation of derivatives.

Parameters
positionstep size for translations [cm]
anglestep size for rotations [radians]
timestep size for module T0 [ns]

Definition at line 44 of file ModuleAlignment.cc.

Member Data Documentation

◆ m_U

TMatrixDSym m_U
private

matrix (neg.

sum of second derivatives)

Definition at line 221 of file ModuleAlignment.h.


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