8#include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
10#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
11#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
12#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
13#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
14#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
16#include <tracking/trackFindingCDC/topology/EStereoKind.h>
17#include <tracking/trackFindingCDC/topology/ISuperLayer.h>
19#include <tracking/trackFindingCDC/geometry/Vector2D.h>
21#include <tracking/trackFindingCDC/ca/AutomatonCell.h>
23#include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
25#include <framework/logging/Logger.h>
31using namespace TrackFindingCDC;
34 : m_fromSegment(nullptr)
35 , m_toSegment(nullptr)
40 : m_fromSegment(fromSegment)
41 , m_toSegment(toSegment)
43 B2ASSERT(
"CDCSegmentPair initialized with nullptr as from segment", fromSegment);
44 B2ASSERT(
"CDCSegmentPair initialized with nullptr as to segment", toSegment);
50 : m_fromSegment(fromSegment)
51 , m_toSegment(toSegment)
52 , m_trajectory3D(trajectory3D)
54 B2ASSERT(
"CDCSegmentPair initialized with nullptr as from segment", fromSegment);
55 B2ASSERT(
"CDCSegmentPair initialized with nullptr as to segment", toSegment);
67 return getToSegment() ==
nullptr ? EStereoKind::c_Invalid
101 const bool toHits =
true;
109 const bool toHits =
true;
116 const bool fromHits =
true;
131 if (not ptrFromSegment) {
135 if (not ptrToSegment) {
142 if (fromSegment.empty() or toSegment.empty()) {
146 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
147 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
152 return lastPos2D_fromSegment.
angleWith(firstPos2D_toSegment);
160 if (not ptrFromSegment) {
164 if (not ptrToSegment) {
171 if (fromSegment.empty() or toSegment.empty()) {
175 const CDCRecoHit2D& firstRecoHit_fromSegment = fromSegment.front();
176 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
178 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
184 Vector2D firstToLast_fromSegment = lastPos2D_fromSegment - firstPos2D_fromSegment;
185 Vector2D firstToFirst = firstPos2D_toSegment - firstPos2D_fromSegment;
187 return firstToLast_fromSegment.
angleWith(firstToFirst);
195 if (not ptrFromSegment) {
199 if (not ptrToSegment) {
206 if (fromSegment.empty() or toSegment.empty()) {
210 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
212 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
213 const CDCRecoHit2D& lastRecoHit_toSegment = toSegment.back();
219 Vector2D firstToLast_toSegment = lastPos2D_toSegment - firstPos2D_toSegment;
220 Vector2D lastToLast = lastPos2D_toSegment - lastPos2D_fromSegment;
222 return firstToLast_toSegment.
angleWith(lastToLast);
230 if (not ptrFromSegment) {
234 if (not ptrToSegment) {
241 if (fromSegment.empty() or toSegment.empty()) {
245 const CDCRecoHit2D& firstRecoHit_fromSegment = fromSegment.front();
246 const CDCRecoHit2D& lastRecoHit_fromSegment = fromSegment.back();
248 const CDCRecoHit2D& firstRecoHit_toSegment = toSegment.front();
249 const CDCRecoHit2D& lastRecoHit_toSegment = toSegment.back();
257 Vector2D firstToLast_fromSegment = lastPos2D_fromSegment - firstPos2D_fromSegment;
258 Vector2D firstToLast_toSegment = lastPos2D_toSegment - firstPos2D_toSegment;
260 return firstToLast_fromSegment.
angleWith(firstToLast_toSegment);
268 if (fromIsCoaligned == EForwardBackward::c_Forward and
269 toIsCoaligned == EForwardBackward::c_Forward) {
270 return EForwardBackward::c_Forward;
271 }
else if (fromIsCoaligned == EForwardBackward::c_Backward and
272 toIsCoaligned == EForwardBackward::c_Backward) {
273 return EForwardBackward::c_Backward;
275 return EForwardBackward::c_Invalid;
void setMaskedFlag(bool setTo=true)
Sets the masked flag to the given value. Default value true.
void unsetMaskedFlag()
Resets the masked flag to false.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
A reconstructed sequence of two dimensional hits in one super layer.
double computeToIsAfterFromFitless() const
Indicator if the from segment lies before the to segment, build without using the trajectories,...
EStereoKind getToStereoKind() const
Getter for the stereo type of the second segment.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional projection of the common three dimensional trajectory.
EStereoKind getFromStereoKind() const
Getter for the stereo type of the first segment.
const CDCSegment2D * getToSegment() const
Getter for the to segment.
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...
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz projection of the common three dimensional trajectory.
ISuperLayer getFromISuperLayer() const
Getter for the superlayer id of the from segment.
CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional trajectory.
EForwardBackward isCoaligned(const CDCTrajectory2D &trajectory2D) const
Checks if the last entity in the vector lies greater or lower travel distance than the last entity.
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.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
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.
EForwardBackward isForwardOrBackwardTo(const AHits &hits) const
Calculates if this trajectory and the hits are coaligned Returns:
Particle full three dimensional trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
Linear trajectory in sz space.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.
static const ISuperLayer c_Invalid
Constant making an invalid superlayer id.