Skip to content

Commit 22bbd7e

Browse files
committed
add trk res in TOF match chi2
1 parent d08d21a commit 22bbd7e

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/MatchInfoTOFReco.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,21 @@ class MatchInfoTOFReco : public MatchInfoTOF
4545
float pt() const { return mPt; }
4646
void setPt(float pt) { mPt = pt; }
4747

48+
void setResX(float val) { mResX = val; }
49+
void setResZ(float val) { mResZ = val; }
50+
float getResX() const { return mResX; }
51+
float getResZ() const { return mResZ; }
52+
4853
void setTrackType(TrackType value) { mTrackType = value; }
4954
TrackType getTrackType() const { return mTrackType; }
5055

5156
private:
5257
TrackType mTrackType; ///< track type (TPC, ITSTPC, TPCTRD, ITSTPCTRD)
5358
bool mFakeMC = false;
5459
float mPt = 0;
55-
ClassDefNV(MatchInfoTOFReco, 4);
60+
float mResX = 1;
61+
float mResZ = 1;
62+
ClassDefNV(MatchInfoTOFReco, 5);
5663
};
5764
} // namespace dataformats
5865
} // namespace o2

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,13 @@ void MatchTOF::doMatching(int sec)
10121012
int eventIdTOF;
10131013
int sourceIdTOF;
10141014
for (auto iPropagation = 0; iPropagation < nStripsCrossedInPropagation; iPropagation++) {
1015+
float padResX2 = 0.52; // (2.5/sqrt(12))^2
1016+
float padResZ2 = 1.02; // (3.5/sqrt(12))^2
1017+
float cosangle = TMath::Cos(Geo::getAngles(indices[1], indices[2]) * TMath::DegToRad());
1018+
float errXinv2 = 1. / (trefTrk.getSigmaY2() + padResX2);
1019+
float errZinv2 = 1. / (trefTrk.getSigmaZ2() * cosangle + padResZ2); // should be valid only at eta=0
1020+
// look at getPadDxDyDz to understand how to convert track errors in TOF strip ref system (wip)
1021+
10151022
LOG(debug) << "TOF Cluster [" << itof << ", " << cacheTOF[itof] << "]: indices = " << indices[0] << ", " << indices[1] << ", " << indices[2] << ", " << indices[3] << ", " << indices[4];
10161023
LOG(debug) << "Propagated Track [" << itrk << "]: detId[" << iPropagation << "] = " << detId[iPropagation][0] << ", " << detId[iPropagation][1] << ", " << detId[iPropagation][2] << ", " << detId[iPropagation][3] << ", " << detId[iPropagation][4];
10171024
float resX = deltaPos[iPropagation][0] - (indices[4] - detId[iPropagation][4]) * Geo::XPAD + posCorr[0]; // readjusting the residuals due to the fact that the propagation fell in a pad that was not exactly the one of the cluster
@@ -1028,7 +1035,7 @@ void MatchTOF::doMatching(int sec)
10281035
if (indices[2] != detId[iPropagation][2]) {
10291036
continue;
10301037
}
1031-
float chi2 = res; // TODO: take into account also the time!
1038+
float chi2 = TMath::Sqrt(resX * resX * errXinv2 + resZ * resZ * errZinv2); // TODO: take into account also the time!
10321039

10331040
if (res < mSpaceTolerance) { // matching ok!
10341041
LOG(debug) << "MATCHING FOUND: We have a match! between track " << mTracksSectIndexCache[type][sec][itrk] << " and TOF cluster " << mTOFClusSectIndexCache[indices[0]][itof];
@@ -1037,6 +1044,8 @@ void MatchTOF::doMatching(int sec)
10371044
int eventIndexTOFCluster = mTOFClusSectIndexCache[indices[0]][itof];
10381045
mMatchedTracksPairsSec[sec].emplace_back(cacheTrk[itrk], eventIndexTOFCluster, mTOFClusWork[cacheTOF[itof]].getTime(), chi2, trkLTInt[iPropagation], mTrackGid[sec][type][cacheTrk[itrk]], type, (trefTOF.getTime() - (minTrkTime + maxTrkTime - 100E3) * 0.5) * 1E-6, trefTOF.getZ(), resX, resZ); // subracting 100 ns to max track which was artificially added
10391046
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setPt(pt);
1047+
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setResX(sqrt(1. / errXinv2));
1048+
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setResZ(sqrt(1. / errZinv2));
10401049
}
10411050
}
10421051
}
@@ -1337,6 +1346,12 @@ void MatchTOF::doMatchingForTPC(int sec)
13371346
if (detId[ibc][iPropagation][1] != indices[1] || detId[ibc][iPropagation][2] != indices[2]) {
13381347
continue;
13391348
}
1349+
float padResX2 = 0.52; // (2.5/sqrt(12))^2
1350+
float padResZ2 = 1.02; // (3.5/sqrt(12))^2
1351+
float cosangle = TMath::Cos(Geo::getAngles(indices[1], indices[2]) * TMath::DegToRad());
1352+
float errXinv2 = 1. / (trefTrk.getSigmaY2() + padResX2);
1353+
float errZinv2 = 1. / (trefTrk.getSigmaZ2() * cosangle + padResZ2); // should be valid only at eta=0
1354+
// look at getPadDxDyDz to understand how to convert track errors in TOF strip ref system (wip)
13401355

13411356
LOG(debug) << "TOF Cluster [" << itof << ", " << cacheTOF[itof] << "]: indices = " << indices[0] << ", " << indices[1] << ", " << indices[2] << ", " << indices[3] << ", " << indices[4];
13421357
LOG(debug) << "Propagated Track [" << itrk << "]: detId[" << iPropagation << "] = " << detId[ibc][iPropagation][0] << ", " << detId[ibc][iPropagation][1] << ", " << detId[ibc][iPropagation][2] << ", " << detId[ibc][iPropagation][3] << ", " << detId[ibc][iPropagation][4];
@@ -1360,7 +1375,7 @@ void MatchTOF::doMatchingForTPC(int sec)
13601375
}
13611376

13621377
LOG(debug) << "resX = " << resX << ", resZ = " << resZ << ", res = " << res;
1363-
float chi2 = mIsCosmics ? resX : res; // TODO: take into account also the time!
1378+
float chi2 = mIsCosmics ? resX : TMath::Sqrt(resX * resX * errXinv2 + resZ * resZ * errZinv2); // TODO: take into account also the time!
13641379

13651380
if (res < mSpaceTolerance) { // matching ok!
13661381
LOG(debug) << "MATCHING FOUND: We have a match! between track " << mTracksSectIndexCache[trkType::UNCONS][sec][itrk] << " and TOF cluster " << mTOFClusSectIndexCache[indices[0]][itof];
@@ -1369,6 +1384,8 @@ void MatchTOF::doMatchingForTPC(int sec)
13691384
int eventIndexTOFCluster = mTOFClusSectIndexCache[indices[0]][itof];
13701385
mMatchedTracksPairsSec[sec].emplace_back(cacheTrk[itrk], eventIndexTOFCluster, mTOFClusWork[cacheTOF[itof]].getTime(), chi2, trkLTInt[ibc][iPropagation], mTrackGid[sec][trkType::UNCONS][cacheTrk[itrk]], trkType::UNCONS, trefTOF.getTime() * 1E-6 - tpctime, trefTOF.getZ(), resX, resZ); // TODO: check if this is correct!
13711386
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setPt(pt);
1387+
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setResX(sqrt(1. / errXinv2));
1388+
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setResZ(sqrt(1. / errZinv2));
13721389
}
13731390
}
13741391
}

0 commit comments

Comments
 (0)