Belle II Software  release-08-01-10
CDCRecoHit2D.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/topology/EStereoKind.h>
13 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
14 
15 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
16 #include <tracking/trackFindingCDC/numerics/ERotation.h>
17 
18 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
19 
20 #include <iosfwd>
21 
22 namespace Belle2 {
27  class CDCSimHit;
28  class CDCHit;
29 
30  namespace TrackFindingCDC {
31  class CDCTrajectory2D;
32  class CDCWireHit;
33  class CDCWire;
34  class Vector3D;
35 
47  class CDCRecoHit2D {
48 
49  public:
51  CDCRecoHit2D() = default;
52 
57  CDCRecoHit2D(const CDCRLWireHit& rlWireHit,
58  const Vector2D& recoDisp2D);
59 
61  explicit CDCRecoHit2D(const CDCRLWireHit& rlWireHit);
62 
70  static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
71  const CDCRecoHit2D& recoHit2);
72 
80  static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
81  const CDCRecoHit2D& recoHit2 ,
82  const CDCRecoHit2D& recoHit3);
83 
91  static CDCRecoHit2D
92  fromRecoPos2D(const CDCRLWireHit& rlWireHit, const Vector2D& recoPos2D, bool snap = true);
93 
99  void reverse();
100 
102  CDCRecoHit2D reversed() const;
103 
105  CDCRecoHit2D getAlias() const;
106 
114  static CDCRecoHit2D fromSimHit(const CDCWireHit* wireHit, const CDCSimHit& simHit);
115 
116 
118  operator const Belle2::CDCHit* () const
119  { return static_cast<const CDCHit*>(getRLWireHit()); }
120 
121 
123  bool operator==(const CDCRecoHit2D& other) const
124  {
125  return getRLWireHit() == other.getRLWireHit() and
126  getRecoDisp2D() == other.getRecoDisp2D();
127  }
128 
133  bool operator<(const CDCRecoHit2D& other) const
134  {
135  return getRLWireHit() < other.getRLWireHit() or (
136  getRLWireHit() == other.getRLWireHit() and
137  getRecoDisp2D() < other.getRecoDisp2D());
138  }
139 
141  friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWire& wire)
142  { return recoHit2D.getRLWireHit() < wire; }
143 
145  friend bool operator<(const CDCWire& wire, const CDCRecoHit2D& recoHit2D)
146  { return wire < recoHit2D.getRLWireHit(); }
147 
149  friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWireHit& wireHit)
150  { return recoHit2D.getRLWireHit() < wireHit; }
151 
153  friend bool operator<(const CDCWireHit& wireHit, const CDCRecoHit2D& recoHit2D)
154  { return wireHit < recoHit2D.getRLWireHit(); }
155 
157  EStereoKind getStereoKind() const
158  {
159  return getRLWireHit().getStereoKind();
160  }
161 
163  bool isAxial() const
164  {
165  return getRLWireHit().isAxial();
166  }
167 
169  ISuperLayer getISuperLayer() const
170  {
171  return getRLWireHit().getISuperLayer();
172  }
173 
175  const CDCWire& getWire() const
176  {
177  return getRLWireHit().getWire();
178  }
179 
181  const Vector2D& getRefPos2D() const
182  {
183  return getRLWireHit().getRefPos2D();
184  }
185 
187  bool isOnWire(const CDCWire& wire) const
188  {
189  return getRLWireHit().isOnWire(wire);
190  }
191 
193  const CDCWireHit& getWireHit() const
194  {
195  return getRLWireHit().getWireHit();
196  }
197 
199  bool hasWireHit(const CDCWireHit& wireHit) const
200  {
201  return getRLWireHit().hasWireHit(wireHit);
202  }
203 
206  {
207  return getRLWireHit().getRLInfo();
208  }
209 
211  void setRLInfo(ERightLeft& rlInfo)
212  {
213  m_rlWireHit.setRLInfo(rlInfo);
214  }
215 
217  double getRefDriftLength() const
218  {
219  return getRLWireHit().getRefDriftLength();
220  }
221 
223  void setRefDriftLength(double driftLength, bool snapRecoPos);
224 
226  double getSignedRefDriftLength() const
227  {
229  }
230 
233  {
235  }
236 
239  {
240  return getRecoDisp2D() + getRefPos2D();
241  }
242 
244  void setRecoPos2D(const Vector2D& recoPos2D)
245  {
246  m_recoDisp2D = recoPos2D - getRefPos2D();
247  }
248 
250  const Vector2D& getRecoDisp2D() const
251  {
252  return m_recoDisp2D;
253  }
254 
257  {
258  ERotation rotation = static_cast<ERotation>(-getRLInfo());
259  return getRecoDisp2D().orthogonal(rotation);
260  }
261 
263  double getAlpha() const
264  {
266  }
267 
269  void snapToDriftCircle(bool switchSide = false);
270 
278  Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, const double z = 0) const;
279 
281  const CDCRLWireHit& getRLWireHit() const
282  {
283  return m_rlWireHit;
284  }
285 
287  void setRLWireHit(const CDCRLWireHit& rlWireHit)
288  {
289  m_rlWireHit = rlWireHit;
290  }
291 
292  private:
295 
298  };
299 
300 
302  std::ostream& operator<<(std::ostream& output, const CDCRecoHit2D& recohit);
303  }
305 }
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
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:204
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
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
Vector2D m_recoDisp2D
Memory for the displacement fo the assoziated wire reference position.
Definition: CDCRecoHit2D.h:297
void setRLInfo(ERightLeft &rlInfo)
Setter the right left passage information.
Definition: CDCRecoHit2D.h:211
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
Definition: CDCRecoHit2D.h:169
double getRefDriftLengthVariance() const
Getter for the uncertainty in the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:232
void reverse()
Turns the orientation in place.
Definition: CDCRecoHit2D.cc:93
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:217
friend bool operator<(const CDCWire &wire, const CDCRecoHit2D &recoHit2D)
Defines wires and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:145
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCRecoHit2D.h:163
CDCRecoHit2D()=default
Default constructor for ROOT.
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
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:84
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determinating the z coordin...
CDCRecoHit2D reversed() const
Returns the recohit with the opposite right left information.
Definition: CDCRecoHit2D.cc:98
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:47
double getAlpha() const
Getter for the direction of flight relative to the position.
Definition: CDCRecoHit2D.h:263
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:281
friend bool operator<(const CDCWireHit &wireHit, const CDCRecoHit2D &recoHit2D)
Defines wire hits and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:153
const Vector2D & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
Definition: CDCRecoHit2D.h:250
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: CDCRecoHit2D.h:287
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
Definition: CDCRecoHit2D.h:226
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit2D.h:256
const Vector2D & getRefPos2D() const
Getter for the reference position of the wire.
Definition: CDCRecoHit2D.h:181
friend bool operator<(const CDCRecoHit2D &recoHit2D, const CDCWire &wire)
Defines wires and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:141
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:133
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:35
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
bool hasWireHit(const CDCWireHit &wireHit) const
Checks if the reconstructed hit is assoziated with the give wire hit.
Definition: CDCRecoHit2D.h:199
friend bool operator<(const CDCRecoHit2D &recoHit2D, const CDCWireHit &wireHit)
Defines wire hits and the two dimensional reconstructed hits as coaligned.
Definition: CDCRecoHit2D.h:149
CDCRLWireHit m_rlWireHit
Memory for the reference to the assiziated wire hit.
Definition: CDCRecoHit2D.h:294
bool isOnWire(const CDCWire &wire) const
Checks if the reconstructed hit is assoziated with the give wire.
Definition: CDCRecoHit2D.h:187
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition: CDCRecoHit2D.h:157
const CDCWireHit & getWireHit() const
Getter for the wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:193
const CDCWire & getWire() const
Getter for the wire the reconstructed hit assoziated to.
Definition: CDCRecoHit2D.h:175
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit2D.h:205
bool operator==(const CDCRecoHit2D &other) const
Equality comparision based on the oriented wire hit and displacement.
Definition: CDCRecoHit2D.h:123
void setRecoPos2D(const Vector2D &recoPos2D)
Setter for the position in the reference plane.
Definition: CDCRecoHit2D.h:244
Particle trajectory as it is seen in xy projection represented as a circle.
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
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34
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.