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 
17 
18 #include <vector>
19 
20 class TrackerTopology;
21 
26 public:
27 
30  theSplitHit(0),
31  theMatchedHit(0),
32  theGeomDet(0),
33  theSubDetId(0),
34  theLayerNumber(0),
35  theRingNumber(0),
37  theLocalError(0.),
38  theLargerError(0.),
39  forward(false) {}
40 
43  const TrackerRecHit& other ) :
44  theSplitHit(theSplitHit),
45  theMatchedHit(0),
46  theGeomDet(other.geomDet()),
47  theSubDetId(other.subDetId()),
48  theLayerNumber(other.layerNumber()),
49  theRingNumber(other.ringNumber()),
51  theLocalError(0.),
52  theLargerError(0.),
53  forward(other.isForward()) {}
54 
56  TrackerRecHit(const SiTrackerGSRecHit2D* theHit,
57  const TrackerGeometry* theGeometry,
58  const TrackerTopology* tTopo);
59 
61  const TrackerGeometry* theGeometry,
62  const TrackerTopology *tTopo);
63 
65  void init(const TrackerGeometry* theGeometry,
66  const TrackerTopology *tTopo);
67 
68  // TrackerRecHit(const SiTrackerGSMatchedRecHit2D* theHit,
69  // const TrackerGeometry* theGeometry);
70 
72  // const SiTrackerGSRecHit2D* hit() const { return theHit; }
73  inline const SiTrackerGSMatchedRecHit2D* matchedHit() const { return theMatchedHit; }
74  inline const SiTrackerGSRecHit2D* splitHit() const { return theSplitHit; }
75 
76  inline const GSSiTrackerRecHit2DLocalPos* hit() const {
79 
81  inline unsigned int subDetId() const { return theSubDetId; }
82 
84  inline unsigned int layerNumber() const { return theLayerNumber; }
85 
87  inline unsigned int ringNumber() const { return theRingNumber; }
88 
90  unsigned int cylinderNumber() const { return theCylinderNumber; }
91 
93  inline bool isForward() const { return forward; }
94 
96  inline const GeomDet* geomDet() const { return theGeomDet; }
97 
99  inline GlobalPoint globalPosition() const {
100  return theGeomDet->surface().toGlobal(hit()->localPosition());
101  }
102 
104  inline LocalPoint localPosition() const { return hit()->localPosition(); }
106  // bool isOnRequestedDet(const std::vector<unsigned int>& whichDet) const;
107  bool isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const;
109  bool isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets) const;
110  bool isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets, const TrackerRecHit& theSeedHitSecond) const;
111  bool isOnRequestedDet(const std::vector<std::vector<TrajectorySeedProducer::LayerSpec> >& theLayersInSets, const TrackerRecHit& theSeedHitSecond, const TrackerRecHit& theSeedHitThird) const;
112 
114  bool makesAPairWith(const TrackerRecHit& anotherHit) const;
115  bool makesAPairWith3rd(const TrackerRecHit& anotherHit) const;
116 
118  bool makesATripletWith(const TrackerRecHit& anotherHit,
119  const TrackerRecHit& yetAnotherHit) const;
120 
122  inline bool isOnTheSameLayer(const TrackerRecHit& other) const {
123 
124  return
125  theSubDetId == other.subDetId() &&
126  theLayerNumber == other.layerNumber();
127  }
128 
129  // The smaller local error
130  double localError() {
131 
132  // Check if it has been already computed
133  if ( theLocalError != 0. ) return theLocalError;
134 
135  // Otherwise, compute it!
136  double xx = hit()->localPositionError().xx();
137  double yy = hit()->localPositionError().yy();
138  double xy = hit()->localPositionError().xy();
139  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
140  theLocalError = 0.5 * (xx+yy-delta);
141  return theLocalError;
142 
143  }
144 
145  // The larger local error
146  double largerError() {
147 
148  // Check if it has been already computed
149  if ( theLargerError != 0. ) return theLargerError;
150 
151  // Otherwise, compute it!
152  double xx = hit()->localPositionError().xx();
153  double yy = hit()->localPositionError().yy();
154  double xy = hit()->localPositionError().xy();
155  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
156  theLargerError = 0.5 * (xx+yy+delta);
157  return theLargerError;
158 
159  }
160 
161  inline bool operator!=(const TrackerRecHit& aHit) const {
162  return
163  aHit.geomDet() != this->geomDet() ||
164  aHit.hit()->localPosition().x() != this->hit()->localPosition().x() ||
165  aHit.hit()->localPosition().y() != this->hit()->localPosition().y() ||
166  aHit.hit()->localPosition().z() != this->hit()->localPosition().z();
167  }
168 
169  private:
170 
174  unsigned int theSubDetId;
175  unsigned int theLayerNumber;
176  unsigned int theRingNumber;
177  unsigned int theCylinderNumber;
180  bool forward;
181 
182 };
183 
184 #endif
185 
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
unsigned int cylinderNumber() const
The global layer number in the nested cylinder geometry.
Definition: TrackerRecHit.h:90
T y() const
Definition: PV3DBase.h:63
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:99
unsigned int ringNumber() const
The Ring Number.
Definition: TrackerRecHit.h:87
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:29
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:74
float xy() const
Definition: LocalError.h:25
void init(const TrackerGeometry *theGeometry, const TrackerTopology *tTopo)
Initialization at construction time.
virtual LocalError localPositionError() const GCC11_FINAL
const SiTrackerGSMatchedRecHit2D * matchedHit() const
The Hit itself.
Definition: TrackerRecHit.h:73
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
unsigned int theSubDetId
T z() const
Definition: PV3DBase.h:64
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:93
unsigned int layerNumber() const
The Layer Number.
Definition: TrackerRecHit.h:84
const GSSiTrackerRecHit2DLocalPos * hit() const
Definition: TrackerRecHit.h:76
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.
unsigned int subDetId() const
The subdet Id.
Definition: TrackerRecHit.h:81
double localError()
const GeomDet * geomDet() const
The GeomDet.
Definition: TrackerRecHit.h:96
volatile std::atomic< bool > shutdown_flag false
TrackerRecHit(const SiTrackerGSRecHit2D *theSplitHit, const TrackerRecHit &other)
Soft Copy Constructor from private members.
Definition: TrackerRecHit.h:42
virtual LocalPoint localPosition() const GCC11_FINAL
T x() const
Definition: PV3DBase.h:62
LocalPoint localPosition() const
The local position.