Skip to content

Commit 3577ad8

Browse files
mfasDashahor02
authored andcommitted
[EMCAL-507] Remove custom end-of-stream handling via EMCALBlockHeader
Terminate condition checking the custom EMCALBlockHeader added as additional payload by the publishers no longer needed. - Remove publishing of EMCALBlockHeader - Remove checkReady terminate condition in ROOTTreeWriterSpecs - Remove includes of headers in various Spec In addition increase verbosity level from LOG of the number of cells at the end of run of the RawToCellConverter from debug to info.
1 parent 4fbd7bd commit 3577ad8

8 files changed

Lines changed: 22 additions & 54 deletions

File tree

Detectors/EMCAL/workflow/include/EMCALWorkflow/RawToCellConverterSpec.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ class RawToCellConverterSpec : public framework::Task
103103
int mHWAddressHG; ///< HW address of HG (for monitoring)
104104
};
105105
bool isLostTimeframe(framework::ProcessingContext& ctx) const;
106+
107+
/// \brief Send data to output channels
108+
/// \param cells Container with output cells for timeframe
109+
/// \param triggers Container with trigger records for timeframe
110+
/// \param decodingErrors Container with decoding errors for timeframe
111+
///
112+
/// Send data to all output channels for the given subspecification. The subspecification
113+
/// is determined on the fly in the run method and therefore used as parameter. Consumers
114+
/// must use wildcard subspecification via ConcreteDataTypeMatcher.
106115
void sendData(framework::ProcessingContext& ctx, const std::vector<o2::emcal::Cell>& cells, const std::vector<o2::emcal::TriggerRecord>& triggers, const std::vector<ErrorTypeFEE>& decodingErrors) const;
107116

108117
header::DataHeader::SubSpecificationType mSubspecification = 0; ///< Subspecification for output channels

Detectors/EMCAL/workflow/src/AnalysisClusterSpec.cxx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "DataFormatsEMCAL/Digit.h"
1616
#include "DataFormatsEMCAL/Cluster.h"
17-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
1817
#include "DataFormatsEMCAL/TriggerRecord.h"
1918
#include "EMCALWorkflow/AnalysisClusterSpec.h"
2019
#include "Framework/ControlService.h"
@@ -73,14 +72,6 @@ void AnalysisClusterSpec<InputType>::run(framework::ProcessingContext& ctx)
7372
TrigName = "cellstrgr";
7473
}
7574

76-
auto dataref = ctx.inputs().get(inputname.c_str());
77-
auto const* emcheader = o2::framework::DataRefUtils::getHeader<o2::emcal::EMCALBlockHeader*>(dataref);
78-
if (!emcheader->mHasPayload) {
79-
LOG(debug) << "[EMCALClusterizer - run] No more cells/digits" << std::endl;
80-
ctx.services().get<o2::framework::ControlService>().readyToQuit(framework::QuitRequest::Me);
81-
return;
82-
}
83-
8475
auto Inputs = ctx.inputs().get<gsl::span<InputType>>(inputname.c_str());
8576
LOG(debug) << "[EMCALClusterizer - run] Received " << Inputs.size() << " Cells/digits, running clusterizer ...";
8677

Detectors/EMCAL/workflow/src/CellConverterSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "FairLogger.h"
1313

1414
#include "DataFormatsEMCAL/Digit.h"
15-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
1615
#include "EMCALWorkflow/CellConverterSpec.h"
1716
#include "Framework/ControlService.h"
1817
#include "Framework/ConfigParamRegistry.h"

Detectors/EMCAL/workflow/src/ClusterizerSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "DataFormatsEMCAL/Digit.h"
1616
#include "DataFormatsEMCAL/Cluster.h"
17-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
1817
#include "DataFormatsEMCAL/TriggerRecord.h"
1918
#include "EMCALWorkflow/ClusterizerSpec.h"
2019
#include "Framework/ControlService.h"

Detectors/EMCAL/workflow/src/DigitsPrinterSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "Framework/ControlService.h"
2020
#include "Framework/DataRefUtils.h"
21-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
2221
#include "DataFormatsEMCAL/Cell.h"
2322
#include "DataFormatsEMCAL/Digit.h"
2423
#include "DataFormatsEMCAL/TriggerRecord.h"

Detectors/EMCAL/workflow/src/PublisherSpec.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "DetectorsCommonDataFormats/NameConf.h"
13-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
1413
#include "EMCALWorkflow/PublisherSpec.h"
1514
#include "Framework/ConfigParamRegistry.h"
1615
#include "Framework/ControlService.h"
@@ -67,9 +66,8 @@ o2::framework::DataProcessorSpec createPublisherSpec(PublisherConf const& config
6766
}
6867

6968
auto publish = [&processAttributes, &pc, propagateMC]() {
70-
o2::emcal::EMCALBlockHeader emcheader(true);
7169
if (processAttributes->reader->next()) {
72-
(*processAttributes->reader)(pc, emcheader);
70+
(*processAttributes->reader)(pc);
7371
} else {
7472
processAttributes->reader.reset();
7573
return false;

Detectors/EMCAL/workflow/src/RawToCellConverterSpec.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "Framework/InputRecordWalker.h"
2222
#include "Framework/Logger.h"
2323
#include "Framework/WorkflowSpec.h"
24-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
2524
#include "DataFormatsEMCAL/Constants.h"
2625
#include "DataFormatsEMCAL/TriggerRecord.h"
2726
#include "DataFormatsEMCAL/ErrorTypeFEE.h"
@@ -499,12 +498,12 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
499498
ncellsEvent++;
500499
mOutputCells.push_back(cell.mCellData);
501500
}
502-
LOG(debug) << "Accepted " << ncellsEvent << " cells";
501+
LOG(debug) << "Next event [Orbit " << bc.orbit << ", BC (" << bc.bc << "]: Accepted " << ncellsEvent << " cells";
503502
}
504503
mOutputTriggerRecords.emplace_back(bc, triggerBuffer[bc], eventstart, ncellsEvent);
505504
}
506505

507-
LOG(debug) << "[EMCALRawToCellConverter - run] Writing " << mOutputCells.size() << " cells ...";
506+
LOG(info) << "[EMCALRawToCellConverter - run] Writing " << mOutputCells.size() << " cells from " << mOutputTriggerRecords.size() << " events ...";
508507
sendData(ctx, mOutputCells, mOutputTriggerRecords, mOutputDecoderErrors);
509508
}
510509

Detectors/EMCAL/workflow/src/RecoWorkflow.cxx

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "Algorithm/RangeTokenizer.h"
1919
#include "DPLUtils/MakeRootTreeWriterSpec.h"
20-
#include "DataFormatsEMCAL/EMCALBlockHeader.h"
2120
#include "DataFormatsEMCAL/Cell.h"
2221
#include "DataFormatsEMCAL/Digit.h"
2322
#include "DataFormatsEMCAL/Cluster.h"
@@ -187,75 +186,50 @@ o2::framework::WorkflowSpec getWorkflow(bool propagateMC,
187186
specs.emplace_back(o2::emcal::reco_workflow::getAnalysisClusterSpec(inputType == InputType::Digits));
188187
}
189188

190-
// check if the process is ready to quit
191-
// this is decided upon the meta information in the EMCAL block header, the operation is set
192-
// value kNoPayload in case of no data or no operation
193-
// see also PublisherSpec.cxx
194-
// in this workflow, the EOD is sent after the last real data, and all inputs will receive EOD,
195-
// so it is enough to check on the first occurence
196-
// FIXME: this will be changed once DPL can propagate control events like EOD
197-
auto checkReady = [](o2::framework::DataRef const& ref) {
198-
auto const* emcalheader = o2::framework::DataRefUtils::getHeader<o2::emcal::EMCALBlockHeader*>(ref);
199-
// sector number -1 indicates end-of-data
200-
if (emcalheader != nullptr) {
201-
// indicate normal processing if not ready and skip if ready
202-
if (!emcalheader->mHasPayload) {
203-
return std::make_tuple(o2::framework::MakeRootTreeWriterSpec::TerminationCondition::Action::SkipProcessing, true);
204-
}
205-
}
206-
return std::make_tuple(o2::framework::MakeRootTreeWriterSpec::TerminationCondition::Action::DoProcessing, false);
207-
};
208-
209-
auto makeWriterSpec = [propagateMC, checkReady](const char* processName, const char* defaultFileName, const char* defaultTreeName,
210-
auto&& databranch, auto&& triggerbranch, auto&& mcbranch) {
189+
auto makeWriterSpec = [propagateMC](const char* processName, const char* defaultFileName, const char* defaultTreeName,
190+
auto&& databranch, auto&& triggerbranch, auto&& mcbranch) {
211191
// depending on the MC propagation flag, the RootTreeWriter spec is created with two
212192
// or one branch definition
213193
if (propagateMC) {
214194
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
215-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
216195
std::move(databranch),
217196
std::move(triggerbranch),
218197
std::move(mcbranch)));
219198
}
220199
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
221-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
222200
std::move(databranch),
223201
std::move(triggerbranch)));
224202
};
225203

226204
// TODO: Write comment in push comment @matthiasrichter
227-
auto makeWriterSpec_Cluster = [checkReady](const char* processName, const char* defaultFileName, const char* defaultTreeName,
228-
auto&& clusterbranch, auto&& digitindicesbranch, auto&& clustertriggerbranch, auto&& indicestriggerbranch) {
205+
auto makeWriterSpec_Cluster = [](const char* processName, const char* defaultFileName, const char* defaultTreeName,
206+
auto&& clusterbranch, auto&& digitindicesbranch, auto&& clustertriggerbranch, auto&& indicestriggerbranch) {
229207
// RootTreeWriter spec is created with one branch definition
230208
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
231-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
232209
std::move(clusterbranch),
233210
std::move(digitindicesbranch),
234211
std::move(clustertriggerbranch),
235212
std::move(indicestriggerbranch)));
236213
};
237214

238-
auto makeWriterSpec_AnalysisCluster = [checkReady](const char* processName, const char* defaultFileName, const char* defaultTreeName,
239-
auto&& analysisclusterbranch) {
215+
auto makeWriterSpec_AnalysisCluster = [](const char* processName, const char* defaultFileName, const char* defaultTreeName,
216+
auto&& analysisclusterbranch) {
240217
// RootTreeWriter spec is created with one branch definition
241218
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
242-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
243219
std::move(analysisclusterbranch)));
244220
};
245221

246-
auto makeWriterSpec_CellsTR = [disableDecodingErrors, checkReady](const char* processName, const char* defaultFileName, const char* defaultTreeName,
247-
auto&& CellsBranch, auto&& TriggerRecordBranch, auto&& DecoderErrorsBranch) {
222+
auto makeWriterSpec_CellsTR = [disableDecodingErrors](const char* processName, const char* defaultFileName, const char* defaultTreeName,
223+
auto&& CellsBranch, auto&& TriggerRecordBranch, auto&& DecoderErrorsBranch) {
248224
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
249-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
250225
std::move(CellsBranch),
251226
std::move(TriggerRecordBranch),
252227
std::move(DecoderErrorsBranch)));
253228
};
254229

255-
auto makeWriterSpec_CellsTR_noerrors = [checkReady](const char* processName, const char* defaultFileName, const char* defaultTreeName,
256-
auto&& CellsBranch, auto&& TriggerRecordBranch) {
230+
auto makeWriterSpec_CellsTR_noerrors = [](const char* processName, const char* defaultFileName, const char* defaultTreeName,
231+
auto&& CellsBranch, auto&& TriggerRecordBranch) {
257232
return std::move(o2::framework::MakeRootTreeWriterSpec(processName, defaultFileName, defaultTreeName,
258-
o2::framework::MakeRootTreeWriterSpec::TerminationCondition{checkReady},
259233
std::move(CellsBranch),
260234
std::move(TriggerRecordBranch)));
261235
};

0 commit comments

Comments
 (0)