Skip to content

Commit 7fc6d3e

Browse files
committed
Fix for TF number getter
1 parent 30d3f99 commit 7fc6d3e

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class AODProducerWorkflowDPL : public Task
9292
uint64_t minGlBC = INT64_MAX;
9393

9494
void findMinMaxBc(gsl::span<const o2::ft0::RecPoints>& ft0RecPoints, gsl::span<const o2::dataformats::TrackTPCITS>& tracksITSTPC);
95-
int64_t getTimeStamp(uint64_t firstVtxGlBC, int runNumber);
95+
int64_t getTFNumber(uint64_t firstVtxGlBC, int runNumber);
9696

9797
template <typename TracksType, typename TracksCursorType>
9898
void fillTracksTable(const TracksType& tracks, std::vector<int>& vCollRefs, const TracksCursorType& tracksCursor, int trackType);

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void AODProducerWorkflowDPL::findMinMaxBc(gsl::span<const o2::ft0::RecPoints>& f
5757
}
5858

5959
for (auto& trackITSTPC : tracksITSTPC) {
60-
Double_t timeStamp = trackITSTPC.getTimeMUS().getTimeStamp() * 1.E3; // ms to ns
60+
Double_t timeStamp = trackITSTPC.getTimeMUS().getTimeStamp() * 1.E3; // mus to ns
6161
uint64_t bc = (uint64_t)(timeStamp / o2::constants::lhc::LHCBunchSpacingNS);
6262
if (minGlBC > bc) {
6363
minGlBC = bc;
@@ -68,7 +68,7 @@ void AODProducerWorkflowDPL::findMinMaxBc(gsl::span<const o2::ft0::RecPoints>& f
6868
}
6969
}
7070

71-
int64_t AODProducerWorkflowDPL::getTimeStamp(uint64_t firstVtxGlBC, int runNumber)
71+
int64_t AODProducerWorkflowDPL::getTFNumber(uint64_t firstVtxGlBC, int runNumber)
7272
{
7373
// FIXME:
7474
// check if this code is correct
@@ -77,7 +77,7 @@ int64_t AODProducerWorkflowDPL::getTimeStamp(uint64_t firstVtxGlBC, int runNumbe
7777
o2::ccdb::CcdbApi ccdb_api;
7878
const std::string rct_path = "RCT/RunInformation/";
7979
const std::string start_orbit_path = "Trigger/StartOrbit";
80-
const std::string url("http://ccdb-test.cern.ch:8080");
80+
const std::string url = "http://ccdb-test.cern.ch:8080";
8181

8282
mgr.setURL(url);
8383
ccdb_api.init(url);
@@ -90,13 +90,21 @@ int64_t AODProducerWorkflowDPL::getTimeStamp(uint64_t firstVtxGlBC, int runNumbe
9090
headers = ccdb_api.retrieveHeaders(run_path, metadata, -1);
9191
ts = atol(headers["SOR"].c_str());
9292

93-
// firstRec --> `minimal` global BC in the simulation (see AODProducerWorkflowDPL::findMinMaxBc)
94-
// firstVtxGlBC --> global BC correspinding to the first prim. vertex
93+
// ccdb returns timestamp in mus
94+
// mus to ms
95+
ts = ts / 1000;
9596

96-
const uint32_t initialOrbit = mapStartOrbit->at(runNumber);
97-
const o2::InteractionRecord firstRec(minGlBC, initialOrbit);
98-
const o2::InteractionRecord firstVtx(firstVtxGlBC, initialOrbit);
99-
ts += (firstRec - firstVtx).bc2ns() / 1000000;
97+
// firstRec --> calculated using `minimal` global BC in the simulation (see AODProducerWorkflowDPL::findMinMaxBc)
98+
// firstVtxGlBC --> calculated using global BC correspinding to the first prim. vertex
99+
100+
uint32_t initialOrbit = mapStartOrbit->at(runNumber);
101+
uint16_t firstRecBC = minGlBC % o2::constants::lhc::LHCMaxBunches;
102+
uint32_t firstRecOrbit = minGlBC / o2::constants::lhc::LHCMaxBunches;
103+
uint16_t firstVtxBC = firstVtxGlBC % o2::constants::lhc::LHCMaxBunches;
104+
uint32_t firstVtxOrbit = firstVtxGlBC / o2::constants::lhc::LHCMaxBunches;
105+
const o2::InteractionRecord firstRec(firstRecBC, firstRecOrbit);
106+
const o2::InteractionRecord firstVtx(firstVtxBC, firstVtxOrbit);
107+
ts += (firstVtx - firstRec).bc2ns() / 1000000;
100108

101109
return ts;
102110
};
@@ -388,7 +396,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
388396
for (auto& vertex : primVertices) {
389397
auto& cov = vertex.getCov();
390398
auto& timeStamp = vertex.getTimeStamp();
391-
Double_t tsTimeStamp = timeStamp.getTimeStamp() * 1E3; // ms to ns
399+
Double_t tsTimeStamp = timeStamp.getTimeStamp() * 1E3; // mus to ns
392400
// FIXME:
393401
// should use IRMin and IRMax for globalBC calculation
394402
uint64_t globalBC = tsTimeStamp / o2::constants::lhc::LHCBunchSpacingNS;
@@ -451,7 +459,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
451459
fillTracksTable(tracksITSTPC, vCollRefsTPCITS, tracksCursor, o2::vertexing::GIndex::Source::TPCITS); // fTrackType = 0
452460
}
453461

454-
timeFrameNumberBuilder = getTimeStamp(firstVtxGlBC, runNumber);
462+
timeFrameNumberBuilder = getTFNumber(firstVtxGlBC, runNumber);
455463

456464
mTimer.Stop();
457465
}

0 commit comments

Comments
 (0)