CMS 3D CMS Logo

DTRecHit1DPair.cc
Go to the documentation of this file.
1 
8 
10 
11 using namespace DTEnums;
12 using namespace std;
13 
14 // Constructor without components: must use setPos and Err!
15 DTRecHit1DPair::DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi)
16  : theLeftHit(wireId, Left, digi.time()), theRightHit(wireId, Right, digi.time()) {}
17 
18 // Default constructor
19 DTRecHit1DPair::DTRecHit1DPair() : theLeftHit(), theRightHit() {}
20 
21 // Destructor
23 
24 DTRecHit1DPair* DTRecHit1DPair::clone() const { return new DTRecHit1DPair(*this); }
25 
26 // Return the 3-dimensional local position.
27 // The average theLeftHit/theRightHit hits position, namely the wire position
28 // is returned.
31 }
32 
33 // Return the 3-dimensional error on the local position.
34 // The error is defiened as half
35 // the distance between theLeftHit and theRightHit pos
37  return LocalError((theRightHit.localPosition().x() - theLeftHit.localPosition().x()) / 2., 0., 0.);
38 }
39 
40 // Access to component RecHits.
41 vector<const TrackingRecHit*> DTRecHit1DPair::recHits() const {
42  vector<const TrackingRecHit*> result;
43  result.push_back(componentRecHit(Left));
44  result.push_back(componentRecHit(Right));
45  return result;
46 }
47 
48 // Non-const access to component RecHits.
49 vector<TrackingRecHit*> DTRecHit1DPair::recHits() {
50  vector<TrackingRecHit*> result;
51  result.push_back(componentRecHit(Left));
52  result.push_back(componentRecHit(Right));
53  return result;
54 }
55 
56 // Return the detId of the Det (a DTLayer).
58 
59 // Comparison operator, based on the wireId and the digi time
61  return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1;
62 }
63 
64 // Return position in the local (layer) coordinate system for a
65 // certain hypothesis about the L/R cell side
66 LocalPoint DTRecHit1DPair::localPosition(DTCellSide lrside) const { return componentRecHit(lrside)->localPosition(); }
67 
68 // Return position error in the local (layer) coordinate system for a
69 // certain hypothesis about the L/R cell side
70 LocalError DTRecHit1DPair::localPositionError(DTCellSide lrside) const {
71  return componentRecHit(lrside)->localPositionError();
72 }
73 
74 // Set the 3-dimensional local position for the component hit
75 // corresponding to the given cell side. Default value is assumed for the error.
76 void DTRecHit1DPair::setPosition(DTCellSide lrside, const LocalPoint& point) {
77  if (lrside != undefLR)
79  else
80  throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR");
81 }
82 
83 // Set the 3-dimensional local position and error for the component hit
84 // corresponding to the given cell side. Default value is assumed for the error.
85 void DTRecHit1DPair::setPositionAndError(DTCellSide lrside, const LocalPoint& point, const LocalError& err) {
86  if (lrside != undefLR) {
88  componentRecHit(lrside)->setError(err);
89  } else
90  throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR");
91 }
92 
93 // Return the left/right DTRecHit1D
94 const DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) const {
95  if (lrSide == Left) {
96  return &theLeftHit;
97  } else if (lrSide == Right) {
98  return &theRightHit;
99  } else {
100  throw cms::Exception("DTRecHit1DPair::recHit with undefined LR");
101  }
102 }
103 
104 // Non const access to left/right DTRecHit1D
105 DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) {
106  if (lrSide == Left) {
107  return &theLeftHit;
108  } else if (lrSide == Right) {
109  return &theRightHit;
110  } else {
111  throw cms::Exception("DTRecHit1DPair::recHit with undefined LR");
112  }
113 }
114 
116 pair<const DTRecHit1D*, const DTRecHit1D*> DTRecHit1DPair::componentRecHits() const {
117  return make_pair(componentRecHit(Left), componentRecHit(Right));
118 }
119 
120 // Ostream operator
121 ostream& operator<<(ostream& os, const DTRecHit1DPair& hit) {
122  os << "Pos: " << hit.localPosition();
123  return os;
124 }
void setPosition(LocalPoint pos)
Set local position.
Definition: DTRecHit1D.h:64
LocalPoint localPosition() const override
void setError(LocalError err)
Set local position error.
Definition: DTRecHit1D.h:67
std::vector< const TrackingRecHit * > recHits() const override
virtual DetId geographicalId() const
Return the detId of the Det (a DTLayer).
T x() const
Definition: PV3DBase.h:59
DTRecHit1D theLeftHit
void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint &point, const LocalError &err)
ostream & operator<<(ostream &os, const DTRecHit1DPair &hit)
DTRecHit1DPair * clone() const override
Definition: DTDigi.h:17
std::pair< const DTRecHit1D *, const DTRecHit1D * > componentRecHits() const
Get the left and right 1D rechits (first and second respectively).
DTRecHit1D theRightHit
Definition: DetId.h:17
bool operator==(const DTRecHit1DPair &hit) const
Comparison operator, based on the wireId and the digi time.
void setPosition(DTEnums::DTCellSide lrside, const LocalPoint &point)
DTWireId wireId() const
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:50
float digiTime() const
Return the digi time (ns) used to build the rechits.
~DTRecHit1DPair() override
Destructor.
DTRecHit1DPair()
Default constructor. Needed to write the RecHit into a STL container.
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
LocalError localPositionError() const override