From 2cd29249bc10346f788a84bb11a01d1fee1311fd Mon Sep 17 00:00:00 2001 From: Matthias Kleiner Date: Wed, 11 May 2022 17:37:23 +0200 Subject: [PATCH] IDCs: adding possibility to disable sending of output adding debug output --- .../TPCWorkflow/TPCDistributeIDCSpec.h | 2 +- .../include/TPCWorkflow/TPCFLPIDCSpec.h | 2 + .../include/TPCWorkflow/TPCFactorizeIDCSpec.h | 37 +++++++++++-------- .../TPC/workflow/src/IDCToVectorSpec.cxx | 9 +++-- .../TPC/workflow/src/tpc-factorize-idc.cxx | 6 ++- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h index 440b4b5ac21fc..702e472bd9d0d 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h @@ -144,8 +144,8 @@ class TPCDistributeIDCSpec : public o2::framework::Task const auto descr = tpcCRUHeader->dataDescription; if (TPCFLPIDCDevice::getDataDescriptionIDCGroup() == descr) { - LOGP(debug, "receiving IDCs for CRU: {}", cru); mIDCs[currentBuffer][cru][relTF] = pc.inputs().get>(ref); + LOGP(info, "receiving IDCs for CRU: {} of size {}", cru, mIDCs[currentBuffer][cru][relTF].size()); } } } diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h index c323d95010388..1ef297802833b 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h @@ -273,12 +273,14 @@ class TPCFLPIDCDevice : public o2::framework::Task // TODO use this and fix #include in ROOT CINT // output.adoptContainer(Output{gDataOriginTPC, getDataDescriptionIDCGroup(), subSpec, Lifetime::Timeframe}, std::move(mIDCs[cru]).getIDCGroupData()); + LOGP(info, "Sending IDCs of size {}", mIDCStruct.getData(cru).size()); output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDCGroup(), subSpec, Lifetime::Timeframe}, mIDCStruct.getData(cru)); mBuffer1DIDCs[cru].emplace_back(std::move(idcOne)); mBuffer1DIDCs[cru].pop_front(); // removing oldest 1D-IDCs fill1DIDCs(cru); + LOGP(info, "Sending 1D-IDCs to EPNs of size {} and weights of size {}", mOneDIDCs.first.size(), mOneDIDCs.second.size()); output.snapshot(Output{gDataOriginTPC, getDataDescription1DIDCEPN(), subSpec, Lifetime::Timeframe}, mOneDIDCs.first); output.snapshot(Output{gDataOriginTPC, getDataDescription1DIDCEPNWeights(), subSpec, Lifetime::Timeframe}, mOneDIDCs.second); } diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFactorizeIDCSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFactorizeIDCSpec.h index 420306e5e5cd7..d9a6bd67f3221 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFactorizeIDCSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFactorizeIDCSpec.h @@ -68,14 +68,14 @@ class TPCFactorizeIDCSpec : public o2::framework::Task template ::value)), int>::type = 0> TPCFactorizeIDCSpec(const std::vector& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, std::array groupPads, std::array groupRows, std::array groupLastRowsThreshold, - std::array groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp) - : mCRUs{crus}, mIDCFactorization{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, timeframes, timeframesDeltaIDC, crus}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp} {}; + std::array groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT) + : mCRUs{crus}, mIDCFactorization{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, timeframes, timeframesDeltaIDC, crus}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp}, mSendOutFFT{sendOutputFFT} {}; template ::value)), int>::type = 0> TPCFactorizeIDCSpec(const std::vector& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, std::array groupPads, std::array groupRows, std::array groupLastRowsThreshold, - std::array groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp) - : mCRUs{crus}, mIDCFactorization{std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 0, timeframes, timeframesDeltaIDC, crus}, mIDCStruct{TPCFactorizeIDCStruct(groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges)}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp} {}; + std::array groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT) + : mCRUs{crus}, mIDCFactorization{std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 0, timeframes, timeframesDeltaIDC, crus}, mIDCStruct{TPCFactorizeIDCStruct(groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges)}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp}, mSendOutFFT{sendOutputFFT} {}; void init(o2::framework::InitContext& ic) final { @@ -135,6 +135,7 @@ class TPCFactorizeIDCSpec : public o2::framework::Task if (TPCDistributeIDCSpec::getDataDescriptionIDC() == descr) { const int cru = tpcCRUHeader->subSpecification - mLaneId * CRU::MaxCRU; mIDCFactorization.setIDCs(pc.inputs().get>(ref), cru, mProcessedTFs); // aggregate IDCs + LOGP(info, "Received IDCs for CRU {} of size {}", cru, mIDCFactorization.getIDCs()[cru][mProcessedTFs].size()); } } ++mProcessedTFs; @@ -181,6 +182,7 @@ class TPCFactorizeIDCSpec : public o2::framework::Task const bool mDebug{false}; ///< dump IDCs to tree for debugging const bool mSendOutDebug{false}; ///< flag if the output will be send (for debugging) const bool mUsePrecisetimeStamp{true}; ///< use precise time stamp when writing to CCDB + const bool mSendOutFFT{false}; ///< flag if the output will be send for the FFT o2::ccdb::CcdbApi mDBapi; ///< API for storing the IDCs in the CCDB std::map mMetadata; ///< meta data of the stored object in CCDB bool mWriteToDB{}; ///< flag if writing to CCDB will be done @@ -244,11 +246,13 @@ class TPCFactorizeIDCSpec : public o2::framework::Task const auto timeStampEnd = (mTimeStampCCDB.second <= timeStampStart) ? timeStampStart + 1 : mTimeStampCCDB.second; // sending output to FFT - LOGP(info, "Sending output"); - output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}, mIDCFactorization.getIDCOne(Side::A)); - output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}, mIDCFactorization.getIDCOne(Side::C)); - output.snapshot(Output{gDataOriginTPC, getDataDescriptionTimeStamp()}, std::vector{timeStampStart, timeStampEnd}); - output.snapshot(Output{gDataOriginTPC, getDataDescriptionIntervals()}, mIDCFactorization.getIntegrationIntervalsPerTF()); + if (mSendOutFFT) { + LOGP(info, "Sending output"); + output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}, mIDCFactorization.getIDCOne(Side::A)); + output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}, mIDCFactorization.getIDCOne(Side::C)); + output.snapshot(Output{gDataOriginTPC, getDataDescriptionTimeStamp()}, std::vector{timeStampStart, timeStampEnd}); + output.snapshot(Output{gDataOriginTPC, getDataDescriptionIntervals()}, mIDCFactorization.getIntegrationIntervalsPerTF()); + } if (mWriteToDB) { LOGP(info, "Writing IDCs to CCDB"); @@ -326,17 +330,20 @@ class TPCFactorizeIDCSpec : public o2::framework::Task }; template -DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp) +DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT) { std::vector outputSpecs; if (senddebug) { outputSpecs.emplace_back(ConcreteDataTypeMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDC0()}); outputSpecs.emplace_back(ConcreteDataTypeMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDCDelta()}); } - outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}); - outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}); - outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionTimeStamp(), header::DataHeader::SubSpecificationType{0}}); - outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIntervals(), header::DataHeader::SubSpecificationType{0}}); + + if (sendOutputFFT) { + outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}); + outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}); + outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionTimeStamp(), header::DataHeader::SubSpecificationType{0}}); + outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec::getDataDescriptionIntervals(), header::DataHeader::SubSpecificationType{0}}); + } std::vector inputSpecs; inputSpecs.reserve(crus.size()); @@ -363,7 +370,7 @@ DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector>(crus, timeframes, timeframesDeltaIDC, groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, compression, debug, senddebug, usePrecisetimeStamp)}, + AlgorithmSpec{adaptFromTask>(crus, timeframes, timeframesDeltaIDC, groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, compression, debug, senddebug, usePrecisetimeStamp, sendOutputFFT)}, Options{{"ccdb-uri", VariantType::String, o2::base::NameConf::getCCDBServer(), {"URI for the CCDB access."}}, {"gainMapFile", VariantType::String, "", {"file to reference gain map, which will be used for correcting the cluster charge"}}, {"update-not-grouping-parameter", VariantType::Bool, false, {"Do NOT Update/Writing grouping parameters to CCDB."}}}}; // end DataProcessorSpec diff --git a/Detectors/TPC/workflow/src/IDCToVectorSpec.cxx b/Detectors/TPC/workflow/src/IDCToVectorSpec.cxx index dbe7908403d35..823df564608b2 100644 --- a/Detectors/TPC/workflow/src/IDCToVectorSpec.cxx +++ b/Detectors/TPC/workflow/src/IDCToVectorSpec.cxx @@ -132,7 +132,7 @@ class IDCToVectorDevice : public o2::framework::Task auto& idcs = *((idc::Container*)(data)); const uint32_t orbit = idcs.header.heartbeatOrbit; const uint32_t bc = idcs.header.heartbeatBC; - //LOGP(info, "IDC Procssing orbit/BC: {:9}/{:4}", orbit, bc); + // LOGP(info, "IDC Procssing orbit/BC: {:9}/{:4}", orbit, bc); auto infoIt = std::find(infoVec.begin(), infoVec.end(), orbit); if (!infoVec.size()) { @@ -188,9 +188,9 @@ class IDCToVectorDevice : public o2::framework::Task const GlobalPadNumber padInRegion = padInSector - regionPadOffset; const GlobalPadNumber vectorPosition = padInRegion + idcOffset * numberPads; // TODO: for debugging, remove later - //auto rawVal = idcs.getChannelValue(iLink, iChannel); - //auto rawValF = idcs.getChannelValueFloat(iLink, iChannel); - //LOGP(info, "filling channel {}, link {}, fecLinkOffsetCRU {:2}, fecSectorOffset {:3}, fecInSector {:3}, idcVec[{} ({})] = {} ({} / {})", iChannel, iLink, fecLinkOffsetCRU, fecSectorOffset, fecInSector, vectorPosition, padInRegion, val, rawVal, rawValF); + // auto rawVal = idcs.getChannelValue(iLink, iChannel); + // auto rawValF = idcs.getChannelValueFloat(iLink, iChannel); + // LOGP(info, "filling channel {}, link {}, fecLinkOffsetCRU {:2}, fecSectorOffset {:3}, fecInSector {:3}, idcVec[{} ({})] = {} ({} / {})", iChannel, iLink, fecLinkOffsetCRU, fecSectorOffset, fecInSector, vectorPosition, padInRegion, val, rawVal, rawValF); idcVec[vectorPosition] = val; } } @@ -278,6 +278,7 @@ class IDCToVectorDevice : public o2::framework::Task for (auto& [cru, idcVec] : mIDCvectors) { idcVec.resize(Mapper::PADSPERREGION[CRU(cru).region()] * orbitsInTF); const header::DataHeader::SubSpecificationType subSpec{cru << 7}; + LOGP(info, "Sending IDCs for CRU {} of size {}", cru, idcVec.size()); output.snapshot(Output{gDataOriginTPC, "IDCVECTOR", subSpec}, idcVec); output.snapshot(Output{gDataOriginTPC, "IDCORBITS", subSpec}, orbitBCInfo); } diff --git a/Detectors/TPC/workflow/src/tpc-factorize-idc.cxx b/Detectors/TPC/workflow/src/tpc-factorize-idc.cxx index 0f6c2f9307e6c..201e7509a790a 100644 --- a/Detectors/TPC/workflow/src/tpc-factorize-idc.cxx +++ b/Detectors/TPC/workflow/src/tpc-factorize-idc.cxx @@ -34,7 +34,8 @@ void customize(std::vector& workflowOptions) {"nthreads-IDC-factorization", VariantType::Int, 1, {"Number of threads which will be used during the factorization of the IDCs."}}, {"nthreads-grouping", VariantType::Int, 1, {"Number of threads which will be used during the grouping of IDCDelta."}}, {"debug", VariantType::Bool, false, {"create debug files"}}, - {"sendOutput", VariantType::Bool, false, {"send IDC0, IDC1, IDCDelta, fourier coefficients (for debugging)"}}, + {"sendOutput", VariantType::Bool, false, {"send IDC0, IDCDelta (for debugging)"}}, + {"sendOutputFFT", VariantType::Bool, false, {"sending the output for fourier transform device"}}, {"crus", VariantType::String, cruDefault.c_str(), {"List of CRUs, comma separated ranges, e.g. 0-3,7,9-15"}}, {"compression", VariantType::Int, 1, {"compression of DeltaIDC: 0 -> No, 1 -> Medium (data compression ratio 2), 2 -> High (data compression ratio ~6)"}}, {"input-lanes", VariantType::Int, 2, {"Number of parallel pipelines which were set in the TPCDistributeIDCSpec device."}}, @@ -72,6 +73,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) const auto debug = config.options().get("debug"); const auto groupIDCs = config.options().get("groupIDCs"); const auto sendOutput = config.options().get("sendOutput"); + const auto sendOutputFFT = config.options().get("sendOutputFFT"); const auto nthreadsFactorization = static_cast(config.options().get("nthreads-IDC-factorization")); IDCFactorization::setNThreads(nthreadsFactorization); const auto nthreadsGrouping = static_cast(config.options().get("nthreads-grouping")); @@ -100,7 +102,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config) WorkflowSpec workflow; workflow.reserve(nLanes); for (int ilane = 0; ilane < nLanes; ++ilane) { - groupIDCs ? workflow.emplace_back(getTPCFactorizeIDCSpec(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp)) : workflow.emplace_back(getTPCFactorizeIDCSpec(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp)); + groupIDCs ? workflow.emplace_back(getTPCFactorizeIDCSpec(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp, sendOutputFFT)) : workflow.emplace_back(getTPCFactorizeIDCSpec(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp, sendOutputFFT)); } return workflow; }