CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
gbl::GblTrajectory Class Reference

GBL trajectory. More...

#include <GblTrajectory.h>

Public Member Functions

unsigned int fit (double &Chi2, int &Ndf, double &lostWeight, std::string optionList="")
 Perform fit of trajectory. More...
 
 GblTrajectory (const std::vector< GblPoint > &aPointList, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
 Create new (simple) trajectory from list of points. More...
 
 GblTrajectory (const std::vector< GblPoint > &aPointList, unsigned int aLabel, const TMatrixDSym &aSeed, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
 Create new (simple) trajectory from list of points with external seed. More...
 
 GblTrajectory (const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &aPointaAndTransList)
 Create new composed trajectory from list of points and transformations. More...
 
 GblTrajectory (const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &aPointaAndTransList, const TMatrixD &extDerivatives, const TVectorD &extMeasurements, const TVectorD &extPrecisions)
 Create new composed trajectory from list of points and transformations with (independent) external measurements. More...
 
void getLabels (std::vector< unsigned int > &aLabelList)
 Get (list of) labels of points on (simple) trajectory. More...
 
void getLabels (std::vector< std::vector< unsigned int > > &aLabelList)
 Get (list of lists of) labels of points on (composed) trajectory. More...
 
unsigned int getMeasResults (unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
 Get residuals at point from measurement. More...
 
unsigned int getNumPoints () const
 Retrieve number of point from trajectory. More...
 
unsigned int getResults (int aSignedLabel, TVectorD &localPar, TMatrixDSym &localCov) const
 Get fit results at point. More...
 
unsigned int getScatResults (unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
 Get (kink) residuals at point from scatterer. More...
 
bool isValid () const
 Retrieve validity of trajectory. More...
 
void milleOut (MilleBinary &aMille)
 Write valid trajectory to Millepede-II binary file. More...
 
void printData ()
 Print GblData blocks for trajectory. More...
 
void printPoints (unsigned int level=0)
 Print GblPoints on trajectory. More...
 
void printTrajectory (unsigned int level=0)
 Print GblTrajectory. More...
 
virtual ~GblTrajectory ()
 

Private Member Functions

void buildLinearEquationSystem ()
 Build linear equation system from data (blocks). More...
 
void calcJacobians ()
 Calculate Jacobians to previous/next scatterer from point to point ones. More...
 
void construct ()
 Construct trajectory from list of points. More...
 
void defineOffsets ()
 Define offsets from list of points. More...
 
double downWeight (unsigned int aMethod)
 Down-weight all points. More...
 
void getFitToKinkJacobian (std::vector< unsigned int > &anIndex, SMatrix27 &aJacobian, const GblPoint &aPoint) const
 Get jacobian for transformation from (trajectory) fit to kink parameters at point. More...
 
void getFitToLocalJacobian (std::vector< unsigned int > &anIndex, SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim, unsigned int nJacobian=1) const
 Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point. More...
 
std::pair< std::vector
< unsigned int >, TMatrixD > 
getJacobian (int aSignedLabel) const
 Get jacobian for transformation from fit to track parameters at point. More...
 
void getResAndErr (unsigned int aData, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
 Get residual and errors from data block. More...
 
void predict ()
 Calculate predictions for all points. More...
 
void prepare ()
 Prepare fit for simple or composed trajectory. More...
 

Private Attributes

bool constructOK
 Trajectory has been successfully constructed (ready for fit/output) More...
 
TMatrixD externalDerivatives
 
TVectorD externalMeasurements
 
unsigned int externalPoint
 Label of external point (or 0) More...
 
TVectorD externalPrecisions
 
TMatrixDSym externalSeed
 Precision (inverse covariance matrix) of external seed. More...
 
bool fitOK
 Trajectory has been successfully fitted (results are valid) More...
 
std::vector< TMatrixD > innerTransformations
 Transformations at innermost points of. More...
 
std::vector< unsigned int > measDataIndex
 mapping points to data blocks from measurements More...
 
unsigned int numAllPoints
 Number of all points on trajectory. More...
 
unsigned int numCurvature
 Number of curvature parameters (0 or 1) or external parameters. More...
 
unsigned int numInnerTrans
 Number of inner transformations to external parameters. More...
 
unsigned int numLocals
 Total number of (additional) local parameters. More...
 
unsigned int numMeasurements
 Total number of measurements. More...
 
unsigned int numOffsets
 Number of (points with) offsets on trajectory. More...
 
unsigned int numParameters
 Number of fit parameters. More...
 
std::vector< unsigned int > numPoints
 Number of points on (sub)trajectory. More...
 
unsigned int numTrajectories
 Number of trajectories (in composed trajectory) More...
 
std::vector< unsigned int > scatDataIndex
 mapping points to data blocks from scatterers More...
 
std::vector< GblDatatheData
 List of data blocks. More...
 
std::vector< unsigned int > theDimension
 List of active dimensions (0=u1, 1=u2) in fit. More...
 
BorderedBandMatrix theMatrix
 (Bordered band) matrix of linear equation system More...
 
std::vector< std::vector
< GblPoint > > 
thePoints
 (list of) List of points on trajectory More...
 
VVector theVector
 Vector of linear equation system. More...
 

Detailed Description

GBL trajectory.

List of GblPoints ordered by arc length. Can be fitted and optionally written to MP-II binary file.

Definition at line 26 of file GblTrajectory.h.

Constructor & Destructor Documentation

gbl::GblTrajectory::GblTrajectory ( const std::vector< GblPoint > &  aPointList,
bool  flagCurv = true,
bool  flagU1dir = true,
bool  flagU2dir = true 
)

Create new (simple) trajectory from list of points.

Curved trajectory in space (default) or without curvature (q/p) or in one plane (u-direction) only.

Parameters
[in]aPointListList of points
[in]flagCurvUse q/p
[in]flagU1dirUse in u1 direction
[in]flagU2dirUse in u2 direction

Definition at line 117 of file GblTrajectory.cc.

gbl::GblTrajectory::GblTrajectory ( const std::vector< GblPoint > &  aPointList,
unsigned int  aLabel,
const TMatrixDSym &  aSeed,
bool  flagCurv = true,
bool  flagU1dir = true,
bool  flagU2dir = true 
)

Create new (simple) trajectory from list of points with external seed.

Curved trajectory in space (default) or without curvature (q/p) or in one plane (u-direction) only.

Parameters
[in]aPointListList of points
[in]aLabel(Signed) label of point for external seed (<0: in front, >0: after point, slope changes at scatterer!)
[in]aSeedPrecision matrix of external seed
[in]flagCurvUse q/p
[in]flagU1dirUse in u1 direction
[in]flagU2dirUse in u2 direction

Definition at line 145 of file GblTrajectory.cc.

gbl::GblTrajectory::GblTrajectory ( const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &  aPointsAndTransList)

Create new composed trajectory from list of points and transformations.

Composed of curved trajectory in space.

Parameters
[in]aPointsAndTransListList containing pairs with list of points and transformation (at inner (first) point)

Definition at line 168 of file GblTrajectory.cc.

gbl::GblTrajectory::GblTrajectory ( const std::vector< std::pair< std::vector< GblPoint >, TMatrixD > > &  aPointsAndTransList,
const TMatrixD &  extDerivatives,
const TVectorD &  extMeasurements,
const TVectorD &  extPrecisions 
)

Create new composed trajectory from list of points and transformations with (independent) external measurements.

Composed of curved trajectory in space.

Parameters
[in]aPointsAndTransListList containing pairs with list of points and transformation (at inner (first) point)
[in]extDerivativesDerivatives of external measurements vs external parameters
[in]extMeasurementsExternal measurements (residuals)
[in]extPrecisionsPrecision of external measurements

Definition at line 194 of file GblTrajectory.cc.

gbl::GblTrajectory::~GblTrajectory ( )
virtual

Definition at line 216 of file GblTrajectory.cc.

Member Function Documentation

void gbl::GblTrajectory::buildLinearEquationSystem ( )
private

Build linear equation system from data (blocks).

Definition at line 692 of file GblTrajectory.cc.

void gbl::GblTrajectory::calcJacobians ( )
private

Calculate Jacobians to previous/next scatterer from point to point ones.

Definition at line 297 of file GblTrajectory.cc.

void gbl::GblTrajectory::construct ( )
private

Construct trajectory from list of points.

Trajectory is prepared for fit or output to binary file, may consists of sub-trajectories.

Definition at line 233 of file GblTrajectory.cc.

void gbl::GblTrajectory::defineOffsets ( )
private

Define offsets from list of points.

Define offsets at points with scatterers and first and last point. All other points need interpolation from adjacent points with offsets.

Definition at line 275 of file GblTrajectory.cc.

double gbl::GblTrajectory::downWeight ( unsigned int  aMethod)
private

Down-weight all points.

Parameters
[in]aMethodM-estimator (1: Tukey, 2:Huber, 3:Cauchy)

Definition at line 937 of file GblTrajectory.cc.

unsigned int gbl::GblTrajectory::fit ( double &  Chi2,
int &  Ndf,
double &  lostWeight,
std::string  optionList = "" 
)

Perform fit of trajectory.

Optionally iterate for outlier down-weighting.

Parameters
[out]Chi2Chi2 sum (corrected for down-weighting)
[out]NdfNumber of degrees of freedom
[out]lostWeightSum of weights lost due to down-weighting
[in]optionListIterations for down-weighting (One character per iteration: t,h,c (or T,H,C) for Tukey, Huber or Cauchy function)
Returns
Error code (non zero value indicates failure of fit)

Definition at line 956 of file GblTrajectory.cc.

void gbl::GblTrajectory::getFitToKinkJacobian ( std::vector< unsigned int > &  anIndex,
SMatrix27 aJacobian,
const GblPoint aPoint 
) const
private

Get jacobian for transformation from (trajectory) fit to kink parameters at point.

Jacobian broken lines (q/p,..,u_i-1,u_i,u_i+1..) to kink (du') parameters.

Parameters
[out]anIndexList of fit parameters with non zero derivatives
[out]aJacobianCorresponding transformation matrix
[in]aPointPoint to use

Definition at line 514 of file GblTrajectory.cc.

void gbl::GblTrajectory::getFitToLocalJacobian ( std::vector< unsigned int > &  anIndex,
SMatrix55 aJacobian,
const GblPoint aPoint,
unsigned int  measDim,
unsigned int  nJacobian = 1 
) const
private

Get (part of) jacobian for transformation from (trajectory) fit to track parameters at point.

Jacobian broken lines (q/p,..,u_i,u_i+1..) to local (q/p,u',u) parameters.

Parameters
[out]anIndexList of fit parameters with non zero derivatives
[out]aJacobianCorresponding transformation matrix
[in]aPointPoint to use
[in]measDimDimension of 'measurement' (<=2: calculate only offset part, >2: complete matrix)
[in]nJacobianDirection (0: to previous offset, 1: to next offset)

Definition at line 419 of file GblTrajectory.cc.

std::pair< std::vector< unsigned int >, TMatrixD > gbl::GblTrajectory::getJacobian ( int  aSignedLabel) const
private

Get jacobian for transformation from fit to track parameters at point.

Jacobian broken lines (q/p,..,u_i,u_i+1..) to track (q/p,u',u) parameters including additional local parameters.

Parameters
[in]aSignedLabel(Signed) label of point for external seed (<0: in front, >0: after point, slope changes at scatterer!)
Returns
List of fit parameters with non zero derivatives and corresponding transformation matrix

Definition at line 343 of file GblTrajectory.cc.

void gbl::GblTrajectory::getLabels ( std::vector< unsigned int > &  aLabelList)

Get (list of) labels of points on (simple) trajectory.

Parameters
[out]aLabelListList of labels (aLabelList[i] = i+1)

Definition at line 636 of file GblTrajectory.cc.

void gbl::GblTrajectory::getLabels ( std::vector< std::vector< unsigned int > > &  aLabelList)

Get (list of lists of) labels of points on (composed) trajectory.

Parameters
[out]aLabelListList of of lists of labels

Definition at line 649 of file GblTrajectory.cc.

unsigned int gbl::GblTrajectory::getMeasResults ( unsigned int  aLabel,
unsigned int &  numData,
TVectorD &  aResiduals,
TVectorD &  aMeasErrors,
TVectorD &  aResErrors,
TVectorD &  aDownWeights 
)

Get residuals at point from measurement.

Get (diagonalized) residual, error of measurement and residual and down-weighting factor for measurement at point

Parameters
[in]aLabelLabel of point on trajectory
[out]numDataNumber of data blocks from measurement at point
[out]aResidualsMeasurements-Predictions
[out]aMeasErrorsErrors of Measurements
[out]aResErrorsErrors of Residuals (including correlations from track fit)
[out]aDownWeightsDown-Weighting factors
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 587 of file GblTrajectory.cc.

unsigned int gbl::GblTrajectory::getNumPoints ( ) const

Retrieve number of point from trajectory.

Definition at line 225 of file GblTrajectory.cc.

void gbl::GblTrajectory::getResAndErr ( unsigned int  aData,
double &  aResidual,
double &  aMeasError,
double &  aResError,
double &  aDownWeight 
)
private

Get residual and errors from data block.

Get residual, error of measurement and residual and down-weighting factor for (single) data block

Parameters
[in]aDataLabel of data block
[out]aResidualMeasurement-Prediction
[out]aMeasErrorError of Measurement
[out]aResErrorError of Residual (including correlations from track fit)
[out]aDownWeightDown-Weighting factor

Definition at line 672 of file GblTrajectory.cc.

unsigned int gbl::GblTrajectory::getResults ( int  aSignedLabel,
TVectorD &  localPar,
TMatrixDSym &  localCov 
) const

Get fit results at point.

Get corrections and covariance matrix for local track and additional parameters in forward or backward direction.

Parameters
[in]aSignedLabel(Signed) label of point on trajectory (<0: in front, >0: after point, slope changes at scatterer!)
[out]localParCorrections for local parameters
[out]localCovCovariance for local parameters
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 557 of file GblTrajectory.cc.

unsigned int gbl::GblTrajectory::getScatResults ( unsigned int  aLabel,
unsigned int &  numData,
TVectorD &  aResiduals,
TVectorD &  aMeasErrors,
TVectorD &  aResErrors,
TVectorD &  aDownWeights 
)

Get (kink) residuals at point from scatterer.

Get (diagonalized) residual, error of measurement and residual and down-weighting factor for scatterering kinks at point

Parameters
[in]aLabelLabel of point on trajectory
[out]numDataNumber of data blocks from scatterer at point
[out]aResiduals(kink)Measurements-(kink)Predictions
[out]aMeasErrorsErrors of (kink)Measurements
[out]aResErrorsErrors of Residuals (including correlations from track fit)
[out]aDownWeightsDown-Weighting factors
Returns
error code (non-zero if trajectory not fitted successfully)

Definition at line 616 of file GblTrajectory.cc.

bool gbl::GblTrajectory::isValid ( void  ) const

Retrieve validity of trajectory.

Definition at line 220 of file GblTrajectory.cc.

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

void gbl::GblTrajectory::milleOut ( MilleBinary aMille)

Write valid trajectory to Millepede-II binary file.

Definition at line 1004 of file GblTrajectory.cc.

void gbl::GblTrajectory::predict ( )
private

Calculate predictions for all points.

Definition at line 926 of file GblTrajectory.cc.

void gbl::GblTrajectory::prepare ( )
private

Prepare fit for simple or composed trajectory.

Generate data (blocks) from measurements, kinks, external seed and measurements.

Definition at line 713 of file GblTrajectory.cc.

void gbl::GblTrajectory::printData ( )

Print GblData blocks for trajectory.

Definition at line 1108 of file GblTrajectory.cc.

void gbl::GblTrajectory::printPoints ( unsigned int  level = 0)

Print GblPoints on trajectory.

Parameters
[in]levelprint level (0: minimum, >0: more)

Definition at line 1096 of file GblTrajectory.cc.

void gbl::GblTrajectory::printTrajectory ( unsigned int  level = 0)

Print GblTrajectory.

Parameters
[in]levelprint level (0: minimum, >0: more)

Definition at line 1030 of file GblTrajectory.cc.

Member Data Documentation

bool gbl::GblTrajectory::constructOK
private

Trajectory has been successfully constructed (ready for fit/output)

Definition at line 70 of file GblTrajectory.h.

TMatrixD gbl::GblTrajectory::externalDerivatives
private

Definition at line 80 of file GblTrajectory.h.

TVectorD gbl::GblTrajectory::externalMeasurements
private

Definition at line 81 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::externalPoint
private

Label of external point (or 0)

Definition at line 69 of file GblTrajectory.h.

TVectorD gbl::GblTrajectory::externalPrecisions
private

Definition at line 82 of file GblTrajectory.h.

TMatrixDSym gbl::GblTrajectory::externalSeed
private

Precision (inverse covariance matrix) of external seed.

Definition at line 77 of file GblTrajectory.h.

bool gbl::GblTrajectory::fitOK
private

Trajectory has been successfully fitted (results are valid)

Definition at line 71 of file GblTrajectory.h.

std::vector<TMatrixD> gbl::GblTrajectory::innerTransformations
private

Transformations at innermost points of.

Definition at line 78 of file GblTrajectory.h.

std::vector<unsigned int> gbl::GblTrajectory::measDataIndex
private

mapping points to data blocks from measurements

Definition at line 75 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numAllPoints
private

Number of all points on trajectory.

Definition at line 60 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numCurvature
private

Number of curvature parameters (0 or 1) or external parameters.

Definition at line 65 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numInnerTrans
private

Number of inner transformations to external parameters.

Definition at line 64 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numLocals
private

Total number of (additional) local parameters.

Definition at line 67 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numMeasurements
private

Total number of measurements.

Definition at line 68 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numOffsets
private

Number of (points with) offsets on trajectory.

Definition at line 63 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numParameters
private

Number of fit parameters.

Definition at line 66 of file GblTrajectory.h.

std::vector<unsigned int> gbl::GblTrajectory::numPoints
private

Number of points on (sub)trajectory.

Definition at line 61 of file GblTrajectory.h.

unsigned int gbl::GblTrajectory::numTrajectories
private

Number of trajectories (in composed trajectory)

Definition at line 62 of file GblTrajectory.h.

std::vector<unsigned int> gbl::GblTrajectory::scatDataIndex
private

mapping points to data blocks from scatterers

Definition at line 76 of file GblTrajectory.h.

std::vector<GblData> gbl::GblTrajectory::theData
private

List of data blocks.

Definition at line 74 of file GblTrajectory.h.

std::vector<unsigned int> gbl::GblTrajectory::theDimension
private

List of active dimensions (0=u1, 1=u2) in fit.

Definition at line 72 of file GblTrajectory.h.

BorderedBandMatrix gbl::GblTrajectory::theMatrix
private

(Bordered band) matrix of linear equation system

Definition at line 84 of file GblTrajectory.h.

std::vector<std::vector<GblPoint> > gbl::GblTrajectory::thePoints
private

(list of) List of points on trajectory

Definition at line 73 of file GblTrajectory.h.

VVector gbl::GblTrajectory::theVector
private

Vector of linear equation system.

Definition at line 83 of file GblTrajectory.h.