8#include <gtest/gtest.h>
9#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
11#include <tracking/trackFindingCDC/eventdata/trajectories/CDCBFieldUtil.h>
12#include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithTopology.h>
13#include <cdc/geometry/CDCGeometryPar.h>
14#include <framework/logging/Logger.h>
17using namespace TrackFindingCDC;
20 public ::testing::WithParamInterface<int> {
26 short oClockDirection = testNeighborKind.getOClockDirection();
27 short reverseOClockDirection = modulo(testNeighborKind.getOClockDirection() + 6, 12);
32 MayBePtr<const CDCWire> neighbor = wire.getSecondaryNeighbor(oClockDirection);
33 if (neighbor !=
nullptr) {
34 MayBePtr<const CDCWire> neighbor_of_neighbor =
35 neighbor->getSecondaryNeighbor(reverseOClockDirection);
37 EXPECT_EQ(*neighbor_of_neighbor, wire);
40 EXPECT_TRUE(neighborKind.
isValid());
41 EXPECT_EQ(testNeighborKind.getCellDistance(), neighborKind.
getCellDistance());
48INSTANTIATE_TEST_SUITE_P(SecondaryWireNeighborhoodTest_IsSymmetric,
50 ::testing::Range(0, 12));
59 MayBePtr<const CDCWire> neighbor = wire.getNeighborCWInwards();
60 if (neighbor !=
nullptr) {
61 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCCWOutwards();
62 EXPECT_EQ(*neighbor_of_neighbor, wire);
78 MayBePtr<const CDCWire> neighbor = wire.getNeighborCCWInwards();
79 if (neighbor !=
nullptr) {
80 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCWOutwards();
81 EXPECT_EQ(*neighbor_of_neighbor, wire);
97 MayBePtr<const CDCWire> neighbor = wire.getNeighborCWOutwards();
98 if (neighbor !=
nullptr) {
99 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCCWInwards();
100 EXPECT_EQ(*neighbor_of_neighbor, wire);
116 MayBePtr<const CDCWire> neighbor = wire.getNeighborCCWOutwards();
117 if (neighbor !=
nullptr) {
118 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCWInwards();
119 EXPECT_EQ(*neighbor_of_neighbor, wire);
135 MayBePtr<const CDCWire> neighbor = wire.getNeighborCCW();
136 if (neighbor !=
nullptr) {
137 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCW();
138 EXPECT_EQ(*neighbor_of_neighbor, wire);
154 MayBePtr<const CDCWire> neighbor = wire.getNeighborCW();
155 if (neighbor !=
nullptr) {
156 MayBePtr<const CDCWire> neighbor_of_neighbor = neighbor->getNeighborCCW();
157 EXPECT_EQ(*neighbor_of_neighbor, wire);
177 const ILayer iCLayer = wireLayer.getICLayer();
179 const CDCWire& firstWire = wireLayer.front();
184 for (
const CDCWire& wire : wireLayer) {
188 EXPECT_NEAR(tanThetaByICLayer[iCLayer], wire.getTanStereoAngle(), 10e-2);
189 EXPECT_NEAR(stereoAngleByICLayer[iCLayer], wire.getStereoAngle(), 10e-2);
190 EXPECT_NEAR(refCylindricalRByICLayer[iCLayer], wire.getRefCylindricalR(), 10e-2);
193 B2INFO(
"ICLayer : " << iCLayer);
194 B2INFO(
" Tan Theta : " << tanThetaByICLayer[iCLayer]);
195 B2INFO(
" Stereo angle : " << stereoAngleByICLayer[iCLayer]);
196 B2INFO(
" Z range : " << wireLayer.getBackwardZ() <<
" to " << wireLayer.getForwardZ());
197 B2INFO(
" Ref. cylindricalR : " << refCylindricalRByICLayer[iCLayer]);
198 B2INFO(
" Max abs displacement : " << wireLayer.getWire(0).getWireVector().xy().norm());
209 if (wireSuperLayer.getStereoKind() == EStereoKind::c_Axial) {
210 EXPECT_EQ(0.0, wireSuperLayer.getRefTanLambda());
213 B2INFO(
"ISuperLayer : " << wireSuperLayer.getISuperLayer() <<
214 " Inner ref. z : " << wireSuperLayer.getInnerRefZ() <<
215 " Outer ref. z : " << wireSuperLayer.getOuterRefZ() <<
216 " CylindricalR Z slope : " << wireSuperLayer.getRefTanLambda()
229 double innerOriginCurv = 1 / (innerR / 2);
230 double outerOriginCurv = 1 / (outerR / 2);
232 double innerCurlCurv = 1 / innerR;
233 double outerCurlCurv = 1 / outerR;
235 B2INFO(
"Maximal curvature still reaching the CDC from IP : " << innerOriginCurv);
238 B2INFO(
"Maximal curvature still leaving the CDC from IP : " << outerOriginCurv);
242 B2INFO(
"Minimal curvature not reaching the CDC from VXD : " << innerCurlCurv);
245 B2INFO(
"Minimal curvature not leaving the CDC from inside the CDC : " << outerCurlCurv);
250 double innerSLCurv = 1 / wireSuperLayer.getInnerCylindricalR();
251 B2INFO(
"Maximal curvature still reaching SL " << wireSuperLayer.getISuperLayer() <<
" from IP : " << innerSLCurv);
252 B2INFO(
"Minimal momentum still reaching SL " << wireSuperLayer.getISuperLayer() <<
" from IP : " <<
263 B2INFO(
"Layer " << iL <<
":");
264 B2INFO(
"z in " << wireLayer.getForwardZ() <<
", " << wireLayer.getBackwardZ());
265 B2INFO(
"r in " << wireLayer.getInnerCylindricalR() <<
", " << wireLayer.getOuterCylindricalR());
273 unsigned iCLayer = 4;
279 EXPECT_TRUE(iWireInFourthLayer < 160);
280 EXPECT_LT(iWireInFourthLayer, 160);
287 const WireLine& wireLine = wire.getWireLine();
288 const double forwardZ = wireLine.
forwardZ();
289 const double backwardZ = wireLine.
backwardZ();
290 const double centerZ = (forwardZ + backwardZ) / 2;
unsigned cellId(unsigned layerId, const B2Vector3D &position) const
The method to get cell id based on given layer id and the position.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
static double curvatureToAbsMom2D(double curvature, double bZ)
Conversion helper for two dimensional curvature to momenta.
Class representing a sense wire layer in the central drift chamber.
Class representing a sense wire superlayer in the central drift chamber.
Class representing the sense wire arrangement in the whole of the central drift chamber.
static const ILayer c_NLayers
Total number of layers.
const std::vector< Belle2::TrackFindingCDC::CDCWireSuperLayer > & getWireSuperLayers() const
Getter for the underlying storing superlayer vector.
double getInnerCylindricalR() const
Getter for the inner radius of the inner most wire layer.
const std::vector< Belle2::TrackFindingCDC::CDCWire > & getWires() const
Getter for the underlying storing wire vector.
const std::vector< Belle2::TrackFindingCDC::CDCWireLayer > & getWireLayers() const
Getter for the underlying storing layer vector.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
double getOuterCylindricalR() const
Getter for the outer radius of the outer most wire layer.
Class representing a sense wire in the central drift chamber.
double getRefCylindricalR() const
Getter for the cylindrical radius at the wire reference position.
double getStereoAngle() const
Getter for the stereo angle of the wire.
double getTanStereoAngle() const
Getter for the tangents of the stereo angle of the wire.
This class provides the declaration of the common test fixture to all test of the track finding in th...
double y() const
Getter for the y coordinate.
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
const Vector2D & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Vector2D sagMovePerZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
double backwardZ() const
Gives the backward z coordinate.
double forwardZ() const
Gives the forward z coordinate.
double sagCoeff() const
Returns the wire sag coefficient due to gravity.
Vector2D sagPos2DAtZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Vector2D nominalPos2DAtZ(const double z) const
Gives the two dimensional position without wire sag effect of the line at the given z value.
Type for the neighbor relationship from one wire to another.
bool isValid() const
Check if the neighbor kind is in principle valid.
short getOClockDirection() const
Get the direction on the clock to follow to reach the neighbor.
short getILayerDifference() const
Calculate the distance between the current and the layer of the designated neighbor.
short getCellDistance() const
Get the distance to the wire neighbor counted in number of cells.
Abstract base class for different kinds of events.