Belle II Software  release-05-02-19
SegmentOrienter Class Referenceabstract

Fixes the orientation of segments by a simple heuristic. More...

#include <SegmentOrienter.h>

Inheritance diagram for SegmentOrienter:
Collaboration diagram for SegmentOrienter:

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invokation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invokation.
 

Public Member Functions

std::string getDescription () final
 Short description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void initialize () final
 Signals the beginning of the event processing.
 
void apply (const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCSegment2D > &outputSegments) final
 Main algorithm applying the adjustment of the orientation. More...
 
virtual void exposeParameters (ModuleParamList *moduleParamList __attribute__((unused)), const std::string &prefix __attribute__((unused)))
 Forward prefixed parameters of this findlet to the module parameter list.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector = typename ToVectorImpl< T >::Type
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = Findlet< const CDCSegment2D, CDCSegment2D >
 Type of the base class.
 

Private Attributes

std::string m_param_segmentOrientationString = ""
 Parameter: String that states the desired segment orientation. More...
 
EPreferredDirection m_segmentOrientation = EPreferredDirection::c_None
 Encoded desired segment orientation. More...
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happend before.
 
bool m_terminated = false
 Flag to keep track whether termination happend before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Fixes the orientation of segments by a simple heuristic.

Definition at line 37 of file SegmentOrienter.h.

Member Function Documentation

◆ apply()

void apply ( const std::vector< CDCSegment2D > &  inputSegments,
std::vector< CDCSegment2D > &  outputSegments 
)
final

Main algorithm applying the adjustment of the orientation.

Copy segments to output fixing their orientation

Definition at line 54 of file SegmentOrienter.cc.

56 {
58  if (m_segmentOrientation == EPreferredDirection::c_None) {
59  // Copy the segments unchanged.
60  outputSegments = inputSegments;
61 
62  } else if (m_segmentOrientation == EPreferredDirection::c_Symmetric) {
63  outputSegments.reserve(2 * inputSegments.size());
64  for (const CDCSegment2D& segment : inputSegments) {
65  outputSegments.push_back(segment);
66  if (segment->hasReverseFlag()) continue; // Already a reverse found in the facet ca
67  outputSegments.back()->setReverseFlag();
68  outputSegments.push_back(segment.reversed());
69  outputSegments.back()->setReverseFlag();
70  }
71 
72  } else if (m_segmentOrientation == EPreferredDirection::c_Curling) {
73  // Only make a copy for segments that are curling inside the CDC
74  // Others fix to flighing outwards
75  outputSegments.reserve(1.5 * inputSegments.size());
76  for (const CDCSegment2D& segment : inputSegments) {
77  if (segment->hasReverseFlag()) {
78  outputSegments.push_back(segment);
79  continue; // Already a reverse found in the facet ca
80  }
81  const CDCTrajectory2D& trajectory2D = segment.getTrajectory2D();
82  bool isFitted = trajectory2D.isFitted();
83  bool isCurler = trajectory2D.isCurler(1.1);
84  bool isOriginer = trajectory2D.isOriginer();
85  // Trajectory is leaving the CDC starting in the inner volume
86  bool isLeaver = isFitted and (not isCurler) and isOriginer;
87  if (isLeaver) {
88  // Fix to outwards flying
89  const CDCRecoHit2D& firstHit = segment.front();
90  const CDCRecoHit2D& lastHit = segment.back();
91  if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
92  outputSegments.push_back(segment.reversed());
93  } else {
94  outputSegments.push_back(segment);
95  }
96  } else {
97  // Ambigious keep both options
98  outputSegments.push_back(segment);
99  outputSegments.back()->setReverseFlag();
100  outputSegments.push_back(segment.reversed());
101  outputSegments.back()->setReverseFlag();
102  }
103  }
104 
105  } else if (m_segmentOrientation == EPreferredDirection::c_Outwards) {
106  outputSegments.reserve(inputSegments.size());
107  for (const CDCSegment2D& segment : inputSegments) {
108  const CDCRecoHit2D& firstHit = segment.front();
109  const CDCRecoHit2D& lastHit = segment.back();
110  if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
111  outputSegments.push_back(segment.reversed());
112  } else {
113  outputSegments.push_back(segment);
114  }
115  }
116  } else if (m_segmentOrientation == EPreferredDirection::c_Downwards) {
117  outputSegments.reserve(inputSegments.size());
118  for (const CDCSegment2D& segment : inputSegments) {
119  const CDCRecoHit2D& firstHit = segment.front();
120  const CDCRecoHit2D& lastHit = segment.back();
121  if (lastHit.getRecoPos2D().y() > firstHit.getRecoPos2D().y()) {
122  outputSegments.push_back(segment.reversed());
123  } else {
124  outputSegments.push_back(segment);
125  }
126  }
127 
128  } else {
129  B2WARNING("Unexpected 'SegmentOrientation' parameter of segment finder module : '" <<
131  "'. No segments are put out.");
132  }
133 }

Member Data Documentation

◆ m_param_segmentOrientationString

std::string m_param_segmentOrientationString = ""
private

Parameter: String that states the desired segment orientation.

Valid orientations are "none" (unchanged), "outwards", "downwards", "symmetric", "curling"

Definition at line 62 of file SegmentOrienter.h.

◆ m_segmentOrientation

EPreferredDirection m_segmentOrientation = EPreferredDirection::c_None
private

Encoded desired segment orientation.

Valid orientations are "c_None" (unchanged), "c_Outwards", "c_Downwards", "c_Symmetric", "c_Curling",

Definition at line 68 of file SegmentOrienter.h.


The documentation for this class was generated from the following files:
Belle2::TrackFindingCDC::SegmentOrienter::m_segmentOrientation
EPreferredDirection m_segmentOrientation
Encoded desired segment orientation.
Definition: SegmentOrienter.h:68
Belle2::TrackFindingCDC::SegmentOrienter::m_param_segmentOrientationString
std::string m_param_segmentOrientationString
Parameter: String that states the desired segment orientation.
Definition: SegmentOrienter.h:62