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/trackFindingCDC/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>
59 void CDCFitter2D<AFitMethod>::update(CDCTrajectory2D& trajectory2D, CDCObservations2D&& observations2D) const
60 {
61 AFitMethod::update(trajectory2D, observations2D);
62 }
63
64 template <class AFitMethod>
66 {
67 return fitGeneric(track);
68 }
69
70 template <class AFitMethod>
72 {
73 return fitGeneric(segment);
74 }
75
76 template <class AFitMethod>
78 {
79 return fitGeneric(segment);
80 }
81
82 template <class AFitMethod>
83 CDCTrajectory2D CDCFitter2D<AFitMethod>::fit(const std::vector<const CDCWireHit*>& wireHits) const
84 {
85 return fitGeneric(wireHits);
86 }
87
88 template <class AFitMethod>
89 CDCTrajectory2D CDCFitter2D<AFitMethod>::fit(const std::vector<const CDCWire*>& wires) const
90 {
91 return fitGeneric(wires);
92 }
93
94 template <class AFitMethod>
96 {
97 return fitGeneric(wireHits);
98 }
99
100 template <class AFitMethod>
102 const CDCSegment2D& toSegment) const
103 {
104 return fitGeneric(fromSegment, toSegment);
105 }
106
107 template <class AFitMethod>
109 const CDCSegment2D& segment) const
110 {
111 updateGeneric(trajectory2D, segment);
112 }
113
114 template <class AFitMethod>
116 const CDCAxialSegmentPair& axialSegmentPair) const
118 return updateGeneric(trajectory2D, axialSegmentPair);
119 }
121 template <class AFitMethod>
122 template <class AHits>
124 {
125 CDCTrajectory2D result;
126 updateGeneric(result, hits);
127 return result;
128 }
129
130 template <class AFitMethod>
131 template <class AStartHits, class AEndHits>
133 CDCFitter2D<AFitMethod>::fitGeneric(const AStartHits& startHits, const AEndHits& endHits) const
134 {
135 CDCTrajectory2D result;
136 updateGeneric(result, startHits, endHits);
137 return result;
138 }
139
140 template <class AFitMethod>
141 template <class AStartHits, class AEndHits>
143 const AStartHits& startHits,
144 const AEndHits& endHits) const
145 {
146 CDCObservations2D observations2D;
147 observations2D.setFitVariance(m_fitVariance);
148
149 if (m_usePosition) {
150 observations2D.setFitPos(EFitPos::c_RecoPos);
151 observations2D.appendRange(startHits);
152 }
153 if (m_useOrientation) {
154 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
155 observations2D.appendRange(startHits);
156 }
157
158 if (m_usePosition) {
159 observations2D.setFitPos(EFitPos::c_RecoPos);
160 observations2D.appendRange(endHits);
161 }
162 if (m_useOrientation) {
163 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
164 observations2D.appendRange(endHits);
165 }
166
167 if (observations2D.size() < 4) {
168 trajectory2D.clear();
169 } else {
170 AFitMethod::update(trajectory2D, observations2D);
171 }
172 }
173
174 template <class AFitMethod>
175 template <class AHits>
176 void
177 CDCFitter2D<AFitMethod>::updateGeneric(CDCTrajectory2D& trajectory2D, const AHits& hits) const
178 {
179 CDCObservations2D observations2D;
180 observations2D.setFitVariance(m_fitVariance);
181
182 if (m_usePosition) {
183 observations2D.setFitPos(EFitPos::c_RecoPos);
184 observations2D.appendRange(hits);
185 }
186 if (m_useOrientation) {
187 observations2D.setFitPos(EFitPos::c_RLDriftCircle);
188 observations2D.appendRange(hits);
189 }
190
191 if (observations2D.size() < 4) {
192 trajectory2D.clear();
193 } else {
194 AFitMethod::update(trajectory2D, observations2D);
195 }
196 }
197
198 template <class AFitMethod>
200 {
201 m_usePosition = true;
202 m_useOrientation = false;
203 }
204
205 template <class AFitMethod>
207 {
208 m_usePosition = false;
209 m_useOrientation = true;
210 }
211
212 template <class AFitMethod>
214 {
215 m_usePosition = true;
216 m_useOrientation = true;
217 }
218
219 template <class AFitMethod>
220 void CDCFitter2D<AFitMethod>::setFitVariance(EFitVariance fitVariance)
221 {
222 m_fitVariance = fitVariance;
223 }
224 }
226}
Class representing a pair of reconstructed axial segements in adjacent superlayer.
CDCTrajectory2D fitGeneric(const AHits &hits) const
Fits a collection of hit typs which are convertable to observation circles.
void updateGeneric(CDCTrajectory2D &trajectory2D, const AHits &hits) const
Updates a given trajectory with a fit to a collection of hits types, which are convertable to observa...
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 update(CDCTrajectory2D &trajectory2D, const CDCObservations2D &observations2D) const
Update the trajectory with a fit to the observations.
void useOnlyOrientation()
Setup the fitter to use only reference position and the drift length with right left orientation.
void usePositionAndOrientation()
Setup the fitter to use both the reconstructed position and the reference position and the drift leng...
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 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.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
A segment consisting of three dimensional reconstructed hits.
Definition: CDCSegment3D.h:26
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle trajectory as it is seen in xy projection represented as a circle.
void clear()
Clears all information from this trajectoy.
A segment consisting of two dimensional reconsturcted hits.
Abstract base class for different kinds of events.