Skip to content

Commit b0792ea

Browse files
committed
Correctly convert relative vertex times into global BC information
Using the orbit information from digitization to convert relative vertex times into global BC information. Fixes https://alice.its.cern.ch/jira/browse/O2-2610
1 parent 31771a6 commit b0792ea

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "DataFormatsMCH/TrackMCH.h"
2121
#include "DataFormatsMFT/TrackMFT.h"
2222
#include "DataFormatsTPC/TrackTPC.h"
23+
#include "DetectorsRaw/HBFUtils.h"
2324
#include "DetectorsBase/GeometryManager.h"
2425
#include "CCDB/BasicCCDBManager.h"
2526
#include "CommonConstants/PhysicsConstants.h"
@@ -67,6 +68,16 @@ using GID = o2::dataformats::GlobalTrackID;
6768
namespace o2::aodproducer
6869
{
6970

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+
7081
void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddRecPoints,
7182
gsl::span<const o2::ft0::RecPoints>& ft0RecPoints,
7283
gsl::span<const o2::fv0::RecPoints>& fv0RecPoints,
@@ -98,7 +109,7 @@ void AODProducerWorkflowDPL::collectBCs(gsl::span<const o2::fdd::RecPoint>& fddR
98109
for (auto& vertex : primVertices) {
99110
auto& timeStamp = vertex.getTimeStamp();
100111
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);
102113
bcsMap[globalBC] = 1;
103114
}
104115

@@ -1095,7 +1106,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
10951106
auto& cov = vertex.getCov();
10961107
auto& timeStamp = vertex.getTimeStamp();
10971108
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);
10991110
LOG(DEBUG) << globalBC << " " << interactionTime;
11001111
// collision timestamp in ns wrt the beginning of collision BC
11011112
const float relInteractionTime = static_cast<float>(globalBC * o2::constants::lhc::LHCBunchSpacingNS - interactionTime);

Detectors/AOD/src/aod-producer-workflow.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "CommonUtils/ConfigurableParam.h"
1616
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
1717
#include "DetectorsCommonDataFormats/DetID.h"
18+
#include "DetectorsRaw/HBFUtilsInitializer.h"
1819

1920
using namespace o2::framework;
2021
using GID = o2::dataformats::GlobalTrackID;
@@ -30,6 +31,8 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3031
{"info-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
3132
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
3233

34+
o2::raw::HBFUtilsInitializer::addConfigOption(options);
35+
3336
std::swap(workflowOptions, options);
3437
}
3538

@@ -50,5 +53,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
5053
o2::globaltracking::InputHelper::addInputSpecsPVertex(configcontext, specs, useMC);
5154
o2::globaltracking::InputHelper::addInputSpecsSVertex(configcontext, specs);
5255

56+
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
57+
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
58+
5359
return std::move(specs);
5460
}

0 commit comments

Comments
 (0)