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