Belle II Software development
CDCSegmentPair.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/eventdata/trajectories/CDCTrajectory3D.h>
11
12#include <tracking/trackFindingCDC/topology/ISuperLayer.h>
13#include <tracking/trackFindingCDC/topology/EStereoKind.h>
14
15#include <tracking/trackFindingCDC/ca/AutomatonCell.h>
16
17#include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
18
19#include <cassert>
20#include <cstddef>
21
22namespace Belle2 {
27 namespace TrackFindingCDC {
28 class CDCSegment2D;
29 class CDCTrajectory2D;
30 class CDCTrajectorySZ;
31
35 public:
38
40 CDCSegmentPair(const CDCSegment2D* fromSegment, const CDCSegment2D* toSegment);
41
43 CDCSegmentPair(const CDCSegment2D* fromSegment,
44 const CDCSegment2D* toSegment,
45 const CDCTrajectory3D& trajectory3D);
46
48 bool operator==(CDCSegmentPair const& rhs) const
49 {
50 return getFromSegment() == rhs.getFromSegment() and getToSegment() == rhs.getToSegment();
51 }
52
54 bool operator<(CDCSegmentPair const& rhs) const
55 {
56 return (getFromSegment() < rhs.getFromSegment() or
57 (getFromSegment() == rhs.getFromSegment() and getToSegment() < rhs.getToSegment()));
58 }
59
62 friend bool operator<(const CDCSegmentPair& segmentPair, const CDCSegment2D* segment)
63 {
64 return segmentPair.getFromSegment() < segment;
65 }
66
69 friend bool operator<(const CDCSegment2D* segment, const CDCSegmentPair& segmentPair)
70 {
71 return segment < segmentPair.getFromSegment();
72 }
73
76 {
77 return getFromSegment() != nullptr and getToSegment() != nullptr;
78 }
79
82 {
83 return (getFromStereoKind() == EStereoKind::c_Axial) xor
84 (getToStereoKind() == EStereoKind::c_Axial);
85 }
86
89 bool checkSegments() const
90 {
92 }
93
95 EStereoKind getFromStereoKind() const;
96
98 EStereoKind getToStereoKind() const;
99
101 ISuperLayer getFromISuperLayer() const;
102
104 ISuperLayer getToISuperLayer() const;
105
107 std::size_t size() const;
108
111 {
112 return m_fromSegment;
113 }
114
116 void setFromSegment(const CDCSegment2D* fromSegment)
117 {
118 setSegments(fromSegment, getToSegment());
119 }
120
123 {
124 return m_toSegment;
125 }
126
128 void setToSegment(const CDCSegment2D* toSegment)
129 {
130 setSegments(getFromSegment(), toSegment);
131 }
132
135 {
136 return getFromStereoKind() != EStereoKind::c_Axial ? getFromSegment() : getToSegment();
137 }
138
141 {
142 return getFromStereoKind() == EStereoKind::c_Axial ? getFromSegment() : getToSegment();
143 }
144
146 void setSegments(const CDCSegment2D* fromSegment, const CDCSegment2D* toSegment)
147 {
148 m_fromSegment = fromSegment;
149 m_toSegment = toSegment;
150 assert(checkSegmentsNonNullptr());
151 assert(checkSegmentsStereoKinds());
152 }
153
157
160 {
162 }
163
165 double computeToIsAfterFrom() const
166 {
168 }
169
171 double computeIsCoaligned() const
172 {
174 }
175
178 double computeFromIsBeforeToFitless() const;
179
182 double computeToIsAfterFromFitless() const;
183
186 double computeIsCoalignedFitless() const;
187
190
194 EForwardBackward isCoaligned(const CDCTrajectory2D& trajectory2D) const;
195
197 void setTrajectory3D(const CDCTrajectory3D& trajectory3D) const
198 {
199 m_trajectory3D = trajectory3D;
200 }
201
204 {
205 return m_trajectory3D;
206 }
207
210
213
215 void clearTrajectory3D() const
216 {
218 }
219
222 void unsetAndForwardMaskedFlag() const;
223
226 void setAndForwardMaskedFlag() const;
227
230 void receiveMaskedFlag() const;
231
234 {
235 return m_automatonCell;
236 }
237
238 private:
241
244
247
250 };
251 }
253}
Cell used by the cellular automata.
Definition: AutomatonCell.h:29
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...
double computeFromIsBeforeTo() const
Indicator if the from segment lies before the to segment.
double computeToIsAfterFromFitless() const
Indicator if the from segment lies before the to segment, build without using the trajectories,...
void setSegments(const CDCSegment2D *fromSegment, const CDCSegment2D *toSegment)
Setter for both segments simultaneously.
friend bool operator<(const CDCSegment2D *segment, const CDCSegmentPair &segmentPair)
Define reconstructed segments and axial stereo segment pairs as coaligned on the from segment.
CDCTrajectory3D m_trajectory3D
Memory for the common three dimensional trajectory.
EStereoKind getToStereoKind() const
Getter for the stereo type of the second segment.
const CDCSegment2D * getAxialSegment() const
Getter for the axial segment.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional projection of the common three dimensional trajectory.
bool checkSegmentsNonNullptr() const
Checks if both stored segments are not nullptr. Returns true if check is succeeded.
friend bool operator<(const CDCSegmentPair &segmentPair, const CDCSegment2D *segment)
Define reconstructed segments and axial stereo segment pairs as coaligned on the from segment.
const CDCSegment2D * m_toSegment
Reference to the to segment.
EStereoKind getFromStereoKind() const
Getter for the stereo type of the first segment.
const CDCSegment2D * getToSegment() const
Getter for the to segment.
bool checkSegments() const
Checks the references to the contained three segment for nullptrs and exactly one of them is axial an...
void setTrajectory3D(const CDCTrajectory3D &trajectory3D) const
Setter for the three dimensional trajectory.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
void setAndForwardMaskedFlag() const
Sets the masked flag of the segment triple's automaton cell and of the three contained segments.
void unsetAndForwardMaskedFlag() const
Unsets the masked flag of the segment triple's automaton cell and of the three contained segments.
double computeFromIsBeforeToFitless() const
Indicator if the from segment lies before the to segment, build without using the trajectories,...
double computeDeltaPhiAtSuperLayerBound() const
Determines the angle between the last reconstructed position of the from segment and the first recons...
bool checkSegmentsStereoKinds() const
Checks if the two segments are of different axial type.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz projection of the common three dimensional trajectory.
void setFromSegment(const CDCSegment2D *fromSegment)
Setter for the from segment.
void setToSegment(const CDCSegment2D *toSegment)
Setter for the to segment.
const CDCSegment2D * getStereoSegment() const
Getter for the stereo segment.
bool operator==(CDCSegmentPair const &rhs) const
Equality comparison based on the pointers to the stored segments.
ISuperLayer getFromISuperLayer() const
Getter for the superlayer id of the from segment.
CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional trajectory.
double computeToIsAfterFrom() const
Indicator if the from segment lies before the to segment.
AutomatonCell m_automatonCell
Automaton cell associated with the pair of segments.
EForwardBackward isCoaligned(const CDCTrajectory2D &trajectory2D) const
Checks if the last entity in the vector lies greater or lower travel distance than the last entity.
double computeIsCoaligned() const
Indicator if the from segment and the to segment have roughly the same travel direction.
CDCSegmentPair()
Default constructor - for ROOT compatibility.
ISuperLayer getToISuperLayer() const
Getter for the superlayer id of the to segment.
std::size_t size() const
Getter for the total number of hits in this segment pair.
void receiveMaskedFlag() const
If one of the contained segments is marked as masked this segment triple is set be masked as well.
void clearTrajectory3D() const
Invalides the currently stored trajectory information.
const CDCSegment2D * m_fromSegment
Reference to the from segment.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
bool operator<(CDCSegmentPair const &rhs) const
Total ordering scheme comparing the segment pointers.
double computeIsCoalignedFitless() const
Indicator if the from segment and the to segment have roughly the same travel direction without using...
Particle trajectory as it is seen in xy projection represented as a circle.
Particle full three dimensional trajectory.
void clear()
Clears all information from this trajectoy.
Linear trajectory in sz space.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.