8#include <tracking/trackFindingCDC/findlets/minimal/SegmentPairCreator.h>
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
11#include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
12#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
14#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
16#include <framework/core/ModuleParamList.templateDetails.h>
24using namespace TrackFindingCDC;
34 return "Creates axial stereo segment pairs from a set of segments filtered by some acceptance criterion";
42 moduleParamList->
addParameter(prefixed(prefix,
"axialBridging"),
44 "Switch to enable the search for axial to axial pairs "
45 "to enable more stable reconstruction of the middle stereo",
50 std::vector<CDCSegmentPair>& segmentPairs)
52 segmentPairs.reserve(500);
56 segmentsInSuperLayer.clear();
60 if (segment.empty())
continue;
61 ISuperLayer iSuperLayer = segment.front().getISuperLayer();
76 create(fromSegments, toSegments, segmentPairs);
83 create(fromSegments, toSegments, segmentPairs);
87 std::sort(segmentPairs.begin(), segmentPairs.end());
92 std::vector<CDCAxialSegmentPair> axialSegmentPairs;
99 const CDCSegment2D* startSegment = axialSegmentPair.getStartSegment();
100 const CDCSegment2D* endSegment = axialSegmentPair.getEndSegment();
102 CDCTrajectory2D startCommonTrajectory = axialSegmentPair.getTrajectory2D();
103 if (not startCommonTrajectory.
isFitted())
continue;
107 startSegment->setTrajectory2D(startCommonTrajectory);
108 std::vector<const CDCSegment2D*> startSegments{startSegment};
110 CDCTrajectory2D endCommonTrajectory = axialSegmentPair.getTrajectory2D();
113 endSegment->setTrajectory2D(endCommonTrajectory);
114 std::vector<const CDCSegment2D*> endSegments{endSegment};
116 if (startSegment->getISuperLayer() == endSegment->getISuperLayer()) {
117 ISuperLayer iSuperLayerCommon = startSegment->getISuperLayer();
122 create(startSegments, middleSegments, segmentPairs);
123 create(middleSegments, endSegments, segmentPairs);
129 create(startSegments, middleSegments, segmentPairs);
130 create(middleSegments, endSegments, segmentPairs);
134 ISuperLayer iSuperLayerMiddle =
135 (startSegment->getISuperLayer() + endSegment->getISuperLayer()) / 2;
137 create(startSegments, middleSegments, segmentPairs);
138 create(middleSegments, endSegments, segmentPairs);
140 startSegment->setTrajectory2D(startTrajectory2D);
141 endSegment->setTrajectory2D(endTrajectory2D);
145 if (lhs < rhs)
return true;
146 if (rhs < lhs)
return false;
150 std::sort(segmentPairs.begin(), segmentPairs.end(), lessPairAndgreaterWeight);
161 const std::vector<const CDCSegment2D*>& toSegments,
162 std::vector<CDCSegmentPair>& segmentPairs)
165 for (
const CDCSegment2D* ptrFromSegment : fromSegments) {
168 if (ptrFromSegment == ptrToSegment)
continue;
169 segmentPair.
setSegments(ptrFromSegment, ptrToSegment);
173 if (not std::isnan(pairWeight)) {
175 segmentPairs.push_back(segmentPair);
The Module parameter list class.
Weight getCellWeight() const
Getter for the cell weight.
void setCellWeight(Weight weight)
Setter for the cell weight.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCAxialSegmentPair > &axialSegmentPairs) final
Main method constructing pairs in adjacent super layers.
Class representing a pair of reconstructed axial segments in adjacent superlayer.
A reconstructed sequence of two dimensional hits in one super layer.
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...
void setSegments(const CDCSegment2D *fromSegment, const CDCSegment2D *toSegment)
Setter for both segments simultaneously.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
void clearTrajectory3D() const
Invalides the currently stored trajectory information.
Particle trajectory as it is seen in xy projection represented as a circle.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
bool isFitted() const
Checks if the circle is already set to a valid value.
const Vector2D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
ChooseableSegmentPairFilter m_segmentPairFilter
The filter to be used for the segment pair generation.
AxialSegmentPairCreator m_axialSegmentPairCreator
Findlet responsible for the creation of axial axial segment pairs.
void create(const std::vector< const CDCSegment2D * > &fromSegments, const std::vector< const CDCSegment2D * > &toSegments, std::vector< CDCSegmentPair > &segmentPairs)
Creates segment pairs from a combination of from segments and to segments.
std::string getDescription() final
Short description of the findlet.
SegmentPairCreator()
Constructor adding the filter as a subordinary processing signal listener.
bool m_param_axialBridging
Parameter : Switch to enable the search for axial to axial pairs to enable more stable reconstruction...
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
std::array< std::vector< const CDCSegment2D * >, ISuperLayerUtil::c_N > m_segmentsBySuperLayer
Structure for the segments grouped by super layer id.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCSegmentPair > &segmentPairs) final
Main method constructing pairs in adjacent super layers.
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.
static const ISuperLayer c_N
Constant representing the total number of cdc superlayers.
static ISuperLayer getNextInwards(ISuperLayer iSuperLayer)
Returns the super layer that is inside of the given super layer.
static bool isInvalid(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...
static ISuperLayer getNextOutwards(ISuperLayer iSuperLayer)
Returns the super layer that is outside of the given super layer.
static bool isInCDC(ISuperLayer iSuperLayer)
Indicates if the given number corresponds to a true cdc superlayer - excludes the logic ids for inner...