Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:02

0001 /** \file
0002  *
0003  *  \author G. Cerminara - INFN Torino
0004  */
0005 
0006 #include "DataFormats/DTRecHit/interface/DTRecHit1D.h"
0007 
0008 using namespace std;
0009 using namespace DTEnums;
0010 
0011 // Constructor from wireId and digi time only.
0012 DTRecHit1D::DTRecHit1D(const DTWireId& wireId,
0013                        DTEnums::DTCellSide lr,
0014                        float digiTime)
0015     : RecHit1D(wireId.layerId()),  // the detId of the Det (a DTLayer).
0016       theWireId(wireId),
0017       theLRSide(lr),
0018       theDigiTime(digiTime),
0019       theLocalPosition(),
0020       theLocalError() {}
0021 
0022 // Default constructor
0023 DTRecHit1D::DTRecHit1D() : theWireId(), theLRSide(undefLR), theDigiTime(-1), theLocalPosition(), theLocalError() {}
0024 
0025 // Constructor from a local position, wireId and digi time.
0026 // The 3-dimensional local error is defined as
0027 // resolution (the cell resolution) for the coordinate being measured
0028 // and 0 for the two other coordinates
0029 DTRecHit1D::DTRecHit1D(const DTWireId& wireId,
0030                        DTEnums::DTCellSide lr,
0031                        float digiTime,
0032                        const LocalPoint& pos)
0033     : RecHit1D(wireId.layerId()),  // the detId of the Det (a DTLayer).
0034       theWireId(wireId),
0035       theLRSide(lr),
0036       theDigiTime(digiTime),
0037       theLocalPosition(pos) {
0038   float cellResolution = 0.02;                                          //cm  cell resolution = 200 um = 0.02 cm
0039   theLocalError = LocalError(cellResolution * cellResolution, 0., 0.);  //FIXME: is it really needed?
0040 }
0041 
0042 // Constructor from a local position and error, wireId and digi time.
0043 DTRecHit1D::DTRecHit1D(
0044     const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err)
0045     : RecHit1D(wireId.layerId()),
0046       theWireId(wireId),
0047       theLRSide(lr),
0048       theDigiTime(digiTime),
0049       theLocalPosition(pos),
0050       theLocalError(err) {}
0051 
0052 // Destructor
0053 DTRecHit1D::~DTRecHit1D() {}
0054 
0055 DTRecHit1D* DTRecHit1D::clone() const { return new DTRecHit1D(*this); }
0056 
0057 // Access to component RecHits.
0058 // No components rechits: it returns a null vector
0059 vector<const TrackingRecHit*> DTRecHit1D::recHits() const {
0060   vector<const TrackingRecHit*> nullvector;
0061   return nullvector;
0062 }
0063 
0064 // Non-const access to component RecHits.
0065 // No components rechits: it returns a null vector
0066 vector<TrackingRecHit*> DTRecHit1D::recHits() {
0067   vector<TrackingRecHit*> nullvector;
0068   return nullvector;
0069 }
0070 
0071 // Comparison operator, based on the wireId and the digi time
0072 bool DTRecHit1D::operator==(const DTRecHit1D& hit) const {
0073   return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1;
0074 }
0075 
0076 // The ostream operator
0077 ostream& operator<<(ostream& os, const DTRecHit1D& hit) {
0078   os << "pos: " << hit.localPosition().x();
0079   os << " +/- " << sqrt(hit.localPositionError().xx());
0080   return os;
0081 }