23 const double det = mat[0] * mat[2] - mat[1] * mat[1];
24 return std::array<double, 3>{mat[2] / det, -mat[1] / det, mat[0] / det};
28template <
unsigned int D>
35 const TrackingFrameInfo& originalTf =
event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(track.getClusterIndex(mLayerToSmooth));
37 mOutwardsTrack = track;
38 mInwardsTrack = {track.getParamOut(),
39 static_cast<short>(mOutwardsTrack.getNumberOfClusters()), -999,
static_cast<std::uint32_t
>(
event.getROFrameId()),
42 mOutwardsTrack.resetCovariance();
43 mOutwardsTrack.setChi2(0);
44 mInwardsTrack.resetCovariance();
45 mInwardsTrack.setChi2(0);
47 bool statusOutw{
false};
48 bool statusInw{
false};
52 for (
size_t iLayer{0}; iLayer < mLayerToSmooth; ++iLayer) {
56 const TrackingFrameInfo& tF =
event.getTrackingFrameInfoOnLayer(iLayer).at(mOutwardsTrack.getClusterIndex(iLayer));
57 statusOutw = mOutwardsTrack.rotate(tF.alphaTrackingFrame);
58 statusOutw &= propInstance->propagateToX(mOutwardsTrack,
64 mOutwardsTrack.setChi2(mOutwardsTrack.getChi2() + mOutwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame));
65 statusOutw &= mOutwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame);
70 auto outwardsClone = mOutwardsTrack;
71 statusOutw = outwardsClone.rotate(originalTf.alphaTrackingFrame);
72 statusOutw &= propInstance->propagateToX(outwardsClone,
73 originalTf.xTrackingFrame,
80 for (
size_t iLayer{D - 1}; iLayer > mLayerToSmooth; --iLayer) {
84 const TrackingFrameInfo& tF =
event.getTrackingFrameInfoOnLayer(iLayer).at(mInwardsTrack.getClusterIndex(iLayer));
85 statusInw = mInwardsTrack.rotate(tF.alphaTrackingFrame);
86 statusInw &= propInstance->propagateToX(mInwardsTrack,
92 mInwardsTrack.setChi2(mInwardsTrack.getChi2() + mInwardsTrack.getPredictedChi2(tF.positionTrackingFrame, tF.covarianceTrackingFrame));
93 statusInw &= mInwardsTrack.o2::track::TrackParCov::update(tF.positionTrackingFrame, tF.covarianceTrackingFrame);
98 auto inwardsClone = mInwardsTrack;
99 statusInw = inwardsClone.rotate(originalTf.alphaTrackingFrame);
100 statusInw &= propInstance->propagateToX(inwardsClone,
101 originalTf.xTrackingFrame,
107 mInitStatus = statusInw && statusOutw;
109 mBestChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, originalTf.positionTrackingFrame, originalTf.covarianceTrackingFrame);
110 mLastChi2 = mBestChi2;
111 LOG(info) <<
"Smoothed chi2 on original cluster: " << mBestChi2;
115template <
unsigned int D>
118template <
unsigned int D>
121 const std::array<float, 2>& cls,
122 const std::array<float, 3>& clCov)
127 if (firstTrack.getX() != secondTrack.getX()) {
128 LOG(fatal) <<
"Tracks need to be propagated to the same point! secondTrack.X=" << secondTrack.getX() <<
" firstTrack.X=" << firstTrack.getX();
131 std::array<double, 2> pp1 = {
static_cast<double>(firstTrack.getY()),
static_cast<double>(firstTrack.getZ())};
132 std::array<double, 2> pp2 = {
static_cast<double>(secondTrack.getY()),
static_cast<double>(secondTrack.getZ())};
134 std::array<double, 3>
c1 = {
static_cast<double>(firstTrack.getSigmaY2()),
135 static_cast<double>(firstTrack.getSigmaZY()),
136 static_cast<double>(firstTrack.getSigmaZ2())};
138 std::array<double, 3>
c2 = {
static_cast<double>(secondTrack.getSigmaY2()),
139 static_cast<double>(secondTrack.getSigmaZY()),
140 static_cast<double>(secondTrack.getSigmaZ2())};
145 std::array<double, 3> w1w2 = {w1[0] + w2[0], w1[1] + w2[1], w1[2] + w2[2]};
148 std::array<double, 2> w1pp1 = {w1[0] * pp1[0] + w1[1] * pp1[1], w1[1] * pp1[0] + w1[2] * pp1[1]};
149 std::array<double, 2> w2pp2 = {w2[0] * pp2[0] + w2[1] * pp2[1], w2[1] * pp2[0] + w2[2] * pp2[1]};
151 double Y =
C[0] * (w1pp1[0] + w2pp2[0]) + C[1] * (w1pp1[1] + w2pp2[1]);
152 double Z =
C[1] * (w1pp1[0] + w2pp2[0]) + C[2] * (w1pp1[1] + w2pp2[1]);
154 std::array<double, 2> delta = {Y - cls[0], Z - cls[1]};
155 std::array<double, 3> CCp = {
C[0] +
static_cast<double>(clCov[0]), C[1] +
static_cast<double>(clCov[1]),
C[2] +
static_cast<double>(clCov[2])};
158 float chi2 =
static_cast<float>(delta[0] * (Wp[0] * delta[0] + Wp[1] * delta[1]) + delta[1] * (Wp[1] * delta[0] + Wp[2] * delta[1]));
161 LOG(info) <<
"Cluster_y: " << cls[0] <<
" Cluster_z: " << cls[1];
162 LOG(info) <<
"\t\t- Covariance cluster: Y2: " << clCov[0] <<
" YZ: " << clCov[1] <<
" Z2: " << clCov[2];
163 LOG(info) <<
"\t\t- Propagated t1_y: " << pp1[0] <<
" t1_z: " << pp1[1];
164 LOG(info) <<
"\t\t- Propagated t2_y: " << pp2[0] <<
" t2_z: " << pp2[1];
165 LOG(info) <<
"\t\t- Covariance t1: sY2: " <<
c1[0] <<
" sYZ: " <<
c1[1] <<
" sZ2: " <<
c1[2];
166 LOG(info) <<
"\t\t- Covariance t2: sY2: " <<
c2[0] <<
" sYZ: " <<
c2[1] <<
" sZ2: " <<
c2[2];
167 LOG(info) <<
"Smoother prediction Y: " << Y <<
" Z: " << Z;
168 LOG(info) <<
"\t\t- Delta_y: " << delta[0] <<
" Delta_z: " << delta[1];
169 LOG(info) <<
"\t\t- Covariance Pr: Y2: " <<
C[0] <<
" YZ: " <<
C[1] <<
" Z2: " <<
C[2];
170 LOG(info) <<
"\t\t- predicted chi2 t1: " << firstTrack.getPredictedChi2(cls, clCov);
171 LOG(info) <<
"\t\t- predicted chi2 t2: " << secondTrack.getPredictedChi2(cls, clCov);
176template <
unsigned int D>
183 const TrackingFrameInfo& testTf =
event.getTrackingFrameInfoOnLayer(mLayerToSmooth).at(clusterId);
185 bool statusOutw{
false};
186 bool statusInw{
false};
189 auto outwardsClone = mOutwardsTrack;
190 statusOutw = outwardsClone.rotate(testTf.alphaTrackingFrame);
191 statusOutw &= propInstance->propagateToX(outwardsClone,
192 testTf.xTrackingFrame,
199 auto inwardsClone = mInwardsTrack;
200 statusInw = inwardsClone.rotate(testTf.alphaTrackingFrame);
201 statusInw &= propInstance->propagateToX(inwardsClone,
202 testTf.xTrackingFrame,
207 if (!(statusOutw && statusInw)) {
208 LOG(warning) <<
"Failed propagation in smoother!";
213 mLastChi2 = computeSmoothedPredictedChi2(inwardsClone, outwardsClone, testTf.positionTrackingFrame, testTf.covarianceTrackingFrame);
214 LOG(info) <<
"Smoothed chi2 on tested cluster: " << mLastChi2;
bool const GPUTPCGMMerger::trackCluster * c1
bool const GPUTPCGMMerger::trackCluster const clcomparestruct * c2
Class to handle Kalman smoothing for ITS tracking. Its instance stores the state of the track to the ...
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Smoother(TrackITSExt &track, size_t layer, const ROframe &event, float bZ, o2::base::PropagatorF::MatCorrType corr)
bool testCluster(const int clusterId, const ROframe &event)
int bool MaxClusters & getClusterIndexes()
constexpr int UnusedIndex
constexpr std::array< double, 3 > getInverseSymm2D(const std::array< double, 3 > &mat)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"