|
20 | 20 | #include "DataFormatsMCH/TrackMCH.h" |
21 | 21 | #include "DataFormatsMFT/TrackMFT.h" |
22 | 22 | #include "DataFormatsTPC/TrackTPC.h" |
| 23 | +#include "DetectorsRaw/HBFUtils.h" |
23 | 24 | #include "DetectorsBase/GeometryManager.h" |
24 | 25 | #include "CCDB/BasicCCDBManager.h" |
25 | 26 | #include "CommonConstants/PhysicsConstants.h" |
@@ -67,6 +68,16 @@ using GID = o2::dataformats::GlobalTrackID; |
67 | 68 | namespace o2::aodproducer |
68 | 69 | { |
69 | 70 |
|
| 71 | +namespace |
| 72 | +{ |
| 73 | +// takes a local vertex timing in NS and converts to a global BC information |
| 74 | +// using the orbit offset from the simulation |
| 75 | +uint64_t relativeTime_to_GlobalBC(double relativeTimeStampInNS) |
| 76 | +{ |
| 77 | + return std::round((o2::raw::HBFUtils::Instance().getFirstSampledTFIR().bc2ns() + relativeTimeStampInNS) / o2::constants::lhc::LHCBunchSpacingNS); |
| 78 | +} |
| 79 | +} // namespace |
| 80 | + |
70 | 81 | void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddRecPoints, |
71 | 82 | gsl::span<const o2::ft0::RecPoints>& ft0RecPoints, |
72 | 83 | gsl::span<const o2::fv0::RecPoints>& fv0RecPoints, |
@@ -98,7 +109,7 @@ void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddR |
98 | 109 | for (auto& vertex : primVertices) { |
99 | 110 | auto& timeStamp = vertex.getTimeStamp(); |
100 | 111 | double tsTimeStamp = timeStamp.getTimeStamp() * 1E3; // mus to ns |
101 | | - uint64_t globalBC = std::round(tsTimeStamp / o2::constants::lhc::LHCBunchSpacingNS); |
| 112 | + uint64_t globalBC = relativeTime_to_GlobalBC(tsTimeStamp); |
102 | 113 | bcsMap[globalBC] = 1; |
103 | 114 | } |
104 | 115 |
|
@@ -1095,7 +1106,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) |
1095 | 1106 | auto& cov = vertex.getCov(); |
1096 | 1107 | auto& timeStamp = vertex.getTimeStamp(); |
1097 | 1108 | const double interactionTime = timeStamp.getTimeStamp() * 1E3; // mus to ns |
1098 | | - uint64_t globalBC = std::round(interactionTime / o2::constants::lhc::LHCBunchSpacingNS); |
| 1109 | + uint64_t globalBC = relativeTime_to_GlobalBC(interactionTime); |
1099 | 1110 | LOG(DEBUG) << globalBC << " " << interactionTime; |
1100 | 1111 | // collision timestamp in ns wrt the beginning of collision BC |
1101 | 1112 | const float relInteractionTime = static_cast<float>(globalBC * o2::constants::lhc::LHCBunchSpacingNS - interactionTime); |
|
0 commit comments