|
24 | 24 | #include "DataFormatsParameters/GRPECSObject.h" |
25 | 25 | #include "ITSMFTBase/DPLAlpideParam.h" |
26 | 26 | #include "MetadataHelper.h" |
| 27 | +#include "DataFormatsParameters/AggregatedRunInfo.h" |
27 | 28 |
|
28 | 29 | #include "TH1D.h" |
29 | 30 |
|
@@ -260,24 +261,12 @@ struct BcSelectionTask { |
260 | 261 | mITSROFrameEndBorderMargin = confITSROFrameEndBorderMargin < 0 ? par->fITSROFrameEndBorderMargin : confITSROFrameEndBorderMargin; |
261 | 262 | mTimeFrameStartBorderMargin = confTimeFrameStartBorderMargin < 0 ? par->fTimeFrameStartBorderMargin : confTimeFrameStartBorderMargin; |
262 | 263 | mTimeFrameEndBorderMargin = confTimeFrameEndBorderMargin < 0 ? par->fTimeFrameEndBorderMargin : confTimeFrameEndBorderMargin; |
263 | | - // access orbit-reset timestamp |
264 | | - auto ctpx = ccdb->getForTimeStamp<std::vector<Long64_t>>("CTP/Calib/OrbitReset", ts); |
265 | | - int64_t tsOrbitReset = (*ctpx)[0]; // us |
266 | | - // access TF duration, start-of-run and end-of-run timestamps from ECS GRP |
267 | | - std::map<std::string, std::string> metadata; |
268 | | - metadata["runNumber"] = Form("%d", run); |
269 | | - auto grpecs = ccdb->getSpecific<o2::parameters::GRPECSObject>("GLO/Config/GRPECS", ts, metadata); |
270 | | - uint32_t nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 |
271 | | - int64_t tsSOR = grpecs->getTimeStart(); // ms |
272 | | - // calculate SOR orbit |
273 | | - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; |
274 | | - // adjust to the nearest TF edge |
275 | | - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; |
276 | | - // first bc of the first orbit (should coincide with TF start) |
277 | | - bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; |
| 264 | + |
| 265 | + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); |
| 266 | + // first bc of the first orbit |
| 267 | + bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; |
278 | 268 | // duration of TF in bcs |
279 | | - nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; |
280 | | - LOGP(info, "tsOrbitReset={} us, SOR = {} ms, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, orbitSOR, nBCsPerTF); |
| 269 | + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; |
281 | 270 | } |
282 | 271 | } |
283 | 272 |
|
@@ -631,28 +620,15 @@ struct EventSelectionTask { |
631 | 620 | // extract bc pattern from CCDB for data or anchored MC only |
632 | 621 | if (run != lastRun && run >= 500000) { |
633 | 622 | lastRun = run; |
| 623 | + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); |
| 624 | + // first bc of the first orbit |
| 625 | + bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; |
| 626 | + // duration of TF in bcs |
| 627 | + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; |
| 628 | + // colliding bc pattern |
634 | 629 | int64_t ts = bcs.iteratorAt(0).timestamp(); |
635 | 630 | auto grplhcif = ccdb->getForTimeStamp<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF", ts); |
636 | 631 | bcPatternB = grplhcif->getBunchFilling().getBCPattern(); |
637 | | - |
638 | | - EventSelectionParams* par = ccdb->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", ts); |
639 | | - // access orbit-reset timestamp |
640 | | - auto ctpx = ccdb->getForTimeStamp<std::vector<Long64_t>>("CTP/Calib/OrbitReset", ts); |
641 | | - int64_t tsOrbitReset = (*ctpx)[0]; // us |
642 | | - // access TF duration, start-of-run timestamp from ECS GRP |
643 | | - std::map<std::string, std::string> metadata; |
644 | | - metadata["runNumber"] = Form("%d", run); |
645 | | - auto grpecs = ccdb->getSpecific<o2::parameters::GRPECSObject>("GLO/Config/GRPECS", ts, metadata); |
646 | | - uint32_t nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 |
647 | | - int64_t tsSOR = grpecs->getTimeStart(); // ms |
648 | | - // calculate SOR orbit |
649 | | - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; |
650 | | - // adjust to the nearest TF edge |
651 | | - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; |
652 | | - // first bc of the first orbit (should coincide with TF start) |
653 | | - bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; |
654 | | - // duration of TF in bcs |
655 | | - nBCsPerTF = nOrbitsPerTF * o2::constants::lhc::LHCMaxBunches; |
656 | 632 | } |
657 | 633 |
|
658 | 634 | // create maps from globalBC to bc index for TVX-fired bcs |
@@ -806,7 +782,7 @@ struct EventSelectionTask { |
806 | 782 | // second loop to match remaining low-pt TPCnoTOFnoTRD collisions |
807 | 783 | for (auto& col : cols) { |
808 | 784 | int32_t colIndex = col.globalIndex(); |
809 | | - if (vIsVertexTPC[colIndex] > 0 && vIsVertexHighPtTPC[colIndex] == 0) { |
| 785 | + if (vIsVertexTPC[colIndex] > 0 && vIsVertexTOF[colIndex] == 0 && vIsVertexHighPtTPC[colIndex] == 0) { |
810 | 786 | float weightedTime = vWeightedTimesTPCnoTOFnoTRD[colIndex]; |
811 | 787 | float weightedSigma = vWeightedSigmaTPCnoTOFnoTRD[colIndex]; |
812 | 788 | auto bc = col.bc_as<BCsWithBcSelsRun3>(); |
|
0 commit comments