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/VectorUtil.h>
19
20#include <Math/Vector3D.h>
21#include <Math/Vector2D.h>
22#include <Math/VectorUtil.h>
23
24#include <iosfwd>
25
26namespace Belle2 {
31 class CDCSimHit;
32 class CDCHit;
33
34 namespace CDC {
35 class CDCWire;
36 }
37
38 namespace TrackingUtilities {
39 class CDCTrajectory2D;
40 class CDCWireHit;
41
54
55 public:
57 CDCRecoHit2D() = default;
58
63 CDCRecoHit2D(const CDCRLWireHit& rlWireHit,
64 const ROOT::Math::XYVector& recoDisp2D);
65
67 explicit CDCRecoHit2D(const CDCRLWireHit& rlWireHit);
68
76 static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
77 const CDCRecoHit2D& recoHit2);
78
86 static CDCRecoHit2D average(const CDCRecoHit2D& recoHit1,
87 const CDCRecoHit2D& recoHit2,
88 const CDCRecoHit2D& recoHit3);
89
97 static CDCRecoHit2D
98 fromRecoPos2D(const CDCRLWireHit& rlWireHit, const ROOT::Math::XYVector& recoPos2D, bool snap = true);
99
105 void reverse();
106
108 CDCRecoHit2D reversed() const;
109
111 CDCRecoHit2D getAlias() const;
112
120 static CDCRecoHit2D fromSimHit(const CDCWireHit* wireHit, const CDCSimHit& simHit);
121
122
124 operator const Belle2::CDCHit* () const
125 { return static_cast<const CDCHit*>(getRLWireHit()); }
126
127
129 bool operator==(const CDCRecoHit2D& other) const
130 {
131 return getRLWireHit() == other.getRLWireHit() and
132 getRecoDisp2D() == other.getRecoDisp2D();
133 }
134
139 bool operator<(const CDCRecoHit2D& other) const
140 {
141 return getRLWireHit() < other.getRLWireHit() or (
142 getRLWireHit() == other.getRLWireHit() and
143 VectorUtil::smaller(getRecoDisp2D(), getRecoDisp2D()));
144 }
145
147 friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDC::CDCWire& wire)
148 { return recoHit2D.getRLWireHit() < wire; }
149
151 friend bool operator<(const CDC::CDCWire& wire, const CDCRecoHit2D& recoHit2D)
152 { return wire < recoHit2D.getRLWireHit(); }
153
155 friend bool operator<(const CDCRecoHit2D& recoHit2D, const CDCWireHit& wireHit)
156 { return recoHit2D.getRLWireHit() < wireHit; }
157
159 friend bool operator<(const CDCWireHit& wireHit, const CDCRecoHit2D& recoHit2D)
160 { return wireHit < recoHit2D.getRLWireHit(); }
161
164 {
165 return getRLWireHit().getStereoKind();
166 }
167
169 bool isAxial() const
170 {
171 return getRLWireHit().isAxial();
172 }
173
176 {
177 return getRLWireHit().getISuperLayer();
178 }
179
181 const CDC::CDCWire& getWire() const
182 {
183 return getRLWireHit().getWire();
184 }
185
187 const ROOT::Math::XYVector& getRefPos2D() const
188 {
189 return getRLWireHit().getRefPos2D();
190 }
191
193 bool isOnWire(const CDC::CDCWire& wire) const
194 {
195 return getRLWireHit().isOnWire(wire);
196 }
197
199 const CDCWireHit& getWireHit() const
200 {
201 return getRLWireHit().getWireHit();
202 }
203
205 bool hasWireHit(const CDCWireHit& wireHit) const
206 {
207 return getRLWireHit().hasWireHit(wireHit);
208 }
209
211 ERightLeft getRLInfo() const
212 {
213 return getRLWireHit().getRLInfo();
214 }
215
217 void setRLInfo(ERightLeft& rlInfo)
218 {
219 m_rlWireHit.setRLInfo(rlInfo);
220 }
221
223 double getRefDriftLength() const
224 {
226 }
227
229 void setRefDriftLength(double driftLength, bool snapRecoPos);
230
233 {
235 }
236
239 {
241 }
242
244 ROOT::Math::XYVector getRecoPos2D() const
245 {
246 return getRecoDisp2D() + getRefPos2D();
247 }
248
250 void setRecoPos2D(const ROOT::Math::XYVector& recoPos2D)
251 {
252 m_recoDisp2D = recoPos2D - getRefPos2D();
253 }
254
256 const ROOT::Math::XYVector& getRecoDisp2D() const
257 {
258 return m_recoDisp2D;
259 }
260
262 ROOT::Math::XYVector getFlightDirection2D() const
263 {
264 ERotation rotation = static_cast<ERotation>(-getRLInfo());
265 return VectorUtil::Orthogonal(getRecoDisp2D(), rotation);
266 }
267
269 double getAlpha() const
270 {
271 return ROOT::Math::VectorUtil::DeltaPhi(getRecoPos2D(), getFlightDirection2D());
272 }
273
275 void snapToDriftCircle(bool switchSide = false);
276
284 ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D& trajectory2D, const double z = 0) const;
285
288 {
289 return m_rlWireHit;
290 }
291
293 void setRLWireHit(const CDCRLWireHit& rlWireHit)
294 {
295 m_rlWireHit = rlWireHit;
296 }
297
298 private:
301
303 ROOT::Math::XYVector m_recoDisp2D;
304 };
305
306
308 std::ostream& operator<<(std::ostream& output, const CDCRecoHit2D& recohit);
309 }
311}
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.
const ROOT::Math::XYVector & getRecoDisp2D() const
Getter for the displacement from the 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.
ROOT::Math::XYVector getFlightDirection2D() const
Getter for the direction of flight.
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
CDC::ISuperLayer getISuperLayer() const
Getter for the superlayer id.
ROOT::Math::XYVector getRecoPos2D() const
Getter for the position in the reference plane.
void setRecoPos2D(const ROOT::Math::XYVector &recoPos2D)
Setter for the position in the reference plane.
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.
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.
ROOT::Math::XYVector m_recoDisp2D
Memory for the displacement of the associated wire reference position.
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
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.
ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determining the z coordinat...
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.
static CDCRecoHit2D fromRecoPos2D(const CDCRLWireHit &rlWireHit, const ROOT::Math::XYVector &recoPos2D, bool snap=true)
Constructs a two dimensional reconstructed hit from an absolute position.
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.
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:56
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.