21 , fSetup(fParameters.GetActiveSetup())
47 const int nStations =
fParameters.GetNstationsActive();
102 for (
int ista = 0; ista < nStations; ista++) {
103 ZSta[ista] = sta[ista].
fZ;
104 mxy[ista].
SetCov(1., 0., 1.);
107 unsigned short N_vTracks = wData.
RecoTracks().size();
109 for (
unsigned short itrack = 0; itrack < N_vTracks; itrack +=
fvec::size()) {
111 if (N_vTracks - itrack <
static_cast<unsigned short>(
fvec::size())) nTracks_SIMD = N_vTracks - itrack;
113 for (
int i = 0; i < nTracks_SIMD; i++) {
118 for (uint i = nTracks_SIMD; i <
fvec::size(); i++) {
123 for (
int ista = 0; ista < nStations; ista++) {
126 z[ista] = ZSta[ista];
131 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
133 int nHitsTrack = t[iVec]->fNofHits;
136 for (
int ih = 0; ih < nHitsTrack; ih++) {
139 const int ista = hit.
Station();
144 w[ista][iVec] =
true;
145 if (sta[ista].timeInfo) {
146 w_time[ista][iVec] =
true;
149 x[ista][iVec] = hit.
X();
150 y[ista][iVec] = hit.
Y();
151 time[ista][iVec] = hit.
T();
152 dt2[ista][iVec] = hit.
dT2();
153 if (!sta[ista].timeInfo) {
154 dt2[ista][iVec] = 1.e4;
156 z[ista][iVec] = hit.
Z();
158 mxy[ista].
X()[iVec] = hit.
X();
159 mxy[ista].
Y()[iVec] = hit.
Y();
160 mxy[ista].
Dx2()[iVec] = hit.
dX2();
161 mxy[ista].
Dy2()[iVec] = hit.
dY2();
162 mxy[ista].
Dxy()[iVec] = hit.
dXY();
163 mxy[ista].
NdfX()[iVec] = 1.;
164 mxy[ista].
NdfY()[iVec] = 1.;
166 fB[ista].
SetSimdEntry(fB_temp.GetBx()[iVec], fB_temp.GetBy()[iVec], fB_temp.GetBz()[iVec], iVec);
169 z_start[iVec] = z[ista][iVec];
170 x_first[iVec] =
x[ista][iVec];
171 y_first[iVec] =
y[ista][iVec];
172 time_first[iVec] = time[ista][iVec];
173 wtime_first[iVec] = sta[ista].
timeInfo ? 1. : 0.;
174 dt2_first[iVec] = dt2[ista][iVec];
175 mxy_first.
X()[iVec] = mxy[ista].
X()[iVec];
176 mxy_first.
Y()[iVec] = mxy[ista].
Y()[iVec];
177 mxy_first.
Dx2()[iVec] = mxy[ista].
Dx2()[iVec];
178 mxy_first.
Dy2()[iVec] = mxy[ista].
Dy2()[iVec];
179 mxy_first.
Dxy()[iVec] = mxy[ista].
Dxy()[iVec];
180 mxy_first.
NdfX()[iVec] = mxy[ista].
NdfX()[iVec];
181 mxy_first.
NdfY()[iVec] = mxy[ista].
NdfY()[iVec];
183 else if (ih == nHitsTrack - 1) {
184 z_end[iVec] = z[ista][iVec];
185 x_last[iVec] =
x[ista][iVec];
186 y_last[iVec] =
y[ista][iVec];
187 mxy_last.
X()[iVec] = mxy[ista].
X()[iVec];
188 mxy_last.
Y()[iVec] = mxy[ista].
Y()[iVec];
189 mxy_last.
Dx2()[iVec] = mxy[ista].
Dx2()[iVec];
190 mxy_last.
Dy2()[iVec] = mxy[ista].
Dy2()[iVec];
191 mxy_last.
Dxy()[iVec] = mxy[ista].
Dxy()[iVec];
192 mxy_last.
NdfX()[iVec] = mxy[ista].
NdfX()[iVec];
193 mxy_last.
NdfY()[iVec] = mxy[ista].
NdfY()[iVec];
194 time_last[iVec] = time[ista][iVec];
195 dt2_last[iVec] = dt2[ista][iVec];
196 wtime_last[iVec] = sta[ista].
timeInfo ? 1. : 0.;
200 for (
int ih = nHitsTrack - 1; ih >= 0; ih--) {
201 const int ista = iSta[ih];
207 fit.
GuessTrack(z_end,
x,
y, z, time, By, w, w_time, nStations);
215 for (
int iter = 0; iter < 2; iter++) {
221 int ista = nStations - 1;
224 dt2_last =
iif(w_time[ista], dt2_last,
fvec(1.e6));
227 tr.
C10() = mxy_last.
Dxy();
228 tr.
X() = mxy_last.
X();
229 tr.
Y() = mxy_last.
Y();
230 tr.
Time() = time_last;
243 fvec dz = fldZ2 - fldZ1;
246 fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0);
248 for (--ista; ista >= 0; ista--) {
251 dz = (fldZ1 - fldZ0);
254 fld.Set(fldB0, fldZ0, fldB1, fldZ1, fldB2, fldZ2);
256 fmask initialised = (z[ista] < z_end) & (z_start <= z[ista]);
262 auto radThick =
fSetup.GetMaterial(ista).GetThicknessX0(tr.
X(), tr.
Y());
266 fit.
SetMask(initialised && w[ista]);
291 for (
int vtxIter = 0; vtxIter < 2; vtxIter++) {
293 fitpv.
Tr() = fit.
Tr();
312 Tf.
Qp() = fitpv.
Tr().
Qp();
315 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
316 t[iVec]->fParFirst.Set(Tf, iVec);
319 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
320 t[iVec]->fParPV.Set(fitpv.
Tr(), iVec);
331 tr.
ResetErrors(mxy_first.
Dx2(), mxy_first.
Dy2(), 0.1, 0.1, 1., dt2_first, 1.e-2);
332 tr.
C10() = mxy_first.
Dxy();
334 tr.
X() = mxy_first.
X();
335 tr.
Y() = mxy_first.
Y();
336 tr.
Time() = time_first;
353 fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0);
355 for (++ista; ista < nStations; ista++) {
357 dz = (fldZ1 - fldZ0);
360 fld.Set(fldB0, fldZ0, fldB1, fldZ1, fldB2, fldZ2);
362 fmask initialised = (z[ista] <= z_end) & (z_start < z[ista]);
366 auto radThick =
fSetup.GetMaterial(ista).GetThicknessX0(tr.
X(), tr.
Y());
369 fit.
SetMask(initialised && w[ista]);
386 Tl.
Qp() = fitpv.
Tr().
Qp();
389 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
390 t[iVec]->fParLast.Set(Tl, iVec);
friend fvec iif(fmask a, fvec b, fvec c)
Track fit utilities for the CA tracking based on the Kalman filter.
ca::Hit class describes a generic hit for the CA tracker
fscal Z() const
Get the Z coordinate.
fscal dT2() const
Get the uncertainty of time.
fscal dXY() const
Get the X/Y covariance.
fscal dX2() const
Get the uncertainty of X coordinate.
fscal Y() const
Get the Y coordinate.
fscal T() const
Get the time.
fscal X() const
Get the X coordinate.
int Station() const
Get the station index.
fscal dY2() const
Get the uncertainty of Y coordinate.
A container for all external parameters of the CA tracking algorithm.
DataT fZ
z position of station [cm]
int timeInfo
flag: if time information can be used
kf::FieldSlice< DataT > fieldSlice
Magnetic field near the station.
ca::TrackingMode fTrackingMode
TrackFitter(const ca::Parameters< fvec > &pars, const fscal mass, const ca::TrackingMode &mode)
Default constructor.
void FitCaTracks(const ca::InputData &input, WindowData &wData)
Fit tracks, found by the CA tracker.
const Parameters< fvec > & fParameters
Object of Framework parameters class.
~TrackFitter()
Destructor.
fscal fDefaultMass
mass of the propagated particle [GeV/c2]
const cbm::algo::kf::Setup< fvec > & fSetup
Setup instance.
Class representing an output track in the CA tracking algorithm.
Container for internal data, processed on a single time window.
Track & RecoTrack(int iTrack)
Accesses reconstructed track by index.
Vector< Track > & RecoTracks()
Accesses reconstructed track container.
HitIndex_t & RecoHitIndex(int iHit)
Accesses index of hit in the input data.
kf::MeasurementXy< fvec > & TargetMeasurement()
Measurement of the target with the uncertainty.
Magnetic field region, corresponding to a hit triplet.
constexpr FieldValue< T > GetFieldValue(const T &x, const T &y) const
Gets field value at a point on the transverse plane.
Magnetic flux density vector.
void SetSimdEntries(const FieldValue &other, const kf::utils::masktype< T > &mask)
Combines the current magnetic field value with another one using a mask.
T GetBy() const
Gets magnetic flux density y-component [kG].
void SetSimdEntry(double bx, double by, double bz, size_t i)
Sets magnetic flux density components to the field function.
static EFieldType fgOriginalFieldType
Global field type.
static FieldFn_t fgOriginalField
Global variable to store the fielf funciton (x,y,z)->(Bx,By,Bz)
The class describes a 2D - measurement (x, y) in XY coordinate system.
void SetCov(DataT dx2, DataT dxy, DataT dy2)
void Extrapolate(DataT z, const kf::FieldRegion< DataT > &F)
void SetMask(const DataTmask &m)
void FilterXY(const kf::MeasurementXy< DataT > &m, bool skipUnmeasuredCoordinates=false)
filter the track with the XY measurement
kf::TrackParam< DataT > & Tr()
void MultipleScattering(DataT radThick, DataT tx0, DataT ty0, DataT qp0)
apply multiple scattering correction to the track with the given Qp0
void GuessTrack(const DataT &trackZ, const DataT hitX[], const DataT hitY[], const DataT hitZ[], const DataT hitT[], const DataT By[], const DataTmask hitW[], const DataTmask hitWtime[], int NHits)
fast guess of track parameterts based on its hits
void EnergyLossCorrection(DataT radThick, FitDirection direction)
void FilterTime(DataT t, DataT dt2, const DataTmask &m)
filter the track with the time measurement
void SetParticleMass(DataT mass)
set particle mass for the fit
void SetDoFitVelocity(bool v)
void SetMaxExtrapolationStep(double step)
set max extrapolation step [cm]
T Ndf() const
Gets NDF of track fit model.
T Vi() const
Gets inverse velocity [ns/cm].
T NdfTime() const
Gets NDF of time measurements.
void ResetErrors(T c00, T c11, T c22, T c33, T c44, T c55, T c66)
Resets variances of track parameters and chi2, ndf values.
T Tx() const
Gets slope along x-axis.
T X() const
Gets x position [cm].
T Y() const
Gets y position [cm].
T Qp() const
Gets charge over momentum [ec/GeV].
void InitVelocityRange(fscal minP)
Initializes inverse velocity range.
T Time() const
Gets time [ns].
T Ty() const
Gets slope along y-axis.
static constexpr size_t size()
constexpr fscal SpeedOfLightInv
Inverse speed of light [ns/cm].
constexpr int MaxNstations
Max number of stations, 2^6 = 64.
TODO: SZh 8.11.2022: add selection of parameterisation.
class cbm::algo::ca::WindowData _fvecalignment