Belle II Software  release-08-01-10
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 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 27 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 52 of file SegmentOrienter.cc.

54 {
56  if (m_segmentOrientation == EPreferredDirection::c_None) {
57  // Copy the segments unchanged.
58  outputSegments = inputSegments;
59 
60  } else if (m_segmentOrientation == EPreferredDirection::c_Symmetric) {
61  outputSegments.reserve(2 * inputSegments.size());
62  for (const CDCSegment2D& segment : inputSegments) {
63  outputSegments.push_back(segment);
64  if (segment->hasReverseFlag()) continue; // Already a reverse found in the facet ca
65  outputSegments.back()->setReverseFlag();
66  outputSegments.push_back(segment.reversed());
67  outputSegments.back()->setReverseFlag();
68  }
69 
70  } else if (m_segmentOrientation == EPreferredDirection::c_Curling) {
71  // Only make a copy for segments that are curling inside the CDC
72  // Others fix to flighing outwards
73  outputSegments.reserve(1.5 * inputSegments.size());
74  for (const CDCSegment2D& segment : inputSegments) {
75  if (segment->hasReverseFlag()) {
76  outputSegments.push_back(segment);
77  continue; // Already a reverse found in the facet ca
78  }
79  const CDCTrajectory2D& trajectory2D = segment.getTrajectory2D();
80  bool isFitted = trajectory2D.isFitted();
81  bool isCurler = trajectory2D.isCurler(1.1);
82  bool isOriginer = trajectory2D.isOriginer();
83  // Trajectory is leaving the CDC starting in the inner volume
84  bool isLeaver = isFitted and (not isCurler) and isOriginer;
85  if (isLeaver) {
86  // Fix to outwards flying
87  const CDCRecoHit2D& firstHit = segment.front();
88  const CDCRecoHit2D& lastHit = segment.back();
89  if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
90  outputSegments.push_back(segment.reversed());
91  } else {
92  outputSegments.push_back(segment);
93  }
94  } else {
95  // Ambigious keep both options
96  outputSegments.push_back(segment);
97  outputSegments.back()->setReverseFlag();
98  outputSegments.push_back(segment.reversed());
99  outputSegments.back()->setReverseFlag();
100  }
101  }
102 
103  } else if (m_segmentOrientation == EPreferredDirection::c_Outwards) {
104  outputSegments.reserve(inputSegments.size());
105  for (const CDCSegment2D& segment : inputSegments) {
106  const CDCRecoHit2D& firstHit = segment.front();
107  const CDCRecoHit2D& lastHit = segment.back();
108  if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
109  outputSegments.push_back(segment.reversed());
110  } else {
111  outputSegments.push_back(segment);
112  }
113  }
114  } else if (m_segmentOrientation == EPreferredDirection::c_Downwards) {
115  outputSegments.reserve(inputSegments.size());
116  for (const CDCSegment2D& segment : inputSegments) {
117  const CDCRecoHit2D& firstHit = segment.front();
118  const CDCRecoHit2D& lastHit = segment.back();
119  if (lastHit.getRecoPos2D().y() > firstHit.getRecoPos2D().y()) {
120  outputSegments.push_back(segment.reversed());
121  } else {
122  outputSegments.push_back(segment);
123  }
124  }
125 
126  } else {
127  B2WARNING("Unexpected 'SegmentOrientation' parameter of segment finder module : '" <<
129  "'. No segments are put out.");
130  }
131 }
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
Particle trajectory as it is seen in xy projection represented as a circle.
bool isOriginer(double factor=1) const
Checks if the trajectory intersects with the inner radius of the CDC time the given tolerance factor.
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
bool isFitted() const
Checks if the circle is already set to a valid value.
std::string m_param_segmentOrientationString
Parameter: String that states the desired segment orientation.
EPreferredDirection m_segmentOrientation
Encoded desired segment orientation.
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition: Vector2D.h:569
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:617

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 52 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 58 of file SegmentOrienter.h.


The documentation for this class was generated from the following files: