Belle II Software  release-08-01-10
CDCWireLayer.cc
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 
9 #include <tracking/trackFindingCDC/topology/CDCWireLayer.h>
10 #include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
11 #include <cdc/geometry/CDCGeometryPar.h>
12 
13 using namespace Belle2;
14 using namespace TrackFindingCDC;
15 
17  : Super(wireRange)
18 {
19  initialize();
20 }
21 
23 {
24  return &(CDCWireTopology::getInstance().getWireLayer(iCLayer));
25 }
26 
27 const CDCWireLayer* CDCWireLayer::getInstance(ISuperLayer iSuperLayer, ILayer iLayer)
28 {
29  return &(CDCWireTopology::getInstance().getWireLayer(iSuperLayer, iLayer));
30 }
31 
33 {
34  size_t nWiresInLayer = size();
35  ILayer iCLayer = getICLayer();
36 
37  // values from CDCGeometryPar
39 
40  const double* innerRadiusWireLayer = cdcgp.innerRadiusWireLayer();
41  const double* outerRadiusWireLayer = cdcgp.outerRadiusWireLayer();
42 
43  m_innerCylindricalR = innerRadiusWireLayer[iCLayer];
44  m_outerCylindricalR = outerRadiusWireLayer[iCLayer];
45 
48 
49  // average values from wires
50  m_tanStereoAngle = 0.0;
51  m_minCylindricalR = 1000000.0;
52  m_refZ = 0.0;
53  m_refCylindricalR = 0.0;
56  m_forwardZ = 0.0;
57  m_backwardZ = 0.0;
58 
59  for (const CDCWire& wire : *this) {
61 
62  double minROfWire = wire.getMinCylindricalR();
63  m_minCylindricalR = std::min(minROfWire, m_minCylindricalR);
64 
65  m_refZ += wire.getRefZ();
67 
68  // calculate the forward nad backward r in the xy projection. take the average
71 
72  // calculate the forward and backward z position. take the average of all wires
73  m_forwardZ += wire.getForwardZ();
74  m_backwardZ += wire.getBackwardZ();
75  }
76 
77  m_tanStereoAngle /= nWiresInLayer;
78 
79  m_refZ /= nWiresInLayer;
80  m_refCylindricalR /= nWiresInLayer;
81 
82  m_forwardCylindricalR /= nWiresInLayer;
83  m_backwardCylindricalR /= nWiresInLayer;
84 
85  m_forwardZ /= nWiresInLayer;
86  m_backwardZ /= nWiresInLayer;
87 }
88 
89 const CDCWire& CDCWireLayer::getClosestWire(const Vector3D& pos3D) const
90 {
91  IWire iWire = CDC::CDCGeometryPar::Instance().cellId(getICLayer(), pos3D);
92  // Safety measure against error in the cellId function
93  iWire %= size();
94  return getWire(iWire);
95 }
The Class for CDC Geometry Parameters.
unsigned cellId(unsigned layerId, const B2Vector3D &position) const
The method to get cell id based on given layer id and the position.
const double * innerRadiusWireLayer() const
Returns an array of inner radius of wire layers.
signed short getShiftInSuperLayer(unsigned short iSuperLayer, unsigned short iLayer) const
Returns shift in the super-layer.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
const double * outerRadiusWireLayer() const
Returns an array of outer radius of wire layers.
Class representating a sense wire layer in the central drift chamber.
Definition: CDCWireLayer.h:42
const CDCWire & getClosestWire(const Vector3D &pos3D) const
Gets the wire in this layer that is closest to the given position.
Definition: CDCWireLayer.cc:89
ERotation m_shift
Indicates if this layer is shifted clockwise or counterclockwise.
Definition: CDCWireLayer.h:275
double m_refZ
Storage for common (averaged) z coordinate of all wire reference positions.
Definition: CDCWireLayer.h:294
double m_backwardZ
Storage for z position of backward wire ends.
Definition: CDCWireLayer.h:306
void initialize()
Intializes the wire layer variables to the average of according variables in the wire range.
Definition: CDCWireLayer.cc:32
ISuperLayer getISuperLayer() const
Getter for the super layer id.
Definition: CDCWireLayer.h:96
static const CDCWireLayer * getInstance(ILayer iCLayer)
Getter from the the continuous layer id. Does not construct a new object.
Definition: CDCWireLayer.cc:22
double m_backwardCylindricalR
Storage for average distance from beamline of backward wire ends.
Definition: CDCWireLayer.h:300
double m_innerCylindricalR
Storage of the inner radius of the wire layer as taken from the CDCGeometryPar instance.
Definition: CDCWireLayer.h:317
CDCWireLayer(const ConstVectorRange< CDCWire > &wireRange)
Constructor taking the range of wires the layer shall contain.
Definition: CDCWireLayer.cc:16
ILayer getICLayer() const
Getter for the continuous layer id unique over all layers.
Definition: CDCWireLayer.h:88
ILayer getILayer() const
Getter for the layer id unique within the superlayer.
Definition: CDCWireLayer.h:92
double m_forwardZ
Storage for z position of forward wire ends.
Definition: CDCWireLayer.h:303
const CDCWire & getWire(IWire iWire) const
Gives the wire by its id in the layer.
Definition: CDCWireLayer.h:138
double m_minCylindricalR
Storage for minimal distance from beamline.
Definition: CDCWireLayer.h:288
double m_tanStereoAngle
Storage for average tan stereo angle.
Definition: CDCWireLayer.h:285
double m_refCylindricalR
Storage for common (averaged) cylindrical radius of all wire reference positions.
Definition: CDCWireLayer.h:291
double m_outerCylindricalR
Storage of the outer radius of the wire layer as taken from the CDCGeometryPar instance.
Definition: CDCWireLayer.h:320
double m_forwardCylindricalR
Storage for average distance from beamline of forward wire ends.
Definition: CDCWireLayer.h:297
const CDCWireLayer & getWireLayer(const WireID &wireId) const
Getter for wire layer getter by wireID object.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
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
double getBackwardCylindricalR() const
Getter for the distance to the beamline ( z-axes ) at the backward joint point.
Definition: CDCWire.h:272
double getForwardCylindricalR() const
Getter for the nominal distance to the beamline ( z-axes ) at the forward joint point.
Definition: CDCWire.h:268
double getForwardZ() const
Getter for the z coordinate at the forward joint points of the wires.
Definition: CDCWire.h:276
double getTanStereoAngle() const
Getter for the tangents of the stereo angle of the wire.
Definition: CDCWire.h:240
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition: CDCWire.h:236
double getMinCylindricalR() const
Getter for the closest distance to the beamline ( z-axes )
Definition: CDCWire.h:264
double getBackwardZ() const
Getter for the z coordinate at the backward joint points of the wires.
Definition: CDCWire.h:280
A pair of iterators usable with the range base for loop.
Definition: Range.h:25
std::size_t size() const
Returns the total number of objects in this range.
Definition: Range.h:76
A three dimensional vector.
Definition: Vector3D.h:33
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: ERotation.h:25
Abstract base class for different kinds of events.