8#include <tracking/trackFindingCDC/findlets/minimal/TrackOrienter.h>
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
11#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
13#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
15#include <framework/core/ModuleParamList.templateDetails.h>
16#include <framework/logging/Logger.h>
19using namespace TrackFindingCDC;
23 return "Fixes the flight direction of tracks to a preferred orientation by simple heuristics.";
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), "
46 }
catch (std::invalid_argument& e) {
53 std::vector<CDCTrack>& outputTracks)
58 outputTracks = inputTracks;
61 outputTracks.reserve(2 * inputTracks.size());
62 for (
const CDCTrack& track : inputTracks) {
63 outputTracks.push_back(track.reversed());
64 outputTracks.push_back(track);
70 outputTracks.reserve(1.5 * inputTracks.size());
71 for (
const CDCTrack& track : inputTracks) {
72 const CDCTrajectory3D& startTrajectory3D = track.getStartTrajectory3D();
78 bool isStartLeaver = (not endTrajectory2D.
isCurler(1.1)) and startTrajectory2D.
isOriginer();
79 bool isEndLeaver = (not startTrajectory2D.
isCurler(1.1)) and endTrajectory2D.
isOriginer();
81 bool isLeaver = isFitted and (isStartLeaver or isEndLeaver);
87 outputTracks.push_back(track.reversed());
89 outputTracks.push_back(track);
93 outputTracks.push_back(track);
94 outputTracks.push_back(track.reversed());
99 outputTracks.reserve(inputTracks.size());
100 for (
const CDCTrack& track : inputTracks) {
104 outputTracks.push_back(track.reversed());
106 outputTracks.push_back(track);
111 outputTracks.reserve(inputTracks.size());
112 for (
const CDCTrack& track : inputTracks) {
116 outputTracks.push_back(track.reversed());
118 outputTracks.push_back(track);
123 B2WARNING(
"Unexpected 'TrackOrientation' parameter of track finder module : '" <<
125 "'. No tracks are put out.");
The Module parameter list class.
Class representing a three dimensional reconstructed hit.
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Class representing a sequence of three dimensional reconstructed hits.
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.
void initialize() override
Receive and dispatch signal before the start of the event processing.
EPreferredDirection m_trackOrientation
Encoded desired track orientation.
void initialize() final
Signals the beginning of the event processing.
std::string m_param_trackOrientationString
Parameter: String that states the desired track orientation.
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 apply(const std::vector< CDCTrack > &inputTracks, std::vector< CDCTrack > &outputTracks) final
Main algorithm applying the adjustment of the orientation.
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
double y() const
Getter for the y coordinate.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.