CMS 3D CMS Logo

DTRecSegment2D.cc
Go to the documentation of this file.
1 
7 /* This Class Header */
9 
10 /* Collaborating Class Header */
11 
12 /* C++ Headers */
13 #include <iostream>
14 using namespace std;
15 /* ====================================================================== */
16 
17 
18 /* static member definition */
19 
20 //This function is only used to initialize theProjectionMatrix at load time
23  theProjectionMatrix[0][1]=1;
24  theProjectionMatrix[1][3]=1;
25  return theProjectionMatrix;
26 }
28 
29 /* Operations */
35  // if ( det().alignmentPositionError()) {
36  // LocalError lape =
37  // ErrorFrameTransformer().transform( det().alignmentPositionError()->globalError(),
38  // det().surface());
39  // m[0][0] = lv.xx();
40  // m[0][1] = 0.;
41  // m[1][1] = lp.xx()+lape.xx();
42  // } else {
43  m[0][0] = theCovMatrix[0][0];
44  m[0][1] = theCovMatrix[0][1];
45  m[1][1] = theCovMatrix[1][1];
46  //};
47 
48  //cout << "theCovMatrix elements " << theCovMatrix[0][0] << " , " << theCovMatrix[0][1] <<
49  // " , " << theCovMatrix[1][0] << " , " << theCovMatrix[1][1] << endl;
50 
51  return m;
52 
53 }
54 
56 
57 DTRecSegment2D::DTRecSegment2D(DetId id, const vector<DTRecHit1D>& hits) :
58  RecSegment(id), theChi2(0.0), theT0(0.), theVdrift(0.), theHits(hits){
59 }
60 
62  LocalPoint &position, LocalVector &direction,
64  std::vector<DTRecHit1D> &hits1D):
65  RecSegment(id), thePosition(position),theDirection(direction),
66  theCovMatrix(covMatrix),theChi2(chi2),theT0(0.),theVdrift(0.),theHits(hits1D){}
67 
68 /* Operations */
70  return LocalError(theCovMatrix[1][1],0.,0.);
71 }
72 
74  return LocalError(theCovMatrix[0][0],0.,0.);
75 }
76 
78  return theHits.size()-dimension();
79 }
80 
81 ostream& operator<<(ostream& os, const DTRecSegment2D& seg) {
82  os << "Pos " << seg.localPosition() <<
83  " Dir: " << seg.localDirection() <<
84  " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() ;
85  return os;
86 }
87 
88 std::vector<const TrackingRecHit*> DTRecSegment2D::recHits() const {
89 
90  std::vector<const TrackingRecHit*> pointersOfRecHits;
91 
92  for(std::vector<DTRecHit1D>::const_iterator rechit = theHits.begin();
93  rechit != theHits.end(); rechit++)
94  pointersOfRecHits.push_back( &(*rechit) );
95 
96  return pointersOfRecHits;
97 }
98 
99 std::vector<TrackingRecHit*> DTRecSegment2D::recHits() {
100 
101  std::vector<TrackingRecHit*> pointersOfRecHits;
102 
103  for(std::vector<DTRecHit1D>::iterator rechit = theHits.begin();
104  rechit != theHits.end(); rechit++)
105  pointersOfRecHits.push_back( &(*rechit) );
106 
107  return pointersOfRecHits;
108 }
109 
110 std::vector<DTRecHit1D> DTRecSegment2D::specificRecHits() const {
111  return theHits;
112 }
113 
114 void DTRecSegment2D::update(std::vector<DTRecHit1D> & updatedRecHits){
115  theHits = updatedRecHits;
116 }
117 
119  thePosition= pos;
120 }
121 
124 }
125 
127  theCovMatrix = cov;
128 }
129 
130 void DTRecSegment2D::setChi2(const double& chi2) {
131  theChi2=chi2;
132 }
133 
134 void DTRecSegment2D::setT0(const double& t0){
135  theT0=t0;
136 }
137 
138 void DTRecSegment2D::setVdrift(const double& vdrift){
139  theVdrift=vdrift;
140 }
virtual LocalError localPositionError() const
local position error in SL frame
void setChi2(const double &chi2)
virtual ~DTRecSegment2D()
Destructor.
virtual int degreesOfFreedom() const
return the DOF of the segment
virtual double chi2() const
the chi2 of the fit
virtual LocalError localDirectionError() const
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
std::vector< DTRecHit1D > theHits
void setCovMatrix(const AlgebraicSymMatrix &cov)
void update(std::vector< DTRecHit1D > &updatedRecHits)
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:80
CLHEP::HepMatrix AlgebraicMatrix
static const AlgebraicMatrix theProjectionMatrix
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
AlgebraicSymMatrix theCovMatrix
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
AlgebraicSymMatrix covMatrix() const
the Covariance Matrix
static AlgebraicMatrix initTheProjectionMatrix()
virtual LocalPoint localPosition() const
local position in SL frame
Definition: DetId.h:18
virtual AlgebraicSymMatrix parametersError() const
LocalPoint thePosition
void setT0(const double &t0)
virtual int dimension() const
return 2. The dimension of the matrix
static int position[264][3]
Definition: ReadPGInfo.cc:509
void setPosition(const LocalPoint &pos)
virtual LocalVector localDirection() const
the local direction in SL frame
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setDirection(const LocalVector &dir)
LocalVector theDirection
void setVdrift(const double &vdrift)
dbl *** dir
Definition: mlp_gen.cc:35
ostream & operator<<(ostream &os, const DTRecSegment2D &seg)
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)