Belle II Software  release-05-02-19
CDCWireHit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
13 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
14 #include <tracking/trackFindingCDC/topology/ILayer.h>
15 
16 #include <tracking/trackFindingCDC/ca/AutomatonCell.h>
17 
18 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
19 #include <tracking/trackFindingCDC/numerics/Index.h>
20 
21 #include <tracking/trackFindingCDC/utilities/FunctorTag.h>
22 
23 #include <cdc/dataobjects/WireID.h>
24 
25 #include <utility>
26 #include <iosfwd>
27 #include <cassert>
28 
29 namespace Belle2 {
34  class CDCHit;
35  namespace CDC {
36  class TDCCountTranslatorBase;
37  class ADCCountTranslatorBase;
38  }
39  namespace TrackFindingCDC {
40  class CDCTrajectory2D;
41  class CDCWireSuperLayer;
42  class CDCWire; // IWYU pragma: keep
43  class Circle2D;
44  class Vector3D;
45  class Vector2D;
46 
57  class CDCWireHit {
58  public:
60  static CDC::TDCCountTranslatorBase& getTDCCountTranslator();
61 
63  static CDC::ADCCountTranslatorBase& getADCCountTranslator();
64 
66  static constexpr const double c_simpleDriftLengthVariance = 0.000169;
67 
69  CDCWireHit() = default;
70 
82  CDCWireHit(const CDCHit* ptrHit,
83  double driftLength,
84  double driftLengthVariance = c_simpleDriftLengthVariance,
85  double chargeDeposit = 0,
86  double driftTime = 0);
87 
96  explicit CDCWireHit(const CDCHit* ptrHit,
97  CDC::TDCCountTranslatorBase* ptrTDCCountTranslator = nullptr,
98  CDC::ADCCountTranslatorBase* ptrADCCountTranslator = nullptr);
99 
101  CDCWireHit(const WireID& wireID,
102  double driftLength,
103  double driftLengthVariance = c_simpleDriftLengthVariance,
104  double chargeDeposit = 0);
105 
107  bool operator==(const CDCWireHit& rhs) const
108  {
109  return getWireID() == rhs.getWireID() and getRefDriftLength() == rhs.getRefDriftLength();
110  }
111 
113  bool operator<(const CDCWireHit& rhs) const
114  {
115  return
116  std::make_pair(getWireID().getEWire(), getRefDriftLength()) <
117  std::make_pair(rhs.getWireID().getEWire(), rhs.getRefDriftLength());
118  }
119 
121  friend bool operator<(const CDCWireHit& wireHit, const CDCWire& wire)
122  {
123  return &wireHit.getWire() < &wire;
124  }
125 
127  // Same as above but the other way round.
128  friend bool operator<(const CDCWire& wire, const CDCWireHit& wireHit)
129  {
130  return &wire < &wireHit.getWire();
131  }
132 
134  // Same as above but with CDCWireHit as a pointer.
135  friend bool operator<(const CDCWireHit* wireHit, const CDCWire& wire)
136  {
137  assert(wireHit);
138  return *wireHit < wire;
139  }
140 
142  // Same as above but the other way round and with CDCWireHit as a pointer.
143  friend bool operator<(const CDCWire& wire, const CDCWireHit* wireHit)
144  {
145  assert(wireHit);
146  return wire < *wireHit;
147  }
148 
150  bool operator<(const CDCHit& hit);
151 
152  friend bool operator<(const CDCWireHit& wireHit, const CDCHit& hit);
153 
155  // Same as above but the other way round.
156  friend bool operator<(const CDCHit& hit, const CDCWireHit& wireHit);
157 
159  const CDCHit* getHit() const
160  {
161  return m_hit;
162  }
163 
165  Index getStoreIHit() const;
166 
168  const CDCWire& getWire() const
169  {
170  // if (not m_wire) return attachWire();
171  if (not m_wire) return attachWire();
172  return *m_wire;
173  }
174 
182  const CDCWire& attachWire() const;
183 
185  const WireID& getWireID() const
186  {
187  return m_wireID;
188  }
189 
191  EStereoKind getStereoKind() const
192  {
194  }
195 
197  bool isAxial() const
198  {
200  }
201 
203  ISuperLayer getISuperLayer() const
204  {
206  }
207 
209  ILayer getILayer() const
210  {
211  return getWireID().getILayer();
212  }
213 
215  const Vector2D& getRefPos2D() const;
216 
218  const Vector3D& getRefPos3D() const;
219 
221  double getRefCylindricalR() const;
222 
224  double getRefDriftLength() const
225  {
226  return m_refDriftLength;
227  }
228 
230  double getRefDriftLengthVariance() const
231  {
233  }
234 
236  double getRefChargeDeposit() const
237  {
239  }
240 
242  bool isOnWire(const CDCWire& wire) const
243  {
244  return &getWire() == &wire;
245  }
246 
256  Vector2D reconstruct2D(const CDCTrajectory2D& trajectory2D) const;
257 
271  Vector3D reconstruct3D(const CDCTrajectory2D& trajectory2D, ERightLeft rlInfo, double z = 0) const;
272 
283  Circle2D conformalTransformed(const Vector2D& relativeTo) const;
284 
287  {
288  return m_automatonCell;
289  }
290 
292  AutomatonCell* operator->() const
293  {
295  }
296 
298  int getISuperCluster() const
299  {
301  }
302 
304  void setISuperCluster(int iSuperCluster)
305  {
306  m_iSuperCluster = iSuperCluster;
307  }
308 
310  double getDriftTime() const
311  {
313  }
314 
315  private:
318 
320  mutable CDCWire const* m_wire = nullptr;
321 
323  mutable AutomatonCell m_automatonCell{1};
324 
326  double m_refDriftLength = 0;
327 
330 
332  double m_refChargeDeposit = 0.0;
333 
335  int m_iSuperCluster = -1;
336 
338  double m_refDriftTime = 0.0f;
339 
341  const CDCHit* m_hit = nullptr;
342  };
343 
345  struct GetWireHit {
347  operator FunctorTag();
348 
350  template<class T, class SFINAE = decltype(&T::getWireHit)>
351  const CDCWireHit & operator()(const T& t) const
352  {
353  return t.getWireHit();
354  }
355 
357  const CDCWireHit& operator()(const CDCWireHit& wireHit) const
358  {
359  return wireHit;
360  }
361  };
362 
364  std::ostream& operator<<(std::ostream& output, const CDCWireHit& wirehit);
365 
367  bool operator<(const CDCWireHit& wireHit, const CDCHit& hit);
368 
370  bool operator<(const CDCHit& hit, const CDCWireHit& wireHit);;
371 
373  bool operator<(const CDCWireHit& wireHit, const CDCWireSuperLayer& wireSuperLayer);
374 
376  // Same as above but the other way round.
377  bool operator<(const CDCWireSuperLayer& wireSuperLayer, const CDCWireHit& wireHit);
378  }
380 }
Belle2::TrackFindingCDC::CDCWireHit::getAutomatonCell
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Definition: CDCWireHit.h:294
Belle2::TrackFindingCDC::CDCWireHit::getStereoKind
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Definition: CDCWireHit.h:199
Belle2::TrackFindingCDC::CDCWireHit::getISuperCluster
int getISuperCluster() const
Getter for the super cluster id.
Definition: CDCWireHit.h:306
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::Vector3D
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:35
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::CDCWireHit::getWireID
const WireID & getWireID() const
Getter for the WireID of the wire the hit is located on.
Definition: CDCWireHit.h:193
Belle2::TrackFindingCDC::CDCWireHit::getILayer
ILayer getILayer() const
Getter for the layer id.
Definition: CDCWireHit.h:217
Belle2::WireID::getILayer
unsigned short getILayer() const
Getter for layer within the Super-Layer.
Definition: WireID.h:146
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCWireHit::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCWireHit.h:232
Belle2::TrackFindingCDC::CDCWireHit::attachWire
const CDCWire & attachWire() const
Reestablishes the pointer of the hit to the wire and returns it Since the DataStore only transport th...
Definition: CDCWireHit.cc:161
Belle2::TrackFindingCDC::ISuperLayerUtil::getStereoKind
static EStereoKind getStereoKind(ISuperLayer iSuperLayer)
Returns the stereo kind of the super layer.
Definition: ISuperLayer.cc:28
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::TrackFindingCDC::CDCWireHit::getISuperLayer
ISuperLayer getISuperLayer() const
Getter for the super layer id.
Definition: CDCWireHit.h:211
Belle2::TrackFindingCDC::CDCWireHit::m_hit
const CDCHit * m_hit
Memory for the CDCHit pointer.
Definition: CDCWireHit.h:349
Belle2::TrackFindingCDC::CDCWireHit::getRefPos2D
const Vector2D & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
Definition: CDCWireHit.cc:214
Belle2::WireID::getISuperLayer
unsigned short getISuperLayer() const
Getter for Super-Layer.
Definition: WireID.h:140
Belle2::TrackFindingCDC::CDCWireHit::getTDCCountTranslator
static CDC::TDCCountTranslatorBase & getTDCCountTranslator()
Return an instance of the used TDC count translator.
Definition: CDCWireHit.cc:41
Belle2::TrackFindingCDC::CDCWireHit::getRefDriftLengthVariance
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCWireHit.h:238
Belle2::TrackFindingCDC::GetWireHit
Generic functor to get the wire hit from an object.
Definition: CDCWireHit.h:353
Belle2::TrackFindingCDC::CDCWireHit::operator<
friend bool operator<(const CDCWireHit *wireHit, const CDCWire &wire)
Defines CDCWires and CDCWireHits to be coaligned on the wire on which they are based.
Definition: CDCWireHit.h:143
Belle2::TrackFindingCDC::CDCWireHit::getHit
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:167
Belle2::TrackFindingCDC::Circle2D
A two dimensional circle in its natural representation using center and radius as parameters.
Definition: Circle2D.h:36
Belle2::TrackFindingCDC::CDCWireHit::getStoreIHit
Index getStoreIHit() const
Getter for the index of the hit in the StoreArray holding this hit.
Definition: CDCWireHit.cc:209
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCWireHit::CDCWireHit
CDCWireHit()=default
Default constructor for ROOT compatibility.
Belle2::TrackFindingCDC::CDCWireHit::isOnWire
bool isOnWire(const CDCWire &wire) const
Checks if the wire hit is based on the given wire.
Definition: CDCWireHit.h:250
Belle2::operator<
bool operator<(ExpRun a, ExpRun b)
less than for ExpRun
Definition: Splitter.h:78
Belle2::TrackFindingCDC::CDCWireHit::m_wire
CDCWire const * m_wire
Memory for the CDCWire pointer - Trailing comment indicates to not stream this member.
Definition: CDCWireHit.h:328
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::AutomatonCell
Cell used by the cellular automata.
Definition: AutomatonCell.h:39
Belle2::TrackFindingCDC::CDCWireHit::operator->
AutomatonCell * operator->() const
Indirection to the automaton cell for easier access to the flags.
Definition: CDCWireHit.h:300
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCWireHit::m_refDriftLengthVariance
double m_refDriftLengthVariance
Memory for the variance of the drift length at the wire reference point.
Definition: CDCWireHit.h:337
Belle2::TrackFindingCDC::GetWireHit::operator()
const CDCWireHit & operator()(const T &t) const
Returns the wire hit of an object.
Definition: CDCWireHit.h:359
Belle2::TrackFindingCDC::CDCWireHit::getRefChargeDeposit
double getRefChargeDeposit() const
Getter for the charge due to energy deposit in the drift cell.
Definition: CDCWireHit.h:244
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::ISuperLayerUtil::isAxial
static bool isAxial(ISuperLayer iSuperLayer)
Returns if the super layer with the given id is axial.
Definition: ISuperLayer.cc:23
Belle2::TrackFindingCDC::FunctorTag
Tag class to facilitate marking of class as a functor in the sense of this code.
Definition: FunctorTag.h:30
Belle2::TrackFindingCDC::CDCWireHit::conformalTransformed
Circle2D conformalTransformed(const Vector2D &relativeTo) const
Applys the conformal transformation to the drift circle this hit represents.
Definition: CDCWireHit.cc:202
Belle2::TrackFindingCDC::CDCWireHit::m_refDriftTime
double m_refDriftTime
Measured drift time of the CDC hit.
Definition: CDCWireHit.h:346
Belle2::TrackFindingCDC::CDCWireHit::operator==
bool operator==(const CDCWireHit &rhs) const
Equality comparison based on the wire and the hit id.
Definition: CDCWireHit.h:115
Belle2::TrackFindingCDC::CDCWireHit::getWire
const CDCWire & getWire() const
Getter for the CDCWire the hit is located on.
Definition: CDCWireHit.h:176
Belle2::TrackFindingCDC::CDCWireSuperLayer
Class representating a sense wire superlayer in the central drift chamber.
Definition: CDCWireSuperLayer.h:53
Belle2::TrackFindingCDC::CDCWireHit::m_automatonCell
AutomatonCell m_automatonCell
Memory for the automaton cell.
Definition: CDCWireHit.h:331
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCWireHit::getDriftTime
double getDriftTime() const
Return the drift time measured by the CDC for this hit.
Definition: CDCWireHit.h:318
Belle2::TrackFindingCDC::CDCWireHit::getRefPos3D
const Vector3D & getRefPos3D() const
The three dimensional reference position of the underlying wire.
Definition: CDCWireHit.cc:219
Belle2::TrackFindingCDC::CDCWireHit::m_iSuperCluster
int m_iSuperCluster
Memory for the super cluster id.
Definition: CDCWireHit.h:343
Belle2::TrackFindingCDC::CDCWireHit::setISuperCluster
void setISuperCluster(int iSuperCluster)
Setter for the super cluster id.
Definition: CDCWireHit.h:312
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::CDCWireHit::getADCCountTranslator
static CDC::ADCCountTranslatorBase & getADCCountTranslator()
Return an instance of the used ADC count translator.
Definition: CDCWireHit.cc:47
Belle2::TrackFindingCDC::CDCWireHit::getRefCylindricalR
double getRefCylindricalR() const
The distance from the beam line at reference position of the underlying wire.
Definition: CDCWireHit.cc:224
Belle2::TrackFindingCDC::CDCWireHit::c_simpleDriftLengthVariance
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:74
Belle2::TrackFindingCDC::CDCWireHit::reconstruct2D
Vector2D reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
Definition: CDCWireHit.cc:168
Belle2::TrackFindingCDC::CDCWireHit::reconstruct3D
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, ERightLeft rlInfo, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
Definition: CDCWireHit.cc:183
Belle2::TrackFindingCDC::CDCWireHit::operator<
bool operator<(const CDCWireHit &rhs) const
Total ordering relation based on the wire and the hit id.
Definition: CDCWireHit.h:121
Belle2::TrackFindingCDC::CDCWireHit::m_refChargeDeposit
double m_refChargeDeposit
Memory for the charge induced by the energy deposit in the drift cell.
Definition: CDCWireHit.h:340
Belle2::TrackFindingCDC::CDCWireHit::m_refDriftLength
double m_refDriftLength
Memory for the drift length at the wire reference point.
Definition: CDCWireHit.h:334
Belle2::TrackFindingCDC::CDCWireHit::m_wireID
WireID m_wireID
Memory for the WireID.
Definition: CDCWireHit.h:325
Belle2::TrackFindingCDC::CDCWireHit::isAxial
bool isAxial() const
Indicator if the underlying wire is axial.
Definition: CDCWireHit.h:205