CMS 3D CMS Logo

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

Class to hold one picture of the BPix survey and the local fit. More...

#include <SurveyPxbImageLocalFit.h>

Inheritance diagram for SurveyPxbImageLocalFit:
SurveyPxbImage

Public Types

typedef unsigned int count_t
 
typedef std::vector< coord_tfidpoint_t
 
typedef std::vector< value_tlocalpars_t
 
typedef float pede_deriv_t
 
typedef int pede_label_t
 
- Public Types inherited from SurveyPxbImage
typedef Point3DBase< value_t,
LocalTag
coord_t
 
typedef unsigned int count_t
 
typedef unsigned int id_t
 
typedef std::pair< id_t, id_tidPair_t
 
enum  location { ll, ul, lr, ur }
 enum to help access specific locations on a picture More...
 
typedef double value_t
 

Public Member Functions

void doFit (const fidpoint_t &fidpointvec)
 Invoke the fit. More...
 
void doFit (const fidpoint_t &fidpointvec, const pede_label_t &label1, const pede_label_t &label2)
 
void doFit (value_t x1, value_t y1, value_t g1, value_t x2, value_t y2, value_t g2)
 
value_t getChi2 ()
 returns the chi^2 of the fit More...
 
const pede_label_tgetGlobalDerivsLabelPtr (count_t i)
 
const pede_deriv_tgetGlobalDerivsPtr (count_t i)
 
const pede_label_t getGlobalDerivsSize ()
 
const pede_deriv_tgetLocalDerivsPtr (count_t i)
 
const pede_label_t getLocalDerivsSize ()
 
localpars_t getLocalParameters ()
 returns local parameters after fit More...
 
const pede_deriv_t getResiduum (count_t i)
 
const pede_deriv_t getSigma (count_t i)
 
bool isFitValid ()
 returns validity flag More...
 
void setGlobalDerivsToZero (count_t i)
 
void setLocalDerivsToZero (count_t i)
 
 SurveyPxbImageLocalFit ()
 
 SurveyPxbImageLocalFit (std::istringstream &iss)
 Constructor from istringstream. More...
 
- Public Member Functions inherited from SurveyPxbImage
void fill (std::istringstream &iss)
 
const coord_t getCoord (count_t m)
 
const id_t getIdFirst ()
 Get Id of first module. More...
 
const idPair_t getIdPair ()
 Get Id pair. More...
 
const id_t getIdSecond ()
 Get Id of second module. More...
 
const value_t getSigmaX ()
 Get Gaussian error in u direction. More...
 
const value_t getSigmaY ()
 Get Gaussian error in u direction. More...
 
bool isValid ()
 returns validity flag More...
 
 SurveyPxbImage ()
 
 SurveyPxbImage (std::istringstream &iss)
 

Static Public Attributes

static const count_t nFidpoints = 4
 
static const count_t nGlD = 3
 
static const count_t nLcD = 4
 
static const count_t nLcPars = 4
 
static const count_t nMsrmts = 8
 

Private Member Functions

value_t dist (coord_t p1, coord_t p2)
 Distance. More...
 
void initFidPoints ()
 Initialise the fiducial points. More...
 

Private Attributes

localpars_t a_
 Local parameters. More...
 
value_t chi2_
 chi2 of the local fit More...
 
bool derivsValidFlag_
 
std::vector< coord_tfidpoints_
 True position of the fiducial points on a sensor wrt. local frame (u,v) More...
 
bool fitValidFlag_
 Validity Flag. More...
 
ROOT::Math::SMatrix
< pede_deriv_t, nMsrmts, nGlD
globalDerivsMatrix_
 Matrix with global derivs. More...
 
std::vector< pede_label_tlabelVec1_
 Vector with labels to global derivs. More...
 
std::vector< pede_label_tlabelVec2_
 
ROOT::Math::SMatrix
< pede_deriv_t, nMsrmts, nLcD
localDerivsMatrix_
 Matrix with local derivs. More...
 
ROOT::Math::SVector< value_t,
nMsrmts
r
 Vector of residuals. More...
 

Additional Inherited Members

- Protected Attributes inherited from SurveyPxbImage
idPair_t idPair_
 
bool isRotated_
 Flag if the image was rotated or not. More...
 
bool isValidFlag_
 Validity Flag. More...
 
std::vector< coord_tmeasurementVec_
 Vector to hold four measurements. More...
 
value_t sigma_x_
 Gaussian errors. More...
 
value_t sigma_y_
 

Detailed Description

Class to hold one picture of the BPix survey and the local fit.

Definition at line 14 of file SurveyPxbImageLocalFit.h.

Member Typedef Documentation

typedef unsigned int SurveyPxbImageLocalFit::count_t

Definition at line 19 of file SurveyPxbImageLocalFit.h.

Definition at line 18 of file SurveyPxbImageLocalFit.h.

Definition at line 17 of file SurveyPxbImageLocalFit.h.

Definition at line 27 of file SurveyPxbImageLocalFit.h.

Definition at line 26 of file SurveyPxbImageLocalFit.h.

Constructor & Destructor Documentation

SurveyPxbImageLocalFit::SurveyPxbImageLocalFit ( )
inline

Definition at line 30 of file SurveyPxbImageLocalFit.h.

References initFidPoints().

30  :
32  {
33  initFidPoints();
34  };
static const count_t nLcPars
bool fitValidFlag_
Validity Flag.
localpars_t a_
Local parameters.
static const count_t nFidpoints
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.
SurveyPxbImageLocalFit::SurveyPxbImageLocalFit ( std::istringstream &  iss)
inline

Constructor from istringstream.

Definition at line 37 of file SurveyPxbImageLocalFit.h.

References initFidPoints().

37  :
39  {
40  initFidPoints();
41  };
static const count_t nLcPars
bool fitValidFlag_
Validity Flag.
localpars_t a_
Local parameters.
static const count_t nFidpoints
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.

Member Function Documentation

value_t SurveyPxbImageLocalFit::dist ( coord_t  p1,
coord_t  p2 
)
inlineprivate

Distance.

Definition at line 108 of file SurveyPxbImageLocalFit.h.

References mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

109  {
110  value_t dx = p1.x()-p2.x();
111  value_t dy = p1.y()-p2.y();
112  return sqrt(dx*dx+dy*dy);
113  }
T sqrt(T t)
Definition: SSEVec.h:28
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
void SurveyPxbImageLocalFit::doFit ( const fidpoint_t fidpointvec)

Invoke the fit.

Definition at line 28 of file SurveyPxbImageLocalFit.cc.

References funct::A, a, a_, chi2_, funct::cos(), gather_cfg::cout, fidpoints_, fitValidFlag_, globalDerivsMatrix_, i, localDerivsMatrix_, SurveyPxbImage::measurementVec_, r, SurveyPxbImage::sigma_x_, SurveyPxbImage::sigma_y_, funct::sin(), mathSSE::sqrt(), and ExpressReco_HICollisions_FallBack::y.

Referenced by doFit().

29 {
30  fitValidFlag_ = false;
31 
32  // Calculate gamma of right module w.r.t left modules' fram
33  const value_t dxr = fidpointvec[3].x()-fidpointvec[2].x();
34  const value_t dyr = fidpointvec[3].y()-fidpointvec[2].y();
35  const value_t gammar = atan(dyr/dxr);
36  const value_t dxl = fidpointvec[1].x()-fidpointvec[0].x();
37  const value_t dyl = fidpointvec[1].y()-fidpointvec[0].y();
38  const value_t gammal = atan(dyl/dxl);
39  const value_t gamma = gammar-gammal;
40  //const value_t gamma = 0.; // Testhalber
41  const value_t sing = sin(gamma);
42  const value_t cosg = cos(gamma);
43 #ifdef DEBUG
44  std::cout << "gamma: " << gamma << " gamma left: " << gammal << " gamma right: " << gammar << std::endl;
45 #endif
46 
47 
48 #ifdef DEBUG
49  std::cout << "&fidpointvec: " << std::endl;
50  for (count_t i=0; i!=fidpointvec.size(); i++)
51  std::cout << i << ": " << fidpointvec[i] << std::endl;
52  std::cout << "&fidpoints_: " << std::endl;
53  for (count_t i=0; i!=fidpoints_.size(); i++)
54  std::cout << i << ": " << fidpoints_[i] << std::endl;
55 #endif
56 
57  // Matrix of the local derivatives
58  ROOT::Math::SMatrix<value_t,nMsrmts,nLcD> A; // 8x4
59  A(0,0)=1.; A(0,1)=0; A(0,2)=+fidpointvec[0].x(); A(0,3)=+fidpointvec[0].y();
60  A(1,0)=0.; A(1,1)=1; A(1,2)=+fidpointvec[0].y(); A(1,3)=-fidpointvec[0].x();
61  A(2,0)=1.; A(2,1)=0; A(2,2)=+fidpointvec[1].x(); A(2,3)=+fidpointvec[1].y();
62  A(3,0)=0.; A(3,1)=1; A(3,2)=+fidpointvec[1].y(); A(3,3)=-fidpointvec[1].x();
63  A(4,0)=1.; A(4,1)=0; A(4,2)=+fidpointvec[2].x(); A(4,3)=+fidpointvec[2].y();
64  A(5,0)=0.; A(5,1)=1; A(5,2)=+fidpointvec[2].y(); A(5,3)=-fidpointvec[2].x();
65  A(6,0)=1.; A(6,1)=0; A(6,2)=+fidpointvec[3].x(); A(6,3)=+fidpointvec[3].y();
66  A(7,0)=0.; A(7,1)=1; A(7,2)=+fidpointvec[3].y(); A(7,3)=-fidpointvec[3].x();
67 #ifdef DEBUG
68  std::cout << "A: \n" << A << std::endl;
69 #endif
70 
71  // Covariance matrix
72  ROOT::Math::SMatrix<value_t,nMsrmts,nMsrmts> W; // 8x8
73  //ROOT::Math::MatRepSym<value_t,8> W;
74  const value_t sigma_x2inv = 1./(sigma_x_*sigma_x_);
75  const value_t sigma_y2inv = 1./(sigma_y_*sigma_y_);
76  W(0,0) = sigma_x2inv;
77  W(1,1) = sigma_y2inv;
78  W(2,2) = sigma_x2inv;
79  W(3,3) = sigma_y2inv;
80  W(4,4) = sigma_x2inv;
81  W(5,5) = sigma_y2inv;
82  W(6,6) = sigma_x2inv;
83  W(7,7) = sigma_y2inv;
84 #ifdef DEBUG
85  std::cout << "W: \n" << W << std::endl;
86 #endif
87 
88  // Prepare for the fit
89  ROOT::Math::SMatrix<value_t,nLcD,nLcD> ATWA; // 4x4
90  ATWA = ROOT::Math::Transpose(A) * W * A;
91  //ATWA = ROOT::Math::SimilarityT(A,W); // W muss symmterisch sein -> aendern.
92  //std::cout << "ATWA: \n" << ATWA << std::endl;
93  ROOT::Math::SMatrix<value_t,nLcD,nLcD> ATWAi; // 4x4
94  int ifail = 0;
95  ATWAi = ATWA.Inverse(ifail);
96  if (ifail != 0)
97  { // TODO: ifail Pruefung auf message logger ausgeben statt cout
98  std::cout << "Problem singular - fit impossible." << std::endl;
99  fitValidFlag_ = false;
100  return;
101  }
102 #ifdef DEBUG
103  std::cout << "ATWA-1: \n" << ATWAi << ifail << std::endl;
104 #endif
105 
106  // Measurements
107  ROOT::Math::SVector<value_t,nMsrmts> y; // 8
108  y(0) = measurementVec_[0].x();
109  y(1) = measurementVec_[0].y();
110  y(2) = measurementVec_[1].x();
111  y(3) = measurementVec_[1].y();
112  y(4) = measurementVec_[2].x();
113  y(5) = measurementVec_[2].y();
114  y(6) = measurementVec_[3].x();
115  y(7) = measurementVec_[3].y();
116 #ifdef DEBUG
117  std::cout << "y: " << y << std::endl;
118 #endif
119 
120  // do the fit
121  ROOT::Math::SVector<value_t,nLcD> a; // 4
122  a = ATWAi * ROOT::Math::Transpose(A) * W * y;
123  chi2_ = ROOT::Math::Dot(y,W*y)-ROOT::Math::Dot(a,ROOT::Math::Transpose(A)*W*y);
124 #ifdef DEBUG
125  std::cout << "a: " << a
126  << " S= " << sqrt(a[2]*a[2]+a[3]*a[3])
127  << " phi= " << atan(a[3]/a[2])
128  << " chi2= " << chi2_ << std::endl;
129  std::cout << "A*a: " << A*a << std::endl;
130 #endif
131  a_.assign(a.begin(),a.end());
132 
133  // Calculate vector of residuals
134  r = y - A*a;
135 #ifdef DEBUG
136  std::cout << "r: " << r << std::endl;
137 #endif
138 
139  // Fill matrix for global fit with local derivatives
140  localDerivsMatrix_(0,0)=1.; localDerivsMatrix_(0,1)=0;
141  localDerivsMatrix_(1,0)=0.; localDerivsMatrix_(1,1)=1;
142  localDerivsMatrix_(2,0)=1.; localDerivsMatrix_(2,1)=0;
143  localDerivsMatrix_(3,0)=0.; localDerivsMatrix_(3,1)=1;
144  localDerivsMatrix_(4,0)=1.; localDerivsMatrix_(4,1)=0;
145  localDerivsMatrix_(5,0)=0.; localDerivsMatrix_(5,1)=1;
146  localDerivsMatrix_(6,0)=1.; localDerivsMatrix_(6,1)=0;
147  localDerivsMatrix_(7,0)=0.; localDerivsMatrix_(7,1)=1;
148  localDerivsMatrix_(0,2)=+fidpointvec[0].x()+cosg*fidpoints_[0].x()-sing*fidpoints_[0].y();
149  localDerivsMatrix_(0,3)=+fidpointvec[0].y()+cosg*fidpoints_[0].y()+sing*fidpoints_[0].x();
150  localDerivsMatrix_(1,2)=+fidpointvec[0].y()+cosg*fidpoints_[0].y()+sing*fidpoints_[0].x();
151  localDerivsMatrix_(1,3)=-fidpointvec[0].x()-cosg*fidpoints_[0].x()+sing*fidpoints_[0].y();
152  localDerivsMatrix_(2,2)=+fidpointvec[1].x()+cosg*fidpoints_[1].x()-sing*fidpoints_[1].y();
153  localDerivsMatrix_(2,3)=+fidpointvec[1].y()+cosg*fidpoints_[1].y()+sing*fidpoints_[1].x();
154  localDerivsMatrix_(3,2)=+fidpointvec[1].y()+cosg*fidpoints_[1].y()+sing*fidpoints_[1].x();
155  localDerivsMatrix_(3,3)=-fidpointvec[1].x()-cosg*fidpoints_[1].x()+sing*fidpoints_[1].y();
156  localDerivsMatrix_(4,2)=+fidpointvec[2].x()+cosg*fidpoints_[2].x()-sing*fidpoints_[2].y();
157  localDerivsMatrix_(4,3)=+fidpointvec[2].y()+cosg*fidpoints_[2].y()+sing*fidpoints_[2].x();
158  localDerivsMatrix_(5,2)=+fidpointvec[2].y()+cosg*fidpoints_[2].y()+sing*fidpoints_[2].x();
159  localDerivsMatrix_(5,3)=-fidpointvec[2].x()-cosg*fidpoints_[2].x()+sing*fidpoints_[2].y();
160  localDerivsMatrix_(6,2)=+fidpointvec[3].x()+cosg*fidpoints_[3].x()-sing*fidpoints_[3].y();
161  localDerivsMatrix_(6,3)=+fidpointvec[3].y()+cosg*fidpoints_[3].y()+sing*fidpoints_[3].x();
162  localDerivsMatrix_(7,2)=+fidpointvec[3].y()+cosg*fidpoints_[3].y()+sing*fidpoints_[3].x();
163  localDerivsMatrix_(7,3)=-fidpointvec[3].x()-cosg*fidpoints_[3].x()+sing*fidpoints_[3].y();
164 
165  // Fill vector with global derivatives and labels (8x3)
166  globalDerivsMatrix_(0,0) = +a(2);
167  globalDerivsMatrix_(0,1) = +a(3);
168  globalDerivsMatrix_(0,2) = +cosg*(a(3)*fidpoints_[0].x()-a(2)*fidpoints_[0].y())
169  -sing*(a(2)*fidpoints_[0].x()+a(3)*fidpoints_[0].y());
170  globalDerivsMatrix_(1,0) = -a(3);
171  globalDerivsMatrix_(1,1) = +a(2);
172  globalDerivsMatrix_(1,2) = +cosg*(a(2)*fidpoints_[0].x()+a(3)*fidpoints_[0].y())
173  -sing*(a(2)*fidpoints_[0].y()-a(3)*fidpoints_[0].x());
174  globalDerivsMatrix_(2,0) = +a(2);
175  globalDerivsMatrix_(2,1) = +a(3);
176  globalDerivsMatrix_(2,2) = +cosg*(a(3)*fidpoints_[1].x()-a(2)*fidpoints_[1].y())
177  -sing*(a(2)*fidpoints_[1].x()+a(3)*fidpoints_[1].y());
178  globalDerivsMatrix_(3,0) = -a(3);
179  globalDerivsMatrix_(3,1) = +a(2);
180  globalDerivsMatrix_(3,2) = +cosg*(a(2)*fidpoints_[1].x()+a(3)*fidpoints_[1].y())
181  -sing*(a(2)*fidpoints_[1].y()-a(3)*fidpoints_[1].x());
182 
183  globalDerivsMatrix_(4,0) = +a(2);
184  globalDerivsMatrix_(4,1) = +a(3);
185  globalDerivsMatrix_(4,2) = +cosg*(a(3)*fidpoints_[2].x()-a(2)*fidpoints_[2].y())
186  -sing*(a(2)*fidpoints_[2].x()+a(3)*fidpoints_[2].y());
187  globalDerivsMatrix_(5,0) = -a(3);
188  globalDerivsMatrix_(5,1) = +a(2);
189  globalDerivsMatrix_(5,2) = +cosg*(a(2)*fidpoints_[2].x()+a(3)*fidpoints_[2].y())
190  -sing*(a(2)*fidpoints_[2].y()-a(3)*fidpoints_[2].x());
191  globalDerivsMatrix_(6,0) = +a(2);
192  globalDerivsMatrix_(6,1) = +a(3);
193  globalDerivsMatrix_(6,2) = +cosg*(a(3)*fidpoints_[3].x()-a(2)*fidpoints_[3].y())
194  -sing*(a(2)*fidpoints_[3].x()+a(3)*fidpoints_[3].y());
195  globalDerivsMatrix_(7,0) = -a(3);
196  globalDerivsMatrix_(7,1) = +a(2);
197  globalDerivsMatrix_(7,2) = +cosg*(a(2)*fidpoints_[3].x()+a(3)*fidpoints_[3].y())
198  -sing*(a(2)*fidpoints_[3].y()-a(3)*fidpoints_[3].x());
199 
200  fitValidFlag_ = true;
201 }
int i
Definition: DBlmapReader.cc:9
bool fitValidFlag_
Validity Flag.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
value_t sigma_x_
Gaussian errors.
localpars_t a_
Local parameters.
ROOT::Math::SVector< value_t, nMsrmts > r
Vector of residuals.
T sqrt(T t)
Definition: SSEVec.h:28
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
value_t chi2_
chi2 of the local fit
std::vector< coord_t > fidpoints_
True position of the fiducial points on a sensor wrt. local frame (u,v)
std::vector< coord_t > measurementVec_
Vector to hold four measurements.
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:41
void SurveyPxbImageLocalFit::doFit ( const fidpoint_t fidpointvec,
const pede_label_t label1,
const pede_label_t label2 
)

Definition at line 15 of file SurveyPxbImageLocalFit.cc.

References doFit(), labelVec1_, and labelVec2_.

16 {
17  labelVec1_.clear();
18  labelVec1_.push_back(label1+0);
19  labelVec1_.push_back(label1+1);
20  labelVec1_.push_back(label1+5);
21  labelVec2_.clear();
22  labelVec2_.push_back(label2+0);
23  labelVec2_.push_back(label2+1);
24  labelVec2_.push_back(label2+5);
25  doFit(fidpointvec);
26 }
std::vector< pede_label_t > labelVec2_
std::vector< pede_label_t > labelVec1_
Vector with labels to global derivs.
void doFit(const fidpoint_t &fidpointvec)
Invoke the fit.
void SurveyPxbImageLocalFit::doFit ( value_t  x1,
value_t  y1,
value_t  g1,
value_t  x2,
value_t  y2,
value_t  g2 
)

Definition at line 204 of file SurveyPxbImageLocalFit.cc.

References funct::cos(), doFit(), fidpoints_, and funct::sin().

205 {
206  // Creating vectors with the global parameters of the two modules
207  ROOT::Math::SVector<value_t,4> mod1, mod2;
208  mod1(0)=u1;
209  mod1(1)=v1;
210  mod1(2)=cos(g1);
211  mod1(3)=sin(g1);
212  mod2(0)=u2;
213  mod2(1)=v2;
214  mod2(2)=cos(g2);
215  mod2(3)=sin(g2);
216  //std::cout << "mod1: " << mod1 << std::endl;
217  //std::cout << "mod2: " << mod2 << std::endl;
218 
219  // Create a matrix for the transformed position of the fidpoints
220  ROOT::Math::SMatrix<value_t,4,4> M1, M2;
221  M1(0,0)=1.; M1(0,1)=0.; M1(0,2)=+fidpoints_[0].x(); M1(0,3)=-fidpoints_[0].y();
222  M1(1,0)=0.; M1(1,1)=1.; M1(1,2)=+fidpoints_[0].y(); M1(1,3)=+fidpoints_[0].x();
223  M1(2,0)=1.; M1(2,1)=0.; M1(2,2)=+fidpoints_[1].x(); M1(2,3)=-fidpoints_[1].y();
224  M1(3,0)=0.; M1(3,1)=1.; M1(3,2)=+fidpoints_[1].y(); M1(3,3)=+fidpoints_[1].x();
225  M2(0,0)=1.; M2(0,1)=0.; M2(0,2)=+fidpoints_[2].x(); M2(0,3)=-fidpoints_[2].y();
226  M2(1,0)=0.; M2(1,1)=1.; M2(1,2)=+fidpoints_[2].y(); M2(1,3)=+fidpoints_[2].x();
227  M2(2,0)=1.; M2(2,1)=0.; M2(2,2)=+fidpoints_[3].x(); M2(2,3)=-fidpoints_[3].y();
228  M2(3,0)=0.; M2(3,1)=1.; M2(3,2)=+fidpoints_[3].y(); M2(3,3)=+fidpoints_[3].x();
229 
230  //std::cout << "M1:\n" << M1 << std::endl;
231  //std::cout << "M2:\n" << M2 << std::endl;
232 
233  ROOT::Math::SVector<value_t,4> mod_tr1, mod_tr2;
234  mod_tr1 = M1*mod2;
235  mod_tr2 = M2*mod1;
236  //std::cout << "mod_tr1: " << mod_tr1 << std::endl;
237  //std::cout << "mod_tr2: " << mod_tr2 << std::endl;
238 
239  fidpoint_t fidpointvec;
240  fidpointvec.push_back(coord_t(mod_tr1(0),mod_tr1(1)));
241  fidpointvec.push_back(coord_t(mod_tr1(2),mod_tr1(3)));
242  fidpointvec.push_back(coord_t(mod_tr2(0),mod_tr2(1)));
243  fidpointvec.push_back(coord_t(mod_tr2(2),mod_tr2(3)));
244 
245  doFit(fidpointvec);
246 }
std::vector< coord_t > fidpoint_t
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Point3DBase< value_t, LocalTag > coord_t
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void doFit(const fidpoint_t &fidpointvec)
Invoke the fit.
std::vector< coord_t > fidpoints_
True position of the fiducial points on a sensor wrt. local frame (u,v)
SurveyPxbImageLocalFit::value_t SurveyPxbImageLocalFit::getChi2 ( )

returns the chi^2 of the fit

Definition at line 254 of file SurveyPxbImageLocalFit.cc.

References chi2_, and fitValidFlag_.

255 {
256  if (!fitValidFlag_) throw std::logic_error("SurveyPxbImageLocalFit::getChi2(): Fit is not valid. Call doFit(...) before calling this function.");
257  return chi2_;
258 }
bool fitValidFlag_
Validity Flag.
value_t chi2_
chi2 of the local fit
const pede_label_t* SurveyPxbImageLocalFit::getGlobalDerivsLabelPtr ( count_t  i)
inline

Definition at line 61 of file SurveyPxbImageLocalFit.h.

References labelVec1_, and labelVec2_.

61 {return i<4 ? &labelVec1_[0] : &labelVec2_[0];};
std::vector< pede_label_t > labelVec2_
std::vector< pede_label_t > labelVec1_
Vector with labels to global derivs.
const pede_deriv_t* SurveyPxbImageLocalFit::getGlobalDerivsPtr ( count_t  i)
inline

Definition at line 60 of file SurveyPxbImageLocalFit.h.

References globalDerivsMatrix_, and nGlD.

60 {return globalDerivsMatrix_.Array()+i*nGlD;};
static const count_t nGlD
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
const pede_label_t SurveyPxbImageLocalFit::getGlobalDerivsSize ( )
inline

Definition at line 58 of file SurveyPxbImageLocalFit.h.

References nGlD.

58 {return nGlD; };
static const count_t nGlD
const pede_deriv_t* SurveyPxbImageLocalFit::getLocalDerivsPtr ( count_t  i)
inline

Definition at line 59 of file SurveyPxbImageLocalFit.h.

References localDerivsMatrix_, and nLcD.

59 {return localDerivsMatrix_.Array()+i*nLcD; };
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.
static const count_t nLcD
const pede_label_t SurveyPxbImageLocalFit::getLocalDerivsSize ( )
inline

Definition at line 57 of file SurveyPxbImageLocalFit.h.

References nLcD.

57 {return nLcD; };
static const count_t nLcD
SurveyPxbImageLocalFit::localpars_t SurveyPxbImageLocalFit::getLocalParameters ( )

returns local parameters after fit

Definition at line 248 of file SurveyPxbImageLocalFit.cc.

References a_, and fitValidFlag_.

249 {
250  if (!fitValidFlag_) throw std::logic_error("SurveyPxbImageLocalFit::getLocalParameters(): Fit is not valid. Call doFit(...) before calling this function.");
251  return a_;
252 }
bool fitValidFlag_
Validity Flag.
localpars_t a_
Local parameters.
const pede_deriv_t SurveyPxbImageLocalFit::getResiduum ( count_t  i)
inline

Definition at line 62 of file SurveyPxbImageLocalFit.h.

References r.

62 { return (pede_deriv_t) r(i); };
ROOT::Math::SVector< value_t, nMsrmts > r
Vector of residuals.
const pede_deriv_t SurveyPxbImageLocalFit::getSigma ( count_t  i)
inline

Definition at line 63 of file SurveyPxbImageLocalFit.h.

References SurveyPxbImage::sigma_x_, and SurveyPxbImage::sigma_y_.

63 { return i%2 ? sigma_x_ : sigma_y_ ; };
value_t sigma_x_
Gaussian errors.
void SurveyPxbImageLocalFit::initFidPoints ( )
inlineprivate

Initialise the fiducial points.

Definition at line 99 of file SurveyPxbImageLocalFit.h.

References fidpoints_.

Referenced by SurveyPxbImageLocalFit().

100  {
101  fidpoints_[0] = coord_t(-0.91,-3.30);
102  fidpoints_[1] = coord_t(+0.91,-3.30);
103  fidpoints_[2] = coord_t(-0.91,+3.30);
104  fidpoints_[3] = coord_t(+0.91,+3.30);
105  }
Point3DBase< value_t, LocalTag > coord_t
std::vector< coord_t > fidpoints_
True position of the fiducial points on a sensor wrt. local frame (u,v)
bool SurveyPxbImageLocalFit::isFitValid ( )
inline

returns validity flag

Definition at line 49 of file SurveyPxbImageLocalFit.h.

References fitValidFlag_.

49 { return fitValidFlag_; };
bool fitValidFlag_
Validity Flag.
void SurveyPxbImageLocalFit::setGlobalDerivsToZero ( count_t  i)

Definition at line 267 of file SurveyPxbImageLocalFit.cc.

References globalDerivsMatrix_, i, nGlD, and nMsrmts.

268 {
269  if (!(j < nGlD)) throw std::range_error("SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");
270  for(count_t i=0; i!=nMsrmts; i++)
271  globalDerivsMatrix_(i,j)=0;
272 }
static const count_t nGlD
int j
Definition: DBlmapReader.cc:9
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
static const count_t nMsrmts
void SurveyPxbImageLocalFit::setLocalDerivsToZero ( count_t  i)

Definition at line 260 of file SurveyPxbImageLocalFit.cc.

References i, localDerivsMatrix_, nLcD, and nMsrmts.

261 {
262  if (!(j < nLcD)) throw std::range_error("SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");
263  for(count_t i=0; i!=nMsrmts; i++)
264  localDerivsMatrix_(i,j)=0;
265 }
int j
Definition: DBlmapReader.cc:9
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.
static const count_t nLcD
static const count_t nMsrmts

Member Data Documentation

localpars_t SurveyPxbImageLocalFit::a_
private

Local parameters.

Definition at line 70 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getLocalParameters().

value_t SurveyPxbImageLocalFit::chi2_
private

chi2 of the local fit

Definition at line 90 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getChi2().

bool SurveyPxbImageLocalFit::derivsValidFlag_
private

Definition at line 96 of file SurveyPxbImageLocalFit.h.

std::vector<coord_t> SurveyPxbImageLocalFit::fidpoints_
private

True position of the fiducial points on a sensor wrt. local frame (u,v)

Definition at line 87 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and initFidPoints().

bool SurveyPxbImageLocalFit::fitValidFlag_
private

Validity Flag.

Definition at line 93 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), getChi2(), getLocalParameters(), and isFitValid().

ROOT::Math::SMatrix<pede_deriv_t,nMsrmts,nGlD> SurveyPxbImageLocalFit::globalDerivsMatrix_
private

Matrix with global derivs.

Definition at line 77 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), getGlobalDerivsPtr(), and setGlobalDerivsToZero().

std::vector<pede_label_t> SurveyPxbImageLocalFit::labelVec1_
private

Vector with labels to global derivs.

Definition at line 84 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getGlobalDerivsLabelPtr().

std::vector<pede_label_t> SurveyPxbImageLocalFit::labelVec2_
private

Definition at line 84 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getGlobalDerivsLabelPtr().

ROOT::Math::SMatrix<pede_deriv_t,nMsrmts,nLcD> SurveyPxbImageLocalFit::localDerivsMatrix_
private

Matrix with local derivs.

Definition at line 81 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), getLocalDerivsPtr(), and setLocalDerivsToZero().

const count_t SurveyPxbImageLocalFit::nFidpoints = 4
static

Definition at line 24 of file SurveyPxbImageLocalFit.h.

const count_t SurveyPxbImageLocalFit::nGlD = 3
static
const count_t SurveyPxbImageLocalFit::nLcD = 4
static
const count_t SurveyPxbImageLocalFit::nLcPars = 4
static

Definition at line 23 of file SurveyPxbImageLocalFit.h.

const count_t SurveyPxbImageLocalFit::nMsrmts = 8
static
ROOT::Math::SVector<value_t, nMsrmts> SurveyPxbImageLocalFit::r
private

Vector of residuals.

Definition at line 73 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getResiduum().