CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajectorySeedHitCandidate.h
Go to the documentation of this file.
1 #ifndef FastSimulation_Tracking_TrajectorySeedHitCandidate_H_
2 #define FastSimulation_Tracking_TrajectorySeedHitCandidate_H_
3 
12 
13 
14 
16 
17 #include <vector>
18 
19 class TrackerTopology;
20 class TrackerGeometry;
21 
23 public:
24 
27  theSplitHit(0),
28  theMatchedHit(0),
29  theGeomDet(0),
30  seedingLayer(),
31 
32  theRingNumber(0),
34  theLocalError(0.),
35  theLargerError(0.),
36  forward(false)
37 
38  {
39 
40  }
41 
44  const TrajectorySeedHitCandidate& other ) :
45  theSplitHit(theSplitHit),
46  theMatchedHit(0),
47  theGeomDet(other.geomDet()),
49  theRingNumber(other.ringNumber()),
51  theLocalError(0.),
52  theLargerError(0.),
53  forward(other.isForward())
54 
55  {
56 
57  }
58 
61  const TrackerGeometry* theGeometry,
62  const TrackerTopology* tTopo);
63 
65  const TrackerGeometry* theGeometry,
66  const TrackerTopology *tTopo);
67 
69  void init(const TrackerGeometry* theGeometry,
70  const TrackerTopology *tTopo);
71 
72  // TrackerRecHit(const SiTrackerGSMatchedRecHit2D* theHit,
73  // const TrackerGeometry* theGeometry);
74 
76  // const SiTrackerGSRecHit2D* hit() const { return theHit; }
77  inline const SiTrackerGSMatchedRecHit2D* matchedHit() const { return theMatchedHit; }
78  inline const SiTrackerGSRecHit2D* splitHit() const { return theSplitHit; }
79 
80  inline const GSSiTrackerRecHit2DLocalPos* hit() const {
83 
84  inline const TrackingLayer& getTrackingLayer() const
85  {
86  return seedingLayer;
87  }
88 
90  inline unsigned int subDetId() const { return seedingLayer.getSubDetNumber(); }
91 
93  inline unsigned int layerNumber() const { return seedingLayer.getLayerNumber(); }
94 
96  inline unsigned int ringNumber() const { return theRingNumber; }
97 
99  unsigned int cylinderNumber() const { return theCylinderNumber; }
100 
102  inline bool isForward() const { return forward; }
103 
105  inline const GeomDet* geomDet() const { return theGeomDet; }
106 
108  inline GlobalPoint globalPosition() const {
109  return theGeomDet->surface().toGlobal(hit()->localPosition());
110  }
111 
113  inline LocalPoint localPosition() const { return hit()->localPosition(); }
115  // bool isOnRequestedDet(const std::vector<unsigned int>& whichDet) const;
116 
118  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets) const;
119  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets, const TrajectorySeedHitCandidate& theSeedHitSecond) const;
120  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets, const TrajectorySeedHitCandidate& theSeedHitSecond, const TrajectorySeedHitCandidate& theSeedHitThird) const;
121 
122 
124  inline bool isOnTheSameLayer(const TrajectorySeedHitCandidate& other) const {
125 
126  return seedingLayer==other.seedingLayer;
127  }
128 
129  // The smaller local error
130  double localError() const
131  {
132 
133  // Check if it has been already computed
134  if ( theLocalError != 0. ) return theLocalError;
135 
136  // Otherwise, compute it!
137  double xx = hit()->localPositionError().xx();
138  double yy = hit()->localPositionError().yy();
139  double xy = hit()->localPositionError().xy();
140  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
141  theLocalError = 0.5 * (xx+yy-delta);
142  return theLocalError;
143 
144  }
145 
146  // The larger local error
147  double largerError() const
148  {
149 
150  // Check if it has been already computed
151  if ( theLargerError != 0. ) return theLargerError;
152 
153  // Otherwise, compute it!
154  double xx = hit()->localPositionError().xx();
155  double yy = hit()->localPositionError().yy();
156  double xy = hit()->localPositionError().xy();
157  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
158  theLargerError = 0.5 * (xx+yy+delta);
159  return theLargerError;
160 
161  }
162 
163  inline bool operator!=(const TrajectorySeedHitCandidate& aHit) const {
164  return
165  aHit.geomDet() != this->geomDet() ||
166  aHit.hit()->localPosition().x() != this->hit()->localPosition().x() ||
167  aHit.hit()->localPosition().y() != this->hit()->localPosition().y() ||
168  aHit.hit()->localPosition().z() != this->hit()->localPosition().z();
169  }
170 
171  private:
172 
177  unsigned int theRingNumber;
178  unsigned int theCylinderNumber;
179  mutable double theLocalError; //only for caching
180  mutable double theLargerError; //only for caching
181  bool forward;
182 
183 };
184 
185 #endif
186 
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:75
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 cylinderNumber() const
The global layer number in the nested cylinder geometry.
bool operator!=(const TrajectorySeedHitCandidate &aHit) const
const GSSiTrackerRecHit2DLocalPos * hit() const
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:85
bool isForward() const
Is it a forward hit ?
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
The global position.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual LocalError localPositionError() const
float xy() const
Definition: LocalError.h:25
void init(const TrackerGeometry *theGeometry, const TrackerTopology *tTopo)
Initialization at construction time.
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
const SiTrackerGSMatchedRecHit2D * matchedHit() const
The Hit itself.
T z() const
Definition: PV3DBase.h:64
TrajectorySeedHitCandidate()
Default Constructor.
bool isOnRequestedDet(const std::vector< std::vector< TrackingLayer > > &theLayersInSets) const
Check if the hit is on one of the requested detector.
const SiTrackerGSRecHit2D * splitHit() const
unsigned int ringNumber() const
The Ring Number.
const GeomDet * geomDet() const
The GeomDet.
const SiTrackerGSMatchedRecHit2D * theMatchedHit
LocalPoint localPosition() const
The local position.
unsigned int layerNumber() const
The Layer Number.
TrajectorySeedHitCandidate(const SiTrackerGSRecHit2D *theSplitHit, const TrajectorySeedHitCandidate &other)
Soft Copy Constructor from private members.
volatile std::atomic< bool > shutdown_flag false
const TrackingLayer & getTrackingLayer() const
bool isOnTheSameLayer(const TrajectorySeedHitCandidate &other) const
Check if two hits are on the same layer of the same subdetector.
unsigned int subDetId() const
The subdet Id.
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const
const SiTrackerGSRecHit2D * theSplitHit