Skip to content

Commit 7f4d8ef

Browse files
njacazioshahor02
authored andcommitted
Removing interaction time for track times
- Storing track times with bunch crossing subtracted so that the float precision is sufficient - Add debug messages
1 parent 6bfc61f commit 7f4d8ef

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,23 +325,22 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
325325
const auto& tofMatch = data.getTOFMatch(contributorsGID[GIndex::Source::ITSTPCTOF]);
326326
extraInfoHolder.tofChi2 = tofMatch.getChi2();
327327
const auto& tofInt = tofMatch.getLTIntegralOut();
328-
float intLen = tofInt.getL();
328+
const float intLen = tofInt.getL();
329329
extraInfoHolder.length = intLen;
330330
if (interactionTime > 0) {
331-
extraInfoHolder.tofSignal = static_cast<float>(tofMatch.getSignal() - interactionTime);
331+
extraInfoHolder.tofSignal = static_cast<float>(tofMatch.getSignal() - interactionTime * 1E3);
332332
}
333333
const float mass = o2::constants::physics::MassPionCharged; // default pid = pion
334334
if (tofInt.getTOF(o2::track::PID::Pion) > 0.f) {
335335
const float expBeta = (intLen / (tofInt.getTOF(o2::track::PID::Pion) * cSpeed));
336336
extraInfoHolder.tofExpMom = mass * expBeta / std::sqrt(1.f - expBeta * expBeta);
337337
}
338-
const auto& tofCl = tofClus[contributorsGID[GIndex::Source::TOF]];
339338
// correct the time of the track
340-
const float massZ = o2::track::PID::getMass2Z(trackPar.getPID());
341-
const float energy = sqrt((massZ * massZ) + (extraInfoHolder.tofExpMom * extraInfoHolder.tofExpMom));
342-
const float exp = extraInfoHolder.length * energy / (cSpeed * extraInfoHolder.tofExpMom);
343-
extraInfoHolder.trackTime = (tofCl.getTime() - exp) * 1e-3; // tof time in \mus, FIXME: account for time of flight to R TOF
344-
extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?)
339+
const double massZ = o2::track::PID::getMass2Z(trackPar.getPID());
340+
const double energy = sqrt((massZ * massZ) + (extraInfoHolder.tofExpMom * extraInfoHolder.tofExpMom));
341+
const double exp = extraInfoHolder.length * energy / (cSpeed * extraInfoHolder.tofExpMom);
342+
extraInfoHolder.trackTime = static_cast<float>((tofMatch.getSignal() - exp) * 1e-3 - interactionTime); // tof time in \mus, FIXME: account for time of flight to R TOF
343+
extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?)
345344
}
346345
if (src == GIndex::Source::TPCTRD || src == GIndex::Source::ITSTPCTRD) {
347346
const auto& trdOrig = data.getTrack<o2::trd::TrackTRD>(src, contributorsGID[src].getIndex());
@@ -1368,7 +1367,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
13681367
truncateFloatFraction(timeStamp.getTimeStampError() * 1E3, mCollisionPositionCov));
13691368
auto& trackRef = primVer2TRefs[collisionID];
13701369
// passing interaction time in [ps]
1371-
fillTrackTablesPerCollision(collisionID, interactionTime * 1E3, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, mftTracksCursor, fwdTracksCursor, fwdTracksCovCursor, vertex);
1370+
fillTrackTablesPerCollision(collisionID, interactionTime, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, mftTracksCursor, fwdTracksCursor, fwdTracksCovCursor, vertex);
13721371
collisionID++;
13731372
}
13741373

Detectors/TOF/base/src/EventTimeMaker.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& tracks, const std::vector<
3838
static constexpr float weightLimit = 1E-6; // Limit in the weights
3939

4040
const int ntracks = tracks.size();
41-
LOG(debug) << "For the collision time using " << ntracks;
41+
LOG(debug) << "For the collision time using " << ntracks << " tracks";
4242

4343
if (ntracks < 2) { // at least 2 tracks required
4444
LOG(debug) << "Skipping event because at least 2 tracks are required";
@@ -48,14 +48,20 @@ void computeEvTime(const std::vector<eventTimeTrack>& tracks, const std::vector<
4848
int hypo[MAXNTRACKINSET];
4949

5050
int nmaxtracksinset = ntracks > 22 ? 6 : MAXNTRACKINSET; // max number of tracks in a set for event time computation
51+
LOG(debug) << "nmaxtracksinset " << nmaxtracksinset;
5152
int ntracksinset = std::min(ntracks, nmaxtracksinset);
53+
LOG(debug) << "ntracksinset " << ntracksinset;
5254

5355
int nset = ((ntracks - 1) / ntracksinset) + 1;
56+
LOG(debug) << "nset " << nset;
5457
int ntrackUsed = ntracks;
58+
LOG(debug) << "ntrackUsed " << ntrackUsed;
5559

5660
if (nset > maxNumberOfSets) {
5761
nset = maxNumberOfSets;
62+
LOG(debug) << "resetting nset " << nset;
5863
ntrackUsed = nmaxtracksinset * nset;
64+
LOG(debug) << "resetting ntrackUsed " << ntrackUsed;
5965
}
6066

6167
// list of tracks in set
@@ -70,6 +76,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& tracks, const std::vector<
7076
int status;
7177
// compute event time for each set
7278
for (int iset = 0; iset < nset; iset++) {
79+
LOG(debug) << "iset " << iset << " has size " << trackInSet[iset].size();
7380
unsigned long bestComb = 0;
7481
while (!(status = getStartTimeInSet(tracks, trackInSet[iset], bestComb))) {
7582
;
@@ -90,6 +97,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& tracks, const std::vector<
9097
evtime.tracktime[index] = ctrack.mSignal - ctrack.expTimes[hypo[itrk]];
9198
}
9299
}
100+
LOG(debug) << "iset " << iset << " did not have good status";
93101
} // end loop in set
94102

95103
// do average among all tracks
@@ -120,8 +128,10 @@ int getStartTimeInSet(const std::vector<eventTimeTrack>& tracks, std::vector<int
120128

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

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

0 commit comments

Comments
 (0)