CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/DataFormats/DTRecHit/src/DTRecHit1D.cc

Go to the documentation of this file.
00001 
00009 #include "DataFormats/DTRecHit/interface/DTRecHit1D.h"
00010 
00011 
00012 using namespace std;
00013 using namespace DTEnums;
00014 
00015 
00016 // Constructor from wireId and digi time only. 
00017 DTRecHit1D::DTRecHit1D(const DTWireId& wireId,
00018                        DTEnums::DTCellSide lr,
00019                        float digiTime) : 
00020     RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer).
00021     theWireId(wireId),
00022     theLRSide(lr),
00023     theDigiTime(digiTime),
00024     theLocalPosition(),
00025     theLocalError() {}
00026 
00027 
00028 // Default constructor
00029 DTRecHit1D::DTRecHit1D() : theWireId(),
00030                            theLRSide(undefLR),
00031                            theDigiTime(-1),
00032                            theLocalPosition(),
00033                            theLocalError() {}
00034 
00035 // Constructor from a local position, wireId and digi time.
00036 // The 3-dimensional local error is defined as
00037 // resolution (the cell resolution) for the coordinate being measured
00038 // and 0 for the two other coordinates
00039 DTRecHit1D::DTRecHit1D(const DTWireId& wireId,
00040                        DTEnums::DTCellSide lr,
00041                        float digiTime,
00042                        const LocalPoint& pos) : 
00043     RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer).
00044     theWireId(wireId),
00045     theLRSide(lr),
00046     theDigiTime(digiTime),
00047     theLocalPosition(pos) {
00048   float cellResolution = 0.02 ; //cm  cell resolution = 200 um = 0.02 cm 
00049   theLocalError =
00050     LocalError(cellResolution*cellResolution, 0., 0.); //FIXME: is it really needed?
00051     }
00052 
00053 
00054 
00055 // Constructor from a local position and error, wireId and digi time.
00056 DTRecHit1D::DTRecHit1D(const DTWireId& wireId,
00057                        DTEnums::DTCellSide lr,
00058                        float digiTime,
00059                        const LocalPoint& pos,
00060                        const LocalError& err) :
00061   RecHit1D(wireId.layerId()),
00062   theWireId(wireId),
00063   theLRSide(lr),
00064   theDigiTime(digiTime),
00065   theLocalPosition(pos),
00066   theLocalError(err) {}
00067 
00068 
00069 
00070 
00071 // Destructor
00072 DTRecHit1D::~DTRecHit1D(){}
00073 
00074 
00075 
00076 DTRecHit1D * DTRecHit1D::clone() const {
00077   return new DTRecHit1D(*this);
00078 }
00079 
00080 
00081 // Access to component RecHits.
00082 // No components rechits: it returns a null vector
00083 vector<const TrackingRecHit*> DTRecHit1D::recHits() const {
00084   vector<const TrackingRecHit*> nullvector;
00085   return nullvector; 
00086 }
00087 
00088 
00089 
00090 // Non-const access to component RecHits.
00091 // No components rechits: it returns a null vector
00092 vector<TrackingRecHit*> DTRecHit1D::recHits() {
00093   vector<TrackingRecHit*> nullvector;
00094   return nullvector; 
00095 }
00096 
00097 
00098 // Comparison operator, based on the wireId and the digi time
00099 bool DTRecHit1D::operator==(const DTRecHit1D& hit) const {
00100   return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1;
00101 }
00102 
00103 
00104 // The ostream operator
00105 ostream& operator<<(ostream& os, const DTRecHit1D& hit) {
00106   os << "pos: " << hit.localPosition().x() ; 
00107   os << " +/- " << sqrt(hit.localPositionError().xx()) ;
00108   return os;
00109 }