Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GblTrajectory.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GblTrajectory.h
1 /*
2  * GblTrajectory.h
3  *
4  * Created on: Aug 18, 2011
5  * Author: kleinwrt
6  */
7 
30 #ifndef GBLTRAJECTORY_H_
31 #define GBLTRAJECTORY_H_
32 
33 #include "GblPoint.h"
34 #include "GblData.h"
35 #include "GblPoint.h"
36 #include "BorderedBandMatrix.h"
37 #include "MilleBinary.h"
38 #include "TMatrixDSymEigen.h"
39 
41 namespace gbl {
42 
44 
49 public:
50  explicit GblTrajectory(const std::vector<GblPoint> &aPointList, bool flagCurv = true,
51  bool flagU1dir = true, bool flagU2dir = true);
52  GblTrajectory(const std::vector<GblPoint> &aPointList, unsigned int aLabel,
53  const TMatrixDSym &aSeed, bool flagCurv = true, bool flagU1dir =
54  true, bool flagU2dir = true);
55  explicit GblTrajectory(
56  const std::vector<std::pair<std::vector<GblPoint>, TMatrixD> > &aPointaAndTransList);
58  const std::vector<std::pair<std::vector<GblPoint>, TMatrixD> > &aPointaAndTransList,
59  const TMatrixD &extDerivatives, const TVectorD &extMeasurements,
60  const TVectorD &extPrecisions);
62  const std::vector<std::pair<std::vector<GblPoint>, TMatrixD> > &aPointaAndTransList,
63  const TMatrixD &extDerivatives, const TVectorD &extMeasurements,
64  const TMatrixDSym &extPrecisions);
65  virtual ~GblTrajectory();
66  bool isValid() const;
67  unsigned int getNumPoints() const;
68  unsigned int getResults(int aSignedLabel, TVectorD &localPar,
69  TMatrixDSym &localCov) const;
70  unsigned int getMeasResults(unsigned int aLabel, unsigned int &numRes,
71  TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors,
72  TVectorD &aDownWeights);
73  unsigned int getScatResults(unsigned int aLabel, unsigned int &numRes,
74  TVectorD &aResiduals, TVectorD &aMeasErrors, TVectorD &aResErrors,
75  TVectorD &aDownWeights);
76  unsigned int getLabels(std::vector<unsigned int> &aLabelList);
77  unsigned int getLabels(std::vector<std::vector<unsigned int> > &aLabelList);
78  unsigned int fit(double &Chi2, int &Ndf, double &lostWeight,
79  std::string optionList = "");
80  void milleOut(MilleBinary &aMille);
81  void printTrajectory(unsigned int level = 0);
82  void printPoints(unsigned int level = 0);
83  void printData();
84  std::vector<GblData> getData() {return theData;}
85 
86 private:
87  unsigned int numAllPoints;
88  std::vector<unsigned int> numPoints;
89  unsigned int numTrajectories;
90  unsigned int numOffsets;
91  unsigned int numInnerTrans;
92  unsigned int numCurvature;
93  unsigned int numParameters;
94  unsigned int numLocals;
95  unsigned int numMeasurements;
96  unsigned int externalPoint;
97  bool constructOK;
98  bool fitOK;
99  std::vector<unsigned int> theDimension;
100  std::vector<std::vector<GblPoint> > thePoints;
101  std::vector<GblData> theData;
102  std::vector<unsigned int> measDataIndex;
103  std::vector<unsigned int> scatDataIndex;
104  TMatrixDSym externalSeed;
105  std::vector<TMatrixD> innerTransformations;
106  // composed trajectory (from common external parameters)
107  TMatrixD externalDerivatives; // Derivatives for external measurements of composed trajectory
108  TVectorD externalMeasurements; // Residuals for external measurements of composed trajectory
109  TVectorD externalPrecisions; // Precisions for external measurements of composed trajectory
112 
113  std::pair<std::vector<unsigned int>, TMatrixD> getJacobian(
114  int aSignedLabel) const;
115  void getFitToLocalJacobian(std::vector<unsigned int> &anIndex,
116  SMatrix55 &aJacobian, const GblPoint &aPoint, unsigned int measDim,
117  unsigned int nJacobian = 1) const;
118  void getFitToKinkJacobian(std::vector<unsigned int> &anIndex,
119  SMatrix27 &aJacobian, const GblPoint &aPoint) const;
120  void construct();
121  void defineOffsets();
122  void calcJacobians();
123  void prepare();
125  void predict();
126  double downWeight(unsigned int aMethod);
127  void getResAndErr(unsigned int aData, double &aResidual,
128  double &aMeadsError, double &aResError, double &aDownWeight);
129 };
130 }
131 #endif /* GBLTRAJECTORY_H_ */