10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
14 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
15 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
16 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
18 #include <tracking/trackFindingCDC/topology/EStereoKind.h>
19 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
21 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
23 #include <tracking/trackFindingCDC/ca/AutomatonCell.h>
25 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
27 #include <framework/logging/Logger.h>
33 using namespace TrackFindingCDC;
36 : m_fromSegment(nullptr)
37 , m_toSegment(nullptr)
42 : m_fromSegment(fromSegment)
43 , m_toSegment(toSegment)
45 B2ASSERT(
"CDCSegmentPair initialized with nullptr as from segment", fromSegment);
46 B2ASSERT(
"CDCSegmentPair initialized with nullptr as to segment", toSegment);
52 : m_fromSegment(fromSegment)
53 , m_toSegment(toSegment)
54 , m_trajectory3D(trajectory3D)
56 B2ASSERT(
"CDCSegmentPair initialized with nullptr as from segment", fromSegment);
57 B2ASSERT(
"CDCSegmentPair initialized with nullptr as to segment", toSegment);
69 return getToSegment() ==
nullptr ? EStereoKind::c_Invalid
103 const bool toHits =
true;
111 const bool toHits =
true;
118 const bool fromHits =
true;
133 if (not ptrFromSegment) {
137 if (not ptrToSegment) {
144 if (fromSegment.empty() or toSegment.empty()) {
148 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
149 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
154 return lastPos2D_fromSegment.
angleWith(firstPos2D_toSegment);
162 if (not ptrFromSegment) {
166 if (not ptrToSegment) {
173 if (fromSegment.empty() or toSegment.empty()) {
177 const CDCRecoHit2D& firstRecoHit_fromSegment = fromSegment.front();
178 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
180 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
186 Vector2D firstToLast_fromSegment = lastPos2D_fromSegment - firstPos2D_fromSegment;
187 Vector2D firstToFirst = firstPos2D_toSegment - firstPos2D_fromSegment;
189 return firstToLast_fromSegment.
angleWith(firstToFirst);
197 if (not ptrFromSegment) {
201 if (not ptrToSegment) {
208 if (fromSegment.empty() or toSegment.empty()) {
212 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
214 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
215 const CDCRecoHit2D& lastRecoHit_toSegment = toSegment.back();
221 Vector2D firstToLast_toSegment = lastPos2D_toSegment - firstPos2D_toSegment;
222 Vector2D lastToLast = lastPos2D_toSegment - lastPos2D_fromSegment;
224 return firstToLast_toSegment.
angleWith(lastToLast);
232 if (not ptrFromSegment) {
236 if (not ptrToSegment) {
243 if (fromSegment.empty() or toSegment.empty()) {
247 const CDCRecoHit2D& firstRecoHit_fromSegment = fromSegment.front();
248 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
250 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
251 const CDCRecoHit2D& lastRecoHit_toSegment = toSegment.back();
259 Vector2D firstToLast_fromSegment = lastPos2D_fromSegment - firstPos2D_fromSegment;
260 Vector2D firstToLast_toSegment = lastPos2D_toSegment - firstPos2D_toSegment;
262 return firstToLast_fromSegment.
angleWith(firstToLast_toSegment);
270 if (fromIsCoaligned == EForwardBackward::c_Forward and
271 toIsCoaligned == EForwardBackward::c_Forward) {
272 return EForwardBackward::c_Forward;
273 }
else if (fromIsCoaligned == EForwardBackward::c_Backward and
274 toIsCoaligned == EForwardBackward::c_Backward) {
275 return EForwardBackward::c_Backward;
277 return EForwardBackward::c_Invalid;