Skip to content

Commit cd837ac

Browse files
committed
Move FragmentToBatch to separate class
1 parent 879a535 commit cd837ac

File tree

12 files changed

+119
-59
lines changed

12 files changed

+119
-59
lines changed

Detectors/EMCAL/workflow/src/StandaloneAODProducerSpec.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "Framework/InputRecordWalker.h"
1818
#include "Framework/Logger.h"
1919
#include "Framework/TableBuilder.h"
20-
#include "Framework/TableTreeHelpers.h"
2120
#include "MathUtils/Utils.h"
2221

2322
using namespace o2::framework;
@@ -105,7 +104,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
105104
o2::math_utils::detail::truncateFloatFraction(cell.getTimeStamp(), mCaloTime),
106105
cell.getType(),
107106
1); // hard coded for emcal (-1 would be undefined, 0 phos)
108-
} // end of cell loop
107+
} // end of cell loop
109108

110109
// filled only with BCID, rest dummy for no2
111110
caloCellsTRGTableCursor(0,

Detectors/Filtering/src/FilteringSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "Framework/InputRecordWalker.h"
3939
#include "Framework/Logger.h"
4040
#include "Framework/TableBuilder.h"
41-
#include "Framework/TableTreeHelpers.h"
4241
#include "Framework/CCDBParamSpec.h"
4342
#include "FDDBase/Constants.h"
4443
#include "FT0Base/Geometry.h"

Detectors/PHOS/workflow/src/StandaloneAODProducerSpec.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "Framework/InputRecordWalker.h"
2020
#include "Framework/Logger.h"
2121
#include "Framework/TableBuilder.h"
22-
#include "Framework/TableTreeHelpers.h"
2322
#include "MathUtils/Utils.h"
2423

2524
using namespace o2::framework;
@@ -106,7 +105,7 @@ void StandaloneAODProducerSpec::run(ProcessingContext& pc)
106105
o2::math_utils::detail::truncateFloatFraction(c.getTime(), mCaloTime),
107106
c.getType(), // HG/LG
108107
0); // hard coded for phos (-1 would be undefined, 0 phos)
109-
} // end of cell loop
108+
} // end of cell loop
110109

111110
auto bcID = tr.getBCData().toLong();
112111
bcCursor(0,

Framework/AnalysisSupport/src/DataInputDirector.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "Framework/AnalysisDataModelHelpers.h"
1717
#include "Framework/Output.h"
1818
#include "Framework/Signpost.h"
19+
#include "Framework/FragmentToBatch.h"
1920
#include "Headers/DataHeader.h"
20-
#include "Framework/TableTreeHelpers.h"
2121
#include "Monitoring/Tags.h"
2222
#include "Monitoring/Metric.h"
2323
#include "Monitoring/Monitoring.h"

Framework/AnalysisSupport/src/Plugin.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727

2828
O2_DECLARE_DYNAMIC_LOG(analysis_support);
2929

30+
struct ROOTTypeInfo {
31+
EDataType type;
32+
char suffix[3];
33+
int size;
34+
};
35+
3036
struct ROOTFileReader : o2::framework::AlgorithmPlugin {
3137
o2::framework::AlgorithmSpec create(o2::framework::ConfigContext const& config) override
3238
{

Framework/Core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ o2_add_library(Framework
8787
src/FairMQDeviceProxy.cxx
8888
src/FairMQResizableBuffer.cxx
8989
src/FairOptionsRetriever.cxx
90+
src/FragmentToBatch.cxx
9091
src/ConfigurationOptionsRetriever.cxx
9192
src/FreePortFinder.cxx
9293
src/GraphvizHelpers.cxx
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#ifndef O2_FRAMEWORK_FRAGMENT_TO_BATCH_H_
12+
#define O2_FRAMEWORK_FRAGMENT_TO_BATCH_H_
13+
14+
#include <arrow/buffer.h>
15+
#include <arrow/io/interfaces.h>
16+
#include <arrow/record_batch.h>
17+
#include <arrow/dataset/file_base.h>
18+
#include <memory>
19+
20+
// =============================================================================
21+
namespace o2::framework
22+
{
23+
class FragmentToBatch
24+
{
25+
public:
26+
// The function to be used to create the required stream.
27+
using StreamerCreator = std::function<std::shared_ptr<arrow::io::OutputStream>(std::shared_ptr<arrow::dataset::FileFragment>, const std::shared_ptr<arrow::ResizableBuffer>& buffer)>;
28+
29+
FragmentToBatch(StreamerCreator, std::shared_ptr<arrow::dataset::FileFragment>, arrow::MemoryPool* pool = arrow::default_memory_pool());
30+
void setLabel(const char* label);
31+
void fill(std::shared_ptr<arrow::Schema> dataSetSchema, std::shared_ptr<arrow::dataset::FileFormat>);
32+
std::shared_ptr<arrow::RecordBatch> finalize();
33+
34+
std::shared_ptr<arrow::io::OutputStream> streamer(std::shared_ptr<arrow::ResizableBuffer> buffer)
35+
{
36+
return mCreator(mFragment, buffer);
37+
}
38+
39+
private:
40+
std::shared_ptr<arrow::dataset::FileFragment> mFragment;
41+
arrow::MemoryPool* mArrowMemoryPool = nullptr;
42+
std::string mTableLabel;
43+
std::shared_ptr<arrow::RecordBatch> mRecordBatch;
44+
StreamerCreator mCreator;
45+
};
46+
47+
// -----------------------------------------------------------------------------
48+
} // namespace o2::framework
49+
50+
// =============================================================================
51+
#endif // O2_FRAMEWORK_FRAGMENT_TO_BATCH_H_

Framework/Core/include/Framework/TableTreeHelpers.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,6 @@ class TableToTree
9191
std::vector<std::unique_ptr<ColumnToBranch>> mColumnReaders;
9292
};
9393

94-
class FragmentToBatch
95-
{
96-
public:
97-
// The function to be used to create the required stream.
98-
using StreamerCreator = std::function<std::shared_ptr<arrow::io::OutputStream>(std::shared_ptr<arrow::dataset::FileFragment>, const std::shared_ptr<arrow::ResizableBuffer>& buffer)>;
99-
100-
FragmentToBatch(StreamerCreator, std::shared_ptr<arrow::dataset::FileFragment>, arrow::MemoryPool* pool = arrow::default_memory_pool());
101-
void setLabel(const char* label);
102-
void fill(std::shared_ptr<arrow::Schema> dataSetSchema, std::shared_ptr<arrow::dataset::FileFormat>);
103-
std::shared_ptr<arrow::RecordBatch> finalize();
104-
105-
std::shared_ptr<arrow::io::OutputStream> streamer(std::shared_ptr<arrow::ResizableBuffer> buffer)
106-
{
107-
return mCreator(mFragment, buffer);
108-
}
109-
110-
private:
111-
std::shared_ptr<arrow::dataset::FileFragment> mFragment;
112-
arrow::MemoryPool* mArrowMemoryPool = nullptr;
113-
std::string mTableLabel;
114-
std::shared_ptr<arrow::RecordBatch> mRecordBatch;
115-
StreamerCreator mCreator;
116-
};
117-
11894
// -----------------------------------------------------------------------------
11995
} // namespace o2::framework
12096

Framework/Core/src/AnalysisSupportHelpers.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "Framework/ControlService.h"
1616
#include "Framework/EndOfStreamContext.h"
1717
#include "Framework/DeviceSpec.h"
18-
#include "Framework/TableTreeHelpers.h"
1918
#include "Framework/PluginManager.h"
2019
#include "Framework/ConfigContext.h"
2120
#include "WorkflowHelpers.h"

Framework/Core/src/DataAllocator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
#include "Framework/CompilerBuiltins.h"
1212
#include "Framework/Lifetime.h"
1313
#include "Framework/TableBuilder.h"
14-
#include "Framework/TableTreeHelpers.h"
1514
#include "Framework/DataAllocator.h"
1615
#include "Framework/MessageContext.h"
1716
#include "Framework/ArrowContext.h"
1817
#include "Framework/DataSpecUtils.h"
1918
#include "Framework/DataProcessingHeader.h"
2019
#include "Framework/FairMQResizableBuffer.h"
2120
#include "Framework/DataProcessingContext.h"
21+
#include "Framework/FragmentToBatch.h"
2222
#include "Framework/DeviceSpec.h"
2323
#include "Framework/StreamContext.h"
2424
#include "Framework/Signpost.h"

0 commit comments

Comments
 (0)