@@ -512,6 +512,9 @@ DataProcessorSpec getCATrackerSpec(ca::Config const& specconfig, std::vector<int
512512 }
513513 }
514514
515+ bool doOutputCompressedClustersFlat = pc.outputs ().isAllowed ({gDataOriginTPC , " COMPCLUSTERSFLAT" , 0 });
516+ bool doOutputCompressedClustersROOT = pc.outputs ().isAllowed ({gDataOriginTPC , " COMPCLUSTERS" , 0 });
517+
515518 std::vector<TrackTPC> tracks;
516519 std::vector<uint32_t > clusRefs;
517520 MCLabelContainer tracksMCTruth;
@@ -541,9 +544,11 @@ DataProcessorSpec getCATrackerSpec(ca::Config const& specconfig, std::vector<int
541544 }
542545 GPUInterfaceOutputs outputRegions;
543546 size_t bufferSize = 2048ul * 1024 * 1024 ; // TODO: Just allocated some large buffer for now, should estimate this correctly;
544- auto & bufferCompressedClusters = pc.outputs ().make <std::vector<char >>(Output{gDataOriginTPC , " COMPCLUSTERS" , 0 }, bufferSize);
545- outputRegions.compressedClusters .ptr = bufferCompressedClusters.data ();
546- outputRegions.compressedClusters .size = bufferCompressedClusters.size ();
547+ auto * bufferCompressedClusters = doOutputCompressedClustersFlat ? &pc.outputs ().make <std::vector<char >>(Output{gDataOriginTPC , " COMPCLUSTERSFLAT" , 0 }, bufferSize) : nullptr ;
548+ if (doOutputCompressedClustersFlat) {
549+ outputRegions.compressedClusters .ptr = bufferCompressedClusters->data ();
550+ outputRegions.compressedClusters .size = bufferCompressedClusters->size ();
551+ }
547552 int retVal = tracker->runTracking (&ptrs, &outputRegions);
548553 if (retVal != 0 ) {
549554 throw std::runtime_error (" tracker returned error code " + std::to_string (retVal));
@@ -566,16 +571,20 @@ DataProcessorSpec getCATrackerSpec(ca::Config const& specconfig, std::vector<int
566571 // o2::tpc::ClusterNativeAccess clustersNativeDecoded; // Cluster native access structure as used by the tracker
567572 // std::vector<o2::tpc::ClusterNative> clusterBuffer; // std::vector that will hold the actual clusters, clustersNativeDecoded will point inside here
568573 // mDecoder.decompress(clustersCompressed, clustersNativeDecoded, clusterBuffer, param); // Run decompressor
569- if (pc. outputs (). isAllowed ({ gDataOriginTPC , " COMPCLUSTERS " , 0 }) ) {
570- if (ptrs. compressedClusters != nullptr ) {
571- if ((void *)ptrs.compressedClusters != (void *)bufferCompressedClusters. data ()) {
574+ if (ptrs. compressedClusters != nullptr ) {
575+ if (doOutputCompressedClustersFlat ) {
576+ if ((void *)ptrs.compressedClusters != (void *)bufferCompressedClusters-> data ()) {
572577 throw std::runtime_error (" output ptrs out of sync" ); // sanity check
573578 }
574- bufferCompressedClusters.resize (outputRegions.compressedClusters .size );
575- CompressedClustersFlat* tmp = (CompressedClustersFlat*)bufferCompressedClusters.data ();
576- } else {
577- LOG (ERROR) << " unable to get compressed cluster info from track" ;
579+ bufferCompressedClusters->resize (outputRegions.compressedClusters .size );
578580 }
581+ if (doOutputCompressedClustersROOT) {
582+ o2::tpc::CompressedClustersROOT compressedClusters = *ptrs.compressedClusters ;
583+ printf (" FOOOO %d\n " , compressedClusters.nTracks );
584+ pc.outputs ().snapshot (Output{gDataOriginTPC , " COMPCLUSTERS" , 0 }, ROOTSerialized<o2::tpc::CompressedClustersROOT const >(compressedClusters));
585+ }
586+ } else {
587+ LOG (ERROR) << " unable to get compressed cluster info from track" ;
579588 }
580589
581590 // publish clusters produced by CA clusterer sector-wise if the outputs are configured
@@ -670,6 +679,9 @@ DataProcessorSpec getCATrackerSpec(ca::Config const& specconfig, std::vector<int
670679 if (specconfig.outputCompClusters ) {
671680 outputSpecs.emplace_back (gDataOriginTPC , " COMPCLUSTERS" , 0 , Lifetime::Timeframe);
672681 }
682+ if (specconfig.outputCompClustersFlat ) {
683+ outputSpecs.emplace_back (gDataOriginTPC , " COMPCLUSTERSFLAT" , 0 , Lifetime::Timeframe);
684+ }
673685 if (specconfig.outputCAClusters ) {
674686 for (auto const & sector : tpcsectors) {
675687 o2::header::DataHeader::SubSpecificationType id = sector;
0 commit comments