Belle II Software development
CDCFitter2D.icc.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/fitting/CDCFitter2D.h>
11
12#include <tracking/trackFindingCDC/fitting/CDCObservations2D.h>
13
14#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
15
16#include <tracking/trackFindingCDC/fitting/EFitVariance.h>
17#include <tracking/trackFindingCDC/fitting/EFitPos.h>
18
19namespace Belle2 {
24 namespace TrackFindingCDC {
25
26 template <class AFitMethod>
28 : m_usePosition(true)
29 , m_useOrientation(false)
30 , m_fitVariance(EFitVariance::c_Proper)
31 {
32 }
33
34 template <class AFitMethod>
36
37 template <class AFitMethod>
39 {
40 return fit(CDCObservations2D(observations2D));
41 }
42
43 template <class AFitMethod>
45 {
47 update(result, observations2D);
48 return result;
49 }
50
51 template <class AFitMethod>
53 const CDCObservations2D& observations2D) const
54 {
55 return update(trajectory2D, CDCObservations2D(observations2D));
56 }
57
58 template <class AFitMethod>
60 {
61 AFitMethod::update(trajectory2D, observations2D);
62 }
63
64 template <class AFitMethod>
69
70 template <class AFitMethod>
75
76 template <class AFitMethod>
81
82 template <class AFitMethod>
83 TrackingUtilities::CDCTrajectory2D CDCFitter2D<AFitMethod>::fit(const std::vector<const TrackingUtilities::CDCWireHit*>& wireHits)
84 const
85 {
86 return fitGeneric(wireHits);
87 }
89 template <class AFitMethod>
90 TrackingUtilities::CDCTrajectory2D CDCFitter2D<AFitMethod>::fit(const std::vector<const CDC::CDCWire*>& wires) const
91 {
92 return fitGeneric(wires);
93 }
94
95 template <class AFitMethod>
100
101 template <class AFitMethod>
103 const TrackingUtilities::CDCSegment2D& toSegment) const
104 {
105 return fitGeneric(fromSegment, toSegment);
107
108 template <class AFitMethod>
110 const TrackingUtilities::CDCSegment2D& segment) const
111 {
112 updateGeneric(trajectory2D, segment);
113 }
114
115 template <class AFitMethod>
117 const TrackingUtilities::CDCAxialSegmentPair& axialSegmentPair) const
119 return updateGeneric(trajectory2D, axialSegmentPair);
120 }
122 template <class AFitMethod>
123 template <class AHits>
125 {
127 updateGeneric(result, hits);
128 return result;
129 }
130
131 template <class AFitMethod>
132 template <class AStartHits, class AEndHits>
134 CDCFitter2D<AFitMethod>::fitGeneric(const AStartHits& startHits, const AEndHits& endHits) const
135 {
137 updateGeneric(result, startHits, endHits);
138 return result;
139 }
140
141 template <class AFitMethod>
142 template <class AStartHits, class AEndHits>
144 const AStartHits& startHits,
145 const AEndHits& endHits) const
146 {
147 CDCObservations2D observations2D;
148 observations2D.setFitVariance(m_fitVariance);
149
150 if (m_usePosition) {
151 observations2D.setFitPos(EFitPos::c_RecoPos);
152 observations2D.appendRange(startHits);
153 }
154 if (m_useOrientation) {
155 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
156 observations2D.appendRange(startHits);
157 }
158
159 if (m_usePosition) {
160 observations2D.setFitPos(EFitPos::c_RecoPos);
161 observations2D.appendRange(endHits);
162 }
163 if (m_useOrientation) {
164 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
165 observations2D.appendRange(endHits);
166 }
167
168 if (observations2D.size() < 4) {
169 trajectory2D.clear();
170 } else {
171 AFitMethod::update(trajectory2D, observations2D);
172 }
173 }
174
175 template <class AFitMethod>
176 template <class AHits>
177 void
179 {
180 CDCObservations2D observations2D;
181 observations2D.setFitVariance(m_fitVariance);
182
183 if (m_usePosition) {
184 observations2D.setFitPos(EFitPos::c_RecoPos);
185 observations2D.appendRange(hits);
186 }
187 if (m_useOrientation) {
188 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
189 observations2D.appendRange(hits);
190 }
191
192 if (observations2D.size() < 4) {
193 trajectory2D.clear();
194 } else {
195 AFitMethod::update(trajectory2D, observations2D);
196 }
197 }
198
199 template <class AFitMethod>
205
206 template <class AFitMethod>
212
213 template <class AFitMethod>
219
220 template <class AFitMethod>
221 void CDCFitter2D<AFitMethod>::setFitVariance(EFitVariance fitVariance)
222 {
223 m_fitVariance = fitVariance;
224 }
225 }
227}
TrackingUtilities::CDCTrajectory2D fitGeneric(const AHits &hits) const
Fits a collection of hit typs which are convertible to observation circles.
void updateGeneric(TrackingUtilities::CDCTrajectory2D &trajectory2D, const AHits &hits) const
Updates a given trajectory with a fit to a collection of hits types, which are convertible to observa...
bool m_useOrientation
Flag indicating the reference position and drift length with right left orientation shall be used in ...
TrackingUtilities::CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
void setFitVariance(EFitVariance fitVariance)
Setup the fitter to use the given variance measure by default.
void useOnlyOrientation()
Setup the fitter to use only reference position and the drift length with right left orientation.
void update(TrackingUtilities::CDCTrajectory2D &trajectory2D, const CDCObservations2D &observations2D) const
void usePositionAndOrientation()
Setup the fitter to use both the reconstructed position and the reference position and the drift leng...
TrackingUtilities::CDCTrajectory2D fitGeneric(const AStartHits &startHits, const AEndHits &endHits) const
Fits together two collections of hit types which are convertible to observation circles.
void update(TrackingUtilities::CDCTrajectory2D &trajectory2D, CDCObservations2D &&observations2D) const
Update the trajectory with a fit to the observations.
bool m_usePosition
Flag indicating the reconstructed position shall be used in the fit.
EFitVariance m_fitVariance
Default variance to be used in the fit.
void useOnlyPosition()
Setup the fitter to use only the reconstructed positions of the hits.
Class serving as a storage of observed drift circles to present to the Riemann fitter.
void setFitVariance(EFitVariance fitVariance)
Setter for the indicator that the drift variance should be used.
std::size_t appendRange(const TrackingUtilities::CDCSegment2D &segment2D)
Appends all reconstructed hits from the two dimensional segment.
std::size_t size() const
Returns the number of observations stored.
void setFitPos(EFitPos fitPos)
Setter for the indicator that the reconstructed position should be favoured.
Class representing a pair of reconstructed axial segments in adjacent superlayer.
A reconstructed sequence of two dimensional hits in one super layer.
A segment consisting of three dimensional reconstructed hits.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:39
Particle trajectory as it is seen in xy projection represented as a circle.
void clear()
Clears all information from this trajectory.
A segment consisting of two dimensional reconstructed hits.
Abstract base class for different kinds of events.