Belle II Software prerelease-11-00-00a
CDCAxialSegmentPair.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/trackingUtilities/eventdata/tracks/CDCAxialSegmentPair.h>
9
10#include <tracking/trackingUtilities/eventdata/segments/CDCSegment2D.h>
11#include <tracking/trackingUtilities/eventdata/segments/CDCAxialSegment2D.h>
12
13#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
14
15#include <cdc/topology/ISuperLayer.h>
16
17#include <tracking/trackingUtilities/ca/AutomatonCell.h>
18
19#include <tracking/trackingUtilities/numerics/EForwardBackward.h>
20
21#include <framework/logging/Logger.h>
22
23using namespace Belle2;
24using namespace CDC;
25using namespace TrackingUtilities;
26
27CDCAxialSegmentPair::CDCAxialSegmentPair(const CDCAxialSegment2D* startSegment,
28 const CDCAxialSegment2D* endSegment)
29 : m_startSegment(startSegment)
30 , m_endSegment(endSegment)
31{
32 B2ASSERT("CDCAxialSegmentPair initialized with nullptr as start segment", startSegment);
33 B2ASSERT("CDCAxialSegmentPair initialized with nullptr as end segment", endSegment);
34}
35
36CDCAxialSegmentPair::CDCAxialSegmentPair(const CDCAxialSegment2D* startSegment,
37 const CDCAxialSegment2D* endSegment,
38 const CDCTrajectory2D& trajectory2D)
39 : m_startSegment(startSegment)
40 , m_endSegment(endSegment)
41 , m_trajectory2D(trajectory2D)
42{
43 B2ASSERT("CDCAxialSegmentPair initialized with nullptr as start segment", startSegment);
44 B2ASSERT("CDCAxialSegmentPair initialized with nullptr as end segment", endSegment);
45}
46
51
56
58{
60 const bool toHits = true;
61 getStartSegment()->unsetAndForwardMaskedFlag(toHits);
62 getEndSegment()->unsetAndForwardMaskedFlag(toHits);
63}
64
66{
68 const bool toHits = true;
69 getStartSegment()->setAndForwardMaskedFlag(toHits);
70 getEndSegment()->setAndForwardMaskedFlag(toHits);
71}
72
74{
75 const bool fromHits = true;
76 getStartSegment()->receiveMaskedFlag(fromHits);
77 getEndSegment()->receiveMaskedFlag(fromHits);
78
79 if (getStartSegment()->getAutomatonCell().hasMaskedFlag() or
80 getEndSegment()->getAutomatonCell().hasMaskedFlag()) {
82 }
83}
84
85EForwardBackward CDCAxialSegmentPair::isCoaligned(const CDCTrajectory2D& trajectory2D) const
86{
87 EForwardBackward startIsCoaligned = trajectory2D.isForwardOrBackwardTo(*(getStartSegment()));
88 EForwardBackward endIsCoaligned = trajectory2D.isForwardOrBackwardTo(*(getEndSegment()));
89 if (startIsCoaligned == EForwardBackward::c_Forward and
90 endIsCoaligned == EForwardBackward::c_Forward) {
91 return EForwardBackward::c_Forward;
92 } else if (startIsCoaligned == EForwardBackward::c_Backward and
93 endIsCoaligned == EForwardBackward::c_Backward) {
94 return EForwardBackward::c_Backward;
95 } else {
96 return EForwardBackward::c_Invalid;
97 }
98}
void setMaskedFlag(bool setTo=true)
Sets the masked flag to the given value. Default value true.
void unsetMaskedFlag()
Resets the masked flag to false.
CDC::ISuperLayer getStartISuperLayer() const
Getter for the superlayer id of the start segment.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
CDCTrajectory2D m_trajectory2D
Reference to the common trajectory.
const CDCAxialSegment2D * m_startSegment
Reference to the start segment.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
CDCAxialSegmentPair()=default
Default constructor setting the contained segments to nullptr.
void setAndForwardMaskedFlag() const
Sets the masked flag of the segment pair's automaton cell. Also forward the masked flag to the contai...
void unsetAndForwardMaskedFlag() const
Unsets the masked flag of the segment pair's automaton cell, of the contained segments and of the con...
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
const CDCAxialSegment2D * m_endSegment
Reference to the end segment.
CDC::ISuperLayer getEndISuperLayer() const
Getter for the superlayer id of the end segment.
EForwardBackward isCoaligned(const CDCTrajectory2D &trajectory2D) const
Checks if the last entity in the vector lies greater or lower travel distance than the last entity.
void receiveMaskedFlag() const
If one of the contained segments is marked as masked this segment pair is set be masked as well.
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:
signed short ISuperLayer
The type of the layer and superlayer ids.
Definition ISuperLayer.h:24
Abstract base class for different kinds of events.
static ISuperLayer getFrom(const T &t)
Returns the superlayer of an object.