CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerRecHit.h
Go to the documentation of this file.
1 #ifndef FastSimulation_Tracking_TrackerRecHit_H_
2 #define FastSimulation_Tracking_TrackerRecHit_H_
3 
13 
15 
16 #include <vector>
17 
18 class TrackerTopology;
19 
24 public:
25 
28  theSplitHit(0),
29  theMatchedHit(0),
30  theGeomDet(0),
31  theSubDetId(0),
32  theLayerNumber(0),
33  theRingNumber(0),
35  theLocalError(0.),
36  theLargerError(0.),
37  forward(false) {}
38 
41  const TrackerRecHit& other ) :
42  theSplitHit(theSplitHit),
43  theMatchedHit(0),
44  theGeomDet(other.geomDet()),
45  theSubDetId(other.subDetId()),
46  theLayerNumber(other.layerNumber()),
47  theRingNumber(other.ringNumber()),
49  theLocalError(0.),
50  theLargerError(0.),
51  forward(other.isForward()) {}
52 
54  TrackerRecHit(const SiTrackerGSRecHit2D* theHit,
55  const TrackerGeometry* theGeometry,
56  const TrackerTopology* tTopo);
57 
59  const TrackerGeometry* theGeometry,
60  const TrackerTopology *tTopo);
61 
63  void init(const TrackerGeometry* theGeometry,
64  const TrackerTopology *tTopo);
65 
66  // TrackerRecHit(const SiTrackerGSMatchedRecHit2D* theHit,
67  // const TrackerGeometry* theGeometry);
68 
70  // const SiTrackerGSRecHit2D* hit() const { return theHit; }
71  inline const SiTrackerGSMatchedRecHit2D* matchedHit() const { return theMatchedHit; }
72  inline const SiTrackerGSRecHit2D* splitHit() const { return theSplitHit; }
73 
74  inline const GSSiTrackerRecHit2DLocalPos* hit() const {
77 
79  inline unsigned int subDetId() const { return theSubDetId; }
80 
82  inline unsigned int layerNumber() const { return theLayerNumber; }
83 
85  inline unsigned int ringNumber() const { return theRingNumber; }
86 
88  unsigned int cylinderNumber() const { return theCylinderNumber; }
89 
91  inline bool isForward() const { return forward; }
92 
94  inline const GeomDet* geomDet() const { return theGeomDet; }
95 
97  inline GlobalPoint globalPosition() const {
99  }
100 
102  inline LocalPoint localPosition() const { return hit()->localPosition(); }
103 
105  // bool isOnRequestedDet(const std::vector<unsigned int>& whichDet) const;
106  bool isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const;
107  bool isOnRequestedDet(const std::vector<std::string>& layerList) const; // AG
108 
110  bool makesAPairWith(const TrackerRecHit& anotherHit) const;
111  bool makesAPairWith3rd(const TrackerRecHit& anotherHit) const;
112 
114  bool makesATripletWith(const TrackerRecHit& anotherHit,
115  const TrackerRecHit& yetAnotherHit) const;
116 
118  inline bool isOnTheSameLayer(const TrackerRecHit& other) const {
119 
120  return
121  theSubDetId == other.subDetId() &&
122  theLayerNumber == other.layerNumber();
123  }
124 
125  // The smaller local error
126  double localError() {
127 
128  // Check if it has been already computed
129  if ( theLocalError != 0. ) return theLocalError;
130 
131  // Otherwise, compute it!
132  double xx = hit()->localPositionError().xx();
133  double yy = hit()->localPositionError().yy();
134  double xy = hit()->localPositionError().xy();
135  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
136  theLocalError = 0.5 * (xx+yy-delta);
137  return theLocalError;
138 
139  }
140 
141  // The larger local error
142  double largerError() {
143 
144  // Check if it has been already computed
145  if ( theLargerError != 0. ) return theLargerError;
146 
147  // Otherwise, compute it!
148  double xx = hit()->localPositionError().xx();
149  double yy = hit()->localPositionError().yy();
150  double xy = hit()->localPositionError().xy();
151  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
152  theLargerError = 0.5 * (xx+yy+delta);
153  return theLargerError;
154 
155  }
156 
157  inline bool operator!=(const TrackerRecHit& aHit) const {
158  return
159  aHit.geomDet() != this->geomDet() ||
160  aHit.hit()->localPosition().x() != this->hit()->localPosition().x() ||
161  aHit.hit()->localPosition().y() != this->hit()->localPosition().y() ||
162  aHit.hit()->localPosition().z() != this->hit()->localPosition().z();
163  }
164 
165  private:
166 
170  unsigned int theSubDetId;
171  unsigned int theLayerNumber;
172  unsigned int theRingNumber;
173  unsigned int theCylinderNumber;
176  bool forward;
177 
178 };
179 
180 #endif
181 
dbl * delta
Definition: mlp_gen.cc:36
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float xx() const
Definition: LocalError.h:24
unsigned int theLayerNumber
const SiTrackerGSRecHit2D * theSplitHit
virtual LocalError localPositionError() const
unsigned int cylinderNumber() const
The global layer number in the nested cylinder geometry.
Definition: TrackerRecHit.h:88
const SiTrackerGSMatchedRecHit2D * theMatchedHit
unsigned int theCylinderNumber
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
GlobalPoint globalPosition() const
The global position.
Definition: TrackerRecHit.h:97
unsigned int ringNumber() const
The Ring Number.
Definition: TrackerRecHit.h:85
double largerError()
bool isOnTheSameLayer(const TrackerRecHit &other) const
Check if two hits are on the same layer of the same subdetector.
TrackerRecHit()
Default Constructor.
Definition: TrackerRecHit.h:27
double theLargerError
unsigned int theRingNumber
bool makesATripletWith(const TrackerRecHit &anotherHit, const TrackerRecHit &yetAnotherHit) const
Check if a triplet is on the proper combination of detectors.
const SiTrackerGSRecHit2D * splitHit() const
Definition: TrackerRecHit.h:72
float xy() const
Definition: LocalError.h:25
void init(const TrackerGeometry *theGeometry, const TrackerTopology *tTopo)
Initialization at construction time.
const SiTrackerGSMatchedRecHit2D * matchedHit() const
The Hit itself.
Definition: TrackerRecHit.h:71
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
unsigned int theSubDetId
const GeomDet * theGeomDet
double theLocalError
bool makesAPairWith3rd(const TrackerRecHit &anotherHit) const
bool operator!=(const TrackerRecHit &aHit) const
bool isForward() const
Is it a forward hit ?
Definition: TrackerRecHit.h:91
unsigned int layerNumber() const
The Layer Number.
Definition: TrackerRecHit.h:82
const GSSiTrackerRecHit2DLocalPos * hit() const
Definition: TrackerRecHit.h:74
bool makesAPairWith(const TrackerRecHit &anotherHit) const
Check if a pair is on the proper combination of detectors.
bool isOnRequestedDet(const std::vector< unsigned int > &whichDet, const std::string &seedingAlgo) const
Check if the hit is on one of the requested detector.
virtual LocalPoint localPosition() const
unsigned int subDetId() const
The subdet Id.
Definition: TrackerRecHit.h:79
double localError()
const GeomDet * geomDet() const
The GeomDet.
Definition: TrackerRecHit.h:94
TrackerRecHit(const SiTrackerGSRecHit2D *theSplitHit, const TrackerRecHit &other)
Soft Copy Constructor from private members.
Definition: TrackerRecHit.h:40
LocalPoint localPosition() const
The local position.