8#include <tracking/trackFindingCDC/findlets/minimal/SegmentOrienter.h>
10#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
12#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14#include <framework/core/ModuleParamList.templateDetails.h>
15#include <framework/logging/Logger.h>
18using namespace TrackFindingCDC;
22 return "Fixes the flight direction of segments to a preferred orientation by simple heuristics.";
28 moduleParamList->
addParameter(prefixed(prefix,
"SegmentOrientation"),
30 "Option which orientation of segments 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<CDCSegment2D>& outputSegments)
58 outputSegments = inputSegments;
61 outputSegments.reserve(2 * inputSegments.size());
63 outputSegments.push_back(segment);
64 if (segment->hasReverseFlag())
continue;
65 outputSegments.back()->setReverseFlag();
66 outputSegments.push_back(segment.reversed());
67 outputSegments.back()->setReverseFlag();
73 outputSegments.reserve(1.5 * inputSegments.size());
75 if (segment->hasReverseFlag()) {
76 outputSegments.push_back(segment);
80 bool isFitted = trajectory2D.
isFitted();
81 bool isCurler = trajectory2D.
isCurler(1.1);
84 bool isLeaver = isFitted and (not isCurler) and isOriginer;
90 outputSegments.push_back(segment.reversed());
92 outputSegments.push_back(segment);
96 outputSegments.push_back(segment);
97 outputSegments.back()->setReverseFlag();
98 outputSegments.push_back(segment.reversed());
99 outputSegments.back()->setReverseFlag();
104 outputSegments.reserve(inputSegments.size());
109 outputSegments.push_back(segment.reversed());
111 outputSegments.push_back(segment);
115 outputSegments.reserve(inputSegments.size());
120 outputSegments.push_back(segment.reversed());
122 outputSegments.push_back(segment);
127 B2WARNING(
"Unexpected 'SegmentOrientation' parameter of segment finder module : '" <<
129 "'. No segments are put out.");
The Module parameter list class.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
A reconstructed sequence of two dimensional hits in one super layer.
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.
void initialize() override
Receive and dispatch signal before the start of the event processing.
std::string m_param_segmentOrientationString
Parameter: String that states the desired segment orientation.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCSegment2D > &outputSegments) final
Main algorithm applying the adjustment of the orientation.
void initialize() final
Signals the beginning of the event processing.
EPreferredDirection m_segmentOrientation
Encoded desired segment 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.
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.