CMS 3D CMS Logo

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);
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; };
58  const pede_label_t* getGlobalDerivsLabelPtr(count_t i) { return i < 4 ? &labelVec1_[0] : &labelVec2_[0]; };
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
SurveyPxbImageLocalFit::getLocalDerivsSize
pede_label_t getLocalDerivsSize()
Definition: SurveyPxbImageLocalFit.h:54
SurveyPxbImage::sigma_x_
value_t sigma_x_
Gaussian errors.
Definition: SurveyPxbImage.h:81
SurveyPxbImage::coord_t
Point3DBase< value_t, LocalTag > coord_t
Definition: SurveyPxbImage.h:17
SurveyPxbImage::sigma_y_
value_t sigma_y_
Definition: SurveyPxbImage.h:81
SurveyPxbImageLocalFit::getGlobalDerivsLabelPtr
const pede_label_t * getGlobalDerivsLabelPtr(count_t i)
Definition: SurveyPxbImageLocalFit.h:58
mps_fire.i
i
Definition: mps_fire.py:355
SurveyPxbImageLocalFit::r
ROOT::Math::SVector< value_t, nMsrmts > r
Vector of residuals.
Definition: SurveyPxbImageLocalFit.h:70
funct::false
false
Definition: Factorize.h:34
count_t
Definition: ErrorPropogationTypes.h:7
SurveyPxbImageLocalFit::fidpoints_
std::vector< coord_t > fidpoints_
True position of the fiducial points on a sensor wrt. local frame (u,v)
Definition: SurveyPxbImageLocalFit.h:84
SurveyPxbImageLocalFit::localDerivsMatrix_
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nLcD > localDerivsMatrix_
Matrix with local derivs.
Definition: SurveyPxbImageLocalFit.h:78
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
SurveyPxbImageLocalFit::nLcPars
static const count_t nLcPars
Definition: SurveyPxbImageLocalFit.h:22
SurveyPxbImage.h
diffTwoXMLs.g1
g1
Definition: diffTwoXMLs.py:52
SurveyPxbImage
Class to hold one picture of the BPix survey.
Definition: SurveyPxbImage.h:12
SurveyPxbImageLocalFit::doFit
void doFit(const fidpoint_t &fidpointvec)
Invoke the fit.
Definition: SurveyPxbImageLocalFit.cc:29
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
SurveyPxbImageLocalFit::nFidpoints
static const count_t nFidpoints
Definition: SurveyPxbImageLocalFit.h:23
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
SurveyPxbImageLocalFit::fidpoint_t
std::vector< coord_t > fidpoint_t
Definition: SurveyPxbImageLocalFit.h:17
bTagCommon_cff.label2
label2
Definition: bTagCommon_cff.py:168
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SurveyPxbImageLocalFit::getGlobalDerivsSize
pede_label_t getGlobalDerivsSize()
Definition: SurveyPxbImageLocalFit.h:55
p2
double p2[4]
Definition: TauolaWrapper.h:90
SurveyPxbImageLocalFit::dist
value_t dist(const coord_t &p1, const coord_t &p2)
Distance.
Definition: SurveyPxbImageLocalFit.h:104
Point3DBase
Definition: Point3DBase.h:10
SurveyPxbImageLocalFit::SurveyPxbImageLocalFit
SurveyPxbImageLocalFit()
Definition: SurveyPxbImageLocalFit.h:29
SurveyPxbImageLocalFit::initFidPoints
void initFidPoints()
Initialise the fiducial points.
Definition: SurveyPxbImageLocalFit.h:96
SurveyPxbImageLocalFit::getSigma
pede_deriv_t getSigma(count_t i)
Definition: SurveyPxbImageLocalFit.h:60
SurveyPxbImageLocalFit::setLocalDerivsToZero
void setLocalDerivsToZero(count_t i)
Definition: SurveyPxbImageLocalFit.cc:313
SurveyPxbImageLocalFit::getLocalDerivsPtr
const pede_deriv_t * getLocalDerivsPtr(count_t i)
Definition: SurveyPxbImageLocalFit.h:56
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
SurveyPxbImageLocalFit
Class to hold one picture of the BPix survey and the local fit.
Definition: SurveyPxbImageLocalFit.h:14
SurveyPxbImageLocalFit::count_t
unsigned int count_t
Definition: SurveyPxbImageLocalFit.h:18
SurveyPxbImageLocalFit::globalDerivsMatrix_
ROOT::Math::SMatrix< pede_deriv_t, nMsrmts, nGlD > globalDerivsMatrix_
Matrix with global derivs.
Definition: SurveyPxbImageLocalFit.h:74
SurveyPxbImageLocalFit::nLcD
static const count_t nLcD
Definition: SurveyPxbImageLocalFit.h:20
SurveyPxbImageLocalFit::pede_label_t
int pede_label_t
Definition: SurveyPxbImageLocalFit.h:25
SurveyPxbImageLocalFit::SurveyPxbImageLocalFit
SurveyPxbImageLocalFit(std::istringstream &iss)
Constructor from istringstream.
Definition: SurveyPxbImageLocalFit.h:35
p1
double p1[4]
Definition: TauolaWrapper.h:89
PVValHelper::dy
Definition: PVValidationHelpers.h:49
SurveyPxbImageLocalFit::a_
localpars_t a_
Local parameters.
Definition: SurveyPxbImageLocalFit.h:67
SurveyPxbImageLocalFit::getGlobalDerivsPtr
const pede_deriv_t * getGlobalDerivsPtr(count_t i)
Definition: SurveyPxbImageLocalFit.h:57
SurveyPxbImageLocalFit::setGlobalDerivsToZero
void setGlobalDerivsToZero(count_t i)
Definition: SurveyPxbImageLocalFit.cc:320
diffTwoXMLs.g2
g2
Definition: diffTwoXMLs.py:71
SurveyPxbImageLocalFit::chi2_
value_t chi2_
chi2 of the local fit
Definition: SurveyPxbImageLocalFit.h:87
SurveyPxbImageLocalFit::pede_deriv_t
float pede_deriv_t
Definition: SurveyPxbImageLocalFit.h:26
SurveyPxbImageLocalFit::nGlD
static const count_t nGlD
Definition: SurveyPxbImageLocalFit.h:19
SurveyPxbImageLocalFit::getChi2
value_t getChi2()
returns the chi^2 of the fit
Definition: SurveyPxbImageLocalFit.cc:306
SurveyPxbImageLocalFit::isFitValid
bool isFitValid()
returns validity flag
Definition: SurveyPxbImageLocalFit.h:46
bTagCommon_cff.label1
label1
Definition: bTagCommon_cff.py:167
LocalPoint.h
SurveyPxbImageLocalFit::derivsValidFlag_
bool derivsValidFlag_
Definition: SurveyPxbImageLocalFit.h:93
SurveyPxbImage::value_t
double value_t
Definition: SurveyPxbImage.h:16
SurveyPxbImageLocalFit::getLocalParameters
localpars_t getLocalParameters()
returns local parameters after fit
Definition: SurveyPxbImageLocalFit.cc:298
SurveyPxbImageLocalFit::labelVec2_
std::vector< pede_label_t > labelVec2_
Definition: SurveyPxbImageLocalFit.h:81
SurveyPxbImageLocalFit::fitValidFlag_
bool fitValidFlag_
Validity Flag.
Definition: SurveyPxbImageLocalFit.h:90
SurveyPxbImageLocalFit::labelVec1_
std::vector< pede_label_t > labelVec1_
Vector with labels to global derivs.
Definition: SurveyPxbImageLocalFit.h:81
SurveyPxbImageLocalFit::getResiduum
pede_deriv_t getResiduum(count_t i)
Definition: SurveyPxbImageLocalFit.h:59
PVValHelper::dx
Definition: PVValidationHelpers.h:48
SurveyPxbImageLocalFit::nMsrmts
static const count_t nMsrmts
Definition: SurveyPxbImageLocalFit.h:21
SurveyPxbImageLocalFit::localpars_t
std::vector< value_t > localpars_t
Definition: SurveyPxbImageLocalFit.h:16