Belle II Software  release-05-02-19
CDCRecoHit2D.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
13 
14 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
15 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
16 
17 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
18 #include <tracking/trackFindingCDC/numerics/ERotation.h>
19 
20 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
21 
22 #include <iosfwd>
23 
24 namespace Belle2 {
29  class CDCSimHit;
30  class CDCHit;
31 
32  namespace TrackFindingCDC {
33  class CDCTrajectory2D;
34  class CDCWireHit;
35  class CDCWire;
36  class Vector3D;
37 
49  class CDCRecoHit2D {
50 
51  public:
53  CDCRecoHit2D() = default;
54 
59  CDCRecoHit2D(const CDCRLWireHit& rlWireHit,
60  const Vector2D& recoDisp2D);
61 
63  explicit CDCRecoHit2D(const CDCRLWireHit& rlWireHit);
64 
72  static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
73  const CDCRecoHit2D& recoHit2);
74 
82  static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
83  const CDCRecoHit2D& recoHit2 ,
84  const CDCRecoHit2D& recoHit3);
85 
93  static CDCRecoHit2D
94  fromRecoPos2D(const CDCRLWireHit& rlWireHit, const Vector2D& recoPos2D, bool snap = true);
95 
101  void reverse();
102 
104  CDCRecoHit2D reversed() const;
105 
107  CDCRecoHit2D getAlias() const;
108 
116  static CDCRecoHit2D fromSimHit(const CDCWireHit* wireHit, const CDCSimHit& simHit);
117 
118 
120  operator const Belle2::CDCHit* () const
121  { return static_cast<const CDCHit*>(getRLWireHit()); }
122 
123 
125  bool operator==(const CDCRecoHit2D& other) const
126  {
127  return getRLWireHit() == other.getRLWireHit() and
128  getRecoDisp2D() == other.getRecoDisp2D();
129  }
130 
135  bool operator<(const CDCRecoHit2D& other) const
136  {
137  return getRLWireHit() < other.getRLWireHit() or (
138  getRLWireHit() == other.getRLWireHit() and
139  getRecoDisp2D() < other.getRecoDisp2D());
140  }
141 
143  friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWire& wire)
144  { return recoHit2D.getRLWireHit() < wire; }
145 
147  friend bool operator<(const CDCWire& wire, const CDCRecoHit2D& recoHit2D)
148  { return wire < recoHit2D.getRLWireHit(); }
149 
151  friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWireHit& wireHit)
152  { return recoHit2D.getRLWireHit() < wireHit; }
153 
155  friend bool operator<(const CDCWireHit& wireHit, const CDCRecoHit2D& recoHit2D)
156  { return wireHit < recoHit2D.getRLWireHit(); }
157 
159  EStereoKind getStereoKind() const
160  {
161  return getRLWireHit().getStereoKind();
162  }
163 
165  bool isAxial() const
166  {
167  return getRLWireHit().isAxial();
168  }
169 
171  ISuperLayer getISuperLayer() const
172  {
174  }
175 
177  const CDCWire& getWire() const
178  {
179  return getRLWireHit().getWire();
180  }
181 
183  const Vector2D& getRefPos2D() const
184  {
186  }
187 
189  bool isOnWire(const CDCWire& wire) const
190  {
191  return getRLWireHit().isOnWire(wire);
192  }
193 
195  const CDCWireHit& getWireHit() const
196  {
198  }
199 
201  bool hasWireHit(const CDCWireHit& wireHit) const
202  {
203  return getRLWireHit().hasWireHit(wireHit);
204  }
205 
207  ERightLeft getRLInfo() const
208  {
210  }
211 
213  void setRLInfo(ERightLeft& rlInfo)
214  {
216  }
217 
219  double getRefDriftLength() const
220  {
222  }
223 
225  void setRefDriftLength(double driftLength, bool snapRecoPos);
226 
228  double getSignedRefDriftLength() const
229  {
231  }
232 
234  double getRefDriftLengthVariance() const
235  {
237  }
238 
240  Vector2D getRecoPos2D() const
241  {
243  }
244 
246  void setRecoPos2D(const Vector2D& recoPos2D)
247  {
248  m_recoDisp2D = recoPos2D - getRefPos2D();
249  }
250 
252  const Vector2D& getRecoDisp2D() const
253  {
254  return m_recoDisp2D;
255  }
256 
259  {
260  ERotation rotation = static_cast<ERotation>(-getRLInfo());
261  return getRecoDisp2D().orthogonal(rotation);
262  }
263 
265  double getAlpha() const
266  {
268  }
269 
271  void snapToDriftCircle(bool switchSide = false);
272 
280  Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, const double z = 0) const;
281 
283  const CDCRLWireHit& getRLWireHit() const
284  {
285  return m_rlWireHit;
286  }
287 
289  void setRLWireHit(const CDCRLWireHit& rlWireHit)
290  {
291  m_rlWireHit = rlWireHit;
292  }
293 
294  private:
297 
300  };
301 
302 
304  std::ostream& operator<<(std::ostream& output, const CDCRecoHit2D& recohit);
305  }
307 }
Belle2::TrackFindingCDC::CDCRLWireHit::setRLInfo
void setRLInfo(const ERightLeft rlInfo)
Setter for the right left passage information.
Definition: CDCRLWireHit.h:250
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::TrackFindingCDC::CDCRecoHit2D::getRefDriftLengthVariance
double getRefDriftLengthVariance() const
Getter for the uncertainty in the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:242
Belle2::TrackFindingCDC::CDCRecoHit2D::setRLWireHit
void setRLWireHit(const CDCRLWireHit &rlWireHit)
Setter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:297
Belle2::TrackFindingCDC::Vector2D::orthogonal
Vector2D orthogonal() const
Orthogonal vector to the counterclockwise direction.
Definition: Vector2D.h:303
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCRecoHit2D::operator<
friend bool operator<(const CDCRecoHit2D &recoHit2D, const CDCWire &wire)
Defines wires and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:151
Belle2::TrackFindingCDC::CDCRecoHit2D::getRecoPos2D
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:248
Belle2::TrackFindingCDC::CDCRLWireHit::getWireHit
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:202
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::TrackFindingCDC::CDCRecoHit2D::fromRecoPos2D
static CDCRecoHit2D fromRecoPos2D(const CDCRLWireHit &rlWireHit, const Vector2D &recoPos2D, bool snap=true)
Constructs a two dimensional reconstructed hit from an absolute position.
Definition: CDCRecoHit2D.cc:88
Belle2::TrackFindingCDC::CDCRLWireHit::getISuperLayer
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
Definition: CDCRLWireHit.cc:143
Belle2::TrackFindingCDC::CDCRecoHit2D::getRLWireHit
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:291
Belle2::TrackFindingCDC::CDCRLWireHit::getWire
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
Definition: CDCRLWireHit.cc:133
Belle2::TrackFindingCDC::CDCRLWireHit::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:214
Belle2::TrackFindingCDC::CDCRecoHit2D::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:227
Belle2::TrackFindingCDC::CDCRecoHit2D::getRecoDisp2D
const Vector2D & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
Definition: CDCRecoHit2D.h:260
Belle2::TrackFindingCDC::CDCRecoHit2D::hasWireHit
bool hasWireHit(const CDCWireHit &wireHit) const
Checks if the reconstructed hit is assoziated with the give wire hit.
Definition: CDCRecoHit2D.h:209
Belle2::TrackFindingCDC::CDCRLWireHit::getSignedRefDriftLength
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:226
Belle2::TrackFindingCDC::CDCRecoHit2D::setRecoPos2D
void setRecoPos2D(const Vector2D &recoPos2D)
Setter for the position in the reference plane.
Definition: CDCRecoHit2D.h:254
Belle2::TrackFindingCDC::CDCRecoHit2D::fromSimHit
static CDCRecoHit2D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a two dimensional reconstructed hit from a sim hit and the assoziated wirehit.
Definition: CDCRecoHit2D.cc:39
Belle2::TrackFindingCDC::CDCRecoHit2D::setRefDriftLength
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.cc:115
Belle2::TrackFindingCDC::CDCRecoHit2D::average
static CDCRecoHit2D average(const CDCRecoHit2D &recoHit1, const CDCRecoHit2D &recoHit2)
Constructs the average of two reconstructed hit positions and snaps it to the drift circle.
Definition: CDCRecoHit2D.cc:51
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCRecoHit2D::reversed
CDCRecoHit2D reversed() const
Returns the recohit with the opposite right left information.
Definition: CDCRecoHit2D.cc:102
Belle2::TrackFindingCDC::CDCRecoHit2D::getRefPos2D
const Vector2D & getRefPos2D() const
Getter for the reference position of the wire.
Definition: CDCRecoHit2D.h:191
Belle2::TrackFindingCDC::CDCRecoHit2D::getWire
const CDCWire & getWire() const
Getter for the wire the reconstructed hit assoziated to.
Definition: CDCRecoHit2D.h:185
Belle2::TrackFindingCDC::CDCRLWireHit::hasWireHit
bool hasWireHit(const CDCWireHit &wirehit) const
Checks if the oriented hit is associated with the give wire hit.
Definition: CDCRLWireHit.h:208
Belle2::TrackFindingCDC::CDCRecoHit2D::m_rlWireHit
CDCRLWireHit m_rlWireHit
Memory for the reference to the assiziated wire hit.
Definition: CDCRecoHit2D.h:304
Belle2::TrackFindingCDC::CDCRLWireHit::getRefDriftLengthVariance
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:232
Belle2::TrackFindingCDC::CDCRecoHit2D::getISuperLayer
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
Definition: CDCRecoHit2D.h:179
Belle2::TrackFindingCDC::CDCRecoHit2D
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:57
Belle2::TrackFindingCDC::CDCRLWireHit::isOnWire
bool isOnWire(const CDCWire &wire) const
Checks if the oriented hit is associated with the give wire.
Definition: CDCRLWireHit.h:178
Belle2::TrackFindingCDC::CDCRLWireHit::getRLInfo
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:244
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::CDCRecoHit2D::CDCRecoHit2D
CDCRecoHit2D()=default
Default constructor for ROOT.
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCRLWireHit::isAxial
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCRLWireHit.cc:153
Belle2::TrackFindingCDC::CDCRecoHit2D::m_recoDisp2D
Vector2D m_recoDisp2D
Memory for the displacement fo the assoziated wire reference position.
Definition: CDCRecoHit2D.h:307
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::CDCRecoHit2D::reverse
void reverse()
Turns the orientation in place.
Definition: CDCRecoHit2D.cc:97
Belle2::TrackFindingCDC::NRotation::ERotation
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: ERotation.h:35
Belle2::TrackFindingCDC::CDCRecoHit2D::isAxial
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCRecoHit2D.h:173
Belle2::TrackFindingCDC::CDCRecoHit2D::getAlias
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
Definition: CDCRecoHit2D.cc:109
Belle2::TrackFindingCDC::CDCRLWireHit::getStereoKind
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition: CDCRLWireHit.cc:148
Belle2::TrackFindingCDC::CDCRLWireHit::getRefPos2D
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
Definition: CDCRLWireHit.cc:158
Belle2::TrackFindingCDC::CDCRecoHit2D::getAlpha
double getAlpha() const
Getter for the direction of flight relative to the position.
Definition: CDCRecoHit2D.h:273
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCRecoHit2D::setRLInfo
void setRLInfo(ERightLeft &rlInfo)
Setter the right left passage information.
Definition: CDCRecoHit2D.h:221
Belle2::TrackFindingCDC::CDCRecoHit2D::getStereoKind
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition: CDCRecoHit2D.h:167
Belle2::TrackFindingCDC::CDCRecoHit2D::snapToDriftCircle
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the dirft circle.
Definition: CDCRecoHit2D.cc:125
Belle2::TrackFindingCDC::Vector2D::angleWith
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:211
Belle2::TrackFindingCDC::CDCRecoHit2D::isOnWire
bool isOnWire(const CDCWire &wire) const
Checks if the reconstructed hit is assoziated with the give wire.
Definition: CDCRecoHit2D.h:197
Belle2::TrackFindingCDC::CDCRecoHit2D::operator<
bool operator<(const CDCRecoHit2D &other) const
Total ordering relation based on wire hit, left right passage information and displacement in this or...
Definition: CDCRecoHit2D.h:143
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::CDCRecoHit2D::getFlightDirection2D
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit2D.h:266
Belle2::TrackFindingCDC::CDCRecoHit2D::operator==
bool operator==(const CDCRecoHit2D &other) const
Equality comparision based on the oriented wire hit and displacement.
Definition: CDCRecoHit2D.h:133
Belle2::TrackFindingCDC::CDCRecoHit2D::getSignedRefDriftLength
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
Definition: CDCRecoHit2D.h:236
Belle2::TrackFindingCDC::CDCRecoHit2D::reconstruct3D
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determinating the z coordin...
Definition: CDCRecoHit2D.cc:133
Belle2::TrackFindingCDC::CDCRecoHit2D::getWireHit
const CDCWireHit & getWireHit() const
Getter for the wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:203
Belle2::TrackFindingCDC::CDCRecoHit2D::operator<
friend bool operator<(const CDCWire &wire, const CDCRecoHit2D &recoHit2D)
Defines wires and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:155
Belle2::TrackFindingCDC::CDCRecoHit2D::getRLInfo
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit2D.h:215