CMS 3D CMS Logo

DTRecHit1D.cc
Go to the documentation of this file.
1 
7 
8 using namespace std;
9 using namespace DTEnums;
10 
11 // Constructor from wireId and digi time only.
14  float digiTime)
15  : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer).
16  theWireId(wireId),
17  theLRSide(lr),
18  theDigiTime(digiTime),
19  theLocalPosition(),
20  theLocalError() {}
21 
22 // Default constructor
23 DTRecHit1D::DTRecHit1D() : theWireId(), theLRSide(undefLR), theDigiTime(-1), theLocalPosition(), theLocalError() {}
24 
25 // Constructor from a local position, wireId and digi time.
26 // The 3-dimensional local error is defined as
27 // resolution (the cell resolution) for the coordinate being measured
28 // and 0 for the two other coordinates
31  float digiTime,
32  const LocalPoint& pos)
33  : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer).
34  theWireId(wireId),
35  theLRSide(lr),
36  theDigiTime(digiTime),
37  theLocalPosition(pos) {
38  float cellResolution = 0.02; //cm cell resolution = 200 um = 0.02 cm
39  theLocalError = LocalError(cellResolution * cellResolution, 0., 0.); //FIXME: is it really needed?
40 }
41 
42 // Constructor from a local position and error, wireId and digi time.
44  const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err)
45  : RecHit1D(wireId.layerId()),
46  theWireId(wireId),
47  theLRSide(lr),
48  theDigiTime(digiTime),
49  theLocalPosition(pos),
50  theLocalError(err) {}
51 
52 // Destructor
54 
55 DTRecHit1D* DTRecHit1D::clone() const { return new DTRecHit1D(*this); }
56 
57 // Access to component RecHits.
58 // No components rechits: it returns a null vector
59 vector<const TrackingRecHit*> DTRecHit1D::recHits() const {
60  vector<const TrackingRecHit*> nullvector;
61  return nullvector;
62 }
63 
64 // Non-const access to component RecHits.
65 // No components rechits: it returns a null vector
66 vector<TrackingRecHit*> DTRecHit1D::recHits() {
67  vector<TrackingRecHit*> nullvector;
68  return nullvector;
69 }
70 
71 // Comparison operator, based on the wireId and the digi time
73  return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1;
74 }
75 
76 // The ostream operator
77 ostream& operator<<(ostream& os, const DTRecHit1D& hit) {
78  os << "pos: " << hit.localPosition().x();
79  os << " +/- " << sqrt(hit.localPositionError().xx());
80  return os;
81 }
ostream & operator<<(ostream &os, const DTRecHit1D &hit)
Definition: DTRecHit1D.cc:77
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
LocalError theLocalError
Definition: DTRecHit1D.h:96
float digiTime() const
Return the time (ns) of the digi used to build the rechit.
Definition: DTRecHit1D.h:79
DTRecHit1D * clone() const override
Definition: DTRecHit1D.cc:55
std::vector< const TrackingRecHit * > recHits() const override
No components rechits: it returns a null vector.
Definition: DTRecHit1D.cc:59
DTRecHit1D()
Default constructor.
Definition: DTRecHit1D.cc:23
T sqrt(T t)
Definition: SSEVec.h:19
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
bool operator==(const DTRecHit1D &hit) const
Comparison operator, based on the wireId and the digi time.
Definition: DTRecHit1D.cc:72
~DTRecHit1D() override
Destructor.
Definition: DTRecHit1D.cc:53