Belle II Software development
TrackOrienter Class Referenceabstract

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

#include <TrackOrienter.h>

Inheritance diagram for TrackOrienter:
Findlet< const TrackingUtilities::CDCTrack, TrackingUtilities::CDCTrack > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

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< TrackingUtilities::CDCTrack > &inputTracks, std::vector< TrackingUtilities::CDCTrack > &outputTracks) final
 Main algorithm applying the adjustment of the orientation.
 
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
 Short hand for ToRangeImpl.
 
using ToVector
 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 = TrackingUtilities::Findlet<const TrackingUtilities::CDCTrack, TrackingUtilities::CDCTrack>
 Type of the base class.
 

Private Attributes

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

Detailed Description

Fixes the orientation of tracks by a simple heuristic.

Definition at line 29 of file TrackOrienter.h.

Member Typedef Documentation

◆ IOTypes [1/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOTypes [2/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors [1/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ IOVectors [2/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Type of the base class.

Definition at line 33 of file TrackOrienter.h.

◆ ToVector [1/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

◆ ToVector [2/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26

◆ apply()

void apply ( const std::vector< TrackingUtilities::CDCTrack > & inputTracks,
std::vector< TrackingUtilities::CDCTrack > & outputTracks )
final

Main algorithm applying the adjustment of the orientation.

Copy tracks to output fixing their orientation

Definition at line 53 of file TrackOrienter.cc.

55{
57 if (m_trackOrientation == EPreferredDirection::c_None) {
58 // Copy the tracks unchanged.
59 outputTracks = inputTracks;
60
61 } else if (m_trackOrientation == EPreferredDirection::c_Symmetric) {
62 outputTracks.reserve(2 * inputTracks.size());
63 for (const CDCTrack& track : inputTracks) {
64 outputTracks.push_back(track.reversed());
65 outputTracks.push_back(track);
66 }
67
68 } else if (m_trackOrientation == EPreferredDirection::c_Curling) {
69 // Only make a copy for tracks that are curling inside the CDC
70 // Others fix to flighing outwards
71 outputTracks.reserve(1.5 * inputTracks.size());
72 for (const CDCTrack& track : inputTracks) {
73 const CDCTrajectory3D& startTrajectory3D = track.getStartTrajectory3D();
74 const CDCTrajectory2D startTrajectory2D = startTrajectory3D.getTrajectory2D();
75
76 const CDCTrajectory3D& endTrajectory3D = track.getEndTrajectory3D();
77 const CDCTrajectory2D endTrajectory2D = endTrajectory3D.getTrajectory2D();
78 bool isFitted = startTrajectory2D.isFitted() and endTrajectory2D.isFitted();
79 bool isStartLeaver = (not endTrajectory2D.isCurler(1.1)) and startTrajectory2D.isOriginer();
80 bool isEndLeaver = (not startTrajectory2D.isCurler(1.1)) and endTrajectory2D.isOriginer();
81 // Trajectory is leaving the CDC starting in the inner volume
82 bool isLeaver = isFitted and (isStartLeaver or isEndLeaver);
83 if (isLeaver) {
84 // Fix to outwards flying
85 const CDCRecoHit3D& firstHit = track.front();
86 const CDCRecoHit3D& lastHit = track.back();
87 if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
88 outputTracks.push_back(track.reversed());
89 } else {
90 outputTracks.push_back(track);
91 }
92 } else {
93 // Ambiguous keep both options
94 outputTracks.push_back(track);
95 outputTracks.push_back(track.reversed());
96 }
97 }
98
99 } else if (m_trackOrientation == EPreferredDirection::c_Outwards) {
100 outputTracks.reserve(inputTracks.size());
101 for (const CDCTrack& track : inputTracks) {
102 const CDCRecoHit3D& firstHit = track.front();
103 const CDCRecoHit3D& lastHit = track.back();
104 if (lastHit.getRecoPos2D().cylindricalR() < firstHit.getRecoPos2D().cylindricalR()) {
105 outputTracks.push_back(track.reversed());
106 } else {
107 outputTracks.push_back(track);
108 }
109 }
110
111 } else if (m_trackOrientation == EPreferredDirection::c_Downwards) {
112 outputTracks.reserve(inputTracks.size());
113 for (const CDCTrack& track : inputTracks) {
114 const CDCRecoHit3D& firstHit = track.front();
115 const CDCRecoHit3D& lastHit = track.back();
116 if (lastHit.getRecoPos2D().y() > firstHit.getRecoPos2D().y()) {
117 outputTracks.push_back(track.reversed());
118 } else {
119 outputTracks.push_back(track);
120 }
121 }
122
123 } else {
124 B2WARNING("Unexpected 'TrackOrientation' parameter of track finder module : '" <<
126 "'. No tracks are put out.");
127 }
128}
EPreferredDirection m_trackOrientation
Encoded desired track orientation.
std::string m_param_trackOrientationString
Parameter: String that states the desired track orientation.
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
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.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition Vector2D.h:588
double y() const
Getter for the y coordinate.
Definition Vector2D.h:641

◆ beginEvent()

void beginEvent ( )
overrideinherited

Receive and dispatch signal for the start of a new event.

Definition at line 36 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overrideinherited

Receive and dispatch signal for the beginning of a new run.

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
void endRun() override
Receive and dispatch signal for the end of the run.
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
finalvirtual

Expose the parameters to a module.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 27 of file TrackOrienter.cc.

28{
29 moduleParamList->addParameter(prefixed(prefix, "TrackOrientation"),
31 "Option which orientation of tracks shall be generate. "
32 "Valid options are '' (default of the finder), "
33 "'none' (one orientation, algorithm dependent), "
34 "'symmetric', "
35 "'curling', "
36 "'outwards', "
37 "'downwards'.",
39}
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription()

std::string getDescription ( )
finalvirtual

Short description of the findlet.

Reimplemented from Findlet< const TrackingUtilities::CDCTrack, TrackingUtilities::CDCTrack >.

Definition at line 22 of file TrackOrienter.cc.

23{
24 return "Fixes the flight direction of tracks to a preferred orientation by simple heuristics.";
25}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
finalvirtual

Signals the beginning of the event processing.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 41 of file TrackOrienter.cc.

42{
44 if (m_param_trackOrientationString != std::string("")) {
45 try {
47 } catch (std::invalid_argument& e) {
48 B2ERROR("Unexpected 'TrackOrientation' parameter : '" << m_param_trackOrientationString);
49 }
50 }
51}

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
void terminate() override
Receive and dispatch Signal for termination of the event processing.
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_initialized

bool m_initialized
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_param_trackOrientationString

std::string m_param_trackOrientationString = ""
private

Parameter: String that states the desired track orientation.

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

Definition at line 54 of file TrackOrienter.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_trackOrientation

EPreferredDirection m_trackOrientation = EPreferredDirection::c_None
private

Encoded desired track orientation.

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

Definition at line 60 of file TrackOrienter.h.


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