Belle II Software  release-05-01-25
CDCRLWireHitTriple.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - 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 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHitTriple.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
13 #include <tracking/trackFindingCDC/topology/CDCWire.h>
14 #include <tracking/trackFindingCDC/topology/WireNeighborKind.h>
15 #include <tracking/trackFindingCDC/numerics/Modulo.h>
16 
17 #include <iostream>
18 #include <limits.h>
19 
20 using namespace Belle2;
21 using namespace TrackFindingCDC;
22 
24  : m_startToMiddleCellDistance(CHAR_MAX / 2)
25  , m_middleToEndCellDistance(CHAR_MAX / 2)
26  , m_oClockDelta(SHRT_MIN)
27 {
28 }
29 
30 CDCRLWireHitTriple::Shape::Shape(const short startToMiddleCellDistance,
31  const short middleToEndCellDistance,
32  const short oClockDelta)
33  : m_startToMiddleCellDistance(startToMiddleCellDistance)
34  , m_middleToEndCellDistance(middleToEndCellDistance)
35  , m_oClockDelta(oClockDelta)
36 {
37 }
38 
40 {
41  return m_startToMiddleCellDistance;
42 }
43 
45 {
46  return m_middleToEndCellDistance;
47 }
48 
50 {
51  return m_startToMiddleCellDistance + m_middleToEndCellDistance;
52 }
53 
55 {
56  return m_oClockDelta;
57 }
58 
60 {
61  return getCellExtend() >= 2 and getCellExtend() <= 4;
62 }
63 
65  const CDCRLWireHit& middleRLWireHit,
66  const CDCRLWireHit& endRLWireHit,
67  int iCluster)
68  : m_startRLWireHit(startRLWireHit)
69  , m_rearRLWireHitPair(middleRLWireHit, endRLWireHit, iCluster)
70 {
71 }
72 
74 {
78  getICluster());
79 }
80 
82 {
83  CDCRLWireHit newEndRLWireHit = getStartRLWireHit().reversed();
86  setEndRLWireHit(newEndRLWireHit);
87 }
88 
90 {
94  getICluster());
95 }
96 
98 {
99  const CDCWire& startWire = getStartWire();
100  const CDCWire& middleWire = getMiddleWire();
101  const CDCWire& endWire = getEndWire();
102 
103  WireNeighborKind startToMiddleNeighborKind = startWire.getNeighborKind(middleWire);
104  WireNeighborKind middleToEndNeighborKind = middleWire.getNeighborKind(endWire);
105 
106  if (not startToMiddleNeighborKind.isValid() or
107  not middleToEndNeighborKind.isValid()) {
108  return Shape();
109  }
110 
111  // Neighbor types are marked on the clock. Difference is so to say an angular value apart from a 12 / (2 * pi) factor
112  const short oClockDelta = middleToEndNeighborKind.getOClockDirection() - startToMiddleNeighborKind.getOClockDirection();
113  const short startToMiddleCellDistance = startToMiddleNeighborKind.getCellDistance();
114  const short middleToEndCellDistance = middleToEndNeighborKind.getCellDistance();
115  return Shape(startToMiddleCellDistance,
116  middleToEndCellDistance,
117  symmetricModuloFast(oClockDelta, 12));
118 }
119 
120 std::ostream& TrackFindingCDC::
121 operator<<(std::ostream& output, const CDCRLWireHitTriple& rlWireHitTriple)
122 {
123  return (output << "Start : " << rlWireHitTriple.getStartRLWireHit() << " "
124  << "Middle : "
125  << rlWireHitTriple.getMiddleRLWireHit()
126  << " "
127  << "End : "
128  << rlWireHitTriple.getEndRLWireHit());
129 }
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getShape
Shape getShape() const
Getter for the shape of this tiple if all three oriented wire hits are neighbors. Else ILLSHAPE.
Definition: CDCRLWireHitTriple.cc:97
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::CDCRLWireHitTriple::Shape::getStartToMiddleCellDistance
short getStartToMiddleCellDistance() const
Getter for the start to middle cell distance.
Definition: CDCRLWireHitTriple.cc:39
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getStartWire
const CDCWire & getStartWire() const
Getter for the wire the first oriented wire hit is based on.
Definition: CDCRLWireHitTriple.h:170
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getAlias
CDCRLWireHitTriple getAlias() const
Returns the aliased version of this oriented wire hit triple.
Definition: CDCRLWireHitTriple.cc:89
Belle2::TrackFindingCDC::CDCRLWireHitTriple::reverse
void reverse()
Reverses the triple inplace.
Definition: CDCRLWireHitTriple.cc:81
Belle2::TrackFindingCDC::CDCRLWireHitTriple::Shape::Shape
Shape()
Default constructor for an invalid shape.
Definition: CDCRLWireHitTriple.cc:23
Belle2::TrackFindingCDC::CDCWire::getNeighborKind
WireNeighborKind getNeighborKind(const CDCWire &wire) const
Returns gives the kind of neighborhood relation from this wire to the given wire.
Definition: CDCWire.cc:145
Belle2::TrackFindingCDC::WireNeighborKind::isValid
bool isValid() const
Check if the neighbor kind is in principle valid.
Definition: WireNeighborKind.h:80
Belle2::TrackFindingCDC::CDCRLWireHitTriple::setMiddleRLWireHit
void setMiddleRLWireHit(const CDCRLWireHit &middleRLWireHit)
Setter for the second oriented wire hit.
Definition: CDCRLWireHitTriple.h:291
Belle2::TrackFindingCDC::CDCRLWireHitTriple
Class representing a triple of neighboring wire hits.
Definition: CDCRLWireHitTriple.h:45
Belle2::TrackFindingCDC::CDCRLWireHitTriple::m_rearRLWireHitPair
CDCRLWireHitPair m_rearRLWireHitPair
Memory for the second and third wire hits.
Definition: CDCRLWireHitTriple.h:337
Belle2::TrackFindingCDC::CDCRLWireHitTriple::Shape
Type for the different shapes of a triple of neighboring wire hits.
Definition: CDCRLWireHitTriple.h:48
Belle2::TrackFindingCDC::CDCRLWireHitTriple::reversed
CDCRLWireHitTriple reversed() const
Constructs the reverse tiple from this one.
Definition: CDCRLWireHitTriple.cc:73
Belle2::TrackFindingCDC::CDCRLWireHitTriple::m_startRLWireHit
CDCRLWireHit m_startRLWireHit
Memory for the start oriented wire hit.
Definition: CDCRLWireHitTriple.h:334
Belle2::TrackFindingCDC::CDCRLWireHit::reversed
CDCRLWireHit reversed() const
Returns the oriented wire hit with the opposite right left information.
Definition: CDCRLWireHit.h:99
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getEndWire
const CDCWire & getEndWire() const
Getter for the wire the third oriented wire hit is based on.
Definition: CDCRLWireHitTriple.h:182
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
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::CDCRLWireHitTriple::Shape::getOClockDelta
short getOClockDelta() const
Getter for the o'clock direction difference from start to middle compared to middle to end.
Definition: CDCRLWireHitTriple.cc:54
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getMiddleWire
const CDCWire & getMiddleWire() const
Getter for the wire the second oriented wire hit is based on.
Definition: CDCRLWireHitTriple.h:176
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getMiddleRLWireHit
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Definition: CDCRLWireHitTriple.h:243
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getEndRLWireHit
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
Definition: CDCRLWireHitTriple.h:249
Belle2::TrackFindingCDC::CDCRLWireHitTriple::CDCRLWireHitTriple
CDCRLWireHitTriple()=default
Default constructor for ROOT.
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getICluster
int getICluster() const
Getter for the cluster id.
Definition: CDCRLWireHitTriple.h:321
Belle2::TrackFindingCDC::WireNeighborKind
Type for the neighbor relationship from one wire to another.
Definition: WireNeighborKind.h:35
Belle2::TrackFindingCDC::CDCRLWireHitTriple::Shape::isValid
bool isValid() const
Check if the shape is considered valid.
Definition: CDCRLWireHitTriple.cc:59
Belle2::TrackFindingCDC::CDCRLWireHitTriple::setEndRLWireHit
void setEndRLWireHit(const CDCRLWireHit &endRLWireHit)
Setter for the third oriented wire hit.
Definition: CDCRLWireHitTriple.h:297
Belle2::TrackFindingCDC::CDCRLWireHitTriple::Shape::getCellExtend
short getCellExtend() const
Getter for the sum of cell distances from start to middle and middle to end.
Definition: CDCRLWireHitTriple.cc:49
Belle2::TrackFindingCDC::CDCRLWireHitTriple::Shape::getMiddleToEndCellDistance
short getMiddleToEndCellDistance() const
Getter for the middle to end cell distance.
Definition: CDCRLWireHitTriple.cc:44
Belle2::TrackFindingCDC::CDCRLWireHitTriple::getStartRLWireHit
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
Definition: CDCRLWireHitTriple.h:237