CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/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 DTRecSegment2D::~DTRecSegment2D(){}
00052 
00053 DTRecSegment2D::DTRecSegment2D(DetId id, const vector<DTRecHit1D>& hits) :
00054   RecSegment(id), theChi2(0.0), theT0(0.), theVdrift(0.), theHits(hits){
00055 }
00056 
00057 DTRecSegment2D::DTRecSegment2D(DetId id, 
00058                LocalPoint &position, LocalVector &direction,
00059                AlgebraicSymMatrix & covMatrix, double chi2, 
00060                std::vector<DTRecHit1D> &hits1D):
00061  RecSegment(id), thePosition(position),theDirection(direction),
00062   theCovMatrix(covMatrix),theChi2(chi2),theT0(0.),theVdrift(0.),theHits(hits1D){}
00063 
00064 /* Operations */ 
00065 LocalError DTRecSegment2D::localPositionError() const {
00066   return LocalError(theCovMatrix[1][1],0.,0.);
00067 }
00068 
00069 LocalError DTRecSegment2D::localDirectionError() const{
00070   return LocalError(theCovMatrix[0][0],0.,0.);
00071 }
00072 
00073 int DTRecSegment2D::degreesOfFreedom() const {
00074   return theHits.size()-dimension();
00075 }
00076 
00077 ostream& operator<<(ostream& os, const DTRecSegment2D& seg) {
00078   os << "Pos " << seg.localPosition() << 
00079     " Dir: " << seg.localDirection() <<
00080     " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() ;
00081   return os;
00082 }
00083 
00084 std::vector<const TrackingRecHit*> DTRecSegment2D::recHits() const {
00085 
00086   std::vector<const TrackingRecHit*> pointersOfRecHits; 
00087   
00088   for(std::vector<DTRecHit1D>::const_iterator rechit = theHits.begin();
00089       rechit != theHits.end(); rechit++)
00090     pointersOfRecHits.push_back( &(*rechit) );
00091   
00092   return pointersOfRecHits;
00093 }
00094 
00095 std::vector<TrackingRecHit*> DTRecSegment2D::recHits() {
00096 
00097   std::vector<TrackingRecHit*> pointersOfRecHits; 
00098     
00099   for(std::vector<DTRecHit1D>::iterator rechit = theHits.begin();
00100       rechit != theHits.end(); rechit++)
00101     pointersOfRecHits.push_back( &(*rechit) );
00102   
00103   return pointersOfRecHits;
00104 }
00105 
00106 std::vector<DTRecHit1D> DTRecSegment2D::specificRecHits() const {
00107   return theHits;
00108 }
00109 
00110 void DTRecSegment2D::update(std::vector<DTRecHit1D> & updatedRecHits){
00111   theHits = updatedRecHits;
00112 }
00113 
00114 void DTRecSegment2D::setPosition(const LocalPoint& pos){
00115   thePosition= pos;
00116 }
00117 
00118 void DTRecSegment2D::setDirection(const LocalVector& dir){
00119   theDirection=dir;
00120 }
00121 
00122 void DTRecSegment2D::setCovMatrix(const AlgebraicSymMatrix& cov){ 
00123   theCovMatrix = cov;
00124 }
00125 
00126 void DTRecSegment2D::setChi2(const double& chi2) {
00127   theChi2=chi2;
00128 }
00129 
00130 void DTRecSegment2D::setT0(const double& t0){
00131   theT0=t0;
00132 }
00133 
00134 void DTRecSegment2D::setVdrift(const double& vdrift){
00135   theVdrift=vdrift;
00136 }