2727#include < memory> // for make_shared
2828#include < vector>
2929#include < numeric> // std::accumulate
30+ #include < algorithm> // std::copy
3031
3132using namespace o2 ::framework;
3233using namespace o2 ::header;
@@ -46,7 +47,7 @@ DataProcessorSpec getClustererSpec(bool sendMC)
4647
4748 constexpr static size_t NSectors = o2::TPC ::Sector::MAXSECTOR ;
4849 struct ProcessAttributes {
49- std::vector<o2::TPC ::Cluster > clusterArray;
50+ std::vector<o2::TPC ::ClusterHardwareContainer8kb > clusterArray;
5051 MCLabelContainer mctruthArray;
5152 std::array<std::shared_ptr<o2::TPC ::HwClusterer>, NSectors> clusterers;
5253 int verbosity = 1 ;
@@ -79,9 +80,9 @@ DataProcessorSpec getClustererSpec(bool sendMC)
7980 // forward the control information
8081 // FIXME define and use flags in TPCSectorHeader
8182 o2::TPC ::TPCSectorHeader header{ sector };
82- pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERSIM " , fanSpec, Lifetime::Timeframe, { header } }, fanSpec);
83+ pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERHW " , fanSpec, Lifetime::Timeframe, { header } }, fanSpec);
8384 if (!labelKey.empty ()) {
84- pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERMCLBL " , fanSpec, Lifetime::Timeframe, { header } }, fanSpec);
85+ pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERHWMCLBL " , fanSpec, Lifetime::Timeframe, { header } }, fanSpec);
8586 }
8687 return (sectorHeader->sector == -1 );
8788 }
@@ -121,9 +122,12 @@ DataProcessorSpec getClustererSpec(bool sendMC)
121122 LOG (INFO ) << " clusterer produced " << mctruthArray.getIndexedSize () << " MC label object(s)" ;
122123 }
123124 }
124- pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERSIM" , fanSpec, Lifetime::Timeframe, { *sectorHeader } }, clusterArray);
125+ // FIXME: that should be a case for pmr, want to send the content of the vector as a binary
126+ // block by using move semantics
127+ auto outputPages = pc.outputs ().make <ClusterHardwareContainer8kb>(Output{ gDataOriginTPC , " CLUSTERHW" , fanSpec, Lifetime::Timeframe, { *sectorHeader } }, clusterArray.size ());
128+ std::copy (clusterArray.begin (), clusterArray.end (), outputPages.begin ());
125129 if (!labelKey.empty ()) {
126- pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERMCLBL " , fanSpec, Lifetime::Timeframe, { *sectorHeader } }, mctruthArray);
130+ pc.outputs ().snapshot (Output{ gDataOriginTPC , " CLUSTERHWMCLBL " , fanSpec, Lifetime::Timeframe, { *sectorHeader } }, mctruthArray);
127131 }
128132 return false ;
129133 };
@@ -175,12 +179,12 @@ DataProcessorSpec getClustererSpec(bool sendMC)
175179
176180 auto createOutputSpecs = [](bool makeMcOutput) {
177181 std::vector<OutputSpec> outputSpecs{
178- OutputSpec{ { " clusters" }, gDataOriginTPC , " CLUSTERSIM " , 0 , Lifetime::Timeframe },
182+ OutputSpec{ { " clusters" }, gDataOriginTPC , " CLUSTERHW " , 0 , Lifetime::Timeframe },
179183 };
180184 if (makeMcOutput) {
181185 OutputLabel label{ " clusterlbl" };
182186 // FIXME: define common data type specifiers
183- constexpr o2::header::DataDescription datadesc (" CLUSTERMCLBL " );
187+ constexpr o2::header::DataDescription datadesc (" CLUSTERHWMCLBL " );
184188 outputSpecs.emplace_back (label, gDataOriginTPC , datadesc, 0 , Lifetime::Timeframe);
185189 }
186190 return std::move (outputSpecs);
0 commit comments