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