Belle II Software development
CDCWire.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 <tracking/trackFindingCDC/topology/WireNeighborPair.h>
11#include <tracking/trackFindingCDC/topology/WireLine.h>
12
13#include <tracking/trackFindingCDC/topology/ISuperLayer.h>
14#include <tracking/trackFindingCDC/topology/ILayer.h>
15#include <tracking/trackFindingCDC/topology/IWire.h>
16
17#include <tracking/trackFindingCDC/topology/WireNeighborKind.h>
18#include <tracking/trackFindingCDC/topology/EStereoKind.h>
19#include <tracking/trackFindingCDC/topology/EWirePosition.h>
20
21#include <tracking/trackFindingCDC/geometry/Vector3D.h>
22#include <tracking/trackFindingCDC/geometry/Vector2D.h>
23
24#include <tracking/trackFindingCDC/utilities/MayBePtr.h>
25
26#include <cdc/dataobjects/WireID.h>
27
28#include <iostream>
29
30namespace Belle2 {
35 class CDCHit;
37}
38
39namespace Belle2 {
44 namespace TrackFindingCDC {
45
46 // Forward declarations
47 class CDCWireLayer;
48 class CDCWireSuperLayer;
49
58 class CDCWire {
59
60 public:
68 static const CDCWire* getInstance(const WireID& wireID);
69
71 static const CDCWire* getInstance(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
72
74 static const CDCWire* getInstance(const CDCHit& hit);
78 explicit CDCWire(const WireID& wireID);
79
81 CDCWire(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
82
84 CDCWire(const CDCWire& wire) = delete;
85
87 CDCWire(CDCWire&& wire) = default;
88
90 void operator=(const CDCWire& wire) = delete;
91
92 public:
94 bool operator==(const CDCWire& other) const
95 { return getWireID() == other.getWireID(); }
96
105 bool operator<(const CDCWire& other) const
106 { return getWireID() < other.getWireID(); }
107
108 public:
110 void initialize(EWirePosition wirePosition, bool ignoreWireSag);
111
118 operator const Belle2::WireID& () const
119 { return getWireID(); }
120
122 const WireID& getWireID() const
123 { return m_wireID; }
124
131 unsigned short getEWire() const
132 { return getWireID().getEWire(); }
133
146 IWire getIWire() const
147 { return getWireID().getIWire(); }
148
150 ILayer getICLayer() const
151 { return getWireID().getICLayer(); }
152
159 ILayer getILayer() const
160 { return getWireID().getILayer(); }
161
163 ISuperLayer getISuperLayer() const
164 { return getWireID().getISuperLayer(); }
174 bool isAxial() const
175 { return getStereoKind() == EStereoKind::c_Axial; }
176
184 EStereoKind getStereoKind() const
186
188 const WireLine& getWireLine() const
189 { return m_wireLine; }
190
192 Vector2D getWirePos2DAtZ(const double z) const
193 { return getWireLine().sagPos2DAtZ(z); }
194
196 Vector3D getWirePos3DAtZ(const double z) const
197 { return getWireLine().sagPos3DAtZ(z); }
198
200 double getDistance(const Vector3D& pos3D) const
201 { return getWireLine().sagDistance(pos3D); }
202
204 Vector3D getClosest(const Vector3D& pos3D) const
205 { return getWireLine().sagClosest3D(pos3D); }
206
214 double getDriftLength(const Vector3D& pos3D) const
215 { return isInCell(pos3D) ? getDistance(pos3D) : NAN; }
216
222 const Vector3D& getRefPos3D() const
223 { return getWireLine().refPos3D(); }
224
229 const Vector2D& getRefPos2D() const
230 { return getWireLine().refPos2D(); }
231
236 double getRefZ() const
237 { return getWireLine().refZ(); }
238
240 double getTanStereoAngle() const
241 { return getWireLine().tanTheta(); }
242
244 double getStereoAngle() const
245 { return getWireLine().theta(); }
246
249 { return getWireLine().wireVector(); }
250
253 { return getWireLine().nominalMovePerZ(); }
254
256 Vector2D getMovePerZAtZ(double z) const
257 { return getWireLine().sagMovePerZ(z); }
258
260 double getRefCylindricalR() const
261 { return m_refCylindricalR; }
262
264 double getMinCylindricalR() const
265 { return getWireLine().nominalPerigee2D().norm(); }
266
269 { return getWireLine().forwardCylindricalR(); };
270
273 { return getWireLine().forwardCylindricalR(); };
274
276 double getForwardZ() const
277 { return getWireLine().forwardZ(); }
278
280 double getBackwardZ() const
281 { return getWireLine().backwardZ(); }
282
285 { return getWireLine().forward3D(); }
286
289 { return getWireLine().backward3D(); }
290
292 bool isInCell(const Vector3D& pos3D) const;
293
295 bool isInCellZBounds(const Vector3D& pos3D, const double factor = 1) const
296 { return getBackwardZ() * factor < pos3D.z() and pos3D.z() < getForwardZ() * factor; }
297
299 double getRadialCellWidth() const;
300
302 double getLateralCellWidth() const;
311 const CDCWireLayer& getWireLayer() const;
312
315
327 WireNeighborKind getNeighborKind(const CDCWire& wire) const;
328
330 bool isPrimaryNeighborWith(const CDCWire& wire) const;
331
341
351
358 MayBePtr<const CDCWire> getNeighborCCW() const;
359
366 MayBePtr<const CDCWire> getNeighborCW() const;
367
374 MayBePtr<const CDCWire> getNeighborCCWInwards() const;
375
382 MayBePtr<const CDCWire> getNeighborCWInwards() const;
383
390 MayBePtr<const CDCWire> getNeighborCCWOutwards() const;
391
398 MayBePtr<const CDCWire> getNeighborCWOutwards() const;
402 MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection) const;
403
405 friend std::ostream& operator<<(std::ostream& output, const CDCWire& wire)
406 { return (output << "CDCWire(" << wire.getISuperLayer() << "," << wire.getILayer() << "," << wire.getIWire() << ")") ; }
407
408 private:
411
414
417
418 };
419 }
421}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Class representating a sense wire layer in the central drift chamber.
Definition: CDCWireLayer.h:42
Class representating a sense wire superlayer in the central drift chamber.
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
double getRefCylindricalR() const
Getter for the cylindrical radius at the wire reference position.
Definition: CDCWire.h:260
void operator=(const CDCWire &wire)=delete
Disallow copy assignment of wires.
double getStereoAngle() const
Getter for the stereo angle of the wire.
Definition: CDCWire.h:244
ISuperLayer getISuperLayer() const
Gives the superlayer id ranging from 0 - 8.
Definition: CDCWire.h:163
CDCWire(const CDCWire &wire)=delete
Disallow copy construction of wires.
MayBePtr< const CDCWire > getNeighborCWOutwards() const
Gives the closest neighbor in the clockwise outwards direction This does not cross superlayer boundar...
Definition: CDCWire.cc:184
WireNeighborKind getNeighborKind(const CDCWire &wire) const
Returns gives the kind of neighborhood relation from this wire to the given wire.
Definition: CDCWire.cc:139
bool isInCell(const Vector3D &pos3D) const
Checks whether the position is in the drift cell surrounding the wire.
Definition: CDCWire.cc:96
double getBackwardCylindricalR() const
Getter for the distance to the beamline ( z-axes ) at the backward joint point.
Definition: CDCWire.h:272
WireLine m_wireLine
The line representation of the wire.
Definition: CDCWire.h:413
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:214
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:295
const WireID & getWireID() const
Getter for the wire id.
Definition: CDCWire.h:122
bool isAxial() const
Indicates if the wire is axial or stereo.
Definition: CDCWire.h:174
MayBePtr< const CDCWire > getNeighborCCWOutwards() const
Gives the closest neighbor in the countclockwise outwards direction This does not cross superlayer bo...
Definition: CDCWire.cc:179
Vector3D getWirePos3DAtZ(const double z) const
Gives position of the wire at the given z coordinate.
Definition: CDCWire.h:196
double getForwardCylindricalR() const
Getter for the nominal distance to the beamline ( z-axes ) at the forward joint point.
Definition: CDCWire.h:268
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition: CDCWire.h:192
Vector3D getClosest(const Vector3D &pos3D) const
Calculates the closest approach in the wire to the position.
Definition: CDCWire.h:204
MayBePtr< const CDCWire > getNeighborCCW() const
Gives the closest neighbor in the counterclockwise direction - always exists.
Definition: CDCWire.cc:159
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:189
bool operator==(const CDCWire &other) const
Equality comparision based on wireID.
Definition: CDCWire.h:94
double getForwardZ() const
Getter for the z coordinate at the forward joint points of the wires.
Definition: CDCWire.h:276
WireNeighborPair getNeighborsOutwards() const
Gives the two wires in the next layer outward.
Definition: CDCWire.cc:154
Vector2D getMovePerZ() const
Getter for the vector describing the nominal positional change in the xy plane per unit z.
Definition: CDCWire.h:252
IWire getIWire() const
Getter for the wire id within its layer.
Definition: CDCWire.h:146
bool isPrimaryNeighborWith(const CDCWire &wire) const
Returns whether the give wire is a neighbor of this wire.
Definition: CDCWire.cc:144
void initialize(EWirePosition wirePosition, bool ignoreWireSag)
(Re)load all geometry parameters form the CDCGeometryPar to adjust to changes in geometry.
Definition: CDCWire.cc:69
unsigned short getEWire() const
Getter for the encoded wire number.
Definition: CDCWire.h:131
Vector3D getForwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition: CDCWire.h:284
static const CDCWire * getInstance(const WireID &wireID)
Getter from the wireID convinience object. Does not construct a new object.
Definition: CDCWire.cc:24
ILayer getICLayer() const
Getter for the continious layer id ranging from 0 - 55.
Definition: CDCWire.h:150
const Vector3D & getRefPos3D() const
Getter for the wire reference position.
Definition: CDCWire.h:222
ILayer getILayer() const
Getter for the layer id within its superlayer Gives the layer id within its superlayer ranging from ...
Definition: CDCWire.h:159
WireID m_wireID
The wireID of the wire.
Definition: CDCWire.h:410
Vector3D getWireVector() const
Getter for the vector pointing from the back end ofthe wire to the front end of the wire.
Definition: CDCWire.h:248
MayBePtr< const CDCWire > getNeighborCWInwards() const
Gives the closest neighbor in the clockwise inwards direction This does not cross superlayer boundari...
Definition: CDCWire.cc:174
MayBePtr< const CDCWire > getNeighborCW() const
Gives the closest neighbor in the clockwise direction - always exists.
Definition: CDCWire.cc:164
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:229
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:256
double getDistance(const Vector3D &pos3D) const
Calculates the distance from the position to the wire.
Definition: CDCWire.h:200
const CDCWireLayer & getWireLayer() const
Getter for the wire layer.
Definition: CDCWire.cc:127
double getLateralCellWidth() const
Getter for the cell widths in lateral direction.
Definition: CDCWire.cc:122
double getTanStereoAngle() const
Getter for the tangents of the stereo angle of the wire.
Definition: CDCWire.h:240
friend std::ostream & operator<<(std::ostream &output, const CDCWire &wire)
Sting output operator for wire objects to help debugging.
Definition: CDCWire.h:405
MayBePtr< const CDCWire > getNeighborCCWInwards() const
Gives the closest neighbor in the countclockwise inwards direction This does not cross superlayer bou...
Definition: CDCWire.cc:169
EStereoKind getStereoKind() const
Getter for the stereo type of the wire.
Definition: CDCWire.h:184
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition: CDCWire.h:236
double m_refCylindricalR
Precomputed distance to the beam line at the reference position.
Definition: CDCWire.h:416
WireNeighborPair getNeighborsInwards() const
Gives the two wires in the next layer inward.
Definition: CDCWire.cc:149
Vector3D getBackwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition: CDCWire.h:288
double getMinCylindricalR() const
Getter for the closest distance to the beamline ( z-axes )
Definition: CDCWire.h:264
CDCWire(CDCWire &&wire)=default
Allow move construction of wires for use in std::vector.
const CDCWireSuperLayer & getWireSuperLayer() const
Getter for the wire super layer.
Definition: CDCWire.cc:133
double getBackwardZ() const
Getter for the z coordinate at the backward joint points of the wires.
Definition: CDCWire.h:280
double getRadialCellWidth() const
Getter for the cell widths in radial direction.
Definition: CDCWire.cc:117
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:105
const WireLine & getWireLine() const
Getter for the wire line represenation of the wire.
Definition: CDCWire.h:188
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175
A three dimensional vector.
Definition: Vector3D.h:33
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:31
const Vector3D & refPos3D() const
Returns the reference position.
Definition: WireLine.h:227
const Vector2D & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition: WireLine.h:71
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:75
const Vector2D & refPos2D() const
Returns the xy vector of the reference position.
Definition: WireLine.h:223
double backwardZ() const
Gives the backward z coodinate.
Definition: WireLine.h:134
double refZ() const
Returns the the z coordinate of the reference point.
Definition: WireLine.h:215
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:187
double forwardZ() const
Gives the forward z coodinate.
Definition: WireLine.h:130
Vector2D nominalPerigee2D() const
Returns the point of nominal closest approach to the z axes.
Definition: WireLine.h:203
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:56
Vector3D sagClosest3D(const Vector3D &point) const
Returns the closest approach on the wire with wire sag effect to the give point.
Definition: WireLine.h:102
Vector3D backward3D() const
Gives the position of the backward point.
Definition: WireLine.h:118
double forwardCylindricalR() const
Gives the cylindrical radius of the forward position.
Definition: WireLine.h:154
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:60
double sagDistance(const Vector3D &pos3D) const
Calculates the distance of the given point to the wire with wire sag effect.
Definition: WireLine.h:90
Vector3D wireVector() const
Getter for the vector from backward to the forward position.
Definition: WireLine.h:126
Vector3D forward3D() const
Gives the position of the forward point.
Definition: WireLine.h:110
double theta() const
Returns the nominal opening angle between tangential vector and the z axes.
Definition: WireLine.h:191
Type for the neighbor relationship from one wire to another.
Class representing a pair of neighbors in the CDC in a single layer For certain circumstances it is a...
Class to identify a wire inside the CDC.
Definition: WireID.h:34
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:24
unsigned short getIWire() const
Getter for wire within the layer.
Definition: WireID.h:145
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
Abstract base class for different kinds of events.
static EStereoKind getStereoKind(ISuperLayer iSuperLayer)
Returns the stereo kind of the super layer.
Definition: ISuperLayer.cc:26