Belle II Software development
SimpleSegmentPairFilter Class Reference

Filter for the construction of axial to axial segment pairs based on simple criterions. More...

#include <SimpleSegmentPairFilter.h>

Inheritance diagram for SimpleSegmentPairFilter:
Filter< CDCSegmentPair > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = CDCSegmentPair
 Type of the object to be analysed.
 
using Interface = Filter< CDCSegmentPair >
 Mark this class as the basic interface.
 

Public Member Functions

Weight operator() (const CDCSegmentPair &segmentPair) final
 Checks if a pair of segments is a good combination.
 
const CDCTrajectory2DgetFittedTrajectory2D (const CDCSegment2D &segment) const
 Returns the trajectory of the segment. Also fits it if necessary.
 
const CDCTrajectory3DgetFittedTrajectory3D (const CDCSegmentPair &segmentPair) const
 Returns the three dimensional trajectory of the axial stereo segment pair.
 
const CDCRiemannFittergetRiemannFitter () const
 Returns the xy fitter instance that is used by this filter.
 
virtual void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix)
 Expose the set of parameters of the filter to the module parameter list.
 
virtual bool needsTruthInformation ()
 Indicates if the filter requires Monte Carlo information.
 
virtual Weight operator() (const Object &obj)
 Function to evaluate the object.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
void initialize () override
 Receive and dispatch signal before the start of the event processing.
 
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 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 = ProcessingSignalListener
 Type of the base class.
 

Private Attributes

CDCRiemannFitter m_riemannFitter
 Memory of the Riemann fitter for the circle fits.
 
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 happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Filter for the construction of axial to axial segment pairs based on simple criterions.

Definition at line 26 of file SimpleSegmentPairFilter.h.

Member Typedef Documentation

◆ Interface

using Interface = Filter<CDCSegmentPair >
inherited

Mark this class as the basic interface.

Definition at line 38 of file Filter.dcl.h.

◆ Object

using Object = CDCSegmentPair
inherited

Type of the object to be analysed.

Definition at line 35 of file Filter.dcl.h.

◆ Super

using Super = ProcessingSignalListener
privateinherited

Type of the base class.

Definition at line 25 of file CompositeProcessingSignalListener.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

Receive and dispatch signal for the beginning of a new run.

Reimplemented from ProcessingSignalListener.

Reimplemented in LayerRelationFilter< AFilter >, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, and TrackCandidateResultRefiner.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList moduleParamList,
const std::string &  prefix 
)
virtualinherited

Expose the set of parameters of the filter to the module parameter list.

Note that not all filters have yet exposed their parameters in this way.

This method is deprecated as the exposeParams below uses a less compile heavy equivalent.

Reimplemented in MCSegmentPairFilter, and MCSymmetric< BaseSegmentPairFilter >.

Definition at line 54 of file Filter.icc.h.

42 {
43 }

◆ getFittedTrajectory2D()

const CDCTrajectory2D & getFittedTrajectory2D ( const CDCSegment2D segment) const

Returns the trajectory of the segment. Also fits it if necessary.

Definition at line 92 of file SimpleSegmentPairFilter.cc.

93{
94 CDCTrajectory2D& trajectory2D = segment.getTrajectory2D();
95 if (not trajectory2D.isFitted()) {
96 getRiemannFitter().update(trajectory2D, segment);
97 }
98 return trajectory2D;
99}
void update(CDCTrajectory2D &trajectory2D, const CDCObservations2D &observations2D) const
Update the trajectory with a fit to the observations.
Particle trajectory as it is seen in xy projection represented as a circle.
bool isFitted() const
Checks if the circle is already set to a valid value.
const CDCRiemannFitter & getRiemannFitter() const
Returns the xy fitter instance that is used by this filter.

◆ getFittedTrajectory3D()

const CDCTrajectory3D & getFittedTrajectory3D ( const CDCSegmentPair segmentPair) const

Returns the three dimensional trajectory of the axial stereo segment pair.

Also fits it if necessary.

Definition at line 101 of file SimpleSegmentPairFilter.cc.

102{
103 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
104 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
105
106 const CDCSegment2D& fromSegment = *ptrFromSegment;
107 const CDCSegment2D& toSegment = *ptrToSegment;
108
109 // Do fits if still necessary.
110 getFittedTrajectory2D(fromSegment);
111 getFittedTrajectory2D(toSegment);
112
113 CDCAxialStereoFusion fusionFit;
114 fusionFit.reconstructFuseTrajectories(segmentPair);
115 return segmentPair.getTrajectory3D();
116}
Utility class implementing the Kalmanesk combination of to two dimensional trajectories to one three ...
void reconstructFuseTrajectories(const CDCSegmentPair &segmentPair)
Combine the two trajectories of the segments in the pair and assign the resulting three dimensional t...
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
const CDCSegment2D * getToSegment() const
Getter for the to segment.
CDCTrajectory3D & getTrajectory3D() const
Getter for the three dimensional trajectory.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
const CDCTrajectory2D & getFittedTrajectory2D(const CDCSegment2D &segment) const
Returns the trajectory of the segment. Also fits it if necessary.

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ getRiemannFitter()

const CDCRiemannFitter & getRiemannFitter ( ) const
inline

Returns the xy fitter instance that is used by this filter.

Definition at line 42 of file SimpleSegmentPairFilter.h.

43 {
44 return m_riemannFitter;
45 }
CDCRiemannFitter m_riemannFitter
Memory of the Riemann fitter for the circle fits.

◆ initialize()

void initialize ( )
overridevirtualinherited

Receive and dispatch signal before the start of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in UnionVarSet< AObject >, UnionVarSet< Object >, VariadicUnionVarSet< AVarSets >, ResultStorer< Belle2::CKFToPXDResult >, ResultStorer< Belle2::CKFToSVDResult >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >, OnVarSet< Filter< ATruthVarSet::Object > >, OnVarSet< Filter< AVarSet::Object > >, OnVarSet< BaseFacetFilter >, OnVarSet< BaseFacetRelationFilter >, OnVarSet< BaseAxialSegmentPairFilter >, OnVarSet< BaseSegmentRelationFilter >, OnVarSet< BaseTrackRelationFilter >, OnVarSet< BaseSegmentPairRelationFilter >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreArrayLoader< const Belle2::SpacePoint >, StoreArrayLoader< DataStoreInputTypeRefType >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RelationVarSet< ABaseVarSet >, QualityIndicatorFilter, TwoHitVirtualIPQIFilter, MultiHoughSpaceFastInterceptFinder, RawTrackCandCleaner< AHit >, RawTrackCandCleaner< Belle2::vxdHoughTracking::VXDHoughState >, RecoTrackStorer, ROIFinder, SingleHoughSpaceFastInterceptFinder, SpacePointLoaderAndPreparer, TrackCandidateOverlapResolver, and TrackCandidateResultRefiner.

Definition at line 15 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
virtual void initialize()
Receive signal before the start of the event processing.

◆ needsTruthInformation()

bool needsTruthInformation
virtualinherited

Indicates if the filter requires Monte Carlo information.

Reimplemented in MCSymmetric< BaseSegmentPairFilter >.

Definition at line 57 of file Filter.icc.h.

47 {
48 return false;
49 }

◆ operator()() [1/4]

Weight operator() ( const CDCSegmentPair segmentPair)
final

Checks if a pair of segments is a good combination.

Definition at line 22 of file SimpleSegmentPairFilter.cc.

23{
24 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
25 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
26
27 assert(ptrFromSegment);
28 assert(ptrToSegment);
29
30 const CDCSegment2D& fromSegment = *ptrFromSegment;
31 const CDCSegment2D& toSegment = *ptrToSegment;
32
33 // Do fits
34 const CDCTrajectory2D& fromFit = getFittedTrajectory2D(fromSegment);
35 const CDCTrajectory2D& toFit = getFittedTrajectory2D(toSegment);
36
37 // Check if segments are coaligned
38 bool toSegmentIsCoaligned = fromFit.getTotalArcLength2D(toSegment) >= 0.0;
39 bool fromSegmentIsCoaligned = toFit.getTotalArcLength2D(fromSegment) >= 0.0;
40
41 if (not toSegmentIsCoaligned or not fromSegmentIsCoaligned) {
42 return NAN;
43 }
44
45 // Check if there is a positive gap between from and to segment
46 double fromFitGap = fromFit.getArcLength2DGap(fromSegment, toSegment);
47 double toFitGap = toFit.getArcLength2DGap(fromSegment, toSegment);
48
49 if (fromFitGap < -5 or fromFitGap > 50 or toFitGap < -5 or toFitGap > 50) {
50 return NAN;
51 }
52
53 double fromFitFrontOffset = fromFit.getArcLength2DFrontOffset(fromSegment, toSegment);
54 double toFitBackOffset = toFit.getArcLength2DBackOffset(fromSegment, toSegment);
55
56 if (fromFitFrontOffset < 0 or
57 fromFitFrontOffset > 50 or
58 toFitBackOffset < 0 or
59 toFitBackOffset > 50) {
60 return NAN;
61 }
62
63 Vector2D fromBackRecoPos2D = fromSegment.back().getRecoPos2D();
64 Vector2D toFrontRecoPos2D = toSegment.front().getRecoPos2D();
65
66 // Momentum agreement cut
67 Vector2D fromMom2DAtFromBack = fromFit.getFlightDirection2D(fromBackRecoPos2D);
68 Vector2D toMom2DAtToFront = toFit.getFlightDirection2D(toFrontRecoPos2D);
69
70 Vector2D fromMom2DAtToFront = fromFit.getFlightDirection2D(toFrontRecoPos2D);
71 Vector2D toMom2DAtFromBack = toFit.getFlightDirection2D(fromBackRecoPos2D);
72
73 double momAngleAtFromBack = fromMom2DAtFromBack.angleWith(toMom2DAtFromBack);
74 double momAngleAtToFront = toMom2DAtToFront.angleWith(fromMom2DAtToFront);
75
76 if (fabs(momAngleAtToFront) > 1.0 or fabs(momAngleAtFromBack) > 1.0) {
77 return NAN;
78 }
79
80 // Proximity cut
81 double fromFit_dist2DToFront_toSegment = fromFit.getDist2D(toSegment.front().getRecoPos2D());
82 double toFit_dist2DToBack_fromSegment = toFit.getDist2D(fromSegment.back().getRecoPos2D());
83
84 if (fromFit_dist2DToFront_toSegment < 10 and toFit_dist2DToBack_fromSegment < 10) {
85 getFittedTrajectory3D(segmentPair);
86 return fromSegment.size() + toSegment.size();
87 } else {
88 return NAN;
89 }
90}
double getTotalArcLength2D(const AHits &hits) const
Calculates the perpendicular travel distance from the first position of the hits to the last position...
double getArcLength2DGap(const AFromHits &fromHits, const AToHits &toHits) const
Calculates the perpendicular travel distance from the last position of the fromHits to the first posi...
double getArcLength2DBackOffset(const AFromHits &fromHits, const AToHits &toHits) const
Calculates the perpendicular travel distance from the last position of the fromHits to the last posit...
Vector2D getFlightDirection2D(const Vector2D &point) const
Get the unit direction of flight at the given point, where arcLength2D = 0.
double getArcLength2DFrontOffset(const AFromHits &fromHits, const AToHits &toHits) const
Calculates the perpendicular travel distance from the first position of the fromHits to the first pos...
double getDist2D(const Vector2D &point) const
Calculates the distance from the point to the trajectory as seen from the xy projection.
const CDCTrajectory3D & getFittedTrajectory3D(const CDCSegmentPair &segmentPair) const
Returns the three dimensional trajectory of the axial stereo segment pair.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197

◆ operator()() [2/4]

Weight operator() ( const Object obj)
virtualinherited

Function to evaluate the object.

Base implementation accepts all objects.

Parameters
objThe object to be accepted or rejected.
Returns
A finite float value if the object is accepted. NAN if the object is rejected.

Definition at line 68 of file Filter.icc.h.

53 {
54 return 1;
55 }

◆ operator()() [3/4]

Weight operator() ( const Object obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

Parameters
objThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected. Nullptr is always rejected.

Definition at line 78 of file Filter.icc.h.

59 {
60 return obj ? operator()(*obj) : NAN;
61 }
virtual Weight operator()(const Object &obj)
Function to evaluate the object.
Definition: Filter.icc.h:52

◆ operator()() [4/4]

std::vector< float > operator() ( const std::vector< Object * > &  objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

Definition at line 86 of file Filter.icc.h.

65 {
66 std::vector<float> out;
67 for (const auto& obj : objs) {
68 out.push_back(operator()(obj));
69 }
70 return out;
71 }

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_initialized

bool m_initialized = false
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_riemannFitter

CDCRiemannFitter m_riemannFitter
private

Memory of the Riemann fitter for the circle fits.

Definition at line 49 of file SimpleSegmentPairFilter.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


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