Belle II Software release-11-00-00
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 <cdc/topology/EStereoKind.h>
11#include <cdc/topology/ISuperLayer.h>
12
13#include <tracking/trackingUtilities/numerics/ERightLeft.h>
14#include <tracking/trackingUtilities/numerics/Index.h>
15#include <tracking/trackingUtilities/numerics/ESign.h>
16
17#include <Math/Vector2D.h>
18
19#include <iosfwd>
20
21
22
23namespace Belle2 {
28 class CDCSimHit;
29 class CDCHit;
30 class WireID;
31
32 namespace CDC {
33 class CDCWire;
34 }
35 namespace TrackingUtilities {
36 class CDCTrajectory2D;
37 class CDCWireHit;
38 class Vector3D;
39 class Vector2D;
40
49
50 public:
52 CDCRLWireHit() = default;
53
59 explicit CDCRLWireHit(const CDCWireHit* wireHit,
60 ERightLeft rlInfo = ERightLeft::c_Unknown);
61
69 CDCRLWireHit(const CDCWireHit* wireHit,
70 ERightLeft rlInfo,
71 double driftLength,
72 double driftLengthVariance);
73
78 static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1, const CDCRLWireHit& rlWireHit2);
79
84 static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1,
85 const CDCRLWireHit& rlWireHit2,
86 const CDCRLWireHit& rlWireHit3);
87
94 static CDCRLWireHit fromSimHit(const CDCWireHit* wirehit, const CDCSimHit& simhit);
95
104
106 void reverse()
107 {
109 }
110
113 {
114 return reversed();
115 }
116
118 bool operator==(const CDCRLWireHit& rhs) const
119 {
120 return &getWireHit() == &rhs.getWireHit() and getRLInfo() == rhs.getRLInfo();
121 }
122
127 bool operator<(const CDCRLWireHit& rhs) const
128 {
129 return &getWireHit() < &rhs.getWireHit() or
130 (&getWireHit() == &rhs.getWireHit() and (getRLInfo() < rhs.getRLInfo()));
131 }
132
134 friend bool operator<(const CDCRLWireHit& rlWireHit, const CDC::CDCWire& wire)
135 {
136 return &rlWireHit.getWire() < &wire;
137 }
138
140 friend bool operator<(const CDC::CDCWire& wire, const CDCRLWireHit& rlWireHit)
141 {
142 return &wire < &rlWireHit.getWire();
143 }
144
149 friend bool operator<(const CDCRLWireHit& rlWireHit, const CDCWireHit& wireHit)
150 {
151 return &rlWireHit.getWireHit() < &wireHit;
152 }
153
158 friend bool operator<(const CDCWireHit& wireHit, const CDCRLWireHit& rlWireHit)
159 {
160 return &wireHit < rlWireHit.m_wireHit;
161 }
162
164 operator const Belle2::CDCHit* () const
165 {
166 return getHit();
167 }
168
170 const CDCHit* getHit() const;
171
173 Index getStoreIHit() const { return m_iHit; }
174
176 const CDC::CDCWire& getWire() const;
177
179 bool isOnWire(const CDC::CDCWire& wire) const
180 {
181 return &getWire() == &wire;
182 }
183
185 const WireID& getWireID() const;
186
189
192
194 bool isAxial() const;
195
197 const ROOT::Math::XYVector& getRefPos2D() const;
198
200 double getRefCylindricalR() const;
201
203 const CDCWireHit& getWireHit() const
204 {
205 return *m_wireHit;
206 }
207
209 bool hasWireHit(const CDCWireHit& wirehit) const
210 {
211 return &getWireHit() == &wirehit;
212 }
213
215 double getRefDriftLength() const
216 {
217 return m_refDriftLength;
218 }
219
221 void setRefDriftLength(double driftLength)
222 {
223 m_refDriftLength = driftLength;
224 }
225
228 {
229 return static_cast<double>(getRLInfo()) * getRefDriftLength();
230 }
231
234 {
236 }
237
239 void setRefDriftLengthVariance(double driftLengthVariance)
240 {
241 m_refDriftLengthVariance = driftLengthVariance;
242 }
243
245 ERightLeft getRLInfo() const
246 {
247 return m_rlInfo;
248 }
249
251 void setRLInfo(const ERightLeft rlInfo)
252 {
253 m_rlInfo = rlInfo;
254 }
255
265 Vector2D reconstruct2D(const CDCTrajectory2D& trajectory2D) const;
266
280 Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, double z = 0) const;
281
282 private:
285 // index instead.
286 const CDCWireHit* m_wireHit = nullptr;
287
289 Index m_iHit = c_InvalidIndex;
290
292 double m_refDriftLength = 0.0;
293
296
298 ERightLeft m_rlInfo = ERightLeft::c_Unknown;
299 };
300
302 std::ostream& operator<<(std::ostream& output, const CDCRLWireHit& rlWireHit);
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 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 ...
double getRefCylindricalR() const
The distance from the beam line at reference position of the underlying wire.
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.
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.
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
bool operator<(const CDCRLWireHit &rhs) const
Total ordering relation based on wire hit and left right passage information in this order of importa...
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.
void reverse()
Switches the right left passage to its opposite in place.
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.
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.
CDCRLWireHit()=default
Default constructor for ROOT.
ERightLeft m_rlInfo
Memory for the right left passage information of the oriented wire hit.
friend bool operator<(const CDCRLWireHit &rlWireHit, const CDC::CDCWire &wire)
Defines wires and oriented wire hits to be coaligned on the wire on which they are based.
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
const CDC::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 information.
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.
void setRLInfo(const ERightLeft rlInfo)
Setter for the right left passage information.
void setRefDriftLengthVariance(double driftLengthVariance)
Setter for the variance of the drift length at the reference position of the wire.
Vector2D reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
bool isOnWire(const CDC::CDCWire &wire) const
Checks if the oriented hit is associated with the give wire.
double m_refDriftLength
Memory for the reestimated drift length.
Index getStoreIHit() const
Getter for the index of the underlying CDCHit in the StoreArray holding it.
double m_refDriftLengthVariance
Memory for the reestimated drift length variance.
const CDCWireHit * m_wireHit
Memory for the reference to the assiziated wire hit - not streamed (ROOT would deep-copy the pointed ...
CDC::EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
ERightLeft getRLInfo() const
Getter for the right left passage information.
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.
friend bool operator<(const CDC::CDCWire &wire, const CDCRLWireHit &rlWireHit)
Defines oriented wire hits and wires to be coaligned on the wire on which they are based.
bool operator==(const CDCRLWireHit &rhs) const
Equality comparison based on wire hit, left right passage information.
Index m_iHit
Index of the underlying CDCHit in its StoreArray, so the link survives serialisation.
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:58
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition Vector2D.h:36
A three dimensional vector.
Definition Vector3D.h:34
Class to identify a wire inside the CDC.
Definition WireID.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
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.