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 }
DTRecHit1DPair::componentRecHit
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DTRecHit1DPair::theRightHit
DTRecHit1D theRightHit
Definition: DTRecHit1DPair.h:103
DTRecHit1DPair::DTRecHit1DPair
DTRecHit1DPair()
Default constructor. Needed to write the RecHit into a STL container.
Definition: DTRecHit1DPair.cc:19
DTRecHit1D
Definition: DTRecHit1D.h:25
DTRecHit1DPair::operator==
bool operator==(const DTRecHit1DPair &hit) const
Comparison operator, based on the wireId and the digi time.
Definition: DTRecHit1DPair.cc:60
DTEnums
Definition: DTEnums.h:12
DTRecHit1DPair::theLeftHit
DTRecHit1D theLeftHit
Definition: DTRecHit1DPair.h:102
DTRecHit1DPair::~DTRecHit1DPair
~DTRecHit1DPair() override
Destructor.
Definition: DTRecHit1DPair.cc:22
DTRecHit1D::localPositionError
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:50
DTRecHit1DPair::digiTime
float digiTime() const
Return the digi time (ns) used to build the rechits.
Definition: DTRecHit1DPair.h:63
DetId
Definition: DetId.h:17
DTRecHit1DPair::geographicalId
virtual DetId geographicalId() const
Return the detId of the Det (a DTLayer).
Definition: DTRecHit1DPair.cc:57
DTEnums::Left
Definition: DTEnums.h:15
DTRecHit1DPair::clone
DTRecHit1DPair * clone() const override
Definition: DTRecHit1DPair.cc:24
DTWireId
Definition: DTWireId.h:12
DTRecHit1DPair::setPosition
void setPosition(DTEnums::DTCellSide lrside, const LocalPoint &point)
Definition: DTRecHit1DPair.cc:76
DTRecHit1DPair
Definition: DTRecHit1DPair.h:26
Point3DBase< float, LocalTag >
DTRecHit1D::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
DTRecHit1DPair::recHits
std::vector< const TrackingRecHit * > recHits() const override
Definition: DTRecHit1DPair.cc:41
DTRecHit1DPair::componentRecHits
std::pair< const DTRecHit1D *, const DTRecHit1D * > componentRecHits() const
Get the left and right 1D rechits (first and second respectively).
Definition: DTRecHit1DPair.cc:116
LocalError
Definition: LocalError.h:12
DTRecHit1DPair::wireId
DTWireId wireId() const
Definition: DTRecHit1DPair.h:89
DTRecHit1DPair.h
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
DTEnums::Right
Definition: DTEnums.h:15
std
Definition: JetResolutionObject.h:76
DTRecHit1DPair::localPosition
LocalPoint localPosition() const override
Definition: DTRecHit1DPair.cc:29
operator<<
ostream & operator<<(ostream &os, const DTRecHit1DPair &hit)
Definition: DTRecHit1DPair.cc:121
DTRecHit1DPair::setPositionAndError
void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint &point, const LocalError &err)
Definition: DTRecHit1DPair.cc:85
Exception
Definition: hltDiff.cc:246
DTDigi
Definition: DTDigi.h:17
Exception.h
DTWireId::layerId
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
DTRecHit1D::setPosition
void setPosition(LocalPoint pos)
Set local position.
Definition: DTRecHit1D.h:64
mps_fire.result
result
Definition: mps_fire.py:311
DTDigi.h
point
*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
ntuplemaker.time
time
Definition: ntuplemaker.py:310
DTRecHit1D::setError
void setError(LocalError err)
Set local position error.
Definition: DTRecHit1D.h:67
DTRecHit1DPair::localPositionError
LocalError localPositionError() const override
Definition: DTRecHit1DPair.cc:36
hit
Definition: SiStripHitEffFromCalibTree.cc:88