Belle II Software  release-08-01-10
CDCRecoHit3D.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
11 
12 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
13 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
14 
15 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
16 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
17 
18 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
19 #include <tracking/trackFindingCDC/numerics/ERotation.h>
20 
21 namespace Belle2 {
26  class CDCSimHit;
27  class CDCHit;
28 
29  namespace TrackFindingCDC {
30  // Forward declaration.
31  class CDCTrajectory3D;
32  class CDCTrajectory2D;
33  class CDCTrajectorySZ;
34  class CDCRecoHit2D;
35  class CDCWireHit;
36  class CDCWire;
37 
52  class CDCRecoHit3D {
53  public:
55  CDCRecoHit3D() = default;
56 
58  CDCRecoHit3D(const CDCRLWireHit& rlWireHit, const Vector3D& recoPos3D, double arcLength2D = 0);
59 
68  static CDCRecoHit3D fromSimHit(const CDCWireHit* wireHit, const CDCSimHit& simHit);
69 
82  static CDCRecoHit3D reconstruct(const CDCRecoHit2D& recoHit2D,
83  const CDCTrajectory2D& trajectory2D);
84 
90  static CDCRecoHit3D reconstruct(const CDCRLWireHit& rlWireHit,
91  const CDCTrajectory2D& trajectory2D);
92 
98  static CDCRecoHit3D reconstruct(const CDCWireHit* wireHit,
99  ERightLeft rlInfo,
100  const CDCTrajectory2D& trajectory2D);
101 
111  static CDCRecoHit3D reconstructNearest(const CDCWireHit* axialWireHit,
112  const CDCTrajectory2D& trajectory2D);
113 
115  static CDCRecoHit3D reconstruct(const CDCRecoHit2D& recoHit,
116  const CDCTrajectory3D& trajectory3D);
117 
134  static CDCRecoHit3D reconstruct(const CDCRecoHit2D& recoHit2D,
135  const CDCTrajectory2D& trajectory2D,
136  const CDCTrajectorySZ& trajectorySZ);
137 
138  public:
145  static CDCRecoHit3D average(const CDCRecoHit3D& first,
146  const CDCRecoHit3D& second);
147 
153  void reverse();
154 
156  CDCRecoHit3D reversed() const;
157 
159  operator const Belle2::CDCHit* () const
160  {
161  return static_cast<const CDCHit*>(getRLWireHit());
162  }
163 
165  bool operator==(const CDCRecoHit3D& other) const
166  {
167  return getRLWireHit() == other.getRLWireHit() and
168  getRLInfo() == other.getRLInfo() and
169  getRecoPos3D() == other.getRecoPos3D();
170  }
171 
176  bool operator<(const CDCRecoHit3D& other) const
177  {
178  return (getRLWireHit() < other.getRLWireHit() or
179  (getRLWireHit() == other.getRLWireHit() and
180  getRecoPos3D() < other.getRecoPos3D()));
181  }
182 
184  friend bool operator<(const CDCRecoHit3D& recoHit3D, const CDCWire& wire)
185  {
186  return recoHit3D.getRLWireHit() < wire;
187  }
188 
190  friend bool operator<(const CDCWire& wire, const CDCRecoHit3D& recoHit3D)
191  {
192  return wire < recoHit3D.getRLWireHit();
193  }
194 
196  friend bool operator<(const CDCRecoHit3D& recoHit3D, const CDCWireHit& wireHit)
197  {
198  return recoHit3D.getRLWireHit() < wireHit;
199  }
200 
202  friend bool operator<(const CDCWireHit& wireHit, const CDCRecoHit3D& recoHit3D)
203  {
204  return wireHit < recoHit3D.getRLWireHit();
205  }
206 
208  EStereoKind getStereoKind() const
209  {
210  return getRLWireHit().getStereoKind();
211  }
212 
214  bool isAxial() const
215  {
216  return getRLWireHit().isAxial();
217  }
218 
220  ISuperLayer getISuperLayer() const
221  {
222  return getRLWireHit().getISuperLayer();
223  }
224 
226  const CDCWire& getWire() const
227  {
228  return getRLWireHit().getWire();
229  }
230 
232  bool isOnWire(const CDCWire& wire) const
233  {
234  return getRLWireHit().isOnWire(wire);
235  }
236 
238  const CDCWireHit& getWireHit() const
239  {
240  return getRLWireHit().getWireHit();
241  }
242 
244  bool hasWireHit(const CDCWireHit& wireHit) const
245  {
246  return getRLWireHit().hasWireHit(wireHit);
247  }
248 
250  const CDCRLWireHit& getRLWireHit() const
251  {
252  return m_rlWireHit;
253  }
254 
256  void setRLWireHit(const CDCRLWireHit& rlWireHit)
257  {
258  m_rlWireHit = rlWireHit;
259  }
260 
268  {
269  return getRLWireHit().getRLInfo();
270  }
271 
273  void setRLInfo(ERightLeft rlInfo)
274  {
275  m_rlWireHit.setRLInfo(rlInfo);
276  }
277 
279  const Vector2D& getRefPos2D() const
280  {
281  return getRLWireHit().getRefPos2D();
282  }
283 
285  const Vector3D& getRecoPos3D() const
286  {
287  return m_recoPos3D;
288  }
289 
291  void setRecoPos3D(const Vector3D& recoPos3D)
292  {
293  m_recoPos3D = recoPos3D;
294  }
295 
297  const Vector2D& getRecoPos2D() const
298  {
299  return getRecoPos3D().xy();
300  }
301 
303  double getRecoZ() const
304  {
305  return getRecoPos3D().z();
306  }
307 
309  Vector2D getRecoDisp2D() const;
310 
313  {
314  ERotation rotation = static_cast<ERotation>(-getRLInfo());
315  return getRecoDisp2D().orthogonal(rotation);
316  }
317 
319  double getAlpha() const
320  {
322  }
323 
328  CDCRecoHit2D getRecoHit2D() const;
329 
335 
337  Vector2D getRecoWirePos2D() const;
338 
340  void snapToDriftCircle(bool switchSide = false);
341 
347  {
349  }
350 
352  void setRecoDriftLength(double driftLength, bool snapRecoPos);
353 
359  {
361  }
362 
364  void shiftArcLength2D(double arcLength2DOffSet)
365  {
366  m_arcLength2D += arcLength2DOffSet;
367  }
368 
370  double getArcLength2D() const
371  {
372  return m_arcLength2D;
373  }
374 
376  void setArcLength2D(const double arcLength2D)
377  {
378  m_arcLength2D = arcLength2D;
379  }
380 
385  bool isInCellZBounds(const double factor = 1) const;
386 
387  private:
390 
393 
395  double m_arcLength2D = 0;
396  };
397  }
399 }
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Example Detector.
Definition: CDCSimHit.h:21
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:222
bool isAxial() const
Indicator if the underlying wire is axial.
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
bool hasWireHit(const CDCWireHit &wirehit) const
Checks if the oriented hit is associated with the give wire hit.
Definition: CDCRLWireHit.h:198
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:216
void setRLInfo(const ERightLeft rlInfo)
Setter for the right left passage information.
Definition: CDCRLWireHit.h:240
bool isOnWire(const CDCWire &wire) const
Checks if the oriented hit is associated with the give wire.
Definition: CDCRLWireHit.h:168
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
static CDCRecoHit3D average(const CDCRecoHit3D &first, const CDCRecoHit3D &second)
Constructs the average of two reconstructed hit positions.
void setRecoPos3D(const Vector3D &recoPos3D)
Setter for the 3d position of the hit.
Definition: CDCRecoHit3D.h:291
double m_arcLength2D
Memory for the travel distance as see in the xy projection.
Definition: CDCRecoHit3D.h:395
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
Definition: CDCRecoHit3D.h:220
void shiftArcLength2D(double arcLength2DOffSet)
Adjust the travel distance by the given value.
Definition: CDCRecoHit3D.h:364
CDCRecoHit3D()=default
Default constructor for ROOT.
void reverse()
Turns the orientation in place.
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCRecoHit3D.h:214
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
Definition: CDCRecoHit3D.h:346
friend bool operator<(const CDCWireHit &wireHit, const CDCRecoHit3D &recoHit3D)
Defines wire hits and the three dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit3D.h:202
bool operator<(const CDCRecoHit3D &other) const
Total ordering relation based on wire hit, right left passage information and position information in...
Definition: CDCRecoHit3D.h:176
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
Definition: CDCRecoHit3D.cc:56
double getAlpha() const
Getter for the direction of flight relative to the position.
Definition: CDCRecoHit3D.h:319
CDCRecoHit2D getRecoHit2D() const
Constructs a two dimensional reconstructed hit by carrying out the stereo ! projection to the wire re...
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit.
Definition: CDCRecoHit3D.h:250
friend bool operator<(const CDCWire &wire, const CDCRecoHit3D &recoHit3D)
Defines wires and the three dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit3D.h:190
Vector2D getRecoWirePos2D() const
Returns the position of the wire in the xy plain the reconstructed position is located in.
static CDCRecoHit3D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a three dimensional reconstructed hit from a sim hit and the assoziated wirehit.
Definition: CDCRecoHit3D.cc:46
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the dirft circle.
void setRLWireHit(const CDCRLWireHit &rlWireHit)
Setter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit3D.h:256
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
Definition: CDCRecoHit3D.h:303
double getRecoDriftLengthVariance() const
Returns the drift length variance next to the reconstructed position.
Definition: CDCRecoHit3D.h:358
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit3D.h:312
const Vector2D & getRefPos2D() const
Getter for the reference position of the wire.
Definition: CDCRecoHit3D.h:279
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Definition: CDCRecoHit3D.h:370
friend bool operator<(const CDCRecoHit3D &recoHit3D, const CDCWireHit &wireHit)
Defines wire hits and the three dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit3D.h:196
friend bool operator<(const CDCRecoHit3D &recoHit3D, const CDCWire &wire)
Defines wires and the three dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit3D.h:184
bool hasWireHit(const CDCWireHit &wireHit) const
Checks if the reconstructed hit is assoziated with the give wire hit.
Definition: CDCRecoHit3D.h:244
CDCRecoHit2D stereoProjectToRef() const
Constructs a two dimensional reconstructed hit by carrying out the stereo ! projection to the wire re...
void setArcLength2D(const double arcLength2D)
Setter for the travel distance in the xy projection.
Definition: CDCRecoHit3D.h:376
bool operator==(const CDCRecoHit3D &other) const
Equality comparision based on wire hit, right left passage information and reconstructed position.
Definition: CDCRecoHit3D.h:165
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
Definition: CDCRecoHit3D.h:285
CDCRLWireHit m_rlWireHit
Memory for the oriented wire hit reference.
Definition: CDCRecoHit3D.h:389
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Definition: CDCRecoHit3D.h:297
bool isOnWire(const CDCWire &wire) const
Checks if the reconstructed hit is assoziated with the give wire.
Definition: CDCRecoHit3D.h:232
void setRLInfo(ERightLeft rlInfo)
Setter the right left passage information.
Definition: CDCRecoHit3D.h:273
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition: CDCRecoHit3D.h:208
const CDCWireHit & getWireHit() const
Getter for the wire hit.
Definition: CDCRecoHit3D.h:238
CDCRecoHit3D reversed() const
Returns the recohit with the opposite right left information.
void setRecoDriftLength(double driftLength, bool snapRecoPos)
Setter to update the drift length of the hit.
static CDCRecoHit3D reconstructNearest(const CDCWireHit *axialWireHit, const CDCTrajectory2D &trajectory2D)
Reconstruct a three dimensional hit from a wire hit (as in reconstruct(rlWireHit, trajectory2D)),...
const CDCWire & getWire() const
Getter for the wire.
Definition: CDCRecoHit3D.h:226
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit3D.h:267
Vector2D getRecoDisp2D() const
Gets the displacement from the wire position in the xy plain at the reconstructed position.
Vector3D m_recoPos3D
Memory for the reconstructed hit position.
Definition: CDCRecoHit3D.h:392
bool isInCellZBounds(const double factor=1) const
Indicator if the hit is in the cdc (scaled by the factor) or already outside its boundaries.
Particle trajectory as it is seen in xy projection represented as a circle.
Particle full three dimensional trajectory.
Linear trajectory in sz space.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
Vector2D orthogonal() const
Orthogonal vector to the counterclockwise direction.
Definition: Vector2D.h:301
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:209
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: ERotation.h:25
Abstract base class for different kinds of events.