CMS 3D CMS Logo

GblTrajectory.h
Go to the documentation of this file.
1 /*
2  * GblTrajectory.h
3  *
4  * Created on: Aug 18, 2011
5  * Author: kleinwrt
6  */
7 
8 #ifndef GBLTRAJECTORY_H_
9 #define GBLTRAJECTORY_H_
10 
11 #include "GblPoint.h"
12 #include "GblData.h"
13 #include "GblPoint.h"
14 #include "BorderedBandMatrix.h"
15 #include "MilleBinary.h"
16 #include "TMatrixDSymEigen.h"
17 
19 namespace gbl {
20 
22 
27 public:
28  GblTrajectory(const std::vector<GblPoint> &aPointList, bool flagCurv = true,
29  bool flagU1dir = true, bool flagU2dir = true);
30  GblTrajectory(const std::vector<GblPoint> &aPointList, unsigned int aLabel,
31  const TMatrixDSym &aSeed, bool flagCurv = true, bool flagU1dir =
32  true, bool flagU2dir = true);
34  const std::vector<std::pair<std::vector<GblPoint>, TMatrixD> > &aPointaAndTransList);
36  const std::vector<std::pair<std::vector<GblPoint>, TMatrixD> > &aPointaAndTransList,
37  const TMatrixD &extDerivatives, const TVectorD &extMeasurements,
38  const TVectorD &extPrecisions);
39  virtual ~GblTrajectory();
40  bool isValid() const;
41  unsigned int getNumPoints() const;
42  unsigned int getResults(int aSignedLabel, TVectorD &localPar,
43  TMatrixDSym &localCov) const;
44  unsigned int getMeasResults(unsigned int aLabel, unsigned int &numRes,
45  TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors,
46  TVectorD &aDownWeights);
47  unsigned int getScatResults(unsigned int aLabel, unsigned int &numRes,
48  TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors,
49  TVectorD &aDownWeights);
50  void getLabels(std::vector<unsigned int> &aLabelList);
51  void getLabels(std::vector<std::vector< unsigned int> > &aLabelList);
52  unsigned int fit(double &Chi2, int &Ndf, double &lostWeight,
53  std::string optionList = "");
54  void milleOut(MilleBinary &aMille);
55  void printTrajectory(unsigned int level = 0);
56  void printPoints(unsigned int level = 0);
57  void printData();
58 
59 private:
60  unsigned int numAllPoints;
61  std::vector<unsigned int> numPoints;
62  unsigned int numTrajectories;
63  unsigned int numOffsets;
64  unsigned int numInnerTrans;
65  unsigned int numCurvature;
66  unsigned int numParameters;
67  unsigned int numLocals;
68  unsigned int numMeasurements;
69  unsigned int externalPoint;
70  bool constructOK;
71  bool fitOK;
72  std::vector<unsigned int> theDimension;
73  std::vector<std::vector<GblPoint> > thePoints;
74  std::vector<GblData> theData;
75  std::vector<unsigned int> measDataIndex;
76  std::vector<unsigned int> scatDataIndex;
77  TMatrixDSym externalSeed;
78  std::vector<TMatrixD> innerTransformations;
79  // composed trajectory (from common external parameters)
80  TMatrixD externalDerivatives; // Derivatives for external measurements of composed trajectory
81  TVectorD externalMeasurements; // Residuals for external measurements of composed trajectory
82  TVectorD externalPrecisions; // Precisions for external measurements of composed trajectory
85 
86  std::pair<std::vector<unsigned int>, TMatrixD> getJacobian(
87  int aSignedLabel) const;
88  void getFitToLocalJacobian(std::vector<unsigned int> &anIndex,
89  SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim,
90  unsigned int nJacobian = 1) const;
91  void getFitToKinkJacobian(std::vector<unsigned int> &anIndex,
92  SMatrix27 &aJacobian, const GblPoint &aPoint) const;
93  void construct();
94  void defineOffsets();
95  void calcJacobians();
96  void prepare();
98  void predict();
99  double downWeight(unsigned int aMethod);
100  void getResAndErr(unsigned int aData, double &aResidual,
101  double &aMeadsError, double &aResError, double &aDownWeight);
102 };
103 }
104 #endif /* GBLTRAJECTORY_H_ */
GBL trajectory.
Definition: GblTrajectory.h:26
std::vector< unsigned int > scatDataIndex
mapping points to data blocks from scatterers
Definition: GblTrajectory.h:76
void construct()
Construct trajectory from list of points.
std::pair< std::vector< unsigned int >, TMatrixD > getJacobian(int aSignedLabel) const
Get jacobian for transformation from fit to track parameters at point.
void buildLinearEquationSystem()
Build linear equation system from data (blocks).
void printTrajectory(unsigned int level=0)
Print GblTrajectory.
TVectorD externalPrecisions
Definition: GblTrajectory.h:82
unsigned int numParameters
Number of fit parameters.
Definition: GblTrajectory.h:66
bool constructOK
Trajectory has been successfully constructed (ready for fit/output)
Definition: GblTrajectory.h:70
std::vector< unsigned int > measDataIndex
mapping points to data blocks from measurements
Definition: GblTrajectory.h:75
bool fitOK
Trajectory has been successfully fitted (results are valid)
Definition: GblTrajectory.h:71
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...
ROOT::Math::SMatrix< double, 2, 7 > SMatrix27
Definition: GblData.h:22
(Symmetric) Bordered Band Matrix.
std::vector< unsigned int > theDimension
List of active dimensions (0=u1, 1=u2) in fit.
Definition: GblTrajectory.h:72
TMatrixDSym externalSeed
Precision (inverse covariance matrix) of external seed.
Definition: GblTrajectory.h:77
void predict()
Calculate predictions for all points.
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.
ROOT::Math::SMatrix< double, 5, 5 > SMatrix55
Definition: GblData.h:23
unsigned int numOffsets
Number of (points with) offsets on trajectory.
Definition: GblTrajectory.h:63
bool isValid() const
Retrieve validity of trajectory.
void getLabels(std::vector< unsigned int > &aLabelList)
Get (list of) labels of points on (simple) trajectory.
unsigned int externalPoint
Label of external point (or 0)
Definition: GblTrajectory.h:69
unsigned int numInnerTrans
Number of inner transformations to external parameters.
Definition: GblTrajectory.h:64
void calcJacobians()
Calculate Jacobians to previous/next scatterer from point to point ones.
unsigned int numMeasurements
Total number of measurements.
Definition: GblTrajectory.h:68
void defineOffsets()
Define offsets from list of points.
void prepare()
Prepare fit for simple or composed trajectory.
unsigned int getMeasResults(unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
Get residuals at point from measurement.
void printData()
Print GblData blocks for trajectory.
Namespace for the general broken lines package.
double downWeight(unsigned int aMethod)
Down-weight all points.
std::vector< unsigned int > numPoints
Number of points on (sub)trajectory.
Definition: GblTrajectory.h:61
std::vector< TMatrixD > innerTransformations
Transformations at innermost points of.
Definition: GblTrajectory.h:78
unsigned int fit(double &Chi2, int &Ndf, double &lostWeight, std::string optionList="")
Perform fit of trajectory.
void milleOut(MilleBinary &aMille)
Write valid trajectory to Millepede-II binary file.
std::vector< GblData > theData
List of data blocks.
Definition: GblTrajectory.h:74
TMatrixD externalDerivatives
Definition: GblTrajectory.h:80
std::vector< std::vector< GblPoint > > thePoints
(list of) List of points on trajectory
Definition: GblTrajectory.h:73
BorderedBandMatrix theMatrix
(Bordered band) matrix of linear equation system
Definition: GblTrajectory.h:84
VVector theVector
Vector of linear equation system.
Definition: GblTrajectory.h:83
unsigned int numTrajectories
Number of trajectories (in composed trajectory)
Definition: GblTrajectory.h:62
unsigned int getScatResults(unsigned int aLabel, unsigned int &numRes, TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors, TVectorD &aDownWeights)
Get (kink) residuals at point from scatterer.
Simple Vector based on std::vector<double>
Definition: VMatrix.h:21
GblTrajectory(const std::vector< GblPoint > &aPointList, bool flagCurv=true, bool flagU1dir=true, bool flagU2dir=true)
Create new (simple) trajectory from list of points.
unsigned int numLocals
Total number of (additional) local parameters.
Definition: GblTrajectory.h:67
virtual ~GblTrajectory()
Millepede-II (binary) record.
Definition: MilleBinary.h:46
unsigned int getNumPoints() const
Retrieve number of point from trajectory.
unsigned int numAllPoints
Number of all points on trajectory.
Definition: GblTrajectory.h:60
void printPoints(unsigned int level=0)
Print GblPoints on trajectory.
Definition: Chi2.h:17
void getResAndErr(unsigned int aData, double &aResidual, double &aMeadsError, double &aResError, double &aDownWeight)
Get residual and errors from data block.
unsigned int getResults(int aSignedLabel, TVectorD &localPar, TMatrixDSym &localCov) const
Get fit results at point.
TVectorD externalMeasurements
Definition: GblTrajectory.h:81
unsigned int numCurvature
Number of curvature parameters (0 or 1) or external parameters.
Definition: GblTrajectory.h:65
Point on trajectory.
Definition: GblPoint.h:46