From 5dbfe224d7c45f895a611740f777659bd531b077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 22 Nov 2021 12:21:03 +0100 Subject: [PATCH] Removing interaction time for track times - Storing track times with bunch crossing subtracted so that the float precision is sufficient - Add debug messages --- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 17 ++++++++--------- Detectors/TOF/base/src/EventTimeMaker.cxx | 12 +++++++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index ea80d6a895383..bcd15773f7296 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -315,23 +315,22 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID, const auto& tofMatch = data.getTOFMatch(contributorsGID[GIndex::Source::ITSTPCTOF]); extraInfoHolder.tofChi2 = tofMatch.getChi2(); const auto& tofInt = tofMatch.getLTIntegralOut(); - float intLen = tofInt.getL(); + const float intLen = tofInt.getL(); extraInfoHolder.length = intLen; if (interactionTime > 0) { - extraInfoHolder.tofSignal = static_cast(tofMatch.getSignal() - interactionTime); + extraInfoHolder.tofSignal = static_cast(tofMatch.getSignal() - interactionTime * 1E3); } const float mass = o2::constants::physics::MassPionCharged; // default pid = pion if (tofInt.getTOF(o2::track::PID::Pion) > 0.f) { const float expBeta = (intLen / (tofInt.getTOF(o2::track::PID::Pion) * cSpeed)); extraInfoHolder.tofExpMom = mass * expBeta / std::sqrt(1.f - expBeta * expBeta); } - const auto& tofCl = tofClus[contributorsGID[GIndex::Source::TOF]]; // correct the time of the track - const float massZ = o2::track::PID::getMass2Z(trackPar.getPID()); - const float energy = sqrt((massZ * massZ) + (extraInfoHolder.tofExpMom * extraInfoHolder.tofExpMom)); - const float exp = extraInfoHolder.length * energy / (cSpeed * extraInfoHolder.tofExpMom); - extraInfoHolder.trackTime = (tofCl.getTime() - exp) * 1e-3; // tof time in \mus, FIXME: account for time of flight to R TOF - extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?) + const double massZ = o2::track::PID::getMass2Z(trackPar.getPID()); + const double energy = sqrt((massZ * massZ) + (extraInfoHolder.tofExpMom * extraInfoHolder.tofExpMom)); + const double exp = extraInfoHolder.length * energy / (cSpeed * extraInfoHolder.tofExpMom); + extraInfoHolder.trackTime = static_cast((tofMatch.getSignal() - exp) * 1e-3 - interactionTime); // tof time in \mus, FIXME: account for time of flight to R TOF + extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?) } if (src == GIndex::Source::TPCTRD || src == GIndex::Source::ITSTPCTRD) { const auto& trdOrig = data.getTrack(src, contributorsGID[src].getIndex()); @@ -1353,7 +1352,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) truncateFloatFraction(timeStamp.getTimeStampError() * 1E3, mCollisionPositionCov)); auto& trackRef = primVer2TRefs[collisionID]; // passing interaction time in [ps] - fillTrackTablesPerCollision(collisionID, interactionTime * 1E3, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, mftTracksCursor, fwdTracksCursor, fwdTracksCovCursor, vertex); + fillTrackTablesPerCollision(collisionID, interactionTime, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, mftTracksCursor, fwdTracksCursor, fwdTracksCovCursor, vertex); collisionID++; } diff --git a/Detectors/TOF/base/src/EventTimeMaker.cxx b/Detectors/TOF/base/src/EventTimeMaker.cxx index b87ae5d68ff72..d763dc8c83f36 100644 --- a/Detectors/TOF/base/src/EventTimeMaker.cxx +++ b/Detectors/TOF/base/src/EventTimeMaker.cxx @@ -38,7 +38,7 @@ void computeEvTime(const std::vector& tracks, const std::vector< static constexpr float weightLimit = 1E-6; // Limit in the weights const int ntracks = tracks.size(); - LOG(debug) << "For the collision time using " << ntracks; + LOG(debug) << "For the collision time using " << ntracks << " tracks"; if (ntracks < 2) { // at least 2 tracks required LOG(debug) << "Skipping event because at least 2 tracks are required"; @@ -48,14 +48,20 @@ void computeEvTime(const std::vector& tracks, const std::vector< int hypo[MAXNTRACKINSET]; int nmaxtracksinset = ntracks > 22 ? 6 : MAXNTRACKINSET; // max number of tracks in a set for event time computation + LOG(debug) << "nmaxtracksinset " << nmaxtracksinset; int ntracksinset = std::min(ntracks, nmaxtracksinset); + LOG(debug) << "ntracksinset " << ntracksinset; int nset = ((ntracks - 1) / ntracksinset) + 1; + LOG(debug) << "nset " << nset; int ntrackUsed = ntracks; + LOG(debug) << "ntrackUsed " << ntrackUsed; if (nset > maxNumberOfSets) { nset = maxNumberOfSets; + LOG(debug) << "resetting nset " << nset; ntrackUsed = nmaxtracksinset * nset; + LOG(debug) << "resetting ntrackUsed " << ntrackUsed; } // list of tracks in set @@ -70,6 +76,7 @@ void computeEvTime(const std::vector& tracks, const std::vector< int status; // compute event time for each set for (int iset = 0; iset < nset; iset++) { + LOG(debug) << "iset " << iset << " has size " << trackInSet[iset].size(); unsigned long bestComb = 0; while (!(status = getStartTimeInSet(tracks, trackInSet[iset], bestComb))) { ; @@ -90,6 +97,7 @@ void computeEvTime(const std::vector& tracks, const std::vector< evtime.tracktime[index] = ctrack.mSignal - ctrack.expTimes[hypo[itrk]]; } } + LOG(debug) << "iset " << iset << " did not have good status"; } // end loop in set // do average among all tracks @@ -120,8 +128,10 @@ int getStartTimeInSet(const std::vector& tracks, std::vector