Belle II Software  release-05-01-25
WireNeighborKind.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/numerics/Modulo.h>
13 #include <tracking/trackFindingCDC/numerics/ESign.h>
14 
15 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
27  class WireNeighborKind {
28 
29  public:
31  WireNeighborKind() = default;
32 
34  WireNeighborKind(short cellDistance, short oClockDirection)
35  : m_cellDistance(cellDistance)
36  , m_oClockDirection(moduloFast(oClockDirection, 12))
37  {}
38 
40  short getILayerDifference() const
41  {
43  }
44 
46  short getAbsILayerDifference() const
47  {
48  short slope = abs(symmetricModuloFast(getOClockDirection() + 3, 6));
49  short iAbsLayerDifference = slope * getCellDistance() / 2;
50  if (iAbsLayerDifference > 2) iAbsLayerDifference = 2;
51  return iAbsLayerDifference;
52  }
53 
55  short getILayerDifferenceSign() const
56  {
57  return sign(symmetricModuloFast(getOClockDirection() + 3, 12));
58  }
59 
64  short getCellDistance() const
65  { return m_cellDistance; }
66 
68  short getOClockDirection() const
69  { return m_oClockDirection; }
70 
72  bool isValid() const
73  {
74  return
75  m_cellDistance >= 1 and
76  m_cellDistance <= 2 and
77  m_oClockDirection >= 0 and
78  m_oClockDirection < 12;
79  }
80 
81  private:
83  short m_cellDistance = 0;
84 
86  short m_oClockDirection = 0;
87 
88  };
89 
90  }
92 }
Belle2::TrackFindingCDC::WireNeighborKind::getCellDistance
short getCellDistance() const
Get the distance to the wire neighbor counted in number of cells.
Definition: WireNeighborKind.h:72
Belle2::TrackFindingCDC::WireNeighborKind::isValid
bool isValid() const
Check if the neighbor kind is in principle valid.
Definition: WireNeighborKind.h:80
Belle2::TrackFindingCDC::WireNeighborKind::getILayerDifferenceSign
short getILayerDifferenceSign() const
Calculate if the designated neighbor is more outside.
Definition: WireNeighborKind.h:63
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::WireNeighborKind::getOClockDirection
short getOClockDirection() const
Get the direction on the clock to follow to reach the neighbor.
Definition: WireNeighborKind.h:76
Belle2::TrackFindingCDC::WireNeighborKind::m_cellDistance
short m_cellDistance
Memory for the distance between to wires counted in numbers of cells.
Definition: WireNeighborKind.h:91
Belle2::TrackFindingCDC::WireNeighborKind::getAbsILayerDifference
short getAbsILayerDifference() const
Calculate the absolute distance between the current and the layer of the designated neighbor.
Definition: WireNeighborKind.h:54
Belle2::TrackFindingCDC::WireNeighborKind::getILayerDifference
short getILayerDifference() const
Calculate the distance between the current and the layer of the designated neighbor.
Definition: WireNeighborKind.h:48
Belle2::TrackFindingCDC::WireNeighborKind::WireNeighborKind
WireNeighborKind()=default
Default constructor - constructs an invalid neighbor kind.
Belle2::TrackFindingCDC::WireNeighborKind::m_oClockDirection
short m_oClockDirection
Memory for the direction the neighbor is located. Range 1 - 12 imaged on a regular clock.
Definition: WireNeighborKind.h:94