CMS 3D CMS Logo

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, LocalTagcoord_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)
 
pede_label_t getGlobalDerivsSize ()
 
const pede_deriv_tgetLocalDerivsPtr (count_t i)
 
pede_label_t getLocalDerivsSize ()
 
localpars_t getLocalParameters ()
 returns local parameters after fit More...
 
pede_deriv_t getResiduum (count_t i)
 
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)
 
id_t getIdFirst ()
 Get Id of first module. More...
 
const idPair_t getIdPair ()
 Get Id pair. More...
 
id_t getIdSecond ()
 Get Id of second module. More...
 
value_t getSigmaX ()
 Get Gaussian error in u direction. More...
 
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 (const coord_t &p1, const 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, nGlDglobalDerivsMatrix_
 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, nLcDlocalDerivsMatrix_
 Matrix with local derivs. More...
 
ROOT::Math::SVector< value_t, nMsrmtsr
 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

◆ count_t

typedef unsigned int SurveyPxbImageLocalFit::count_t

Definition at line 18 of file SurveyPxbImageLocalFit.h.

◆ fidpoint_t

Definition at line 17 of file SurveyPxbImageLocalFit.h.

◆ localpars_t

Definition at line 16 of file SurveyPxbImageLocalFit.h.

◆ pede_deriv_t

Definition at line 26 of file SurveyPxbImageLocalFit.h.

◆ pede_label_t

Definition at line 25 of file SurveyPxbImageLocalFit.h.

Constructor & Destructor Documentation

◆ SurveyPxbImageLocalFit() [1/2]

SurveyPxbImageLocalFit::SurveyPxbImageLocalFit ( )
inline

Definition at line 29 of file SurveyPxbImageLocalFit.h.

References initFidPoints().

31  initFidPoints();
32  };
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() [2/2]

SurveyPxbImageLocalFit::SurveyPxbImageLocalFit ( std::istringstream &  iss)
inline

Constructor from istringstream.

Definition at line 35 of file SurveyPxbImageLocalFit.h.

References initFidPoints().

37  initFidPoints();
38  };
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

◆ dist()

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

Distance.

Definition at line 104 of file SurveyPxbImageLocalFit.h.

References PVValHelper::dx, PVValHelper::dy, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, and mathSSE::sqrt().

104  {
105  value_t dx = p1.x() - p2.x();
106  value_t dy = p1.y() - p2.y();
107  return sqrt(dx * dx + dy * dy);
108  }
T sqrt(T t)
Definition: SSEVec.h:19

◆ doFit() [1/3]

void SurveyPxbImageLocalFit::doFit ( const fidpoint_t fidpointvec)

Invoke the fit.

Definition at line 29 of file SurveyPxbImageLocalFit.cc.

References A, a, a_, chi2_, funct::cos(), gather_cfg::cout, fidpoints_, fitValidFlag_, CustomPhysics_cfi::gamma, globalDerivsMatrix_, mps_fire::i, localDerivsMatrix_, SurveyPxbImage::measurementVec_, r, SurveyPxbImage::sigma_x_, SurveyPxbImage::sigma_y_, funct::sin(), mathSSE::sqrt(), and 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 #ifdef DEBUG
48  std::cout << "&fidpointvec: " << std::endl;
49  for (count_t i = 0; i != fidpointvec.size(); i++)
50  std::cout << i << ": " << fidpointvec[i] << std::endl;
51  std::cout << "&fidpoints_: " << std::endl;
52  for (count_t i = 0; i != fidpoints_.size(); i++)
53  std::cout << i << ": " << fidpoints_[i] << std::endl;
54 #endif
55 
56  // Matrix of the local derivatives
57  ROOT::Math::SMatrix<value_t, nMsrmts, nLcD> A; // 8x4
58  A(0, 0) = 1.;
59  A(0, 1) = 0;
60  A(0, 2) = +fidpointvec[0].x();
61  A(0, 3) = +fidpointvec[0].y();
62  A(1, 0) = 0.;
63  A(1, 1) = 1;
64  A(1, 2) = +fidpointvec[0].y();
65  A(1, 3) = -fidpointvec[0].x();
66  A(2, 0) = 1.;
67  A(2, 1) = 0;
68  A(2, 2) = +fidpointvec[1].x();
69  A(2, 3) = +fidpointvec[1].y();
70  A(3, 0) = 0.;
71  A(3, 1) = 1;
72  A(3, 2) = +fidpointvec[1].y();
73  A(3, 3) = -fidpointvec[1].x();
74  A(4, 0) = 1.;
75  A(4, 1) = 0;
76  A(4, 2) = +fidpointvec[2].x();
77  A(4, 3) = +fidpointvec[2].y();
78  A(5, 0) = 0.;
79  A(5, 1) = 1;
80  A(5, 2) = +fidpointvec[2].y();
81  A(5, 3) = -fidpointvec[2].x();
82  A(6, 0) = 1.;
83  A(6, 1) = 0;
84  A(6, 2) = +fidpointvec[3].x();
85  A(6, 3) = +fidpointvec[3].y();
86  A(7, 0) = 0.;
87  A(7, 1) = 1;
88  A(7, 2) = +fidpointvec[3].y();
89  A(7, 3) = -fidpointvec[3].x();
90 #ifdef DEBUG
91  std::cout << "A: \n" << A << std::endl;
92 #endif
93 
94  // Covariance matrix
95  ROOT::Math::SMatrix<value_t, nMsrmts, nMsrmts> W; // 8x8
96  //ROOT::Math::MatRepSym<value_t,8> W;
97  const value_t sigma_x2inv = 1. / (sigma_x_ * sigma_x_);
98  const value_t sigma_y2inv = 1. / (sigma_y_ * sigma_y_);
99  W(0, 0) = sigma_x2inv;
100  W(1, 1) = sigma_y2inv;
101  W(2, 2) = sigma_x2inv;
102  W(3, 3) = sigma_y2inv;
103  W(4, 4) = sigma_x2inv;
104  W(5, 5) = sigma_y2inv;
105  W(6, 6) = sigma_x2inv;
106  W(7, 7) = sigma_y2inv;
107 #ifdef DEBUG
108  std::cout << "W: \n" << W << std::endl;
109 #endif
110 
111  // Prepare for the fit
112  ROOT::Math::SMatrix<value_t, nLcD, nLcD> ATWA; // 4x4
113  ATWA = ROOT::Math::Transpose(A) * W * A;
114  //ATWA = ROOT::Math::SimilarityT(A,W); // W muss symmterisch sein -> aendern.
115  //std::cout << "ATWA: \n" << ATWA << std::endl;
116  ROOT::Math::SMatrix<value_t, nLcD, nLcD> ATWAi; // 4x4
117  int ifail = 0;
118  ATWAi = ATWA.Inverse(ifail);
119  if (ifail != 0) { // TODO: ifail Pruefung auf message logger ausgeben statt cout
120  std::cout << "Problem singular - fit impossible." << std::endl;
121  fitValidFlag_ = false;
122  return;
123  }
124 #ifdef DEBUG
125  std::cout << "ATWA-1: \n" << ATWAi << ifail << std::endl;
126 #endif
127 
128  // Measurements
129  ROOT::Math::SVector<value_t, nMsrmts> y; // 8
130  y(0) = measurementVec_[0].x();
131  y(1) = measurementVec_[0].y();
132  y(2) = measurementVec_[1].x();
133  y(3) = measurementVec_[1].y();
134  y(4) = measurementVec_[2].x();
135  y(5) = measurementVec_[2].y();
136  y(6) = measurementVec_[3].x();
137  y(7) = measurementVec_[3].y();
138 #ifdef DEBUG
139  std::cout << "y: " << y << std::endl;
140 #endif
141 
142  // do the fit
143  ROOT::Math::SVector<value_t, nLcD> a; // 4
144  a = ATWAi * ROOT::Math::Transpose(A) * W * y;
145  chi2_ = ROOT::Math::Dot(y, W * y) - ROOT::Math::Dot(a, ROOT::Math::Transpose(A) * W * y);
146 #ifdef DEBUG
147  std::cout << "a: " << a << " S= " << sqrt(a[2] * a[2] + a[3] * a[3]) << " phi= " << atan(a[3] / a[2])
148  << " chi2= " << chi2_ << std::endl;
149  std::cout << "A*a: " << A * a << std::endl;
150 #endif
151  a_.assign(a.begin(), a.end());
152 
153  // Calculate vector of residuals
154  r = y - A * a;
155 #ifdef DEBUG
156  std::cout << "r: " << r << std::endl;
157 #endif
158 
159  // Fill matrix for global fit with local derivatives
160  localDerivsMatrix_(0, 0) = 1.;
161  localDerivsMatrix_(0, 1) = 0;
162  localDerivsMatrix_(1, 0) = 0.;
163  localDerivsMatrix_(1, 1) = 1;
164  localDerivsMatrix_(2, 0) = 1.;
165  localDerivsMatrix_(2, 1) = 0;
166  localDerivsMatrix_(3, 0) = 0.;
167  localDerivsMatrix_(3, 1) = 1;
168  localDerivsMatrix_(4, 0) = 1.;
169  localDerivsMatrix_(4, 1) = 0;
170  localDerivsMatrix_(5, 0) = 0.;
171  localDerivsMatrix_(5, 1) = 1;
172  localDerivsMatrix_(6, 0) = 1.;
173  localDerivsMatrix_(6, 1) = 0;
174  localDerivsMatrix_(7, 0) = 0.;
175  localDerivsMatrix_(7, 1) = 1;
176  localDerivsMatrix_(0, 2) = +fidpointvec[0].x() + cosg * fidpoints_[0].x() - sing * fidpoints_[0].y();
177  localDerivsMatrix_(0, 3) = +fidpointvec[0].y() + cosg * fidpoints_[0].y() + sing * fidpoints_[0].x();
178  localDerivsMatrix_(1, 2) = +fidpointvec[0].y() + cosg * fidpoints_[0].y() + sing * fidpoints_[0].x();
179  localDerivsMatrix_(1, 3) = -fidpointvec[0].x() - cosg * fidpoints_[0].x() + sing * fidpoints_[0].y();
180  localDerivsMatrix_(2, 2) = +fidpointvec[1].x() + cosg * fidpoints_[1].x() - sing * fidpoints_[1].y();
181  localDerivsMatrix_(2, 3) = +fidpointvec[1].y() + cosg * fidpoints_[1].y() + sing * fidpoints_[1].x();
182  localDerivsMatrix_(3, 2) = +fidpointvec[1].y() + cosg * fidpoints_[1].y() + sing * fidpoints_[1].x();
183  localDerivsMatrix_(3, 3) = -fidpointvec[1].x() - cosg * fidpoints_[1].x() + sing * fidpoints_[1].y();
184  localDerivsMatrix_(4, 2) = +fidpointvec[2].x() + cosg * fidpoints_[2].x() - sing * fidpoints_[2].y();
185  localDerivsMatrix_(4, 3) = +fidpointvec[2].y() + cosg * fidpoints_[2].y() + sing * fidpoints_[2].x();
186  localDerivsMatrix_(5, 2) = +fidpointvec[2].y() + cosg * fidpoints_[2].y() + sing * fidpoints_[2].x();
187  localDerivsMatrix_(5, 3) = -fidpointvec[2].x() - cosg * fidpoints_[2].x() + sing * fidpoints_[2].y();
188  localDerivsMatrix_(6, 2) = +fidpointvec[3].x() + cosg * fidpoints_[3].x() - sing * fidpoints_[3].y();
189  localDerivsMatrix_(6, 3) = +fidpointvec[3].y() + cosg * fidpoints_[3].y() + sing * fidpoints_[3].x();
190  localDerivsMatrix_(7, 2) = +fidpointvec[3].y() + cosg * fidpoints_[3].y() + sing * fidpoints_[3].x();
191  localDerivsMatrix_(7, 3) = -fidpointvec[3].x() - cosg * fidpoints_[3].x() + sing * fidpoints_[3].y();
192 
193  // Fill vector with global derivatives and labels (8x3)
194  globalDerivsMatrix_(0, 0) = +a(2);
195  globalDerivsMatrix_(0, 1) = +a(3);
196  globalDerivsMatrix_(0, 2) = +cosg * (a(3) * fidpoints_[0].x() - a(2) * fidpoints_[0].y()) -
197  sing * (a(2) * fidpoints_[0].x() + a(3) * fidpoints_[0].y());
198  globalDerivsMatrix_(1, 0) = -a(3);
199  globalDerivsMatrix_(1, 1) = +a(2);
200  globalDerivsMatrix_(1, 2) = +cosg * (a(2) * fidpoints_[0].x() + a(3) * fidpoints_[0].y()) -
201  sing * (a(2) * fidpoints_[0].y() - a(3) * fidpoints_[0].x());
202  globalDerivsMatrix_(2, 0) = +a(2);
203  globalDerivsMatrix_(2, 1) = +a(3);
204  globalDerivsMatrix_(2, 2) = +cosg * (a(3) * fidpoints_[1].x() - a(2) * fidpoints_[1].y()) -
205  sing * (a(2) * fidpoints_[1].x() + a(3) * fidpoints_[1].y());
206  globalDerivsMatrix_(3, 0) = -a(3);
207  globalDerivsMatrix_(3, 1) = +a(2);
208  globalDerivsMatrix_(3, 2) = +cosg * (a(2) * fidpoints_[1].x() + a(3) * fidpoints_[1].y()) -
209  sing * (a(2) * fidpoints_[1].y() - a(3) * fidpoints_[1].x());
210 
211  globalDerivsMatrix_(4, 0) = +a(2);
212  globalDerivsMatrix_(4, 1) = +a(3);
213  globalDerivsMatrix_(4, 2) = +cosg * (a(3) * fidpoints_[2].x() - a(2) * fidpoints_[2].y()) -
214  sing * (a(2) * fidpoints_[2].x() + a(3) * fidpoints_[2].y());
215  globalDerivsMatrix_(5, 0) = -a(3);
216  globalDerivsMatrix_(5, 1) = +a(2);
217  globalDerivsMatrix_(5, 2) = +cosg * (a(2) * fidpoints_[2].x() + a(3) * fidpoints_[2].y()) -
218  sing * (a(2) * fidpoints_[2].y() - a(3) * fidpoints_[2].x());
219  globalDerivsMatrix_(6, 0) = +a(2);
220  globalDerivsMatrix_(6, 1) = +a(3);
221  globalDerivsMatrix_(6, 2) = +cosg * (a(3) * fidpoints_[3].x() - a(2) * fidpoints_[3].y()) -
222  sing * (a(2) * fidpoints_[3].x() + a(3) * fidpoints_[3].y());
223  globalDerivsMatrix_(7, 0) = -a(3);
224  globalDerivsMatrix_(7, 1) = +a(2);
225  globalDerivsMatrix_(7, 2) = +cosg * (a(2) * fidpoints_[3].x() + a(3) * fidpoints_[3].y()) -
226  sing * (a(2) * fidpoints_[3].y() - a(3) * fidpoints_[3].x());
227 
228  fitValidFlag_ = true;
229 }
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:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
value_t chi2_
chi2 of the local fit
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
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
Definition: APVGainStruct.h:7
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.

◆ doFit() [2/3]

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(), HLT_2023v12_cff::label1, HLT_2023v12_cff::label2, labelVec1_, and labelVec2_.

17  {
18  labelVec1_.clear();
19  labelVec1_.push_back(label1 + 0);
20  labelVec1_.push_back(label1 + 1);
21  labelVec1_.push_back(label1 + 5);
22  labelVec2_.clear();
23  labelVec2_.push_back(label2 + 0);
24  labelVec2_.push_back(label2 + 1);
25  labelVec2_.push_back(label2 + 5);
26  doFit(fidpointvec);
27 }
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.

◆ doFit() [3/3]

void SurveyPxbImageLocalFit::doFit ( value_t  x1,
value_t  y1,
value_t  g1,
value_t  x2,
value_t  y2,
value_t  g2 
)

Definition at line 231 of file SurveyPxbImageLocalFit.cc.

References funct::cos(), doFit(), fidpoints_, diffTwoXMLs::g1, diffTwoXMLs::g2, funct::sin(), testProducerWithPsetDescEmpty_cfi::u1, and MetAnalyzer::u2.

231  {
232  // Creating vectors with the global parameters of the two modules
233  ROOT::Math::SVector<value_t, 4> mod1, mod2;
234  mod1(0) = u1;
235  mod1(1) = v1;
236  mod1(2) = cos(g1);
237  mod1(3) = sin(g1);
238  mod2(0) = u2;
239  mod2(1) = v2;
240  mod2(2) = cos(g2);
241  mod2(3) = sin(g2);
242  //std::cout << "mod1: " << mod1 << std::endl;
243  //std::cout << "mod2: " << mod2 << std::endl;
244 
245  // Create a matrix for the transformed position of the fidpoints
246  ROOT::Math::SMatrix<value_t, 4, 4> M1, M2;
247  M1(0, 0) = 1.;
248  M1(0, 1) = 0.;
249  M1(0, 2) = +fidpoints_[0].x();
250  M1(0, 3) = -fidpoints_[0].y();
251  M1(1, 0) = 0.;
252  M1(1, 1) = 1.;
253  M1(1, 2) = +fidpoints_[0].y();
254  M1(1, 3) = +fidpoints_[0].x();
255  M1(2, 0) = 1.;
256  M1(2, 1) = 0.;
257  M1(2, 2) = +fidpoints_[1].x();
258  M1(2, 3) = -fidpoints_[1].y();
259  M1(3, 0) = 0.;
260  M1(3, 1) = 1.;
261  M1(3, 2) = +fidpoints_[1].y();
262  M1(3, 3) = +fidpoints_[1].x();
263  M2(0, 0) = 1.;
264  M2(0, 1) = 0.;
265  M2(0, 2) = +fidpoints_[2].x();
266  M2(0, 3) = -fidpoints_[2].y();
267  M2(1, 0) = 0.;
268  M2(1, 1) = 1.;
269  M2(1, 2) = +fidpoints_[2].y();
270  M2(1, 3) = +fidpoints_[2].x();
271  M2(2, 0) = 1.;
272  M2(2, 1) = 0.;
273  M2(2, 2) = +fidpoints_[3].x();
274  M2(2, 3) = -fidpoints_[3].y();
275  M2(3, 0) = 0.;
276  M2(3, 1) = 1.;
277  M2(3, 2) = +fidpoints_[3].y();
278  M2(3, 3) = +fidpoints_[3].x();
279 
280  //std::cout << "M1:\n" << M1 << std::endl;
281  //std::cout << "M2:\n" << M2 << std::endl;
282 
283  ROOT::Math::SVector<value_t, 4> mod_tr1, mod_tr2;
284  mod_tr1 = M1 * mod2;
285  mod_tr2 = M2 * mod1;
286  //std::cout << "mod_tr1: " << mod_tr1 << std::endl;
287  //std::cout << "mod_tr2: " << mod_tr2 << std::endl;
288 
289  fidpoint_t fidpointvec;
290  fidpointvec.push_back(coord_t(mod_tr1(0), mod_tr1(1)));
291  fidpointvec.push_back(coord_t(mod_tr1(2), mod_tr1(3)));
292  fidpointvec.push_back(coord_t(mod_tr2(0), mod_tr2(1)));
293  fidpointvec.push_back(coord_t(mod_tr2(2), mod_tr2(3)));
294 
295  doFit(fidpointvec);
296 }
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)

◆ getChi2()

SurveyPxbImageLocalFit::value_t SurveyPxbImageLocalFit::getChi2 ( )

returns the chi^2 of the fit

Definition at line 306 of file SurveyPxbImageLocalFit.cc.

References chi2_, and fitValidFlag_.

306  {
307  if (!fitValidFlag_)
308  throw std::logic_error(
309  "SurveyPxbImageLocalFit::getChi2(): Fit is not valid. Call doFit(...) before calling this function.");
310  return chi2_;
311 }
bool fitValidFlag_
Validity Flag.
value_t chi2_
chi2 of the local fit

◆ getGlobalDerivsLabelPtr()

const pede_label_t* SurveyPxbImageLocalFit::getGlobalDerivsLabelPtr ( count_t  i)
inline

Definition at line 58 of file SurveyPxbImageLocalFit.h.

References mps_fire::i, labelVec1_, and labelVec2_.

58 { 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.

◆ getGlobalDerivsPtr()

const pede_deriv_t* SurveyPxbImageLocalFit::getGlobalDerivsPtr ( count_t  i)
inline

Definition at line 57 of file SurveyPxbImageLocalFit.h.

References globalDerivsMatrix_, mps_fire::i, and nGlD.

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

◆ getGlobalDerivsSize()

pede_label_t SurveyPxbImageLocalFit::getGlobalDerivsSize ( )
inline

Definition at line 55 of file SurveyPxbImageLocalFit.h.

References nGlD.

55 { return nGlD; };
static const count_t nGlD

◆ getLocalDerivsPtr()

const pede_deriv_t* SurveyPxbImageLocalFit::getLocalDerivsPtr ( count_t  i)
inline

Definition at line 56 of file SurveyPxbImageLocalFit.h.

References mps_fire::i, localDerivsMatrix_, and nLcD.

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

◆ getLocalDerivsSize()

pede_label_t SurveyPxbImageLocalFit::getLocalDerivsSize ( )
inline

Definition at line 54 of file SurveyPxbImageLocalFit.h.

References nLcD.

54 { return nLcD; };
static const count_t nLcD

◆ getLocalParameters()

SurveyPxbImageLocalFit::localpars_t SurveyPxbImageLocalFit::getLocalParameters ( )

returns local parameters after fit

Definition at line 298 of file SurveyPxbImageLocalFit.cc.

References a_, and fitValidFlag_.

298  {
299  if (!fitValidFlag_)
300  throw std::logic_error(
301  "SurveyPxbImageLocalFit::getLocalParameters(): Fit is not valid. Call doFit(...) before calling this "
302  "function.");
303  return a_;
304 }
bool fitValidFlag_
Validity Flag.
localpars_t a_
Local parameters.

◆ getResiduum()

pede_deriv_t SurveyPxbImageLocalFit::getResiduum ( count_t  i)
inline

Definition at line 59 of file SurveyPxbImageLocalFit.h.

References mps_fire::i, and r.

59 { return (pede_deriv_t)r(i); };
ROOT::Math::SVector< value_t, nMsrmts > r
Vector of residuals.

◆ getSigma()

pede_deriv_t SurveyPxbImageLocalFit::getSigma ( count_t  i)
inline

Definition at line 60 of file SurveyPxbImageLocalFit.h.

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

60 { return i % 2 ? sigma_x_ : sigma_y_; };
value_t sigma_x_
Gaussian errors.

◆ initFidPoints()

void SurveyPxbImageLocalFit::initFidPoints ( )
inlineprivate

Initialise the fiducial points.

Definition at line 96 of file SurveyPxbImageLocalFit.h.

References fidpoints_.

Referenced by SurveyPxbImageLocalFit().

96  {
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  }
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)

◆ isFitValid()

bool SurveyPxbImageLocalFit::isFitValid ( )
inline

returns validity flag

Definition at line 46 of file SurveyPxbImageLocalFit.h.

References fitValidFlag_.

46 { return fitValidFlag_; };
bool fitValidFlag_
Validity Flag.

◆ setGlobalDerivsToZero()

void SurveyPxbImageLocalFit::setGlobalDerivsToZero ( count_t  i)

Definition at line 320 of file SurveyPxbImageLocalFit.cc.

References globalDerivsMatrix_, mps_fire::i, dqmiolumiharvest::j, nGlD, and nMsrmts.

320  {
321  if (!(j < nGlD))
322  throw std::range_error("SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");
323  for (count_t i = 0; i != nMsrmts; i++)
324  globalDerivsMatrix_(i, j) = 0;
325 }
static const count_t nGlD
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
static const count_t nMsrmts

◆ setLocalDerivsToZero()

void SurveyPxbImageLocalFit::setLocalDerivsToZero ( count_t  i)

Definition at line 313 of file SurveyPxbImageLocalFit.cc.

References mps_fire::i, dqmiolumiharvest::j, localDerivsMatrix_, nLcD, and nMsrmts.

313  {
314  if (!(j < nLcD))
315  throw std::range_error("SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");
316  for (count_t i = 0; i != nMsrmts; i++)
317  localDerivsMatrix_(i, j) = 0;
318 }
static const count_t nLcD
static const count_t nMsrmts
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.

Member Data Documentation

◆ a_

localpars_t SurveyPxbImageLocalFit::a_
private

Local parameters.

Definition at line 67 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getLocalParameters().

◆ chi2_

value_t SurveyPxbImageLocalFit::chi2_
private

chi2 of the local fit

Definition at line 87 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getChi2().

◆ derivsValidFlag_

bool SurveyPxbImageLocalFit::derivsValidFlag_
private

Definition at line 93 of file SurveyPxbImageLocalFit.h.

◆ fidpoints_

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

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

Definition at line 84 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and initFidPoints().

◆ fitValidFlag_

bool SurveyPxbImageLocalFit::fitValidFlag_
private

Validity Flag.

Definition at line 90 of file SurveyPxbImageLocalFit.h.

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

◆ globalDerivsMatrix_

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

Matrix with global derivs.

Definition at line 74 of file SurveyPxbImageLocalFit.h.

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

◆ labelVec1_

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

Vector with labels to global derivs.

Definition at line 81 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getGlobalDerivsLabelPtr().

◆ labelVec2_

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

Definition at line 81 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getGlobalDerivsLabelPtr().

◆ localDerivsMatrix_

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

Matrix with local derivs.

Definition at line 78 of file SurveyPxbImageLocalFit.h.

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

◆ nFidpoints

const count_t SurveyPxbImageLocalFit::nFidpoints = 4
static

Definition at line 23 of file SurveyPxbImageLocalFit.h.

◆ nGlD

const count_t SurveyPxbImageLocalFit::nGlD = 3
static

◆ nLcD

const count_t SurveyPxbImageLocalFit::nLcD = 4
static

◆ nLcPars

const count_t SurveyPxbImageLocalFit::nLcPars = 4
static

Definition at line 22 of file SurveyPxbImageLocalFit.h.

◆ nMsrmts

const count_t SurveyPxbImageLocalFit::nMsrmts = 8
static

◆ r

ROOT::Math::SVector<value_t, nMsrmts> SurveyPxbImageLocalFit::r
private

Vector of residuals.

Definition at line 70 of file SurveyPxbImageLocalFit.h.

Referenced by doFit(), and getResiduum().