Belle II Software development
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/Vector3D.h>
18#include <Math/Vector2D.h>
19
20#include <iosfwd>
21
22
23
24namespace Belle2 {
29 class CDCSimHit;
30 class CDCHit;
31 class WireID;
32
33 namespace CDC {
34 class CDCWire;
35 }
36 namespace TrackingUtilities {
37 class CDCTrajectory2D;
38 class CDCWireHit;
39
48
49 public:
51 CDCRLWireHit() = default;
52
58 explicit CDCRLWireHit(const CDCWireHit* wireHit,
59 ERightLeft rlInfo = ERightLeft::c_Unknown);
60
68 CDCRLWireHit(const CDCWireHit* wireHit,
69 ERightLeft rlInfo,
70 double driftLength,
71 double driftLengthVariance);
72
77 static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1, const CDCRLWireHit& rlWireHit2);
78
83 static CDCRLWireHit average(const CDCRLWireHit& rlWireHit1,
84 const CDCRLWireHit& rlWireHit2,
85 const CDCRLWireHit& rlWireHit3);
86
93 static CDCRLWireHit fromSimHit(const CDCWireHit* wirehit, const CDCSimHit& simhit);
94
103
105 void reverse()
106 {
108 }
109
112 {
113 return reversed();
114 }
115
117 bool operator==(const CDCRLWireHit& rhs) const
118 {
119 return &getWireHit() == &rhs.getWireHit() and getRLInfo() == rhs.getRLInfo();
120 }
121
126 bool operator<(const CDCRLWireHit& rhs) const
127 {
128 return &getWireHit() < &rhs.getWireHit() or
129 (&getWireHit() == &rhs.getWireHit() and (getRLInfo() < rhs.getRLInfo()));
130 }
131
133 friend bool operator<(const CDCRLWireHit& rlWireHit, const CDC::CDCWire& wire)
134 {
135 return &rlWireHit.getWire() < &wire;
136 }
137
139 friend bool operator<(const CDC::CDCWire& wire, const CDCRLWireHit& rlWireHit)
140 {
141 return &wire < &rlWireHit.getWire();
142 }
143
148 friend bool operator<(const CDCRLWireHit& rlWireHit, const CDCWireHit& wireHit)
149 {
150 return &rlWireHit.getWireHit() < &wireHit;
151 }
152
157 friend bool operator<(const CDCWireHit& wireHit, const CDCRLWireHit& rlWireHit)
158 {
159 return &wireHit < rlWireHit.m_wireHit;
160 }
161
163 operator const Belle2::CDCHit* () const
164 {
165 return getHit();
166 }
167
169 const CDCHit* getHit() const;
170
172 Index getStoreIHit() const { return m_iHit; }
173
175 const CDC::CDCWire& getWire() const;
176
178 bool isOnWire(const CDC::CDCWire& wire) const
179 {
180 return &getWire() == &wire;
181 }
182
184 const WireID& getWireID() const;
185
188
191
193 bool isAxial() const;
194
196 const ROOT::Math::XYVector& getRefPos2D() const;
197
199 double getRefCylindricalR() const;
200
202 const CDCWireHit& getWireHit() const
203 {
204 return *m_wireHit;
205 }
206
208 bool hasWireHit(const CDCWireHit& wirehit) const
209 {
210 return &getWireHit() == &wirehit;
211 }
212
214 double getRefDriftLength() const
215 {
216 return m_refDriftLength;
217 }
218
220 void setRefDriftLength(double driftLength)
221 {
222 m_refDriftLength = driftLength;
223 }
224
227 {
228 return static_cast<double>(getRLInfo()) * getRefDriftLength();
229 }
230
233 {
235 }
236
238 void setRefDriftLengthVariance(double driftLengthVariance)
239 {
240 m_refDriftLengthVariance = driftLengthVariance;
241 }
242
244 ERightLeft getRLInfo() const
245 {
246 return m_rlInfo;
247 }
248
250 void setRLInfo(const ERightLeft rlInfo)
251 {
252 m_rlInfo = rlInfo;
253 }
254
264 ROOT::Math::XYVector reconstruct2D(const CDCTrajectory2D& trajectory2D) const;
265
279 ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D& trajectory2D, double z = 0) const;
280
281 private:
284 // index instead.
285 const CDCWireHit* m_wireHit = nullptr;
286
288 Index m_iHit = c_InvalidIndex;
289
291 double m_refDriftLength = 0.0;
292
295
297 ERightLeft m_rlInfo = ERightLeft::c_Unknown;
298 };
299
301 std::ostream& operator<<(std::ostream& output, const CDCRLWireHit& rlWireHit);
302 }
304}
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.
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.
ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D &trajectory2D, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
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.
ROOT::Math::XYVector reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
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.
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
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.