CMS 3D CMS Logo

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::parError( const LocalError& lp, 
00027                                              const LocalError& lv) const {
00028   AlgebraicSymMatrix m(2);
00032   // if ( det().alignmentPositionError()) {
00033   //   LocalError lape = 
00034   //     ErrorFrameTransformer().transform( det().alignmentPositionError()->globalError(), 
00035   //                                        det().surface());
00036   //   m[0][0] = lv.xx();
00037   //   m[0][1] = 0.;
00038   //   m[1][1] = lp.xx()+lape.xx();
00039   // } else {
00040     m[0][0] = lv.xx();
00041     m[0][1] = 0.;
00042     m[1][1] = lp.xx();
00043   //};
00044   return m;
00045 
00046 }
00047 
00048 
00049 DTRecSegment2D::DTRecSegment2D(DetId id, const vector<DTRecHit1D>& hits) :
00050   RecSegment(id), theChi2(0.0), theT0(0.), theHits(hits){
00051 }
00052 
00053 DTRecSegment2D::DTRecSegment2D(DetId id, 
00054                LocalPoint &position, LocalVector &direction,
00055                AlgebraicSymMatrix & covMatrix, double chi2, 
00056                std::vector<DTRecHit1D> &hits1D):
00057  RecSegment(id), thePosition(position),theDirection(direction),
00058   theCovMatrix(covMatrix),theChi2(chi2),theT0(0.),theHits(hits1D){}
00059 
00060 /* Operations */ 
00061 LocalError DTRecSegment2D::localPositionError() const {
00062   return LocalError(theCovMatrix[1][1],0.,0.);
00063 }
00064 
00065 LocalError DTRecSegment2D::localDirectionError() const{
00066   return LocalError(theCovMatrix[0][0],0.,0.);
00067 }
00068 
00069 int DTRecSegment2D::degreesOfFreedom() const {
00070   return theHits.size()-dimension();
00071 }
00072 
00073 ostream& operator<<(ostream& os, const DTRecSegment2D& seg) {
00074   os << "Pos " << seg.localPosition() << 
00075     " Dir: " << seg.localDirection() <<
00076     " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() ;
00077   return os;
00078 }
00079 
00080 std::vector<const TrackingRecHit*> DTRecSegment2D::recHits() const {
00081 
00082   std::vector<const TrackingRecHit*> pointersOfRecHits; 
00083   
00084   for(std::vector<DTRecHit1D>::const_iterator rechit = theHits.begin();
00085       rechit != theHits.end(); rechit++)
00086     pointersOfRecHits.push_back( &(*rechit) );
00087   
00088   return pointersOfRecHits;
00089 }
00090 
00091 std::vector<TrackingRecHit*> DTRecSegment2D::recHits() {
00092 
00093   std::vector<TrackingRecHit*> pointersOfRecHits; 
00094     
00095   for(std::vector<DTRecHit1D>::iterator rechit = theHits.begin();
00096       rechit != theHits.end(); rechit++)
00097     pointersOfRecHits.push_back( &(*rechit) );
00098   
00099   return pointersOfRecHits;
00100 }
00101 
00102 std::vector<DTRecHit1D> DTRecSegment2D::specificRecHits() const {
00103   return theHits;
00104 }
00105 
00106 void DTRecSegment2D::update(std::vector<DTRecHit1D> & updatedRecHits){
00107   theHits = updatedRecHits;
00108 }
00109 
00110 void DTRecSegment2D::setPosition(const LocalPoint& pos){
00111   thePosition= pos;
00112 }
00113 
00114 void DTRecSegment2D::setDirection(const LocalVector& dir){
00115   theDirection=dir;
00116 }
00117 
00118 void DTRecSegment2D::setCovMatrix(const AlgebraicSymMatrix& cov){ 
00119   theCovMatrix = cov;
00120 }
00121 
00122 void DTRecSegment2D::setChi2(const double& chi2) {
00123   theChi2=chi2;
00124 }
00125 
00126 void DTRecSegment2D::setT0(const double& t0){
00127   theT0=t0;
00128 }

Generated on Tue Jun 9 17:30:41 2009 for CMSSW by  doxygen 1.5.4