CMS 3D CMS Logo

DTSurveyChamber.cc
Go to the documentation of this file.
1 #include <iostream>
2 
5 
6 DTSurveyChamber::DTSurveyChamber(int m_wheel, int m_station, int m_sector, long m_rawId) {
7  //Coordinates of the chamber
8  wheel = m_wheel;
9  station = m_station;
10  sector = m_sector;
11  pointNumber = 0;
12  rawId = m_rawId;
13 }
14 
16  TMatrixD leftMatrix = makeMatrix();
17  TMatrixD rightMatrix = makeVector();
18  TMatrixD errors = makeErrors();
19 
20  Chi2 myChi2(leftMatrix, rightMatrix, errors);
21 
22  Solution.ResizeTo(6, 1);
23  Solution = myChi2.getSolution();
24  Covariance.ResizeTo(6, 6);
25  Covariance = myChi2.getCovariance();
26 }
27 
28 void DTSurveyChamber::addPoint(int code, const TMatrixD &r, const TMatrixD &disp, const TMatrixD &err) {
29  ++pointNumber;
30 
31  points.push_back(r);
32  pointsDiff.push_back(disp);
33  pointsError.push_back(err);
34  pointsTheoretical.push_back(r - disp);
35 }
36 
38  TMatrixD *result = new TMatrixD(3 * getNumberPoints(), 1);
39  result->Zero();
40  int real = 0;
41  for (std::vector<TMatrixD>::iterator p = pointsDiff.begin(); p != pointsDiff.end(); ++p) {
42  (*result)(real * 3, 0) = (*p)(0, 0);
43  (*result)(real * 3 + 1, 0) = (*p)(1, 0);
44  (*result)(real * 3 + 2, 0) = (*p)(2, 0);
45  ++real;
46  }
47  return *result;
48 }
49 
51  TMatrixD *result = new TMatrixD(3 * getNumberPoints(), 3 * getNumberPoints());
52  result->Zero();
53  int real = 0;
54  for (std::vector<TMatrixD>::iterator p = pointsError.begin(); p != pointsError.end(); ++p) {
55  double rmsn = 1.0 / ((*p)(0, 0) * (*p)(0, 0));
56  (*result)(real * 3, real * 3) = rmsn;
57  (*result)(real * 3 + 1, real * 3 + 1) = rmsn;
58  (*result)(real * 3 + 2, real * 3 + 2) = rmsn;
59  real++;
60  }
61  return *result;
62 }
63 
65  TMatrixD *result = new TMatrixD(3 * getNumberPoints(), 6);
66  result->Zero();
67  int real = 0;
68  for (std::vector<TMatrixD>::iterator p = pointsTheoretical.begin(); p != pointsTheoretical.end(); p++) {
69  (*result)(real * 3, 0) = 1.0;
70  (*result)(real * 3, 3) = (*p)(1, 0);
71  (*result)(real * 3, 4) = (*p)(2, 0);
72  (*result)(real * 3 + 1, 1) = 1.0;
73  (*result)(real * 3 + 1, 3) = -(*p)(0, 0);
74  (*result)(real * 3 + 1, 5) = (*p)(2, 0);
75  (*result)(real * 3 + 2, 2) = 1.0;
76  (*result)(real * 3 + 2, 4) = -(*p)(0, 0);
77  (*result)(real * 3 + 2, 5) = -(*p)(1, 0);
78  real++;
79  }
80  return *result;
81 }
82 
83 std::ostream &operator<<(std::ostream &flujo, const DTSurveyChamber &obj) {
84  flujo << obj.getId() << " " << obj.getDeltaX() << " " << obj.getDeltaXError() << " " << obj.getDeltaY() << " "
85  << obj.getDeltaYError() << " " << obj.getDeltaZ() << " " << obj.getDeltaZError() << " " << obj.getAlpha() << " "
86  << obj.getAlphaError() << " " << obj.getBeta() << " " << obj.getBetaError() << " " << obj.getGamma() << " "
87  << obj.getGammaError() << std::endl;
88  return flujo;
89 }
DTSurveyChamber::makeMatrix
TMatrixD & makeMatrix()
Definition: DTSurveyChamber.cc:64
DTSurveyChamber::makeVector
TMatrixD & makeVector()
Definition: DTSurveyChamber.cc:37
DTSurveyChamber
Definition: DTSurveyChamber.h:19
DTSurveyChamber::Solution
TMatrixD Solution
Definition: DTSurveyChamber.h:63
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Chi2::getSolution
TMatrixD & getSolution()
Definition: Chi2.cc:27
Chi2.h
Chi2
Definition: Chi2.h:15
DTSurveyChamber::sector
int sector
Definition: DTSurveyChamber.h:53
errors
Definition: errors.py:1
DTSurveyChamber::station
int station
Definition: DTSurveyChamber.h:53
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
DTSurveyChamber::DTSurveyChamber
DTSurveyChamber(int, int, int, long)
Definition: DTSurveyChamber.cc:6
runTheMatrix.err
err
Definition: runTheMatrix.py:288
DTSurveyChamber::wheel
int wheel
Definition: DTSurveyChamber.h:53
DTSurveyChamber::makeErrors
TMatrixD & makeErrors()
Definition: DTSurveyChamber.cc:50
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DTSurveyChamber::pointsTheoretical
std::vector< TMatrixD > pointsTheoretical
Definition: DTSurveyChamber.h:61
DTSurveyChamber::points
std::vector< TMatrixD > points
Definition: DTSurveyChamber.h:58
DTSurveyChamber::addPoint
void addPoint(int, const TMatrixD &, const TMatrixD &, const TMatrixD &)
Definition: DTSurveyChamber.cc:28
DTSurveyChamber.h
operator<<
std::ostream & operator<<(std::ostream &flujo, const DTSurveyChamber &obj)
Definition: DTSurveyChamber.cc:83
DTSurveyChamber::getNumberPoints
int getNumberPoints() const
Definition: DTSurveyChamber.h:27
Chi2::getCovariance
TMatrixD & getCovariance()
Definition: Chi2.cc:26
Covariance
Definition: Histograms.h:1875
DTSurveyChamber::pointNumber
int pointNumber
Definition: DTSurveyChamber.h:67
mps_fire.result
result
Definition: mps_fire.py:303
DTSurveyChamber::pointsError
std::vector< TMatrixD > pointsError
Definition: DTSurveyChamber.h:60
DTSurveyChamber::compute
void compute()
Definition: DTSurveyChamber.cc:15
DTSurveyChamber::rawId
long rawId
Definition: DTSurveyChamber.h:55
DTSurveyChamber::pointsDiff
std::vector< TMatrixD > pointsDiff
Definition: DTSurveyChamber.h:59