Skip to content

Commit

Permalink
TOF matching debug mode improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
noferini committed Apr 12, 2024
1 parent 9da1a8c commit 90d59fb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ class MatchInfoTOFReco : public MatchInfoTOF
void setFakeMatch() { mFakeMC = true; }
void resetFakeMatch() { mFakeMC = false; }
bool isFake() const { return mFakeMC; }
float pt() const { return mPt; }
void setPt(float pt) { mPt = pt; }

void setTrackType(TrackType value) { mTrackType = value; }
TrackType getTrackType() const { return mTrackType; }

private:
TrackType mTrackType; ///< track type (TPC, ITSTPC, TPCTRD, ITSTPCTRD)
bool mFakeMC = false;
ClassDefNV(MatchInfoTOFReco, 3);
float mPt = 0;
ClassDefNV(MatchInfoTOFReco, 4);
};
} // namespace dataformats
} // namespace o2
Expand Down
36 changes: 36 additions & 0 deletions Detectors/GlobalTracking/src/MatchTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,44 @@ void MatchTOF::run(const o2::globaltracking::RecoContainer& inp, unsigned long f
matchingPair.setFakeMatch();
}
}
} else {
for (auto& matchingPair : mMatchedTracksPairsSec[sec]) {
int bct0 = int((matchingPair.getSignal() - 10000) * Geo::BC_TIME_INPS_INV);
float tof = matchingPair.getSignal() - bct0 * Geo::BC_TIME_INPS;
if (abs(tof - matchingPair.getLTIntegralOut().getTOF(2)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(3)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(4)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(0)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(1)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(5)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(6)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(7)) < 600) {
} else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(8)) < 600) {
} else { // no pion, kaon, proton, electron, muon, deuteron, triton, 3He, 4He
matchingPair.setFakeMatch();
}
}
}
}

LOG(debug) << "...done. Now check the best matches";
nMatches[sec] = mMatchedTracksPairsSec[sec].size();
selectBestMatches(sec);

if (mStoreMatchable) {
for (auto& matchingPair : mMatchedTracksPairsSec[sec]) {
trkType trkTypeSplitted = trkType::TPC;
auto sourceID = matchingPair.getTrackRef().getSource();
if (sourceID == o2::dataformats::GlobalTrackID::ITSTPC) {
trkTypeSplitted = trkType::ITSTPC;
} else if (sourceID == o2::dataformats::GlobalTrackID::TPCTRD) {
trkTypeSplitted = trkType::TPCTRD;
} else if (sourceID == o2::dataformats::GlobalTrackID::ITSTPCTRD) {
trkTypeSplitted = trkType::ITSTPCTRD;
}
matchingPair.setTrackType(trkTypeSplitted);
}
}
}
std::string nMatchesStr = "Number of pairs matched per sector: ";
for (int sec = o2::constants::math::NSectors - 1; sec > -1; sec--) {
Expand Down Expand Up @@ -801,6 +833,7 @@ void MatchTOF::doMatching(int sec)
int nStripsCrossedInPropagation = 0; // how many strips were hit during the propagation
auto& trackWork = mTracksWork[sec][type][cacheTrk[itrk]];
auto& trefTrk = trackWork.first;
float pt = trefTrk.getPt();
auto& intLT = mLTinfos[sec][type][cacheTrk[itrk]];
float timeShift = intLT.getL() * 33.35641; // integrated time for 0.75 beta particles in ps, to take into account the t.o.f. delay with respect the interaction BC
// using beta=0.75 to cover beta range [0.59 , 1.04] also for a 8 m track lenght with a 10 ns track resolution (TRD)
Expand Down Expand Up @@ -1003,6 +1036,7 @@ void MatchTOF::doMatching(int sec)
// set event indexes (to be checked)
int eventIndexTOFCluster = mTOFClusSectIndexCache[indices[0]][itof];
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
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setPt(pt);
}
}
}
Expand Down Expand Up @@ -1048,6 +1082,7 @@ void MatchTOF::doMatchingForTPC(int sec)
for (int itrk = 0; itrk < cacheTrk.size(); itrk++) {
auto& trackWork = mTracksWork[sec][trkType::UNCONS][cacheTrk[itrk]];
auto& trefTrk = trackWork.first;
float pt = trefTrk.getPt();
auto& intLT = mLTinfos[sec][trkType::UNCONS][cacheTrk[itrk]];

float timeShift = intLT.getL() * 33.35641; // integrated time for 0.75 beta particles in ps, to take into account the t.o.f. delay with respect the interaction BC
Expand Down Expand Up @@ -1333,6 +1368,7 @@ void MatchTOF::doMatchingForTPC(int sec)
// set event indexes (to be checked)
int eventIndexTOFCluster = mTOFClusSectIndexCache[indices[0]][itof];
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!
mMatchedTracksPairsSec[sec][mMatchedTracksPairsSec[sec].size() - 1].setPt(pt);
}
}
}
Expand Down

0 comments on commit 90d59fb

Please sign in to comment.