Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(tofMatch.getSignal() - interactionTime);
extraInfoHolder.tofSignal = static_cast<float>(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<float>((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<o2::trd::TrackTRD>(src, contributorsGID[src].getIndex());
Expand Down Expand Up @@ -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++;
}

Expand Down
12 changes: 11 additions & 1 deletion Detectors/TOF/base/src/EventTimeMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& 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";
Expand All @@ -48,14 +48,20 @@ void computeEvTime(const std::vector<eventTimeTrack>& 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
Expand All @@ -70,6 +76,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& 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))) {
;
Expand All @@ -90,6 +97,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& 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
Expand Down Expand Up @@ -120,8 +128,10 @@ int getStartTimeInSet(const std::vector<eventTimeTrack>& tracks, std::vector<int

chi2best = 10000;
int ntracks = trackInSet.size();
LOG(debug) << "Computing the start time in set with " << ntracks << " tracks";

if (ntracks < 3) {
LOG(debug) << "Not enough tracks!";
return 2; // no event time in the set
}

Expand Down