CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SurveyPxbImageLocalFit.h
Go to the documentation of this file.
1 #ifndef GUARD_surveypxbimagelocalfit_h
2 #define GUARD_surveypxbimagelocalfit_h
3 
4 #include <sstream>
5 #include <vector>
6 #include <utility>
9 #include "Math/SMatrix.h"
10 #include "Math/SVector.h"
11 #include <iostream>
12 
15 public:
16  typedef std::vector<value_t> localpars_t;
17  typedef std::vector<coord_t> fidpoint_t;
18  typedef unsigned int count_t;
19  static const count_t nGlD = 3; // no of global derivs
20  static const count_t nLcD = 4; // no of local derivs
21  static const count_t nMsrmts = 8; // no of measurements per image
22  static const count_t nLcPars = 4; // no of local parameters
23  static const count_t nFidpoints = 4; // no of fiducial points
24  // Typedefs for pede
25  typedef int pede_label_t;
26  typedef float pede_deriv_t;
27 
28  // Constructors
31  initFidPoints();
32  };
33 
35  SurveyPxbImageLocalFit(std::istringstream& iss)
37  initFidPoints();
38  };
39 
41  void doFit(const fidpoint_t& fidpointvec);
42  void doFit(const fidpoint_t& fidpointvec, const pede_label_t& label1, const pede_label_t& label2);
43  void doFit(value_t x1, value_t y1, value_t g1, value_t x2, value_t y2, value_t g2);
44 
46  bool isFitValid() { return fitValidFlag_; };
47 
50 
52  value_t getChi2();
53 
56  const pede_deriv_t* getLocalDerivsPtr(count_t i) { return localDerivsMatrix_.Array() + i * nLcD; };
57  const pede_deriv_t* getGlobalDerivsPtr(count_t i) { return globalDerivsMatrix_.Array() + i * nGlD; };
58  const pede_label_t* getGlobalDerivsLabelPtr(count_t i) { return i < 4 ? &labelVec1_[0] : &labelVec2_[0]; };
60  pede_deriv_t getSigma(count_t i) { return i % 2 ? sigma_x_ : sigma_y_; };
61 
64 
65 private:
68 
70  ROOT::Math::SVector<value_t, nMsrmts> r;
71 
73  //std::vector<localDerivs_t> globalDerivsVec_;
74  ROOT::Math::SMatrix<pede_deriv_t, nMsrmts, nGlD> globalDerivsMatrix_;
75 
77  //std::vector<globalDerivs_t> localDerivsVec_;
78  ROOT::Math::SMatrix<pede_deriv_t, nMsrmts, nLcD> localDerivsMatrix_;
79 
81  std::vector<pede_label_t> labelVec1_, labelVec2_;
82 
84  std::vector<coord_t> fidpoints_;
85 
88 
91 
94 
96  void initFidPoints() {
97  fidpoints_[0] = coord_t(-0.91, -3.30);
98  fidpoints_[1] = coord_t(+0.91, -3.30);
99  fidpoints_[2] = coord_t(-0.91, +3.30);
100  fidpoints_[3] = coord_t(+0.91, +3.30);
101  }
102 
104  value_t dist(const coord_t& p1, const coord_t& p2) {
105  value_t dx = p1.x() - p2.x();
106  value_t dy = p1.y() - p2.y();
107  return sqrt(dx * dx + dy * dy);
108  }
109 };
110 
111 #endif
bool isFitValid()
returns validity flag
std::vector< coord_t > fidpoint_t
static const count_t nLcPars
localpars_t getLocalParameters()
returns local parameters after fit
const TString p2
Definition: fwPaths.cc:13
bool fitValidFlag_
Validity Flag.
const pede_deriv_t * getLocalDerivsPtr(count_t i)
T y() const
Definition: PV3DBase.h:60
std::vector< pede_label_t > labelVec2_
value_t sigma_x_
Gaussian errors.
localpars_t a_
Local parameters.
Class to hold one picture of the BPix survey and the local fit.
static const count_t nFidpoints
value_t getChi2()
returns the chi^2 of the fit
ROOT::Math::SVector< value_t, nMsrmts > r
Vector of residuals.
Point3DBase< value_t, LocalTag > coord_t
T sqrt(T t)
Definition: SSEVec.h:19
static const count_t nGlD
pede_deriv_t getSigma(count_t i)
const TString p1
Definition: fwPaths.cc:12
static const count_t nLcD
pede_deriv_t getResiduum(count_t i)
const pede_deriv_t * getGlobalDerivsPtr(count_t i)
SurveyPxbImageLocalFit(std::istringstream &iss)
Constructor from istringstream.
std::vector< pede_label_t > labelVec1_
Vector with labels to global derivs.
void doFit(const fidpoint_t &fidpointvec)
Invoke the fit.
Class to hold one picture of the BPix survey.
value_t chi2_
chi2 of the local fit
value_t dist(const coord_t &p1, const coord_t &p2)
Distance.
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
std::vector< value_t > localpars_t
std::vector< coord_t > fidpoints_
True position of the fiducial points on a sensor wrt. local frame (u,v)
void initFidPoints()
Initialise the fiducial points.
static const count_t nMsrmts
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.
const pede_label_t * getGlobalDerivsLabelPtr(count_t i)
T x() const
Definition: PV3DBase.h:59