Belle II Software  release-05-01-25
CDCAxialSegmentPair.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
13 #include <tracking/trackFindingCDC/eventdata/segments/CDCAxialSegment2D.h>
14 
15 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
16 
17 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
18 
19 #include <tracking/trackFindingCDC/ca/AutomatonCell.h>
20 
21 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
22 
23 #include <framework/logging/Logger.h>
24 
25 using namespace Belle2;
26 using namespace TrackFindingCDC;
27 
29  : m_startSegment(nullptr)
30  , m_endSegment(nullptr)
31 {
32 }
33 
35  const CDCAxialSegment2D* endSegment)
36  : m_startSegment(startSegment)
37  , m_endSegment(endSegment)
38 {
39  B2ASSERT("CDCAxialSegmentPair initialized with nullptr as start segment", startSegment);
40  B2ASSERT("CDCAxialSegmentPair initialized with nullptr as end segment", endSegment);
41 }
42 
44  const CDCAxialSegment2D* endSegment,
45  const CDCTrajectory2D& trajectory2D)
46  : m_startSegment(startSegment)
47  , m_endSegment(endSegment)
48  , m_trajectory2D(trajectory2D)
49 {
50  B2ASSERT("CDCAxialSegmentPair initialized with nullptr as start segment", startSegment);
51  B2ASSERT("CDCAxialSegmentPair initialized with nullptr as end segment", endSegment);
52 }
53 
55 {
57 }
58 
60 {
62 }
63 
65 {
67  const bool toHits = true;
68  getStartSegment()->unsetAndForwardMaskedFlag(toHits);
69  getEndSegment()->unsetAndForwardMaskedFlag(toHits);
70 }
71 
73 {
75  const bool toHits = true;
76  getStartSegment()->setAndForwardMaskedFlag(toHits);
77  getEndSegment()->setAndForwardMaskedFlag(toHits);
78 }
79 
81 {
82  const bool fromHits = true;
83  getStartSegment()->receiveMaskedFlag(fromHits);
84  getEndSegment()->receiveMaskedFlag(fromHits);
85 
86  if (getStartSegment()->getAutomatonCell().hasMaskedFlag() or
87  getEndSegment()->getAutomatonCell().hasMaskedFlag()) {
89  }
90 }
91 
93 {
94  EForwardBackward startIsCoaligned = trajectory2D.isForwardOrBackwardTo(*(getStartSegment()));
95  EForwardBackward endIsCoaligned = trajectory2D.isForwardOrBackwardTo(*(getEndSegment()));
96  if (startIsCoaligned == EForwardBackward::c_Forward and
97  endIsCoaligned == EForwardBackward::c_Forward) {
98  return EForwardBackward::c_Forward;
99  } else if (startIsCoaligned == EForwardBackward::c_Backward and
100  endIsCoaligned == EForwardBackward::c_Backward) {
101  return EForwardBackward::c_Backward;
102  } else {
103  return EForwardBackward::c_Invalid;
104  }
105 }
Belle2::TrackFindingCDC::ISuperLayerUtil::getFrom
static ISuperLayer getFrom(const T &t)
Returns the superlayer of an object.
Definition: ISuperLayer.h:112
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getStartISuperLayer
ISuperLayer getStartISuperLayer() const
Getter for the superlayer id of the start segment.
Definition: CDCAxialSegmentPair.cc:54
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getStartSegment
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Definition: CDCAxialSegmentPair.h:99
Belle2::TrackFindingCDC::AutomatonCell::unsetMaskedFlag
void unsetMaskedFlag()
Resets the masked flag to false.
Definition: AutomatonCell.h:222
Belle2::TrackFindingCDC::CDCAxialSegmentPair::unsetAndForwardMaskedFlag
void unsetAndForwardMaskedFlag() const
Unsets the masked flag of the segment pair's automaton cell, of the contained segments and of the con...
Definition: CDCAxialSegmentPair.cc:64
Belle2::TrackFindingCDC::NForwardBackward::EForwardBackward
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: EForwardBackward.h:35
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getEndSegment
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
Definition: CDCAxialSegmentPair.h:111
Belle2::TrackFindingCDC::CDCAxialSegmentPair::CDCAxialSegmentPair
CDCAxialSegmentPair()
Default constructor setting the contained segmetns to nullptr.
Definition: CDCAxialSegmentPair.cc:28
Belle2::TrackFindingCDC::AutomatonCell::setMaskedFlag
void setMaskedFlag(bool setTo=true)
Sets the masked flag to the given value. Default value true.
Definition: AutomatonCell.h:216
Belle2::TrackFindingCDC::CDCAxialSegmentPair::isCoaligned
EForwardBackward isCoaligned(const CDCTrajectory2D &trajectory2D) const
Checks if the last entity in the vector lies greater or lower travel distance than the last entity.
Definition: CDCAxialSegmentPair.cc:92
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getAutomatonCell
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Definition: CDCAxialSegmentPair.h:162
Belle2::TrackFindingCDC::CDCSegment2D
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:40
Belle2::TrackFindingCDC::CDCAxialSegmentPair::receiveMaskedFlag
void receiveMaskedFlag() const
If one of the contained segments is marked as masked this segment pair is set be masked as well.
Definition: CDCAxialSegmentPair.cc:80
Belle2::TrackFindingCDC::CDCTrajectory2D::isForwardOrBackwardTo
EForwardBackward isForwardOrBackwardTo(const AHits &hits) const
Calculates if this trajectory and the hits are coaligned Returns:
Definition: CDCTrajectory2D.h:210
Belle2::TrackFindingCDC::CDCAxialSegmentPair::setAndForwardMaskedFlag
void setAndForwardMaskedFlag() const
Sets the masked flag of the segment pair's automaton cell. Also forward the masked flag to the contai...
Definition: CDCAxialSegmentPair.cc:72
Belle2::TrackFindingCDC::CDCAxialSegmentPair::getEndISuperLayer
ISuperLayer getEndISuperLayer() const
Getter for the superlayer id of the end segment.
Definition: CDCAxialSegmentPair.cc:59