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 
11 
12 
13 
15 
16 #include <vector>
17 
18 class TrackerTopology;
19 class TrackerGeometry;
20 
22 public:
23 
26  theSplitHit(0),
27  theMatchedHit(0),
28  theGeomDet(0),
29  seedingLayer(),
30 
31  theRingNumber(0),
33  theLocalError(0.),
34  theLargerError(0.),
35  forward(false)
36 
37  {
38 
39  }
40 
43  const TrajectorySeedHitCandidate& other ) :
44  theSplitHit(theSplitHit),
45  theMatchedHit(0),
46  theGeomDet(other.geomDet()),
48  theRingNumber(other.ringNumber()),
50  theLocalError(0.),
51  theLargerError(0.),
52  forward(other.isForward())
53 
54  {
55 
56  }
57 
60  const TrackerGeometry* theGeometry,
61  const TrackerTopology* tTopo);
62 
64  const TrackerGeometry* theGeometry,
65  const TrackerTopology *tTopo);
66 
68  void init(const TrackerGeometry* theGeometry,
69  const TrackerTopology *tTopo);
70 
71  // TrackerRecHit(const SiTrackerGSMatchedRecHit2D* theHit,
72  // const TrackerGeometry* theGeometry);
73 
75  // const SiTrackerGSRecHit2D* hit() const { return theHit; }
76  inline const SiTrackerGSMatchedRecHit2D* matchedHit() const { return theMatchedHit; }
77  inline const SiTrackerGSRecHit2D* splitHit() const { return theSplitHit; }
78 
79  inline const GSSiTrackerRecHit2DLocalPos* hit() const {
82 
83  inline const TrackingLayer& getTrackingLayer() const
84  {
85  return seedingLayer;
86  }
87 
89  inline unsigned int subDetId() const { return seedingLayer.getSubDetNumber(); }
90 
92  inline unsigned int layerNumber() const { return seedingLayer.getLayerNumber(); }
93 
95  inline unsigned int ringNumber() const { return theRingNumber; }
96 
98  unsigned int cylinderNumber() const { return theCylinderNumber; }
99 
101  inline bool isForward() const { return forward; }
102 
104  inline const GeomDet* geomDet() const { return theGeomDet; }
105 
107  inline GlobalPoint globalPosition() const {
108  return theGeomDet->surface().toGlobal(hit()->localPosition());
109  }
110 
112  inline LocalPoint localPosition() const { return hit()->localPosition(); }
114  // bool isOnRequestedDet(const std::vector<unsigned int>& whichDet) const;
115 
117  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets) const;
118  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets, const TrajectorySeedHitCandidate& theSeedHitSecond) const;
119  bool isOnRequestedDet(const std::vector<std::vector<TrackingLayer> >& theLayersInSets, const TrajectorySeedHitCandidate& theSeedHitSecond, const TrajectorySeedHitCandidate& theSeedHitThird) const;
120 
121 
123  inline bool isOnTheSameLayer(const TrajectorySeedHitCandidate& other) const {
124 
125  return seedingLayer==other.seedingLayer;
126  }
127 
128  // The smaller local error
129  double localError() const
130  {
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() const
147  {
148 
149  // Check if it has been already computed
150  if ( theLargerError != 0. ) return theLargerError;
151 
152  // Otherwise, compute it!
153  double xx = hit()->localPositionError().xx();
154  double yy = hit()->localPositionError().yy();
155  double xy = hit()->localPositionError().xy();
156  double delta = std::sqrt((xx-yy)*(xx-yy)+4.*xy*xy);
157  theLargerError = 0.5 * (xx+yy+delta);
158  return theLargerError;
159 
160  }
161 
162  inline bool operator!=(const TrajectorySeedHitCandidate& aHit) const {
163  return
164  aHit.geomDet() != this->geomDet() ||
165  aHit.hit()->localPosition().x() != this->hit()->localPosition().x() ||
166  aHit.hit()->localPosition().y() != this->hit()->localPosition().y() ||
167  aHit.hit()->localPosition().z() != this->hit()->localPosition().z();
168  }
169 
170  private:
171 
176  unsigned int theRingNumber;
177  unsigned int theCylinderNumber;
178  mutable double theLocalError; //only for caching
179  mutable double theLargerError; //only for caching
180  bool forward;
181 
182 };
183 
184 #endif
185 
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