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 <cdc/topology/WireNeighborPair.h>
11#include <cdc/topology/WireLine.h>
12
13#include <cdc/topology/ISuperLayer.h>
14#include <cdc/topology/ILayer.h>
15#include <cdc/topology/IWire.h>
16
17#include <cdc/topology/WireNeighborKind.h>
18#include <cdc/topology/EStereoKind.h>
19#include <cdc/topology/EWirePosition.h>
20
21#include <tracking/trackingUtilities/utilities/MayBePtr.h>
22
23#include <cdc/dataobjects/WireID.h>
24
25#include <Math/Vector2D.h>
26#include <Math/Vector3D.h>
27
28#include <iostream>
29
30
31namespace Belle2 {
36 class CDCHit;
37 namespace CDC {
38 // Forward declarations
39 class CDCWireLayer;
41
50 class CDCWire {
51
52 public:
58
60 static const CDCWire* getInstance(const WireID& wireID);
61
63 static const CDCWire* getInstance(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
64
66 static const CDCWire* getInstance(const CDCHit& hit);
68
70 explicit CDCWire(const WireID& wireID);
71
73 CDCWire(ISuperLayer iSuperLayer, ILayer iLayer, IWire iWire);
74
76 CDCWire(const CDCWire& wire) = delete;
77
79 CDCWire(CDCWire&& wire) = default;
80
82 void operator=(const CDCWire& wire) = delete;
83
84 public:
86 bool operator==(const CDCWire& other) const
87 { return getWireID() == other.getWireID(); }
88
97 bool operator<(const CDCWire& other) const
98 { return getWireID() < other.getWireID(); }
99
100 public:
102 void initialize(EWirePosition wirePosition, bool ignoreWireSag);
103
108
110 operator const Belle2::WireID& () const
111 { return getWireID(); }
112
114 const WireID& getWireID() const
115 { return m_wireID; }
116
123 unsigned short getEWire() const
124 { return getWireID().getEWire(); }
125
139 { return getWireID().getIWire(); }
140
143 { return getWireID().getICLayer(); }
144
152 { return getWireID().getILayer(); }
153
157
158
164
166 bool isAxial() const
167 { return getStereoKind() == EStereoKind::c_Axial; }
168
178
180 const WireLine& getWireLine() const
181 { return m_wireLine; }
182
184 ROOT::Math::XYVector getWirePos2DAtZ(const double z) const
185 { return getWireLine().sagPos2DAtZ(z); }
186
188 ROOT::Math::XYZVector getWirePos3DAtZ(const double z) const
189 { return getWireLine().sagPos3DAtZ(z); }
190
192 double getDistance(const ROOT::Math::XYZVector& pos3D) const
193 { return getWireLine().sagDistance(pos3D); }
194
196 ROOT::Math::XYZVector getClosest(const ROOT::Math::XYZVector& pos3D) const
197 { return getWireLine().sagClosest3D(pos3D); }
198
206 double getDriftLength(const ROOT::Math::XYZVector& pos3D) const
207 { return isInCell(pos3D) ? getDistance(pos3D) : NAN; }
208
214 const ROOT::Math::XYZVector& getRefPos3D() const
215 { return getWireLine().refPos3D(); }
216
221 const ROOT::Math::XYVector& getRefPos2D() const
222 { return getWireLine().refPos2D(); }
223
228 double getRefZ() const
229 { return getWireLine().refZ(); }
230
232 double getTanStereoAngle() const
233 { return getWireLine().tanTheta(); }
234
236 double getStereoAngle() const
237 { return getWireLine().theta(); }
238
240 ROOT::Math::XYZVector getWireVector() const
241 { return getWireLine().wireVector(); }
242
244 ROOT::Math::XYVector getMovePerZ() const
245 { return getWireLine().nominalMovePerZ(); }
246
248 ROOT::Math::XYVector getMovePerZAtZ(double z) const
249 { return getWireLine().sagMovePerZ(z); }
250
252 double getRefCylindricalR() const
253 { return m_refCylindricalR; }
254
256 double getMinCylindricalR() const
257 { return getWireLine().nominalPerigee2D().R(); }
258
261 { return getWireLine().forwardCylindricalR(); };
262
265 { return getWireLine().forwardCylindricalR(); };
266
268 double getForwardZ() const
269 { return getWireLine().forwardZ(); }
270
272 double getBackwardZ() const
273 { return getWireLine().backwardZ(); }
274
276 ROOT::Math::XYZVector getForwardPos3D() const
277 { return getWireLine().forward3D(); }
278
280 ROOT::Math::XYZVector getBackwardPos3D() const
281 { return getWireLine().backward3D(); }
282
284 bool isInCell(const ROOT::Math::XYZVector& pos3D) const;
285
287 bool isInCellZBounds(const ROOT::Math::XYZVector& pos3D, const double factor = 1) const
288 { return getBackwardZ() * factor < pos3D.z() and pos3D.z() < getForwardZ() * factor; }
289
291 double getRadialCellWidth() const;
292
294 double getLateralCellWidth() const;
296
297
301
303 const CDCWireLayer& getWireLayer() const;
304
307
314
319 WireNeighborKind getNeighborKind(const CDCWire& wire) const;
320
322 bool isPrimaryNeighborWith(const CDCWire& wire) const;
323
333
343
350 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCW() const;
351
358 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCW() const;
359
366 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCWInwards() const;
367
374 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCWInwards() const;
375
382 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCCWOutwards() const;
383
390 TrackingUtilities::MayBePtr<const CDCWire> getNeighborCWOutwards() const;
392
394 TrackingUtilities::MayBePtr<const CDCWire> getSecondaryNeighbor(short oClockDirection) const;
395
397 friend std::ostream& operator<<(std::ostream& output, const CDCWire& wire)
398 { return (output << "CDCWire(" << wire.getISuperLayer() << "," << wire.getILayer() << "," << wire.getIWire() << ")") ; }
399
400 private:
403
406
409
410 };
411 }
413}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition CDCHit.h:40
Class representing a sense wire layer in the central drift chamber.
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
double getRefCylindricalR() const
Getter for the cylindrical radius at the wire reference position.
Definition CDCWire.h:252
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:236
CDCWire(const WireID &wireID)
Constructor taking the combined wire id convenience object.
Definition CDCWire.cc:57
ISuperLayer getISuperLayer() const
Gives the superlayer id ranging from 0 - 8.
Definition CDCWire.h:155
CDCWire(const CDCWire &wire)=delete
Disallow copy construction of wires.
ROOT::Math::XYZVector getWireVector() const
Getter for the vector pointing from the back end of the wire to the front end of the wire.
Definition CDCWire.h:240
TrackingUtilities::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
double getBackwardCylindricalR() const
Getter for the distance to the beamline ( z-axes ) at the backward joint point.
Definition CDCWire.h:264
WireLine m_wireLine
The line representation of the wire.
Definition CDCWire.h:405
const ROOT::Math::XYVector & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition CDCWire.h:221
const WireID & getWireID() const
Getter for the wire id.
Definition CDCWire.h:114
bool isAxial() const
Indicates if the wire is axial or stereo.
Definition CDCWire.h:166
ROOT::Math::XYZVector getBackwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition CDCWire.h:280
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCCWOutwards() const
Gives the closest neighbor in the countclockwise outwards direction This does not cross superlayer bo...
Definition CDCWire.cc:179
ROOT::Math::XYVector getMovePerZ() const
Getter for the vector describing the nominal positional change in the xy plane per unit z.
Definition CDCWire.h:244
double getForwardCylindricalR() const
Getter for the nominal distance to the beamline ( z-axes ) at the forward joint point.
Definition CDCWire.h:260
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCCW() const
Gives the closest neighbor in the counterclockwise direction - always exists.
Definition CDCWire.cc:159
TrackingUtilities::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 comparison based on wireID.
Definition CDCWire.h:86
const ROOT::Math::XYZVector & getRefPos3D() const
Getter for the wire reference position.
Definition CDCWire.h:214
double getForwardZ() const
Getter for the z coordinate at the forward joint points of the wires.
Definition CDCWire.h:268
WireNeighborPair getNeighborsOutwards() const
Gives the two wires in the next layer outward.
Definition CDCWire.cc:154
IWire getIWire() const
Getter for the wire id within its layer.
Definition CDCWire.h:138
bool isPrimaryNeighborWith(const CDCWire &wire) const
Returns whether the give wire is a neighbor of this wire.
Definition CDCWire.cc:144
double getDistance(const ROOT::Math::XYZVector &pos3D) const
Calculates the distance from the position to the wire.
Definition CDCWire.h:192
void initialize(EWirePosition wirePosition, bool ignoreWireSag)
(Re)load all geometry parameters form the CDCGeometryPar to adjust to changes in geometry.
Definition CDCWire.cc:69
ROOT::Math::XYVector getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition CDCWire.h:184
ROOT::Math::XYZVector getWirePos3DAtZ(const double z) const
Gives position of the wire at the given z coordinate.
Definition CDCWire.h:188
double getDriftLength(const ROOT::Math::XYZVector &pos3D) const
Calculates the straight drift length from the position to the wire This is essentially the same as th...
Definition CDCWire.h:206
unsigned short getEWire() const
Getter for the encoded wire number.
Definition CDCWire.h:123
static const CDCWire * getInstance(const WireID &wireID)
Getter from the wireID convenience object. Does not construct a new object.
Definition CDCWire.cc:24
ILayer getICLayer() const
Getter for the continuous layer id ranging from 0 - 55.
Definition CDCWire.h:142
ROOT::Math::XYVector 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:248
ILayer getILayer() const
Getter for the layer id within its superlayer Gives the layer id within its superlayer ranging from ...
Definition CDCWire.h:151
WireID m_wireID
The wireID of the wire.
Definition CDCWire.h:402
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCWInwards() const
Gives the closest neighbor in the clockwise inwards direction This does not cross superlayer boundari...
Definition CDCWire.cc:174
TrackingUtilities::MayBePtr< const CDCWire > getNeighborCW() const
Gives the closest neighbor in the clockwise direction - always exists.
Definition CDCWire.cc:164
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
bool isInCellZBounds(const ROOT::Math::XYZVector &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:287
double getTanStereoAngle() const
Getter for the tangents of the stereo angle of the wire.
Definition CDCWire.h:232
friend std::ostream & operator<<(std::ostream &output, const CDCWire &wire)
String output operator for wire objects to help debugging.
Definition CDCWire.h:397
TrackingUtilities::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:176
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition CDCWire.h:228
double m_refCylindricalR
Precomputed distance to the beam line at the reference position.
Definition CDCWire.h:408
WireNeighborPair getNeighborsInwards() const
Gives the two wires in the next layer inward.
Definition CDCWire.cc:149
bool isInCell(const ROOT::Math::XYZVector &pos3D) const
Checks whether the position is in the drift cell surrounding the wire.
Definition CDCWire.cc:96
ROOT::Math::XYZVector getForwardPos3D() const
Getter for the forward joint point of the wire with the wall.
Definition CDCWire.h:276
double getMinCylindricalR() const
Getter for the closest distance to the beamline ( z-axes )
Definition CDCWire.h:256
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:272
double getRadialCellWidth() const
Getter for the cell widths in radial direction.
Definition CDCWire.cc:117
ROOT::Math::XYZVector getClosest(const ROOT::Math::XYZVector &pos3D) const
Calculates the closest approach in the wire to the position.
Definition CDCWire.h:196
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:97
const WireLine & getWireLine() const
Getter for the wire line representation of the wire.
Definition CDCWire.h:180
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition WireLine.h:33
const ROOT::Math::XYVector & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition WireLine.h:79
ROOT::Math::XYZVector wireVector() const
Getter for the vector from backward to the forward position.
Definition WireLine.h:141
ROOT::Math::XYZVector backward3D() const
Gives the position of the backward point.
Definition WireLine.h:133
double sagDistance(const ROOT::Math::XYZVector &pos3D) const
Calculates the distance of the given point to the wire with wire sag effect.
Definition WireLine.h:100
ROOT::Math::XYVector 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:68
double backwardZ() const
Gives the backward z coordinate.
Definition WireLine.h:152
double refZ() const
Returns the the z coordinate of the reference point.
Definition WireLine.h:233
ROOT::Math::XYZVector forward3D() const
Gives the position of the forward point.
Definition WireLine.h:125
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:205
ROOT::Math::XYZVector 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:61
double forwardZ() const
Gives the forward z coordinate.
Definition WireLine.h:148
ROOT::Math::XYVector 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:83
double forwardCylindricalR() const
Gives the cylindrical radius of the forward position.
Definition WireLine.h:172
const ROOT::Math::XYVector & refPos2D() const
Returns the xy vector of the reference position.
Definition WireLine.h:241
const ROOT::Math::XYZVector & refPos3D() const
Returns the reference position.
Definition WireLine.h:245
ROOT::Math::XYZVector sagClosest3D(const ROOT::Math::XYZVector &point) const
Returns the closest approach on the wire with wire sag effect to the give point.
Definition WireLine.h:116
double theta() const
Returns the nominal opening angle between tangential vector and the z axes.
Definition WireLine.h:209
ROOT::Math::XYVector nominalPerigee2D() const
Returns the point of nominal closest approach to the z axes.
Definition WireLine.h:221
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
signed short IWire
The type of the wire ids enumerating wires within a given layer.
Definition IWire.h:20
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
@ c_Axial
Constant for an axial wire.
Definition EStereoKind.h:22
CDCGeometryPar::EWirePosition EWirePosition
For ease-of-use just create a new alias for CDCGeometryPar::EWirePosition.
signed short ISuperLayer
The type of the layer and superlayer ids.
Definition ISuperLayer.h:24
Abstract base class for different kinds of events.
static EStereoKind getStereoKind(ISuperLayer iSuperLayer)
Returns the stereo kind of the super layer.