Belle II Software development
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/trackingUtilities/eventdata/hits/CDCRLWireHit.h>
11
12#include <cdc/topology/EStereoKind.h>
13#include <cdc/topology/ISuperLayer.h>
14
15#include <tracking/trackingUtilities/numerics/ERightLeft.h>
16#include <tracking/trackingUtilities/numerics/ERotation.h>
17
18#include <tracking/trackingUtilities/geometry/Vector2D.h>
19
20#include <iosfwd>
21
22namespace Belle2 {
27 class CDCSimHit;
28 class CDCHit;
29
30 namespace CDC {
31 class CDCWire;
32 }
33
34 namespace TrackingUtilities {
35 class CDCTrajectory2D;
36 class CDCWireHit;
37 class Vector3D;
38
51
52 public:
54 CDCRecoHit2D() = default;
55
60 CDCRecoHit2D(const CDCRLWireHit& rlWireHit,
61 const Vector2D& recoDisp2D);
62
64 explicit CDCRecoHit2D(const CDCRLWireHit& rlWireHit);
65
73 static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
74 const CDCRecoHit2D& recoHit2);
75
83 static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
84 const CDCRecoHit2D& recoHit2,
85 const CDCRecoHit2D& recoHit3);
86
94 static CDCRecoHit2D
95 fromRecoPos2D(const CDCRLWireHit& rlWireHit, const Vector2D& recoPos2D, bool snap = true);
96
102 void reverse();
103
105 CDCRecoHit2D reversed() const;
106
108 CDCRecoHit2D getAlias() const;
109
117 static CDCRecoHit2D fromSimHit(const CDCWireHit* wireHit, const CDCSimHit& simHit);
118
119
121 operator const Belle2::CDCHit* () const
122 { return static_cast<const CDCHit*>(getRLWireHit()); }
123
124
126 bool operator==(const CDCRecoHit2D& other) const
127 {
128 return getRLWireHit() == other.getRLWireHit() and
129 getRecoDisp2D() == other.getRecoDisp2D();
130 }
131
136 bool operator<(const CDCRecoHit2D& other) const
137 {
138 return getRLWireHit() < other.getRLWireHit() or (
139 getRLWireHit() == other.getRLWireHit() and
140 getRecoDisp2D() < other.getRecoDisp2D());
141 }
142
144 friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDC::CDCWire& wire)
145 { return recoHit2D.getRLWireHit() < wire; }
146
148 friend bool operator<(const CDC::CDCWire& wire, const CDCRecoHit2D& recoHit2D)
149 { return wire < recoHit2D.getRLWireHit(); }
150
152 friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWireHit& wireHit)
153 { return recoHit2D.getRLWireHit() < wireHit; }
154
156 friend bool operator<(const CDCWireHit& wireHit, const CDCRecoHit2D& recoHit2D)
157 { return wireHit < recoHit2D.getRLWireHit(); }
158
161 {
162 return getRLWireHit().getStereoKind();
163 }
164
166 bool isAxial() const
167 {
168 return getRLWireHit().isAxial();
169 }
170
173 {
174 return getRLWireHit().getISuperLayer();
175 }
176
178 const CDC::CDCWire& getWire() const
179 {
180 return getRLWireHit().getWire();
181 }
182
184 const ROOT::Math::XYVector& getRefPos2D() const
185 {
186 return getRLWireHit().getRefPos2D();
187 }
188
190 bool isOnWire(const CDC::CDCWire& wire) const
191 {
192 return getRLWireHit().isOnWire(wire);
193 }
194
196 const CDCWireHit& getWireHit() const
197 {
198 return getRLWireHit().getWireHit();
199 }
200
202 bool hasWireHit(const CDCWireHit& wireHit) const
203 {
204 return getRLWireHit().hasWireHit(wireHit);
205 }
206
208 ERightLeft getRLInfo() const
209 {
210 return getRLWireHit().getRLInfo();
211 }
212
214 void setRLInfo(ERightLeft& rlInfo)
215 {
216 m_rlWireHit.setRLInfo(rlInfo);
217 }
218
220 double getRefDriftLength() const
221 {
223 }
224
226 void setRefDriftLength(double driftLength, bool snapRecoPos);
227
230 {
232 }
233
236 {
238 }
239
242 {
243 return getRecoDisp2D() + getRefPos2D();
244 }
245
247 void setRecoPos2D(const Vector2D& recoPos2D)
248 {
249 m_recoDisp2D = recoPos2D - getRefPos2D();
250 }
251
253 const Vector2D& getRecoDisp2D() const
254 {
255 return m_recoDisp2D;
256 }
257
260 {
261 ERotation rotation = static_cast<ERotation>(-getRLInfo());
262 return getRecoDisp2D().orthogonal(rotation);
263 }
264
266 double getAlpha() const
267 {
269 }
270
272 void snapToDriftCircle(bool switchSide = false);
273
281 Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, const double z = 0) const;
282
285 {
286 return m_rlWireHit;
287 }
288
290 void setRLWireHit(const CDCRLWireHit& rlWireHit)
291 {
292 m_rlWireHit = rlWireHit;
293 }
294
295 private:
298
301 };
302
303
305 std::ostream& operator<<(std::ostream& output, const CDCRecoHit2D& recohit);
306 }
308}
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 a sense wire in the central drift chamber.
Definition CDCWire.h:50
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
CDC::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.
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position of the underlying wire.
bool isAxial() const
Indicator if the underlying wire is axial.
const CDC::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.
double getSignedRefDriftLength() const
Getter for the drift length at the reference position of the wire.
bool isOnWire(const CDC::CDCWire &wire) const
Checks if the oriented hit is associated with the give wire.
CDC::EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Class representing a two dimensional reconstructed hit in the central drift chamber.
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
Vector2D m_recoDisp2D
Memory for the displacement of the associated wire reference position.
void setRLInfo(ERightLeft &rlInfo)
Setter the right left passage information.
friend bool operator<(const CDCRecoHit2D &recoHit2D, const CDC::CDCWire &wire)
Defines wires and the two dimensional reconstructed hits as coaligned.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
double getRefDriftLengthVariance() const
Getter for the uncertainty in the drift length at the wire reference position.
void reverse()
Turns the orientation in place.
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
const ROOT::Math::XYVector & getRefPos2D() const
Getter for the reference position of the wire.
bool isAxial() const
Indicator if the underlying wire is axial.
CDCRecoHit2D()=default
Default constructor for ROOT.
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
CDC::ISuperLayer getISuperLayer() const
Getter for the superlayer id.
static CDCRecoHit2D fromRecoPos2D(const CDCRLWireHit &rlWireHit, const Vector2D &recoPos2D, bool snap=true)
Constructs a two dimensional reconstructed hit from an absolute position.
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determining the z coordinat...
CDCRecoHit2D reversed() const
Returns the recohit with the opposite right left information.
const CDC::CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
static CDCRecoHit2D average(const CDCRecoHit2D &recoHit1, const CDCRecoHit2D &recoHit2)
Constructs the average of two reconstructed hit positions and snaps it to the drift circle.
double getAlpha() const
Getter for the direction of flight relative to the position.
friend bool operator<(const CDCWireHit &wireHit, const CDCRecoHit2D &recoHit2D)
Defines wire hits and the two dimensional reconstructed hits as coaligned.
const Vector2D & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the drift circle.
void setRLWireHit(const CDCRLWireHit &rlWireHit)
Setter for the oriented wire hit associated with the reconstructed hit.
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
bool operator<(const CDCRecoHit2D &other) const
Total ordering relation based on wire hit, left right passage information and displacement in this or...
static CDCRecoHit2D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a two dimensional reconstructed hit from a sim hit and the associated wirehit.
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
bool hasWireHit(const CDCWireHit &wireHit) const
Checks if the reconstructed hit is associated with the give wire hit.
friend bool operator<(const CDCRecoHit2D &recoHit2D, const CDCWireHit &wireHit)
Defines wire hits and the two dimensional reconstructed hits as coaligned.
CDCRLWireHit m_rlWireHit
Memory for the reference to the associated wire hit.
bool isOnWire(const CDC::CDCWire &wire) const
Checks if the reconstructed hit is associated with the give wire.
CDC::EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
friend bool operator<(const CDC::CDCWire &wire, const CDCRecoHit2D &recoHit2D)
Defines wires and the two dimensional reconstructed hits as coaligned.
ERightLeft getRLInfo() const
Getter for the right left passage information.
bool operator==(const CDCRecoHit2D &other) const
Equality comparison based on the oriented wire hit and displacement.
void setRecoPos2D(const Vector2D &recoPos2D)
Setter for the position in the reference plane.
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:58
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:36
Vector2D orthogonal() const
Orthogonal vector to the counterclockwise direction.
Definition Vector2D.h:320
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition Vector2D.h:228
A three dimensional vector.
Definition Vector3D.h:34
EStereoKind
Type for the stereo property of the wire.
Definition EStereoKind.h:20
signed short ISuperLayer
The type of the layer and superlayer ids.
Definition ISuperLayer.h:24
Abstract base class for different kinds of events.