Belle II Software  release-05-02-19
CDCWire.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/WireNeighborPair.h>
13 #include <tracking/trackFindingCDC/topology/WireLine.h>
14 
15 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
16 #include <tracking/trackFindingCDC/topology/ILayer.h>
17 #include <tracking/trackFindingCDC/topology/IWire.h>
18 
19 #include <tracking/trackFindingCDC/topology/WireNeighborKind.h>
20 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
21 #include <tracking/trackFindingCDC/topology/EWirePosition.h>
22 
23 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
24 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
25 
26 #include <tracking/trackFindingCDC/utilities/MayBePtr.h>
27 
28 #include <cdc/dataobjects/WireID.h>
29 
30 #include <iostream>
31 
32 namespace Belle2 {
37  class CDCHit;
39 }
40 
41 namespace Belle2 {
46  namespace TrackFindingCDC {
47 
48  // Forward declarations
49  class CDCWireLayer;
50  class CDCWireSuperLayer;
51 
60  class CDCWire {
61 
62  public:
69  static const CDCWire* getInstance(const WireID& wireID);
71 
73  static const CDCWire* getInstance(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
74 
76  static const CDCWire* getInstance(const CDCHit& hit);
79  explicit CDCWire(const WireID& wireID);
81 
83  CDCWire(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
84 
86  CDCWire(const CDCWire& wire) = delete;
87 
89  CDCWire(CDCWire&& wire) = default;
90 
92  void operator=(const CDCWire& wire) = delete;
93 
94  public:
96  bool operator==(const CDCWire& other) const
97  { return getWireID() == other.getWireID(); }
98 
107  bool operator<(const CDCWire& other) const
108  { return getWireID() < other.getWireID(); }
109 
110  public:
112  void initialize(EWirePosition wirePosition, bool ignoreWireSag);
113 
119  operator const Belle2::WireID& () const
121  { return getWireID(); }
122 
124  const WireID& getWireID() const
125  { return m_wireID; }
126 
133  unsigned short getEWire() const
134  { return getWireID().getEWire(); }
135 
148  IWire getIWire() const
149  { return getWireID().getIWire(); }
150 
152  ILayer getICLayer() const
153  { return getWireID().getICLayer(); }
154 
161  ILayer getILayer() const
162  { return getWireID().getILayer(); }
163 
165  ISuperLayer getISuperLayer() const
166  { return getWireID().getISuperLayer(); }
175  bool isAxial() const
177  { return getStereoKind() == EStereoKind::c_Axial; }
178 
186  EStereoKind getStereoKind() const
188 
190  const WireLine& getWireLine() const
191  { return m_wireLine; }
192 
194  Vector2D getWirePos2DAtZ(const double z) const
195  { return getWireLine().sagPos2DAtZ(z); }
196 
198  Vector3D getWirePos3DAtZ(const double z) const
199  { return getWireLine().sagPos3DAtZ(z); }
200 
202  double getDistance(const Vector3D& pos3D) const
203  { return getWireLine().sagDistance(pos3D); }
204 
206  Vector3D getClosest(const Vector3D& pos3D) const
207  { return getWireLine().sagClosest3D(pos3D); }
208 
216  double getDriftLength(const Vector3D& pos3D) const
217  { return isInCell(pos3D) ? getDistance(pos3D) : NAN; }
218 
224  const Vector3D& getRefPos3D() const
225  { return getWireLine().refPos3D(); }
226 
231  const Vector2D& getRefPos2D() const
232  { return getWireLine().refPos2D(); }
233 
238  double getRefZ() const
239  { return getWireLine().refZ(); }
240 
242  double getTanStereoAngle() const
243  { return getWireLine().tanTheta(); }
244 
246  double getStereoAngle() const
247  { return getWireLine().theta(); }
248 
251  { return getWireLine().wireVector(); }
252 
255  { return getWireLine().nominalMovePerZ(); }
256 
258  Vector2D getMovePerZAtZ(double z) const
259  { return getWireLine().sagMovePerZ(z); }
260 
262  double getRefCylindricalR() const
263  { return m_refCylindricalR; }
264 
266  double getMinCylindricalR() const
267  { return getWireLine().nominalPerigee2D().norm(); }
268 
270  double getForwardCylindricalR() const
271  { return getWireLine().forwardCylindricalR(); };
272 
274  double getBackwardCylindricalR() const
275  { return getWireLine().forwardCylindricalR(); };
276 
278  double getForwardZ() const
279  { return getWireLine().forwardZ(); }
280 
282  double getBackwardZ() const
283  { return getWireLine().backwardZ(); }
284 
287  { return getWireLine().forward3D(); }
288 
291  { return getWireLine().backward3D(); }
292 
294  bool isInCell(const Vector3D& pos3D) const;
295 
297  bool isInCellZBounds(const Vector3D& pos3D, const double factor = 1) const
298  { return getBackwardZ() * factor < pos3D.z() and pos3D.z() < getForwardZ() * factor; }
299 
301  double getRadialCellWidth() const;
302 
304  double getLateralCellWidth() const;
312  const CDCWireLayer& getWireLayer() const;
314 
316  const CDCWireSuperLayer& getWireSuperLayer() const;
317 
329  WireNeighborKind getNeighborKind(const CDCWire& wire) const;
330 
332  bool isPrimaryNeighborWith(const CDCWire& wire) const;
333 
343 
353 
360  MayBePtr<const CDCWire> getNeighborCCW() const;
361 
368  MayBePtr<const CDCWire> getNeighborCW() const;
369 
376  MayBePtr<const CDCWire> getNeighborCCWInwards() const;
377 
384  MayBePtr<const CDCWire> getNeighborCWInwards() const;
385 
392  MayBePtr<const CDCWire> getNeighborCCWOutwards() const;
393 
400  MayBePtr<const CDCWire> getNeighborCWOutwards() const;
403  MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection) const;
405 
407  friend std::ostream& operator<<(std::ostream& output, const CDCWire& wire)
408  { return (output << "CDCWire(" << wire.getISuperLayer() << "," << wire.getILayer() << "," << wire.getIWire() << ")") ; }
409 
410  private:
413 
416 
419 
420  };
421  }
423 }
Belle2::TrackFindingCDC::WireLine::sagClosest3D
Vector3D sagClosest3D(const Vector3D &point) const
Returns the closest approach on the wire with wire sag effect to the give point.
Definition: WireLine.h:112
Belle2::TrackFindingCDC::WireLine::theta
double theta() const
Returns the nominal opening angle between tangential vector and the z axes.
Definition: WireLine.h:201
Belle2::TrackFindingCDC::CDCWire::getBackwardPos3D
Vector3D getBackwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition: CDCWire.h:290
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::TrackFindingCDC::WireLine::nominalPerigee2D
Vector2D nominalPerigee2D() const
Returns the point of nominal closest approach to the z axes.
Definition: WireLine.h:213
Belle2::TrackFindingCDC::CDCWire::getForwardZ
double getForwardZ() const
Getter for the z coordinate at the forward joint points of the wires.
Definition: CDCWire.h:278
Belle2::TrackFindingCDC::CDCWire::getDistance
double getDistance(const Vector3D &pos3D) const
Calculates the distance from the position to the wire.
Definition: CDCWire.h:202
Belle2::TrackFindingCDC::CDCWire::getWirePos3DAtZ
Vector3D getWirePos3DAtZ(const double z) const
Gives position of the wire at the given z coordinate.
Definition: CDCWire.h:198
Belle2::TrackFindingCDC::CDCWire::getNeighborsInwards
WireNeighborPair getNeighborsInwards() const
Gives the two wires in the next layer inward.
Definition: CDCWire.cc:155
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::WireLine::wireVector
Vector3D wireVector() const
Getter for the vector from backward to the forward position.
Definition: WireLine.h:136
Belle2::TrackFindingCDC::WireLine::sagMovePerZ
Vector2D sagMovePerZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:85
Belle2::TrackFindingCDC::WireLine::sagPos2DAtZ
Vector2D sagPos2DAtZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:70
Belle2::TrackFindingCDC::CDCWire::getIWire
IWire getIWire() const
Getter for the wire id within its layer.
Definition: CDCWire.h:148
Belle2::WireID::getEWire
unsigned short getEWire() const
Getter for encoded wire number.
Definition: WireID.h:164
Belle2::TrackFindingCDC::CDCWire::getRefPos2D
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:231
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::CDCWire::getRefZ
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition: CDCWire.h:238
Belle2::TrackFindingCDC::CDCWire::getNeighborKind
WireNeighborKind getNeighborKind(const CDCWire &wire) const
Returns gives the kind of neighborhood relation from this wire to the given wire.
Definition: CDCWire.cc:145
Belle2::TrackFindingCDC::CDCWire::getEWire
unsigned short getEWire() const
Getter for the encoded wire number.
Definition: CDCWire.h:133
Belle2::WireID::getISuperLayer
unsigned short getISuperLayer() const
Getter for Super-Layer.
Definition: WireID.h:140
Belle2::TrackFindingCDC::WireLine::forward3D
Vector3D forward3D() const
Gives the position of the forward point.
Definition: WireLine.h:120
Belle2::TrackFindingCDC::CDCWire::getBackwardZ
double getBackwardZ() const
Getter for the z coordinate at the backward joint points of the wires.
Definition: CDCWire.h:282
Belle2::TrackFindingCDC::CDCWire::getNeighborCW
MayBePtr< const CDCWire > getNeighborCW() const
Gives the closest neighbor in the clockwise direction - always exists.
Definition: CDCWire.cc:170
Belle2::TrackFindingCDC::CDCWire::m_refCylindricalR
double m_refCylindricalR
Precomputed distance to the beam line at the reference position.
Definition: CDCWire.h:418
Belle2::TrackFindingCDC::CDCWire::getWireLayer
const CDCWireLayer & getWireLayer() const
Getter for the wire layer.
Definition: CDCWire.cc:133
Belle2::TrackFindingCDC::CDCWire::getBackwardCylindricalR
double getBackwardCylindricalR() const
Getter for the distance to the beamline ( z-axes ) at the backward joint point.
Definition: CDCWire.h:274
Belle2::TrackFindingCDC::CDCWire::getNeighborCWInwards
MayBePtr< const CDCWire > getNeighborCWInwards() const
Gives the closest neighbor in the clockwise inwards direction This does not cross superlayer boundari...
Definition: CDCWire.cc:180
Belle2::TrackFindingCDC::CDCWire::initialize
void initialize(EWirePosition wirePosition, bool ignoreWireSag)
(Re)load all geometry parameters form the CDCGeometryPar to adjust to changes in geometry.
Definition: CDCWire.cc:71
Belle2::TrackFindingCDC::CDCWire::isInCellZBounds
bool isInCellZBounds(const Vector3D &pos3D, const double factor=1) const
Checks whether the position is in the z bounds of the drift cell (scaled by the factor) surrounding t...
Definition: CDCWire.h:297
Belle2::TrackFindingCDC::CDCWire::operator==
bool operator==(const CDCWire &other) const
Equality comparision based on wireID.
Definition: CDCWire.h:96
Belle2::TrackFindingCDC::CDCWire::getWireVector
Vector3D getWireVector() const
Getter for the vector pointing from the back end ofthe wire to the front end of the wire.
Definition: CDCWire.h:250
Belle2::TrackFindingCDC::WireLine::forwardCylindricalR
double forwardCylindricalR() const
Gives the cylindrical radius of the forward position.
Definition: WireLine.h:164
Belle2::TrackFindingCDC::WireLine::sagDistance
double sagDistance(const Vector3D &pos3D) const
Calculates the distance of the given point to the wire with wire sag effect.
Definition: WireLine.h:100
Belle2::TrackFindingCDC::CDCWire::getClosest
Vector3D getClosest(const Vector3D &pos3D) const
Calculates the closest approach in the wire to the position.
Definition: CDCWire.h:206
Belle2::TrackFindingCDC::CDCWire::operator=
void operator=(const CDCWire &wire)=delete
Disallow copy assignment of wires.
Belle2::TrackFindingCDC::CDCWire::getILayer
ILayer getILayer() const
Getter for the layer id within its superlayer Gives the layer id within its superlayer ranging from ...
Definition: CDCWire.h:161
Belle2::TrackFindingCDC::CDCWire::getISuperLayer
ISuperLayer getISuperLayer() const
Gives the superlayer id ranging from 0 - 8.
Definition: CDCWire.h:165
Belle2::TrackFindingCDC::CDCWire::getWirePos2DAtZ
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition: CDCWire.h:194
Belle2::TrackFindingCDC::WireLine::refPos2D
const Vector2D & refPos2D() const
Returns the xy vector of the reference position.
Definition: WireLine.h:233
Belle2::TrackFindingCDC::CDCWire::getRefPos3D
const Vector3D & getRefPos3D() const
Getter for the wire reference position.
Definition: CDCWire.h:224
Belle2::TrackFindingCDC::WireLine::refZ
double refZ() const
Returns the the z coordinate of the reference point.
Definition: WireLine.h:225
Belle2::TrackFindingCDC::CDCWire::getLateralCellWidth
double getLateralCellWidth() const
Getter for the cell widths in lateral direction.
Definition: CDCWire.cc:128
Belle2::TrackFindingCDC::CDCWire::getMovePerZ
Vector2D getMovePerZ() const
Getter for the vector describing the nominal positional change in the xy plane per unit z.
Definition: CDCWire.h:254
Belle2::TrackFindingCDC::WireLine::sagPos3DAtZ
Vector3D sagPos3DAtZ(const double z) const
Gives the three dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:66
Belle2::TrackFindingCDC::CDCWire::getICLayer
ILayer getICLayer() const
Getter for the continious layer id ranging from 0 - 55.
Definition: CDCWire.h:152
Belle2::TrackFindingCDC::CDCWire::isPrimaryNeighborWith
bool isPrimaryNeighborWith(const CDCWire &wire) const
Returns whether the give wire is a neighbor of this wire.
Definition: CDCWire.cc:150
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::WireLine
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:41
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCWire::getNeighborCCWOutwards
MayBePtr< const CDCWire > getNeighborCCWOutwards() const
Gives the closest neighbor in the countclockwise outwards direction This does not cross superlayer bo...
Definition: CDCWire.cc:185
Belle2::TrackFindingCDC::WireLine::refPos3D
const Vector3D & refPos3D() const
Returns the reference position.
Definition: WireLine.h:237
Belle2::TrackFindingCDC::CDCWire::getInstance
static const CDCWire * getInstance(const WireID &wireID)
Getter from the wireID convinience object. Does not construct a new object.
Definition: CDCWire.cc:26
Belle2::TrackFindingCDC::WireLine::tanTheta
double tanTheta() const
Returns the tangent of the opening angle between tangential vector and the z axes Also know as ds / d...
Definition: WireLine.h:197
Belle2::TrackFindingCDC::CDCWire::getMinCylindricalR
double getMinCylindricalR() const
Getter for the closest distance to the beamline ( z-axes )
Definition: CDCWire.h:266
Belle2::TrackFindingCDC::WireLine::nominalMovePerZ
const Vector2D & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition: WireLine.h:81
Belle2::TrackFindingCDC::CDCWire::getWireLine
const WireLine & getWireLine() const
Getter for the wire line represenation of the wire.
Definition: CDCWire.h:190
Belle2::TrackFindingCDC::CDCWire::operator<
bool operator<(const CDCWire &other) const
Total ordering relation based on the wire id Defines a total ordering scheme for wire objects based o...
Definition: CDCWire.h:107
Belle2::TrackFindingCDC::CDCWireLayer
Class representating a sense wire layer in the central drift chamber.
Definition: CDCWireLayer.h:51
Belle2::TrackFindingCDC::CDCWire::isAxial
bool isAxial() const
Indicates if the wire is axial or stereo.
Definition: CDCWire.h:176
Belle2::TrackFindingCDC::CDCWire::getTanStereoAngle
double getTanStereoAngle() const
Getter for the tangents of the stereo angle of the wire.
Definition: CDCWire.h:242
Belle2::TrackFindingCDC::CDCWire::m_wireLine
WireLine m_wireLine
The line representation of the wire.
Definition: CDCWire.h:415
Belle2::TrackFindingCDC::CDCWire::getWireID
const WireID & getWireID() const
Getter for the wire id.
Definition: CDCWire.h:124
Belle2::TrackFindingCDC::CDCWire::getForwardCylindricalR
double getForwardCylindricalR() const
Getter for the nominal distance to the beamline ( z-axes ) at the forward joint point.
Definition: CDCWire.h:270
Belle2::TrackFindingCDC::WireLine::backward3D
Vector3D backward3D() const
Gives the position of the backward point.
Definition: WireLine.h:128
Belle2::TrackFindingCDC::CDCWire::CDCWire
CDCWire(const WireID &wireID)
Constructor taking the combined wire id convenience object.
Definition: CDCWire.cc:59
Belle2::TrackFindingCDC::WireLine::forwardZ
double forwardZ() const
Gives the forward z coodinate.
Definition: WireLine.h:140
Belle2::TrackFindingCDC::NWirePosition::EWirePosition
EWirePosition
Wire position set.
Definition: EWirePosition.h:40
Belle2::TrackFindingCDC::CDCWireSuperLayer
Class representating a sense wire superlayer in the central drift chamber.
Definition: CDCWireSuperLayer.h:53
Belle2::TrackFindingCDC::Vector2D::norm
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:189
Belle2::TrackFindingCDC::WireLine::backwardZ
double backwardZ() const
Gives the backward z coodinate.
Definition: WireLine.h:144
Belle2::TrackFindingCDC::CDCWire::isInCell
bool isInCell(const Vector3D &pos3D) const
Checks whether the position is in the drift cell surrounding the wire.
Definition: CDCWire.cc:98
Belle2::TrackFindingCDC::CDCWire::getForwardPos3D
Vector3D getForwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition: CDCWire.h:286
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCWire::getSecondaryNeighbor
MayBePtr< const CDCWire > getSecondaryNeighbor(short oClockDirection) const
Getter for the secondary neighbors of this wire id following the direction on the clock.
Definition: CDCWire.cc:195
Belle2::TrackFindingCDC::CDCWire::getStereoKind
EStereoKind getStereoKind() const
Getter for the stereo type of the wire.
Definition: CDCWire.h:186
Belle2::TrackFindingCDC::CDCWire::getWireSuperLayer
const CDCWireSuperLayer & getWireSuperLayer() const
Getter for the wire super layer.
Definition: CDCWire.cc:139
Belle2::TrackFindingCDC::Vector3D::z
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:488
Belle2::TrackFindingCDC::WireNeighborKind
Type for the neighbor relationship from one wire to another.
Definition: WireNeighborKind.h:35
Belle2::TrackFindingCDC::CDCWire::getRadialCellWidth
double getRadialCellWidth() const
Getter for the cell widths in radial direction.
Definition: CDCWire.cc:123
Belle2::TrackFindingCDC::CDCWire::getNeighborCCWInwards
MayBePtr< const CDCWire > getNeighborCCWInwards() const
Gives the closest neighbor in the countclockwise inwards direction This does not cross superlayer bou...
Definition: CDCWire.cc:175
Belle2::TrackFindingCDC::CDCWire::m_wireID
WireID m_wireID
The wireID of the wire.
Definition: CDCWire.h:412
Belle2::TrackFindingCDC::CDCWire::getNeighborsOutwards
WireNeighborPair getNeighborsOutwards() const
Gives the two wires in the next layer outward.
Definition: CDCWire.cc:160
Belle2::TrackFindingCDC::CDCWire::getMovePerZAtZ
Vector2D getMovePerZAtZ(double z) const
Getter for the vector describing the real positional change in the xy plane per unit z at the z posit...
Definition: CDCWire.h:258
Belle2::WireID::getIWire
unsigned short getIWire() const
Getter for wire within the layer.
Definition: WireID.h:155
Belle2::WireID::getICLayer
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:26
Belle2::TrackFindingCDC::WireNeighborPair
Class representing a pair of neighbors in the CDC in a single layer For certain circumstances it is a...
Definition: WireNeighborPair.h:39
Belle2::TrackFindingCDC::CDCWire::getNeighborCWOutwards
MayBePtr< const CDCWire > getNeighborCWOutwards() const
Gives the closest neighbor in the clockwise outwards direction This does not cross superlayer boundar...
Definition: CDCWire.cc:190
Belle2::TrackFindingCDC::CDCWire::getDriftLength
double getDriftLength(const Vector3D &pos3D) const
Calculates the straight drift length from the position to the wire This is essentially the same as th...
Definition: CDCWire.h:216
Belle2::TrackFindingCDC::CDCWire::operator<<
friend std::ostream & operator<<(std::ostream &output, const CDCWire &wire)
Sting output operator for wire objects to help debugging.
Definition: CDCWire.h:407
Belle2::TrackFindingCDC::CDCWire::getStereoAngle
double getStereoAngle() const
Getter for the stereo angle of the wire.
Definition: CDCWire.h:246
Belle2::TrackFindingCDC::CDCWire::getNeighborCCW
MayBePtr< const CDCWire > getNeighborCCW() const
Gives the closest neighbor in the counterclockwise direction - always exists.
Definition: CDCWire.cc:165
Belle2::TrackFindingCDC::CDCWire::getRefCylindricalR
double getRefCylindricalR() const
Getter for the cylindrical radius at the wire reference position.
Definition: CDCWire.h:262