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 CDCTrack, CDCTrack > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 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< CDCTrack > &inputTracks, std::vector< 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.
 

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 CDCTrack, 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 26 of file TrackOrienter.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = Findlet<const CDCTrack, CDCTrack>
private

Type of the base class.

Definition at line 30 of file TrackOrienter.h.

◆ ToVector

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< CDCTrack > & inputTracks,
std::vector< CDCTrack > & outputTracks )
final

Main algorithm applying the adjustment of the orientation.

Copy tracks to output fixing their orientation

Definition at line 52 of file TrackOrienter.cc.

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

◆ 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 26 of file TrackOrienter.cc.

27{
28 moduleParamList->addParameter(prefixed(prefix, "TrackOrientation"),
30 "Option which orientation of tracks shall be generate. "
31 "Valid options are '' (default of the finder), "
32 "'none' (one orientation, algorithm dependent), "
33 "'symmetric', "
34 "'curling', "
35 "'outwards', "
36 "'downwards'.",
38}
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 CDCTrack, CDCTrack >.

Definition at line 21 of file TrackOrienter.cc.

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

◆ 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 40 of file TrackOrienter.cc.

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

◆ 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 50 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 56 of file TrackOrienter.h.


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