Belle II Software  release-08-01-10
CDCRLWireHit.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/topology/EStereoKind.h>
11 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
12 
13 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
14 #include <tracking/trackFindingCDC/numerics/ESign.h>
15 
16 #include <iosfwd>
17 
18 namespace Belle2 {
23  class CDCSimHit;
24  class CDCHit;
25  class WireID;
26 
27  namespace TrackFindingCDC {
28  class CDCTrajectory2D;
29  class CDCWireHit;
30  class CDCWire;
31  class Vector3D;
32  class Vector2D;
33 
41  class CDCRLWireHit {
42 
43  public:
45  CDCRLWireHit() = default;
46 
52  explicit CDCRLWireHit(const CDCWireHit* wireHit, ERightLeft rlInfo = ERightLeft::c_Unknown);
53 
61  CDCRLWireHit(const CDCWireHit* wireHit,
62  ERightLeft rlInfo,
63  double driftLength,
64  double driftLengthVariance);
65 
70  static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1, const CDCRLWireHit& rlWireHit2);
71 
76  static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1,
77  const CDCRLWireHit& rlWireHit2,
78  const CDCRLWireHit& rlWireHit3);
79 
86  static CDCRLWireHit fromSimHit(const CDCWireHit* wirehit, const CDCSimHit& simhit);
87 
90  {
91  return CDCRLWireHit(m_wireHit,
95  }
96 
98  void reverse()
99  {
101  }
102 
105  {
106  return reversed();
107  }
108 
110  bool operator==(const CDCRLWireHit& rhs) const
111  {
112  return &getWireHit() == &rhs.getWireHit() and getRLInfo() == rhs.getRLInfo();
113  }
114 
119  bool operator<(const CDCRLWireHit& rhs) const
120  {
121  return &getWireHit() < &rhs.getWireHit() or
122  (&getWireHit() == &rhs.getWireHit() and (getRLInfo() < rhs.getRLInfo()));
123  }
124 
126  friend bool operator<(const CDCRLWireHit& rlWireHit, const CDCWire& wire)
127  {
128  return &rlWireHit.getWire() < &wire;
129  }
130 
132  friend bool operator<(const CDCWire& wire, const CDCRLWireHit& rlWireHit)
133  {
134  return &wire < &rlWireHit.getWire();
135  }
136 
141  friend bool operator<(const CDCRLWireHit& rlWireHit, const CDCWireHit& wireHit)
142  {
143  return &rlWireHit.getWireHit() < &wireHit;
144  }
145 
150  friend bool operator<(const CDCWireHit& wireHit, const CDCRLWireHit& rlWireHit)
151  {
152  return &wireHit < rlWireHit.m_wireHit;
153  }
154 
156  operator const Belle2::CDCHit* () const
157  {
158  return getHit();
159  }
160 
162  const CDCHit* getHit() const;
163 
165  const CDCWire& getWire() const;
166 
168  bool isOnWire(const CDCWire& wire) const
169  {
170  return &getWire() == &wire;
171  }
172 
174  const WireID& getWireID() const;
175 
177  ISuperLayer getISuperLayer() const;
178 
180  EStereoKind getStereoKind() const;
181 
183  bool isAxial() const;
184 
186  const Vector2D& getRefPos2D() const;
187 
189  double getRefCylindricalR() const;
190 
192  const CDCWireHit& getWireHit() const
193  {
194  return *m_wireHit;
195  }
196 
198  bool hasWireHit(const CDCWireHit& wirehit) const
199  {
200  return &getWireHit() == &wirehit;
201  }
202 
204  double getRefDriftLength() const
205  {
206  return m_refDriftLength;
207  }
208 
210  void setRefDriftLength(double driftLength)
211  {
212  m_refDriftLength = driftLength;
213  }
214 
216  double getSignedRefDriftLength() const
217  {
218  return static_cast<double>(getRLInfo()) * getRefDriftLength();
219  }
220 
223  {
225  }
226 
228  void setRefDriftLengthVariance(double driftLengthVariance)
229  {
230  m_refDriftLengthVariance = driftLengthVariance;
231  }
232 
235  {
236  return m_rlInfo;
237  }
238 
240  void setRLInfo(const ERightLeft rlInfo)
241  {
242  m_rlInfo = rlInfo;
243  }
244 
254  Vector2D reconstruct2D(const CDCTrajectory2D& trajectory2D) const;
255 
269  Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, double z = 0) const;
270 
271  private:
273  const CDCWireHit* m_wireHit = nullptr;
274 
276  ERightLeft m_rlInfo = ERightLeft::c_Unknown;
277 
279  double m_refDriftLength = 0.0;
280 
283  };
284 
286  std::ostream& operator<<(std::ostream& output, const CDCRLWireHit& rlWireHit);
287  }
289 }
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
double getRefCylindricalR() const
The distance from the beam line at reference position of the underlying wire.
friend bool operator<(const CDCRLWireHit &rlWireHit, const CDCWire &wire)
Defines wires and oriented wire hits to be coaligned on the wire on which they are based.
Definition: CDCRLWireHit.h:126
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
CDCRLWireHit getAlias() const
Returns the aliased version of this oriented wire hit - here same as reverse.
Definition: CDCRLWireHit.h:104
friend bool operator<(const CDCRLWireHit &rlWireHit, const CDCWireHit &wireHit)
Defines wire hits and oriented wire hits to be coaligned on the wire hit on which they are based.
Definition: CDCRLWireHit.h:141
bool operator<(const CDCRLWireHit &rhs) const
Total ordering relation based on wire hit and left right passage information in this order of importa...
Definition: CDCRLWireHit.h:119
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
void reverse()
Swiches the right left passage to its opposite inplace.
Definition: CDCRLWireHit.h:98
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:204
const WireID & getWireID() const
Getter for the WireID of the wire the hit is located on.
bool isAxial() const
Indicator if the underlying wire is axial.
CDCRLWireHit reversed() const
Returns the oriented wire hit with the opposite right left information.
Definition: CDCRLWireHit.h:89
CDCRLWireHit()=default
Default constructor for ROOT.
ERightLeft m_rlInfo
Memory for the right left passage information of the oriented wire hit.
Definition: CDCRLWireHit.h:276
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:210
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
static CDCRLWireHit fromSimHit(const CDCWireHit *wirehit, const CDCSimHit &simhit)
Constructs an oriented wire hit from a CDCSimHit and the associated wirehit.
static CDCRLWireHit average(const CDCRLWireHit &rlWireHit1, const CDCRLWireHit &rlWireHit2)
Constructs the average of two wire hits with right left passage informations.
Definition: CDCRLWireHit.cc:59
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
void setRefDriftLengthVariance(double driftLengthVariance)
Setter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:228
Vector2D reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
bool isOnWire(const CDCWire &wire) const
Checks if the oriented hit is associated with the give wire.
Definition: CDCRLWireHit.h:168
double m_refDriftLength
Memory for the reestimated drift length.
Definition: CDCRLWireHit.h:279
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
double m_refDriftLengthVariance
Memory for the reestimated drift length variance.
Definition: CDCRLWireHit.h:282
const CDCWireHit * m_wireHit
Memory for the reference to the assiziated wire hit.
Definition: CDCRLWireHit.h:273
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
friend bool operator<(const CDCWire &wire, const CDCRLWireHit &rlWireHit)
Defines oriented wire hits and wires to be coaligned on the wire on which they are based.
Definition: CDCRLWireHit.h:132
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
friend bool operator<(const CDCWireHit &wireHit, const CDCRLWireHit &rlWireHit)
Defines oriented wire hits and wire hits to be coaligned on the wire hit on which they are based.
Definition: CDCRLWireHit.h:150
bool operator==(const CDCRLWireHit &rhs) const
Equality comparison based on wire hit, left right passage information.
Definition: CDCRLWireHit.h:110
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
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
A three dimensional vector.
Definition: Vector3D.h:33
Class to identify a wire inside the CDC.
Definition: WireID.h:34
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
ERightLeft reversed(ERightLeft eRightLeft)
Return the reversed right left indicator. Leaves ERightLeft::c_Invalid the same.
Definition: ERightLeft.h:41
Abstract base class for different kinds of events.