Belle II Software development
CDCWireHit.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#include <cdc/topology/ILayer.h>
13
14#include <tracking/trackingUtilities/ca/AutomatonCell.h>
15
16#include <tracking/trackingUtilities/numerics/ERightLeft.h>
17#include <tracking/trackingUtilities/numerics/Index.h>
18
19#include <tracking/trackingUtilities/utilities/FunctorTag.h>
20
21#include <cdc/dataobjects/WireID.h>
22
23#include <Math/Vector2D.h>
24#include <Math/Vector3D.h>
25
26#include <utility>
27#include <iosfwd>
28#include <cassert>
29
30namespace Belle2 {
35 class CDCHit;
36 namespace CDC {
40 class CDCWire; // IWYU pragma: keep
41 }
42 namespace TrackingUtilities {
43 class CDCTrajectory2D;
44 class Circle2D;
45
56 class CDCWireHit {
57 public:
60
63
65 static constexpr const double c_simpleDriftLengthVariance = 0.000169;
66
68 CDCWireHit() = default;
69
81 CDCWireHit(const CDCHit* ptrHit,
82 double driftLength,
83 double driftLengthVariance = c_simpleDriftLengthVariance,
84 double chargeDeposit = 0,
85 double driftTime = 0);
86
97 explicit CDCWireHit(const CDCHit* ptrHit,
98 CDC::TDCCountTranslatorBase* ptrTDCCountTranslator = nullptr,
99 CDC::ADCCountTranslatorBase* ptrADCCountTranslator = nullptr);
100
102 CDCWireHit(const WireID& wireID,
103 double driftLength,
104 double driftLengthVariance = c_simpleDriftLengthVariance,
105 double chargeDeposit = 0);
106
108 bool operator==(const CDCWireHit& rhs) const
109 {
110 return getWireID() == rhs.getWireID() and getRefDriftLength() == rhs.getRefDriftLength();
111 }
112
114 bool operator<(const CDCWireHit& rhs) const
115 {
116 return
117 std::make_pair(getWireID().getEWire(), getRefDriftLength()) <
118 std::make_pair(rhs.getWireID().getEWire(), rhs.getRefDriftLength());
119 }
120
122 friend bool operator<(const CDCWireHit& wireHit, const CDC::CDCWire& wire)
123 {
124 return &wireHit.getWire() < &wire;
125 }
126
128 // Same as above but the other way round.
129 friend bool operator<(const CDC::CDCWire& wire, const CDCWireHit& wireHit)
130 {
131 return &wire < &wireHit.getWire();
132 }
133
135 // Same as above but with CDCWireHit as a pointer.
136 friend bool operator<(const CDCWireHit* wireHit, const CDC::CDCWire& wire)
137 {
138 assert(wireHit);
139 return *wireHit < wire;
140 }
141
143 // Same as above but the other way round and with CDCWireHit as a pointer.
144 friend bool operator<(const CDC::CDCWire& wire, const CDCWireHit* wireHit)
145 {
146 assert(wireHit);
147 return wire < *wireHit;
148 }
149
151 bool operator<(const CDCHit& hit);
152
153 friend bool operator<(const CDCWireHit& wireHit, const CDCHit& hit);
154
156 // Same as above but the other way round.
157 friend bool operator<(const CDCHit& hit, const CDCWireHit& wireHit);
158
160 const CDCHit* getHit() const
161 {
162 return m_hit;
163 }
164
166 Index getStoreIHit() const;
167
169 const CDC::CDCWire& getWire() const
170 {
171 // if (not m_wire) return attachWire();
172 if (not m_wire) return attachWire();
173 return *m_wire;
174 }
175
183 const CDC::CDCWire& attachWire() const;
184
186 const WireID& getWireID() const
187 {
188 return m_wireID;
189 }
190
196
198 bool isAxial() const
199 {
201 }
202
205 {
206 return getWireID().getISuperLayer();
207 }
208
211 {
212 return getWireID().getILayer();
213 }
214
216 const ROOT::Math::XYVector& getRefPos2D() const;
217
219 const ROOT::Math::XYZVector& getRefPos3D() const;
220
222 double getRefCylindricalR() const;
223
225 double getRefDriftLength() const
226 {
227 return m_refDriftLength;
228 }
229
232 {
234 }
235
237 double getRefChargeDeposit() const
238 {
239 return m_refChargeDeposit;
240 }
241
243 bool isOnWire(const CDC::CDCWire& wire) const
244 {
245 return &getWire() == &wire;
246 }
247
257 ROOT::Math::XYVector reconstruct2D(const CDCTrajectory2D& trajectory2D) const;
258
272 ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D& trajectory2D, ERightLeft rlInfo, double z = 0) const;
273
284 Circle2D conformalTransformed(const ROOT::Math::XYVector& relativeTo) const;
285
288 {
289 return m_automatonCell;
290 }
291
294 {
295 return &m_automatonCell;
296 }
297
300 {
301 return m_iSuperCluster;
302 }
303
305 void setISuperCluster(int iSuperCluster)
306 {
307 m_iSuperCluster = iSuperCluster;
308 }
309
311 double getDriftTime() const
312 {
313 return m_refDriftTime;
314 }
315
316 private:
319
321 mutable CDC::CDCWire const* m_wire = nullptr;
322
324 const CDCHit* m_hit = nullptr;
325
328
331
334
336 double m_refChargeDeposit = 0.0;
337
339 double m_refDriftTime = 0.0f;
340
343 };
344
346 struct GetWireHit {
348 operator FunctorTag();
349
351 template<class T, class SFINAE = decltype(&T::getWireHit)>
352 const CDCWireHit & operator()(const T& t) const
353 {
354 return t.getWireHit();
355 }
356
358 const CDCWireHit& operator()(const CDCWireHit& wireHit) const
359 {
360 return wireHit;
361 }
362 };
363
365 std::ostream& operator<<(std::ostream& output, const CDCWireHit& wirehit);
366
368 bool operator<(const CDCWireHit& wireHit, const CDCHit& hit);
369
371 bool operator<(const CDCHit& hit, const CDCWireHit& wireHit);;
372
374 bool operator<(const CDCWireHit& wireHit, const CDC::CDCWireSuperLayer& wireSuperLayer);
375
377 // Same as above but the other way round.
378 bool operator<(const CDC::CDCWireSuperLayer& wireSuperLayer, const CDCWireHit& wireHit);
379 }
381}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition CDCHit.h:40
CDCWireHit()=default
Default constructor for ROOT compatibility.
Abstract Base class for the ADC count translator.
Class representing a sense wire superlayer in the central drift chamber.
Class representing a sense wire in the central drift chamber.
Definition CDCWire.h:50
Base class for translation of Drift Time into Drift Length.
Cell used by the cellular automata.
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
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.
Definition CDCWireHit.h:160
Circle2D conformalTransformed(const ROOT::Math::XYVector &relativeTo) const
Applies the conformal transformation to the drift circle this hit represents.
static CDC::TDCCountTranslatorBase & getTDCCountTranslator()
Return an instance of the used TDC count translator.
Definition CDCWireHit.cc:37
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition CDCWireHit.h:231
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition CDCWireHit.h:225
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
const WireID & getWireID() const
Getter for the WireID of the wire the hit is located on.
Definition CDCWireHit.h:186
bool isAxial() const
Indicator if the underlying wire is axial.
Definition CDCWireHit.h:198
friend bool operator<(const CDCWireHit *wireHit, const CDC::CDCWire &wire)
Defines CDCWires and CDCWireHits to be coaligned on the wire on which they are based.
Definition CDCWireHit.h:136
friend bool operator<(const CDCWireHit &wireHit, const CDCHit &hit)
Defines CDCWireHits and raw CDCHit to be coaligned.
friend bool operator<(const CDCHit &hit, const CDCWireHit &wireHit)
Defines wire hits and raw CDCHit to be coaligned.
double getRefChargeDeposit() const
Getter for the charge due to energy deposit in the drift cell.
Definition CDCWireHit.h:237
CDC::ISuperLayer getISuperLayer() const
Getter for the super layer id.
Definition CDCWireHit.h:204
int m_iSuperCluster
Memory for the super cluster id.
Definition CDCWireHit.h:342
AutomatonCell * operator->() const
Indirection to the automaton cell for easier access to the flags.
Definition CDCWireHit.h:293
const ROOT::Math::XYZVector & getRefPos3D() const
The three dimensional reference position of the underlying wire.
CDCWireHit()=default
Default constructor for ROOT compatibility.
const CDC::CDCWire & getWire() const
Getter for the CDCWire the hit is located on.
Definition CDCWireHit.h:169
void setISuperCluster(int iSuperCluster)
Setter for the super cluster id.
Definition CDCWireHit.h:305
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Definition CDCWireHit.h:287
friend bool operator<(const CDC::CDCWire &wire, const CDCWireHit &wireHit)
Defines CDCWires and CDCWireHits to be coaligned on the wire on which they are based.
Definition CDCWireHit.h:129
friend bool operator<(const CDC::CDCWire &wire, const CDCWireHit *wireHit)
Defines CDCWires and CDCWireHits to be coaligned on the wire on which they are based.
Definition CDCWireHit.h:144
const CDCHit * m_hit
Memory for the CDCHit pointer.
Definition CDCWireHit.h:324
static CDC::ADCCountTranslatorBase & getADCCountTranslator()
Return an instance of the used ADC count translator.
Definition CDCWireHit.cc:43
bool operator==(const CDCWireHit &rhs) const
Equality comparison based on the wire and the hit id.
Definition CDCWireHit.h:108
static constexpr const double c_simpleDriftLengthVariance
A default value for the drift length variance if no variance from the drift length translation is ava...
Definition CDCWireHit.h:65
bool operator<(const CDCWireHit &rhs) const
Total ordering relation based on the wire and the hit id.
Definition CDCWireHit.h:114
friend bool operator<(const CDCWireHit &wireHit, const CDC::CDCWire &wire)
Defines CDCWires and CDCWireHits to be coaligned on the wire on which they are based.
Definition CDCWireHit.h:122
const CDC::CDCWire & attachWire() const
Reestablishes the pointer of the hit to the wire and returns it Since the DataStore only transport th...
WireID m_wireID
Memory for the WireID.
Definition CDCWireHit.h:318
bool isOnWire(const CDC::CDCWire &wire) const
Checks if the wire hit is based on the given wire.
Definition CDCWireHit.h:243
CDC::EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition CDCWireHit.h:192
double m_refDriftLength
Memory for the drift length at the wire reference point.
Definition CDCWireHit.h:330
Index getStoreIHit() const
Getter for the index of the hit in the StoreArray holding this hit.
double m_refDriftLengthVariance
Memory for the variance of the drift length at the wire reference point.
Definition CDCWireHit.h:333
AutomatonCell m_automatonCell
Memory for the automaton cell.
Definition CDCWireHit.h:327
ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D &trajectory2D, ERightLeft rlInfo, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
ROOT::Math::XYVector reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
CDC::CDCWire const * m_wire
Memory for the CDCWire pointer - Trailing comment indicates to not stream this member.
Definition CDCWireHit.h:321
int getISuperCluster() const
Getter for the super cluster id.
Definition CDCWireHit.h:299
double getDriftTime() const
Return the drift time measured by the CDC for this hit.
Definition CDCWireHit.h:311
double m_refChargeDeposit
Memory for the charge induced by the energy deposit in the drift cell.
Definition CDCWireHit.h:336
CDC::ILayer getILayer() const
Getter for the layer id.
Definition CDCWireHit.h:210
double m_refDriftTime
Measured drift time of the CDC hit.
Definition CDCWireHit.h:339
A two dimensional circle in its natural representation using center and radius as parameters.
Definition Circle2D.h:32
Class to identify a wire inside the CDC.
Definition WireID.h:34
unsigned short getEWire() const
Getter for encoded wire number.
Definition WireID.h:154
unsigned short getISuperLayer() const
Getter for Super-Layer.
Definition WireID.h:130
unsigned short getILayer() const
Getter for layer within the Super-Layer.
Definition WireID.h:136
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
bool operator<(ExpRun a, ExpRun b)
less than for ExpRun
Definition Splitter.h:74
signed short ILayer
The type of the layer ids enumerating layers within a superlayer.
Definition ILayer.h:18
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.
static bool isAxial(ISuperLayer iSuperLayer)
Returns if the super layer with the given id is axial.
static EStereoKind getStereoKind(ISuperLayer iSuperLayer)
Returns the stereo kind of the super layer.
Tag class to facilitate marking of class as a functor in the sense of this code.
Definition FunctorTag.h:20
Generic functor to get the wire hit from an object.
Definition CDCWireHit.h:346
const CDCWireHit & operator()(const CDCWireHit &wireHit) const
If given a wire hit return it unchanged.
Definition CDCWireHit.h:358
const CDCWireHit & operator()(const T &t) const
Returns the wire hit of an object.
Definition CDCWireHit.h:352