Belle II Software development
WireNeighborKind.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/numerics/Modulo.h>
11#include <tracking/trackFindingCDC/numerics/ESign.h>
12
13namespace Belle2 {
19 namespace TrackFindingCDC {
20
26
27 public:
29 WireNeighborKind() = default;
30
32 WireNeighborKind(short cellDistance, short oClockDirection)
33 : m_cellDistance(cellDistance)
34 , m_oClockDirection(moduloFast(oClockDirection, 12))
35 {}
36
38 short getILayerDifference() const
39 {
41 }
42
45 {
46 short slope = abs(symmetricModuloFast(getOClockDirection() + 3, 6));
47 short iAbsLayerDifference = slope * getCellDistance() / 2;
48 if (iAbsLayerDifference > 2) iAbsLayerDifference = 2;
49 return iAbsLayerDifference;
50 }
51
54 {
55 return sign(symmetricModuloFast(getOClockDirection() + 3, 12));
56 }
57
62 short getCellDistance() const
63 { return m_cellDistance; }
64
66 short getOClockDirection() const
67 { return m_oClockDirection; }
68
70 bool isValid() const
71 {
72 return
73 m_cellDistance >= 1 and
74 m_cellDistance <= 2 and
75 m_oClockDirection >= 0 and
77 }
78
79 private:
81 short m_cellDistance = 0;
82
85
86 };
87
88 }
90}
Type for the neighbor relationship from one wire to another.
bool isValid() const
Check if the neighbor kind is in principle valid.
short getAbsILayerDifference() const
Calculate the absolute distance between the current and the layer of the designated neighbor.
short getOClockDirection() const
Get the direction on the clock to follow to reach the neighbor.
short getILayerDifferenceSign() const
Calculate if the designated neighbor is more outside.
WireNeighborKind()=default
Default constructor - constructs an invalid neighbor kind.
short getILayerDifference() const
Calculate the distance between the current and the layer of the designated neighbor.
short m_oClockDirection
Memory for the direction the neighbor is located. Range 1 - 12 imaged on a regular clock.
WireNeighborKind(short cellDistance, short oClockDirection)
Useful constructor from cell distance and direction to reach the designated neighbor.
short m_cellDistance
Memory for the distance between to wires counted in numbers of cells.
short getCellDistance() const
Get the distance to the wire neighbor counted in number of cells.
Abstract base class for different kinds of events.