test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecHit1DPair.cc
Go to the documentation of this file.
1 
8 
10 
11 
12 using namespace DTEnums;
13 using namespace std;
14 
15 
16 
17 // Constructor without components: must use setPos and Err!
19  const DTDigi& digi) : theLeftHit(wireId, Left, digi.time()),
20  theRightHit(wireId, Right, digi.time()) {}
21 
22 
23 // Default constructor
25  theRightHit() {}
26 
27 
28 // Destructor
30 
31 
32 
34  return new DTRecHit1DPair(*this);
35 }
36 
37 
38 
39 // Return the 3-dimensional local position.
40 // The average theLeftHit/theRightHit hits position, namely the wire position
41 // is returned.
43  return theLeftHit.localPosition() +
45 }
46 
47 
48 
49 // Return the 3-dimensional error on the local position.
50 // The error is defiened as half
51 // the distance between theLeftHit and theRightHit pos
54  theLeftHit.localPosition().x())/2.,0.,0.);
55 }
56 
57 
58 
59 // Access to component RecHits.
60 vector<const TrackingRecHit*> DTRecHit1DPair::recHits() const {
61  vector<const TrackingRecHit*> result;
62  result.push_back(componentRecHit(Left));
63  result.push_back(componentRecHit(Right));
64  return result;
65 }
66 
67 
68 
69 // Non-const access to component RecHits.
70 vector<TrackingRecHit*> DTRecHit1DPair::recHits() {
71  vector<TrackingRecHit*> result;
72  result.push_back(componentRecHit(Left));
73  result.push_back(componentRecHit(Right));
74  return result;
75 }
76 
77 
78 
79 // Return the detId of the Det (a DTLayer).
81  return wireId().layerId();
82 }
83 
84 
85 
86 // Comparison operator, based on the wireId and the digi time
88  return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1;
89 }
90 
91 
92 
93 // Return position in the local (layer) coordinate system for a
94 // certain hypothesis about the L/R cell side
95 LocalPoint DTRecHit1DPair::localPosition(DTCellSide lrside) const {
96  return componentRecHit(lrside)->localPosition();
97 }
98 
99 
100 
101 // Return position error in the local (layer) coordinate system for a
102  // certain hypothesis about the L/R cell side
103  LocalError DTRecHit1DPair::localPositionError(DTCellSide lrside) const {
104  return componentRecHit(lrside)->localPositionError();
105 }
106 
107 
108 
109 // Set the 3-dimensional local position for the component hit
110 // corresponding to the given cell side. Default value is assumed for the error.
111 void DTRecHit1DPair::setPosition(DTCellSide lrside, const LocalPoint& point) {
112  if(lrside != undefLR)
113  componentRecHit(lrside)->setPosition(point);
114  else throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR");
115 }
116 
117 
118 
119 // Set the 3-dimensional local position and error for the component hit
120 // corresponding to the given cell side. Default value is assumed for the error.
121 void DTRecHit1DPair::setPositionAndError(DTCellSide lrside,
122  const LocalPoint& point,
123  const LocalError& err) {
124  if(lrside != undefLR) {
125  componentRecHit(lrside)->setPosition(point);
126  componentRecHit(lrside)->setError(err);
127  }
128  else throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR");
129 }
130 
131 
132 
133 // Return the left/right DTRecHit1D
134 const DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) const {
135  if(lrSide == Left) {
136  return &theLeftHit;
137  } else if(lrSide == Right) {
138  return &theRightHit;
139  } else {
140  throw cms::Exception("DTRecHit1DPair::recHit with undefined LR");
141  }
142 }
143 
144 
145 
146 // Non const access to left/right DTRecHit1D
147 DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) {
148  if(lrSide == Left) {
149  return &theLeftHit;
150  } else if(lrSide == Right) {
151  return &theRightHit;
152  } else {
153  throw cms::Exception("DTRecHit1DPair::recHit with undefined LR");
154  }
155 }
156 
157 
158 
160 pair<const DTRecHit1D*, const DTRecHit1D*> DTRecHit1DPair::componentRecHits() const {
161  return make_pair(componentRecHit(Left), componentRecHit(Right));
162 }
163 
164 
165 
166 // Ostream operator
167 ostream& operator<<(ostream& os, const DTRecHit1DPair& hit) {
168  os << "Pos: " << hit.localPosition() ;
169  return os;
170 }
void setPosition(LocalPoint pos)
Set local position.
Definition: DTRecHit1D.h:88
float digiTime() const
Return the digi time (ns) used to build the rechits.
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
void setError(LocalError err)
Set local position error.
Definition: DTRecHit1D.h:94
tuple result
Definition: mps_fire.py:84
virtual LocalError localPositionError() const
DTRecHit1D theLeftHit
void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint &point, const LocalError &err)
virtual DetId geographicalId() const
Return the detId of the Det (a DTLayer).
virtual std::vector< const TrackingRecHit * > recHits() const
bool operator==(const DTRecHit1DPair &hit) const
Comparison operator, based on the wireId and the digi time.
Definition: DTDigi.h:17
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:66
DTRecHit1D theRightHit
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
Definition: DetId.h:18
void setPosition(DTEnums::DTCellSide lrside, const LocalPoint &point)
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
DTRecHit1DPair()
Default constructor. Needed to write the RecHit into a STL container.
DTWireId wireId() const
virtual DTRecHit1DPair * clone() const
virtual ~DTRecHit1DPair()
Destructor.
T x() const
Definition: PV3DBase.h:62
std::pair< const DTRecHit1D *, const DTRecHit1D * > componentRecHits() const
Get the left and right 1D rechits (first and second respectively).
*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
virtual LocalPoint localPosition() const