diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/LumiInfo.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/LumiInfo.h index c489e0a184a25..27f67ba6e92a8 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/LumiInfo.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/LumiInfo.h @@ -24,12 +24,13 @@ struct LumiInfo { LumiInfo() = default; uint32_t orbit = 0; // orbit of TF when was updated uint32_t nHBFCounted = 0; // length of interval in HB + uint32_t nHBFCountedFV0 = 0; uint64_t counts = 0; // counts in the interval for the nominal lumi detector (FT0) uint64_t countsFV0 = 0; // connts for FV0 (less reliable) float getLumi() const { return nHBFCounted > 0 ? float(counts / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } - float getLumiFV0() const { return nHBFCounted > 0 ? float(countsFV0 / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } + float getLumiFV0() const { return nHBFCountedFV0 > 0 ? float(countsFV0 / (nHBFCountedFV0 * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } float getLumiError() const { return nHBFCounted > 0 ? float(std::sqrt(counts) / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } - float getLumiFV0Error() const { return nHBFCounted > 0 ? float(std::sqrt(countsFV0) / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } + float getLumiFV0Error() const { return nHBFCountedFV0 > 0 ? float(std::sqrt(countsFV0) / (nHBFCountedFV0 * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; } ClassDefNV(LumiInfo, 2); }; } // namespace ctp diff --git a/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h b/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h index a43dbd2caa9e5..ca6dc79fb2ac7 100644 --- a/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h +++ b/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h @@ -63,13 +63,17 @@ class RawDecoderSpec : public framework::Task // for lumi bool mDoLumi = true; // - gbtword80_t mTVXMask = 0x4; // TVX is 3rd input + gbtword80_t mTVXMask = 0x4; // TVX is 3rd input + gbtword80_t mVBAMask = 0x20; // VBA is 6 th input LumiInfo mOutputLumiInfo; bool mVerbose = false; - uint64_t mCounts = 0; + uint64_t mCountsT = 0; + uint64_t mCountsV = 0; uint32_t mNTFToIntegrate = 1; - uint32_t mNHBIntegrated = 0; - std::deque mHistory; + uint32_t mNHBIntegratedT = 0; + uint32_t mNHBIntegratedV = 0; + std::deque mHistoryT; + std::deque mHistoryV; }; /// \brief Creating DataProcessorSpec for the CTP diff --git a/Detectors/CTP/workflow/src/RawDecoderSpec.cxx b/Detectors/CTP/workflow/src/RawDecoderSpec.cxx index 7b2e7873195ba..4ad16e1a0cf2b 100644 --- a/Detectors/CTP/workflow/src/RawDecoderSpec.cxx +++ b/Detectors/CTP/workflow/src/RawDecoderSpec.cxx @@ -69,7 +69,8 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx) std::vector filter{InputSpec{"filter", ConcreteDataTypeMatcher{"CTP", "RAWDATA"}, Lifetime::Timeframe}}; o2::framework::DPLRawParser parser(ctx.inputs(), filter); std::vector lumiPointsHBF1; - uint64_t countsMB = 0; + uint64_t countsMBT = 0; + uint64_t countsMBV = 0; uint32_t payloadCTP; uint32_t orbit0 = 0; bool first = true; @@ -110,8 +111,9 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx) std::vector diglets; if (orbit0 != triggerOrbit) { if (mDoLumi && payloadCTP == o2::ctp::NIntRecPayload) { // create lumi per HB - lumiPointsHBF1.emplace_back(LumiInfo{triggerOrbit, 0, countsMB}); - countsMB = 0; + lumiPointsHBF1.emplace_back(LumiInfo{triggerOrbit, 0, 0, countsMBT, countsMBV}); + countsMBT = 0; + countsMBV = 0; } remnant = 0; size_gbt = 0; @@ -138,7 +140,11 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx) if (mDoLumi && payloadCTP == o2::ctp::NIntRecPayload) { gbtword80_t pld = (diglet >> 12) & mTVXMask; if (pld.count() != 0) { - countsMB++; + countsMBT++; + } + pld = (diglet >> 12) & mVBAMask; + if (pld.count() != 0) { + countsMBV++; } } if (!mDoDigits) { @@ -159,7 +165,11 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx) if (mDoLumi && payloadCTP == o2::ctp::NIntRecPayload) { gbtword80_t pld = (remnant >> 12) & mTVXMask; if (pld.count() != 0) { - countsMB++; + countsMBT++; + } + pld = (remnant >> 12) & mVBAMask; + if (pld.count() != 0) { + countsMBV++; } } if (!mDoDigits) { @@ -177,27 +187,42 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx) ctx.outputs().snapshot(o2::framework::Output{"CTP", "DIGITS", 0, o2::framework::Lifetime::Timeframe}, mOutputDigits); } if (mDoLumi) { - lumiPointsHBF1.emplace_back(LumiInfo{orbit0, 0, countsMB}); - uint32_t tfCounts = 0; + lumiPointsHBF1.emplace_back(LumiInfo{orbit0, 0, 0, countsMBT, countsMBV}); + uint32_t tfCountsT = 0; + uint32_t tfCountsV = 0; for (auto const& lp : lumiPointsHBF1) { - tfCounts += lp.counts; + tfCountsT += lp.counts; + tfCountsV += lp.countsFV0; } // LOG(info) << "Lumi rate:" << tfCounts/(128.*88e-6); - mHistory.push_back(tfCounts); - mCounts += tfCounts; - if (mHistory.size() <= mNTFToIntegrate) { - mNHBIntegrated += lumiPointsHBF1.size(); + // FT0 + mHistoryT.push_back(tfCountsT); + mCountsT += tfCountsT; + if (mHistoryT.size() <= mNTFToIntegrate) { + mNHBIntegratedT += lumiPointsHBF1.size(); + } else { + mCountsT -= mHistoryT.front(); + mHistoryT.pop_front(); + } + // FV0 + mHistoryV.push_back(tfCountsV); + mCountsV += tfCountsV; + if (mHistoryV.size() <= mNTFToIntegrate) { + mNHBIntegratedV += lumiPointsHBF1.size(); } else { - mCounts -= mHistory.front(); - mHistory.pop_front(); + mCountsV -= mHistoryV.front(); + mHistoryV.pop_front(); } - if (mNHBIntegrated) { + // + if (mNHBIntegratedT || mNHBIntegratedV) { mOutputLumiInfo.orbit = lumiPointsHBF1[0].orbit; } - mOutputLumiInfo.counts = mCounts; - mOutputLumiInfo.nHBFCounted = mNHBIntegrated; + mOutputLumiInfo.counts = mCountsT; + mOutputLumiInfo.countsFV0 = mCountsV; + mOutputLumiInfo.nHBFCounted = mNHBIntegratedT; + mOutputLumiInfo.nHBFCountedFV0 = mNHBIntegratedV; if (mVerbose) { - LOGP(info, "Orbit {}: {} counts in {} HBFs -> lumi = {:.3e}+-{:.3e}", mOutputLumiInfo.orbit, mCounts, mNHBIntegrated, mOutputLumiInfo.getLumi(), mOutputLumiInfo.getLumiError()); + LOGP(info, "Orbit {}: {}/{} counts T/V in {}/{} HBFs -> lumiT = {:.3e}+-{:.3e} lumiV = {:.3e}+-{:.3e}", mOutputLumiInfo.orbit, mCountsT, mCountsV, mNHBIntegratedT, mNHBIntegratedV, mOutputLumiInfo.getLumi(), mOutputLumiInfo.getLumiError(), mOutputLumiInfo.getLumiFV0(), mOutputLumiInfo.getLumiFV0Error()); } ctx.outputs().snapshot(o2::framework::Output{"CTP", "LUMI", 0, o2::framework::Lifetime::Timeframe}, mOutputLumiInfo); }