Skip to content

Commit 52175f2

Browse files
matthias-kleinershahor02
authored andcommitted
IDCs: adding possibility to disable sending of output
adding debug output
1 parent 90c3cf2 commit 52175f2

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ class TPCDistributeIDCSpec : public o2::framework::Task
144144

145145
const auto descr = tpcCRUHeader->dataDescription;
146146
if (TPCFLPIDCDevice<TPCFLPIDCDeviceGroup>::getDataDescriptionIDCGroup() == descr) {
147-
LOGP(debug, "receiving IDCs for CRU: {}", cru);
148147
mIDCs[currentBuffer][cru][relTF] = pc.inputs().get<pmr::vector<float>>(ref);
148+
LOGP(info, "receiving IDCs for CRU: {} of size {}", cru, mIDCs[currentBuffer][cru][relTF].size());
149149
}
150150
}
151151
}

Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ class TPCFLPIDCDevice : public o2::framework::Task
273273

274274
// TODO use this and fix #include <boost/container/pmr/polymorphic_allocator.hpp> in ROOT CINT
275275
// output.adoptContainer(Output{gDataOriginTPC, getDataDescriptionIDCGroup(), subSpec, Lifetime::Timeframe}, std::move(mIDCs[cru]).getIDCGroupData());
276+
LOGP(info, "Sending IDCs of size {}", mIDCStruct.getData(cru).size());
276277
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDCGroup(), subSpec, Lifetime::Timeframe}, mIDCStruct.getData(cru));
277278

278279
mBuffer1DIDCs[cru].emplace_back(std::move(idcOne));
279280
mBuffer1DIDCs[cru].pop_front(); // removing oldest 1D-IDCs
280281

281282
fill1DIDCs(cru);
283+
LOGP(info, "Sending 1D-IDCs to EPNs of size {} and weights of size {}", mOneDIDCs.first.size(), mOneDIDCs.second.size());
282284
output.snapshot(Output{gDataOriginTPC, getDataDescription1DIDCEPN(), subSpec, Lifetime::Timeframe}, mOneDIDCs.first);
283285
output.snapshot(Output{gDataOriginTPC, getDataDescription1DIDCEPNWeights(), subSpec, Lifetime::Timeframe}, mOneDIDCs.second);
284286
}

Detectors/TPC/workflow/include/TPCWorkflow/TPCFactorizeIDCSpec.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ class TPCFactorizeIDCSpec : public o2::framework::Task
6868
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, TPCFactorizeIDCSpecNoGroup>::value)), int>::type = 0>
6969
TPCFactorizeIDCSpec(const std::vector<uint32_t>& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, std::array<unsigned char, Mapper::NREGIONS> groupPads,
7070
std::array<unsigned char, Mapper::NREGIONS> groupRows, std::array<unsigned char, Mapper::NREGIONS> groupLastRowsThreshold,
71-
std::array<unsigned char, Mapper::NREGIONS> groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp)
72-
: mCRUs{crus}, mIDCFactorization{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, timeframes, timeframesDeltaIDC, crus}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp} {};
71+
std::array<unsigned char, Mapper::NREGIONS> groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT)
72+
: mCRUs{crus}, mIDCFactorization{groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, timeframes, timeframesDeltaIDC, crus}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp}, mSendOutFFT{sendOutputFFT} {};
7373

7474
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, TPCFactorizeIDCSpecGroup>::value)), int>::type = 0>
7575
TPCFactorizeIDCSpec(const std::vector<uint32_t>& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, std::array<unsigned char, Mapper::NREGIONS> groupPads,
7676
std::array<unsigned char, Mapper::NREGIONS> groupRows, std::array<unsigned char, Mapper::NREGIONS> groupLastRowsThreshold,
77-
std::array<unsigned char, Mapper::NREGIONS> groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp)
78-
: mCRUs{crus}, mIDCFactorization{std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 0, timeframes, timeframesDeltaIDC, crus}, mIDCStruct{TPCFactorizeIDCStruct<TPCFactorizeIDCSpecGroup>(groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges)}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp} {};
77+
std::array<unsigned char, Mapper::NREGIONS> groupLastPadsThreshold, const unsigned int groupPadsSectorEdges, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT)
78+
: mCRUs{crus}, mIDCFactorization{std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, std::array<unsigned char, Mapper::NREGIONS>{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 0, timeframes, timeframesDeltaIDC, crus}, mIDCStruct{TPCFactorizeIDCStruct<TPCFactorizeIDCSpecGroup>(groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges)}, mCompressionDeltaIDC{compression}, mDebug{debug}, mSendOutDebug{senddebug}, mUsePrecisetimeStamp{usePrecisetimeStamp}, mSendOutFFT{sendOutputFFT} {};
7979

8080
void init(o2::framework::InitContext& ic) final
8181
{
@@ -135,6 +135,7 @@ class TPCFactorizeIDCSpec : public o2::framework::Task
135135
if (TPCDistributeIDCSpec::getDataDescriptionIDC() == descr) {
136136
const int cru = tpcCRUHeader->subSpecification - mLaneId * CRU::MaxCRU;
137137
mIDCFactorization.setIDCs(pc.inputs().get<std::vector<float>>(ref), cru, mProcessedTFs); // aggregate IDCs
138+
LOGP(info, "Received IDCs for CRU {} of size {}", cru, mIDCFactorization.getIDCs()[cru][mProcessedTFs].size());
138139
}
139140
}
140141
++mProcessedTFs;
@@ -181,6 +182,7 @@ class TPCFactorizeIDCSpec : public o2::framework::Task
181182
const bool mDebug{false}; ///< dump IDCs to tree for debugging
182183
const bool mSendOutDebug{false}; ///< flag if the output will be send (for debugging)
183184
const bool mUsePrecisetimeStamp{true}; ///< use precise time stamp when writing to CCDB
185+
const bool mSendOutFFT{false}; ///< flag if the output will be send for the FFT
184186
o2::ccdb::CcdbApi mDBapi; ///< API for storing the IDCs in the CCDB
185187
std::map<std::string, std::string> mMetadata; ///< meta data of the stored object in CCDB
186188
bool mWriteToDB{}; ///< flag if writing to CCDB will be done
@@ -244,11 +246,13 @@ class TPCFactorizeIDCSpec : public o2::framework::Task
244246
const auto timeStampEnd = (mTimeStampCCDB.second <= timeStampStart) ? timeStampStart + 1 : mTimeStampCCDB.second;
245247

246248
// sending output to FFT
247-
LOGP(info, "Sending output");
248-
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}, mIDCFactorization.getIDCOne(Side::A));
249-
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}, mIDCFactorization.getIDCOne(Side::C));
250-
output.snapshot(Output{gDataOriginTPC, getDataDescriptionTimeStamp()}, std::vector<uint64_t>{timeStampStart, timeStampEnd});
251-
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIntervals()}, mIDCFactorization.getIntegrationIntervalsPerTF());
249+
if (mSendOutFFT) {
250+
LOGP(info, "Sending output");
251+
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}}, mIDCFactorization.getIDCOne(Side::A));
252+
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}}, mIDCFactorization.getIDCOne(Side::C));
253+
output.snapshot(Output{gDataOriginTPC, getDataDescriptionTimeStamp()}, std::vector<uint64_t>{timeStampStart, timeStampEnd});
254+
output.snapshot(Output{gDataOriginTPC, getDataDescriptionIntervals()}, mIDCFactorization.getIntegrationIntervalsPerTF());
255+
}
252256

253257
if (mWriteToDB) {
254258
LOGP(info, "Writing IDCs to CCDB");
@@ -326,17 +330,20 @@ class TPCFactorizeIDCSpec : public o2::framework::Task
326330
};
327331

328332
template <class Type>
329-
DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector<uint32_t>& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp)
333+
DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector<uint32_t>& crus, const unsigned int timeframes, const unsigned int timeframesDeltaIDC, const IDCDeltaCompression compression, const bool debug, const bool senddebug, const bool usePrecisetimeStamp, const bool sendOutputFFT)
330334
{
331335
std::vector<OutputSpec> outputSpecs;
332336
if (senddebug) {
333337
outputSpecs.emplace_back(ConcreteDataTypeMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDC0()});
334338
outputSpecs.emplace_back(ConcreteDataTypeMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDCDelta()});
335339
}
336-
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}});
337-
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}});
338-
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionTimeStamp(), header::DataHeader::SubSpecificationType{0}});
339-
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIntervals(), header::DataHeader::SubSpecificationType{0}});
340+
341+
if (sendOutputFFT) {
342+
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::A}});
343+
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIDC1(), header::DataHeader::SubSpecificationType{Side::C}});
344+
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionTimeStamp(), header::DataHeader::SubSpecificationType{0}});
345+
outputSpecs.emplace_back(ConcreteDataMatcher{gDataOriginTPC, TPCFactorizeIDCSpec<Type>::getDataDescriptionIntervals(), header::DataHeader::SubSpecificationType{0}});
346+
}
340347

341348
std::vector<InputSpec> inputSpecs;
342349
inputSpecs.reserve(crus.size());
@@ -363,7 +370,7 @@ DataProcessorSpec getTPCFactorizeIDCSpec(const int lane, const std::vector<uint3
363370
fmt::format("tpc-factorize-idc-{:02}", lane).data(),
364371
inputSpecs,
365372
outputSpecs,
366-
AlgorithmSpec{adaptFromTask<TPCFactorizeIDCSpec<Type>>(crus, timeframes, timeframesDeltaIDC, groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, compression, debug, senddebug, usePrecisetimeStamp)},
373+
AlgorithmSpec{adaptFromTask<TPCFactorizeIDCSpec<Type>>(crus, timeframes, timeframesDeltaIDC, groupPads, groupRows, groupLastRowsThreshold, groupLastPadsThreshold, groupPadsSectorEdges, compression, debug, senddebug, usePrecisetimeStamp, sendOutputFFT)},
367374
Options{{"ccdb-uri", VariantType::String, o2::base::NameConf::getCCDBServer(), {"URI for the CCDB access."}},
368375
{"gainMapFile", VariantType::String, "", {"file to reference gain map, which will be used for correcting the cluster charge"}},
369376
{"update-not-grouping-parameter", VariantType::Bool, false, {"Do NOT Update/Writing grouping parameters to CCDB."}}}}; // end DataProcessorSpec

Detectors/TPC/workflow/src/IDCToVectorSpec.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class IDCToVectorDevice : public o2::framework::Task
132132
auto& idcs = *((idc::Container*)(data));
133133
const uint32_t orbit = idcs.header.heartbeatOrbit;
134134
const uint32_t bc = idcs.header.heartbeatBC;
135-
//LOGP(info, "IDC Procssing orbit/BC: {:9}/{:4}", orbit, bc);
135+
// LOGP(info, "IDC Procssing orbit/BC: {:9}/{:4}", orbit, bc);
136136

137137
auto infoIt = std::find(infoVec.begin(), infoVec.end(), orbit);
138138
if (!infoVec.size()) {
@@ -188,9 +188,9 @@ class IDCToVectorDevice : public o2::framework::Task
188188
const GlobalPadNumber padInRegion = padInSector - regionPadOffset;
189189
const GlobalPadNumber vectorPosition = padInRegion + idcOffset * numberPads;
190190
// TODO: for debugging, remove later
191-
//auto rawVal = idcs.getChannelValue(iLink, iChannel);
192-
//auto rawValF = idcs.getChannelValueFloat(iLink, iChannel);
193-
//LOGP(info, "filling channel {}, link {}, fecLinkOffsetCRU {:2}, fecSectorOffset {:3}, fecInSector {:3}, idcVec[{} ({})] = {} ({} / {})", iChannel, iLink, fecLinkOffsetCRU, fecSectorOffset, fecInSector, vectorPosition, padInRegion, val, rawVal, rawValF);
191+
// auto rawVal = idcs.getChannelValue(iLink, iChannel);
192+
// auto rawValF = idcs.getChannelValueFloat(iLink, iChannel);
193+
// LOGP(info, "filling channel {}, link {}, fecLinkOffsetCRU {:2}, fecSectorOffset {:3}, fecInSector {:3}, idcVec[{} ({})] = {} ({} / {})", iChannel, iLink, fecLinkOffsetCRU, fecSectorOffset, fecInSector, vectorPosition, padInRegion, val, rawVal, rawValF);
194194
idcVec[vectorPosition] = val;
195195
}
196196
}
@@ -278,6 +278,7 @@ class IDCToVectorDevice : public o2::framework::Task
278278
for (auto& [cru, idcVec] : mIDCvectors) {
279279
idcVec.resize(Mapper::PADSPERREGION[CRU(cru).region()] * orbitsInTF);
280280
const header::DataHeader::SubSpecificationType subSpec{cru << 7};
281+
LOGP(info, "Sending IDCs for CRU {} of size {}", cru, idcVec.size());
281282
output.snapshot(Output{gDataOriginTPC, "IDCVECTOR", subSpec}, idcVec);
282283
output.snapshot(Output{gDataOriginTPC, "IDCORBITS", subSpec}, orbitBCInfo);
283284
}

Detectors/TPC/workflow/src/tpc-factorize-idc.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3434
{"nthreads-IDC-factorization", VariantType::Int, 1, {"Number of threads which will be used during the factorization of the IDCs."}},
3535
{"nthreads-grouping", VariantType::Int, 1, {"Number of threads which will be used during the grouping of IDCDelta."}},
3636
{"debug", VariantType::Bool, false, {"create debug files"}},
37-
{"sendOutput", VariantType::Bool, false, {"send IDC0, IDC1, IDCDelta, fourier coefficients (for debugging)"}},
37+
{"sendOutput", VariantType::Bool, false, {"send IDC0, IDCDelta (for debugging)"}},
38+
{"sendOutputFFT", VariantType::Bool, false, {"sending the output for fourier transform device"}},
3839
{"crus", VariantType::String, cruDefault.c_str(), {"List of CRUs, comma separated ranges, e.g. 0-3,7,9-15"}},
3940
{"compression", VariantType::Int, 1, {"compression of DeltaIDC: 0 -> No, 1 -> Medium (data compression ratio 2), 2 -> High (data compression ratio ~6)"}},
4041
{"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)
7273
const auto debug = config.options().get<bool>("debug");
7374
const auto groupIDCs = config.options().get<bool>("groupIDCs");
7475
const auto sendOutput = config.options().get<bool>("sendOutput");
76+
const auto sendOutputFFT = config.options().get<bool>("sendOutputFFT");
7577
const auto nthreadsFactorization = static_cast<unsigned long>(config.options().get<int>("nthreads-IDC-factorization"));
7678
IDCFactorization::setNThreads(nthreadsFactorization);
7779
const auto nthreadsGrouping = static_cast<unsigned long>(config.options().get<int>("nthreads-grouping"));
@@ -100,7 +102,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
100102
WorkflowSpec workflow;
101103
workflow.reserve(nLanes);
102104
for (int ilane = 0; ilane < nLanes; ++ilane) {
103-
groupIDCs ? workflow.emplace_back(getTPCFactorizeIDCSpec<TPCFactorizeIDCSpecGroup>(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp)) : workflow.emplace_back(getTPCFactorizeIDCSpec<TPCFactorizeIDCSpecNoGroup>(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp));
105+
groupIDCs ? workflow.emplace_back(getTPCFactorizeIDCSpec<TPCFactorizeIDCSpecGroup>(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp, sendOutputFFT)) : workflow.emplace_back(getTPCFactorizeIDCSpec<TPCFactorizeIDCSpecNoGroup>(ilane, rangeCRUs, timeframes, timeframesDeltaIDC, compression, debug, sendOutput, usePrecisetimeStamp, sendOutputFFT));
104106
}
105107
return workflow;
106108
}

0 commit comments

Comments
 (0)