test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTSurveyChamber.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 
6 
7 DTSurveyChamber::DTSurveyChamber(int m_wheel, int m_station, int m_sector, long m_rawId) {
8 
9  //Coordinates of the chamber
10  wheel = m_wheel;
11  station = m_station;
12  sector = m_sector;
13  pointNumber = 0;
14  rawId = m_rawId;
15 
16 }
17 
18 
20 
21  TMatrixD leftMatrix = makeMatrix();
22  TMatrixD rightMatrix = makeVector();
23  TMatrixD errors = makeErrors();
24 
25  Chi2 myChi2(leftMatrix, rightMatrix, errors);
26 
27  Solution.ResizeTo(6,1);
28  Solution = myChi2.getSolution();
29  Covariance.ResizeTo(6,6);
30  Covariance = myChi2.getCovariance();
31 
32 }
33 
34 
35 void DTSurveyChamber::addPoint(int code, const TMatrixD& r, const TMatrixD& disp, const TMatrixD& err) {
36 
37 
38  ++pointNumber;
39 
40  points.push_back(r);
41  pointsDiff.push_back(disp);
42  pointsError.push_back(err);
43  pointsTheoretical.push_back(r-disp);
44 
45 }
46 
47 
48 
50 
51  TMatrixD *result = new TMatrixD(3*getNumberPoints(),1);
52  result->Zero();
53  int real = 0;
54  for(std::vector<TMatrixD >::iterator p = pointsDiff.begin(); p != pointsDiff.end(); ++p) {
55  (*result)(real*3,0) = (*p)(0,0);
56  (*result)(real*3+1,0) = (*p)(1,0);
57  (*result)(real*3+2,0) = (*p)(2,0);
58  ++real;
59  }
60  return *result;
61 }
62 
63 
64 
66 
67  TMatrixD *result = new TMatrixD(3*getNumberPoints(),3*getNumberPoints());
68  result->Zero();
69  int real = 0;
70  for(std::vector<TMatrixD >::iterator p = pointsError.begin(); p != pointsError.end(); ++p) {
71  double rmsn = 1.0/((*p)(0,0)*(*p)(0,0));
72  (*result)(real*3,real*3) = rmsn;
73  (*result)(real*3+1,real*3+1) = rmsn;
74  (*result)(real*3+2,real*3+2) = rmsn;
75  real++;
76  }
77  return *result;
78 }
79 
80 
82 
83  TMatrixD *result = new TMatrixD(3*getNumberPoints(), 6);
84  result->Zero();
85  int real = 0;
86  for(std::vector<TMatrixD >::iterator p = pointsTheoretical.begin(); p != pointsTheoretical.end(); p++) {
87  (*result)(real*3,0)= 1.0;
88  (*result)(real*3,3) = (*p)(1,0);
89  (*result)(real*3,4) = (*p)(2,0);
90  (*result)(real*3+1,1) = 1.0;
91  (*result)(real*3+1,3) = -(*p)(0,0);
92  (*result)(real*3+1,5) = (*p)(2,0);
93  (*result)(real*3+2,2) = 1.0;
94  (*result)(real*3+2,4) = -(*p)(0,0);
95  (*result)(real*3+2,5) = -(*p)(1,0);
96  real++;
97  }
98  return *result;
99 }
100 
101 
102 std::ostream &operator<<(std::ostream &flujo, const DTSurveyChamber& obj) {
103 
104  flujo << obj.getId() << " "
105  << obj.getDeltaX() << " " << obj.getDeltaXError() << " "
106  << obj.getDeltaY() << " " << obj.getDeltaYError() << " "
107  << obj.getDeltaZ() << " " << obj.getDeltaZError() << " "
108  << obj.getAlpha() << " " << obj.getAlphaError() << " "
109  << obj.getBeta() << " " << obj.getBetaError() << " "
110  << obj.getGamma() << " " << obj.getGammaError() << std::endl;
111  return flujo;
112 
113 }
DTSurveyChamber(int, int, int, long)
std::vector< TMatrixD > points
float getDeltaZError() const
float getDeltaYError() const
long getId() const
std::vector< TMatrixD > pointsError
int getNumberPoints() const
TMatrixD & getCovariance()
Definition: Chi2.cc:29
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
tuple result
Definition: mps_fire.py:84
float getDeltaXError() const
std::vector< TMatrixD > pointsTheoretical
float getDeltaZ() const
float getBeta() const
void addPoint(int, const TMatrixD &, const TMatrixD &, const TMatrixD &)
float getAlphaError() const
TMatrixD & getSolution()
Definition: Chi2.cc:30
float getGammaError() const
float getDeltaX() const
float getAlpha() const
float getGamma() const
float getDeltaY() const
float getBetaError() const
Definition: Chi2.h:17
TMatrixD & makeVector()
std::vector< TMatrixD > pointsDiff
TMatrixD & makeMatrix()
TMatrixD & makeErrors()