CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/DTRecHit/src/DTRecSegment2D.cc

Go to the documentation of this file.
00001 
00009 /* This Class Header */
00010 #include "DataFormats/DTRecHit/interface/DTRecSegment2D.h"
00011 
00012 /* Collaborating Class Header */
00013 
00014 /* C++ Headers */
00015 #include <iostream>
00016 using namespace std;
00017 /* ====================================================================== */
00018 
00019 
00020 /* static member definition */
00021 bool DTRecSegment2D::isInitialized(false);
00022 
00023 AlgebraicMatrix DTRecSegment2D::theProjectionMatrix;
00024 
00025 /* Operations */ 
00026 AlgebraicSymMatrix DTRecSegment2D::parametersError() const {
00027   AlgebraicSymMatrix m(2);
00031   // if ( det().alignmentPositionError()) {
00032   //   LocalError lape = 
00033   //     ErrorFrameTransformer().transform( det().alignmentPositionError()->globalError(), 
00034   //                                        det().surface());
00035   //   m[0][0] = lv.xx();
00036   //   m[0][1] = 0.;
00037   //   m[1][1] = lp.xx()+lape.xx();
00038   // } else {
00039     m[0][0] = theCovMatrix[0][0];
00040     m[0][1] = theCovMatrix[0][1];
00041     m[1][1] = theCovMatrix[1][1];
00042   //};
00043 
00044     //cout << "theCovMatrix elements " << theCovMatrix[0][0] << " , " << theCovMatrix[0][1] <<
00045     //        " , " << theCovMatrix[1][0] << " , " << theCovMatrix[1][1] << endl;
00046 
00047   return m;
00048 
00049 }
00050 
00051 
00052 DTRecSegment2D::DTRecSegment2D(DetId id, const vector<DTRecHit1D>& hits) :
00053   RecSegment(id), theChi2(0.0), theT0(0.), theVdrift(0.), theHits(hits){
00054 }
00055 
00056 DTRecSegment2D::DTRecSegment2D(DetId id, 
00057                LocalPoint &position, LocalVector &direction,
00058                AlgebraicSymMatrix & covMatrix, double chi2, 
00059                std::vector<DTRecHit1D> &hits1D):
00060  RecSegment(id), thePosition(position),theDirection(direction),
00061   theCovMatrix(covMatrix),theChi2(chi2),theT0(0.),theVdrift(0.),theHits(hits1D){}
00062 
00063 /* Operations */ 
00064 LocalError DTRecSegment2D::localPositionError() const {
00065   return LocalError(theCovMatrix[1][1],0.,0.);
00066 }
00067 
00068 LocalError DTRecSegment2D::localDirectionError() const{
00069   return LocalError(theCovMatrix[0][0],0.,0.);
00070 }
00071 
00072 int DTRecSegment2D::degreesOfFreedom() const {
00073   return theHits.size()-dimension();
00074 }
00075 
00076 ostream& operator<<(ostream& os, const DTRecSegment2D& seg) {
00077   os << "Pos " << seg.localPosition() << 
00078     " Dir: " << seg.localDirection() <<
00079     " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() ;
00080   return os;
00081 }
00082 
00083 std::vector<const TrackingRecHit*> DTRecSegment2D::recHits() const {
00084 
00085   std::vector<const TrackingRecHit*> pointersOfRecHits; 
00086   
00087   for(std::vector<DTRecHit1D>::const_iterator rechit = theHits.begin();
00088       rechit != theHits.end(); rechit++)
00089     pointersOfRecHits.push_back( &(*rechit) );
00090   
00091   return pointersOfRecHits;
00092 }
00093 
00094 std::vector<TrackingRecHit*> DTRecSegment2D::recHits() {
00095 
00096   std::vector<TrackingRecHit*> pointersOfRecHits; 
00097     
00098   for(std::vector<DTRecHit1D>::iterator rechit = theHits.begin();
00099       rechit != theHits.end(); rechit++)
00100     pointersOfRecHits.push_back( &(*rechit) );
00101   
00102   return pointersOfRecHits;
00103 }
00104 
00105 std::vector<DTRecHit1D> DTRecSegment2D::specificRecHits() const {
00106   return theHits;
00107 }
00108 
00109 void DTRecSegment2D::update(std::vector<DTRecHit1D> & updatedRecHits){
00110   theHits = updatedRecHits;
00111 }
00112 
00113 void DTRecSegment2D::setPosition(const LocalPoint& pos){
00114   thePosition= pos;
00115 }
00116 
00117 void DTRecSegment2D::setDirection(const LocalVector& dir){
00118   theDirection=dir;
00119 }
00120 
00121 void DTRecSegment2D::setCovMatrix(const AlgebraicSymMatrix& cov){ 
00122   theCovMatrix = cov;
00123 }
00124 
00125 void DTRecSegment2D::setChi2(const double& chi2) {
00126   theChi2=chi2;
00127 }
00128 
00129 void DTRecSegment2D::setT0(const double& t0){
00130   theT0=t0;
00131 }
00132 
00133 void DTRecSegment2D::setVdrift(const double& vdrift){
00134   theVdrift=vdrift;
00135 }