Belle II Software  release-08-01-10
TrackOrienter Class Referenceabstract

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

#include <TrackOrienter.h>

Inheritance diagram for TrackOrienter:
Collaboration diagram for TrackOrienter:

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< CDCTrack > &inputTracks, std::vector< CDCTrack > &outputTracks) 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 CDCTrack, CDCTrack >
 Type of the base class.
 

Private Attributes

std::string m_param_trackOrientationString = ""
 Parameter: String that states the desired track orientation. More...
 
EPreferredDirection m_trackOrientation = EPreferredDirection::c_None
 Encoded desired track 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 tracks by a simple heuristic.

Definition at line 26 of file TrackOrienter.h.

Member Function Documentation

◆ 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  // Ambigious 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 }
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Definition: CDCRecoHit3D.h:297
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
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.
Particle full three dimensional trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
EPreferredDirection m_trackOrientation
Encoded desired track orientation.
Definition: TrackOrienter.h:56
std::string m_param_trackOrientationString
Parameter: String that states the desired track orientation.
Definition: TrackOrienter.h:50
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_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_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: