Belle II Software development
SegmentFitter Class Referenceabstract

Fits segments with the Riemann method. More...

#include <SegmentFitter.h>

Inheritance diagram for SegmentFitter:
Findlet< CDCSegment2D & > CompositeProcessingSignalListener ProcessingSignalListener

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 () override
 Short description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters to a module.
 
void initialize () override
 Signals the beginning of the event processing.
 
void apply (std::vector< CDCSegment2D > &outputSegments) override
 Main algorithm applying the fit to each segment.
 
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< CDCSegment2D & >
 Type of the base class.
 

Private Attributes

bool m_param_karimakiFit = false
 Parameter : Switch to use Karimaki fit.
 
std::string m_param_fitPosString = "recoPos"
 Parameter : Option string which positional information from the hits should be used.
 
std::string m_param_fitVarianceString = "proper"
 Parameter : Option string which variance information from the hits should be used.
 
bool m_param_updateDriftLength = true
 Parameter : Switch to reestimate the drift length before the fit.
 
bool m_param_updateRecoPos = false
 Parameter : Switch to reevaluate the position and right left passage information based in the fit.
 
EFitPos m_fitPos = EFitPos::c_RecoPos
 Option which positional information from the hits should be used.
 
EFitVariance m_fitVariance = EFitVariance::c_Proper
 Option which variance information from the hits should be used.
 
CDCRiemannFitter m_riemannFitter
 Instance of the riemann fitter to be used.
 
CDCKarimakiFitter m_karimakiFitter
 Instance of the karimaki fitter to be used.
 
DriftLengthEstimator m_driftLengthEstimator
 Instance of the drift length estimator to be used.
 
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

Fits segments with the Riemann method.

Definition at line 34 of file SegmentFitter.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invokation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invokation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = Findlet<CDCSegment2D&>
private

Type of the base class.

Definition at line 39 of file SegmentFitter.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.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.

◆ apply()

void apply ( std::vector< CDCSegment2D > &  outputSegments)
override

Main algorithm applying the fit to each segment.

Definition at line 87 of file SegmentFitter.cc.

88{
89 // Update the drift length
91 for (CDCSegment2D& segment : outputSegments) {
93 }
94 }
95
96 for (const CDCSegment2D& segment : outputSegments) {
98 observations2D.appendRange(segment);
99
100 if (m_param_karimakiFit or observations2D.size() < 4) {
101 // Karimaki only works with the reconstructed position
102 if (m_fitPos != EFitPos::c_RecoPos) {
103 observations2D.clear();
104 observations2D.setFitPos(EFitPos::c_RecoPos);
105 observations2D.appendRange(segment);
106 }
107 CDCTrajectory2D trajectory2D = m_karimakiFitter.fit(observations2D);
108 segment.setTrajectory2D(trajectory2D);
109 } else {
110
111 CDCTrajectory2D trajectory2D = m_riemannFitter.fit(observations2D);
112 segment.setTrajectory2D(trajectory2D);
113 }
114 }
115
117 for (CDCSegment2D& segment : outputSegments) {
118 const CDCTrajectory2D& trajectory2D = segment.getTrajectory2D();
119 if (not trajectory2D.isFitted()) continue;
120 int nRLChanges = 0;
121 for (CDCRecoHit2D& recoHit2D : segment) {
122 ERightLeft rlInfo = trajectory2D.isRightOrLeft(recoHit2D.getRefPos2D());
123 if (rlInfo != recoHit2D.getRLInfo()) ++nRLChanges;
124 recoHit2D.setRLInfo(rlInfo);
125 const CDCRLWireHit& rlWireHit = recoHit2D.getRLWireHit();
126 Vector2D recoPos2D = rlWireHit.reconstruct2D(trajectory2D);
127 recoHit2D.setRecoPos2D(recoPos2D);
128 }
129 if (nRLChanges > 0) B2DEBUG(25, "RL changes " << nRLChanges);
130 }
131 }
132}
CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
Class serving as a storage of observed drift circles to present to the Riemann fitter.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
Vector2D reconstruct2D(const CDCTrajectory2D &trajectory2D) const
Reconstructs a position of primary ionisation on the drift circle.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
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.
ERightLeft isRightOrLeft(const Vector2D &point) const
Checks if the given point is to the right or to the left of the trajectory.
EFitPos m_fitPos
Option which positional information from the hits should be used.
Definition: SegmentFitter.h:72
DriftLengthEstimator m_driftLengthEstimator
Instance of the drift length estimator to be used.
Definition: SegmentFitter.h:84
bool m_param_karimakiFit
Parameter : Switch to use Karimaki fit.
Definition: SegmentFitter.h:57
CDCKarimakiFitter m_karimakiFitter
Instance of the karimaki fitter to be used.
Definition: SegmentFitter.h:81
bool m_param_updateDriftLength
Parameter : Switch to reestimate the drift length before the fit.
Definition: SegmentFitter.h:66
CDCRiemannFitter m_riemannFitter
Instance of the riemann fitter to be used.
Definition: SegmentFitter.h:78
EFitVariance m_fitVariance
Option which variance information from the hits should be used.
Definition: SegmentFitter.h:75
bool m_param_updateRecoPos
Parameter : Switch to reevaluate the position and right left passage information based in the fit.
Definition: SegmentFitter.h:69
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25
double updateDriftLength(CDCRecoHit2D &recoHit2D)
Update the drift length of the reconstructed hit in place.

◆ 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 
)
overridevirtual

Expose the parameters to a module.

Reimplemented from Findlet< CDCSegment2D & >.

Definition at line 27 of file SegmentFitter.cc.

28{
29 moduleParamList->addParameter(prefixed(prefix, "karimakiFit"),
31 "Switch to select Karimaki method for fitting instead of Riemann fit",
33
34 moduleParamList->addParameter(prefixed(prefix, "fitPos"),
36 "Positional information of the hits to be used in the fit. "
37 "Options are 'recoPos', 'rlDriftCircle', 'wirePos'.",
39
40 moduleParamList->addParameter(prefixed(prefix, "fitVariance"),
42 "Positional information of the hits to be used in the fit. "
43 "Options are 'unit', 'driftLength', 'pseudo', 'proper'.",
45
46 moduleParamList->addParameter(prefixed(prefix, "updateDriftLength"),
48 "Switch to reestimate the drift length",
50
51 moduleParamList->addParameter(prefixed(prefix, "updateRecoPos"),
53 "Switch to reestimate the position and right left passage information",
55
56 m_driftLengthEstimator.exposeParameters(moduleParamList, prefix);
57}
std::string m_param_fitVarianceString
Parameter : Option string which variance information from the hits should be used.
Definition: SegmentFitter.h:63
std::string m_param_fitPosString
Parameter : Option string which positional information from the hits should be used.
Definition: SegmentFitter.h:60
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Add the parameters of the estimator to the module.

◆ getDescription()

std::string getDescription ( )
overridevirtual

Short description of the findlet.

Reimplemented from Findlet< CDCSegment2D & >.

Definition at line 22 of file SegmentFitter.cc.

23{
24 return "Fits each segment with a selectable method";
25}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

Signals the beginning of the event processing.

Reimplemented from ProcessingSignalListener.

Definition at line 60 of file SegmentFitter.cc.

61{
63 if (m_param_fitPosString != std::string("")) {
64 try {
65 m_fitPos = getFitPos(m_param_fitPosString);
66 } catch (std::invalid_argument& e) {
67 B2ERROR("Unexpected fitPos parameter : '" << m_param_fitPosString);
68 }
69 }
70
71 if (m_param_fitVarianceString != std::string("")) {
72 try {
74 } catch (std::invalid_argument& e) {
75 B2ERROR("Unexpected fitVariance parameter : '" << m_param_fitVarianceString);
76 }
77 }
78
80 if (m_fitPos != EFitPos::c_RecoPos) {
81 B2WARNING("Karimaki fitter only works with the reconstructed position as input.");
82 }
83 m_fitPos = EFitPos::c_RecoPos;
84 }
85}
void initialize() override
Receive and dispatch signal before the start of the event processing.

◆ 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_driftLengthEstimator

DriftLengthEstimator m_driftLengthEstimator
private

Instance of the drift length estimator to be used.

Definition at line 84 of file SegmentFitter.h.

◆ m_fitPos

EFitPos m_fitPos = EFitPos::c_RecoPos
private

Option which positional information from the hits should be used.

Definition at line 72 of file SegmentFitter.h.

◆ m_fitVariance

EFitVariance m_fitVariance = EFitVariance::c_Proper
private

Option which variance information from the hits should be used.

Definition at line 75 of file SegmentFitter.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happend 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_karimakiFitter

CDCKarimakiFitter m_karimakiFitter
private

Instance of the karimaki fitter to be used.

Definition at line 81 of file SegmentFitter.h.

◆ m_param_fitPosString

std::string m_param_fitPosString = "recoPos"
private

Parameter : Option string which positional information from the hits should be used.

Definition at line 60 of file SegmentFitter.h.

◆ m_param_fitVarianceString

std::string m_param_fitVarianceString = "proper"
private

Parameter : Option string which variance information from the hits should be used.

Definition at line 63 of file SegmentFitter.h.

◆ m_param_karimakiFit

bool m_param_karimakiFit = false
private

Parameter : Switch to use Karimaki fit.

Definition at line 57 of file SegmentFitter.h.

◆ m_param_updateDriftLength

bool m_param_updateDriftLength = true
private

Parameter : Switch to reestimate the drift length before the fit.

Definition at line 66 of file SegmentFitter.h.

◆ m_param_updateRecoPos

bool m_param_updateRecoPos = false
private

Parameter : Switch to reevaluate the position and right left passage information based in the fit.

Definition at line 69 of file SegmentFitter.h.

◆ m_riemannFitter

CDCRiemannFitter m_riemannFitter
private

Instance of the riemann fitter to be used.

Definition at line 78 of file SegmentFitter.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 happend before.

Definition at line 55 of file ProcessingSignalListener.h.


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