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();
140 auto [detSystemId, iStLocal] =
fParameters.GetActiveSetup().GetIndexMap().GlobalToLocal<
EDetectorID>(ista);
145 w[ista][iVec] =
true;
146 if (sta[ista].timeInfo) {
147 w_time[ista][iVec] =
true;
150 float dX2Orig = hit.
dX2() -
fParameters.GetMisalignmentXsq(detSystemId);
151 float dY2Orig = hit.
dY2() -
fParameters.GetMisalignmentYsq(detSystemId);
152 float dXYOrig = hit.
dXY();
153 if (dX2Orig < 0. || dY2Orig < 0. || fabs(dXYOrig /
sqrt(dX2Orig * dY2Orig)) > 1.) {
157 float dT2Orig = hit.
dT2() -
fParameters.GetMisalignmentTsq(detSystemId);
162 x[ista][iVec] = hit.
X();
163 y[ista][iVec] = hit.
Y();
164 time[ista][iVec] = hit.
T();
165 dt2[ista][iVec] = dT2Orig;
166 if (!sta[ista].timeInfo) {
167 dt2[ista][iVec] = 1.e4;
169 z[ista][iVec] = hit.
Z();
171 mxy[ista].
X()[iVec] = hit.
X();
172 mxy[ista].
Y()[iVec] = hit.
Y();
173 mxy[ista].
Dx2()[iVec] = dX2Orig;
174 mxy[ista].
Dy2()[iVec] = dY2Orig;
175 mxy[ista].
Dxy()[iVec] = dXYOrig;
176 mxy[ista].
NdfX()[iVec] = 1.;
177 mxy[ista].
NdfY()[iVec] = 1.;
179 fB[ista].
SetSimdEntry(fB_temp.GetBx()[iVec], fB_temp.GetBy()[iVec], fB_temp.GetBz()[iVec], iVec);
182 z_start[iVec] = z[ista][iVec];
183 x_first[iVec] =
x[ista][iVec];
184 y_first[iVec] =
y[ista][iVec];
185 time_first[iVec] = time[ista][iVec];
186 wtime_first[iVec] = sta[ista].
timeInfo ? 1. : 0.;
187 dt2_first[iVec] = dt2[ista][iVec];
188 mxy_first.
X()[iVec] = mxy[ista].
X()[iVec];
189 mxy_first.
Y()[iVec] = mxy[ista].
Y()[iVec];
190 mxy_first.
Dx2()[iVec] = mxy[ista].
Dx2()[iVec];
191 mxy_first.
Dy2()[iVec] = mxy[ista].
Dy2()[iVec];
192 mxy_first.
Dxy()[iVec] = mxy[ista].
Dxy()[iVec];
193 mxy_first.
NdfX()[iVec] = mxy[ista].
NdfX()[iVec];
194 mxy_first.
NdfY()[iVec] = mxy[ista].
NdfY()[iVec];
196 else if (ih == nHitsTrack - 1) {
197 z_end[iVec] = z[ista][iVec];
198 x_last[iVec] =
x[ista][iVec];
199 y_last[iVec] =
y[ista][iVec];
200 mxy_last.
X()[iVec] = mxy[ista].
X()[iVec];
201 mxy_last.
Y()[iVec] = mxy[ista].
Y()[iVec];
202 mxy_last.
Dx2()[iVec] = mxy[ista].
Dx2()[iVec];
203 mxy_last.
Dy2()[iVec] = mxy[ista].
Dy2()[iVec];
204 mxy_last.
Dxy()[iVec] = mxy[ista].
Dxy()[iVec];
205 mxy_last.
NdfX()[iVec] = mxy[ista].
NdfX()[iVec];
206 mxy_last.
NdfY()[iVec] = mxy[ista].
NdfY()[iVec];
207 time_last[iVec] = time[ista][iVec];
208 dt2_last[iVec] = dt2[ista][iVec];
209 wtime_last[iVec] = sta[ista].
timeInfo ? 1. : 0.;
213 for (
int ih = nHitsTrack - 1; ih >= 0; ih--) {
214 const int ista = iSta[ih];
220 fit.
GuessTrack(z_end,
x,
y, z, time, By, w, w_time, nStations);
228 for (
int iter = 0; iter < 2; iter++) {
234 int ista = nStations - 1;
237 dt2_last =
iif(w_time[ista], dt2_last,
fvec(1.e6));
240 tr.
C10() = mxy_last.
Dxy();
241 tr.
X() = mxy_last.
X();
242 tr.
Y() = mxy_last.
Y();
243 tr.
Time() = time_last;
256 fvec dz = fldZ2 - fldZ1;
259 fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0);
261 for (--ista; ista >= 0; ista--) {
264 dz = (fldZ1 - fldZ0);
267 fld.Set(fldB0, fldZ0, fldB1, fldZ1, fldB2, fldZ2);
269 fmask initialised = (z[ista] < z_end) & (z_start <= z[ista]);
275 auto radThick =
fSetup.GetMaterial(ista).GetThicknessX0(tr.
X(), tr.
Y());
279 fit.
SetMask(initialised && w[ista]);
304 for (
int vtxIter = 0; vtxIter < 2; vtxIter++) {
306 fitpv.
Tr() = fit.
Tr();
325 Tf.
Qp() = fitpv.
Tr().
Qp();
328 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
329 t[iVec]->fParFirst.Set(Tf, iVec);
332 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
333 t[iVec]->fParPV.Set(fitpv.
Tr(), iVec);
344 tr.
ResetErrors(mxy_first.
Dx2(), mxy_first.
Dy2(), 0.1, 0.1, 1., dt2_first, 1.e-2);
345 tr.
C10() = mxy_first.
Dxy();
347 tr.
X() = mxy_first.
X();
348 tr.
Y() = mxy_first.
Y();
349 tr.
Time() = time_first;
366 fld.Set(fldB2, fldZ2, fldB1, fldZ1, fldB0, fldZ0);
368 for (++ista; ista < nStations; ista++) {
370 dz = (fldZ1 - fldZ0);
373 fld.Set(fldB0, fldZ0, fldB1, fldZ1, fldB2, fldZ2);
375 fmask initialised = (z[ista] <= z_end) & (z_start < z[ista]);
379 auto radThick =
fSetup.GetMaterial(ista).GetThicknessX0(tr.
X(), tr.
Y());
382 fit.
SetMask(initialised && w[ista]);
399 Tl.
Qp() = fitpv.
Tr().
Qp();
402 for (
int iVec = 0; iVec < nTracks_SIMD; iVec++) {
403 t[iVec]->fParLast.Set(Tl, iVec);
friend fvec sqrt(const fvec &a)
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
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.