Project
Loading...
Searching...
No Matches
o2::tpc::HardwareClusterDecoder Class Reference

Class to convert a list of input buffers containing TPC clusters of type ClusterHardware to type ClusterNative. More...

#include <HardwareClusterDecoder.h>

Public Types

using OutputAllocator = std::function< char *(size_t)>
 Allocator function object to provide the output buffer.
 

Public Member Functions

 HardwareClusterDecoder ()=default
 
 ~HardwareClusterDecoder ()=default
 
int decodeClusters (std::vector< std::pair< const o2::tpc::ClusterHardwareContainer *, std::size_t > > &inputClusters, OutputAllocator outputAllocator, const std::vector< o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > > *inMCLabels=nullptr, o2::dataformats::MCTruthContainer< o2::MCCompLabel > *outMCLabels=nullptr)
 Decode clusters provided in raw pages The function uses an allocator object to request a raw char buffer of needed size. Inside this buffer, flat structures of type ClusterNativeBuffer are initialized, each block starting with a property header containing also the number of clusters immediately following the the property header.
 

Static Public Member Functions

static void sortClustersAndMC (ClusterNative *clusters, size_t nClusters, o2::dataformats::MCTruthContainer< o2::MCCompLabel > &mcTruth)
 Sort clusters and MC labels in place ClusterNative defines the smaller-than relation used in the sorting, with time being the more significant condition in the comparison.
 

Detailed Description

Class to convert a list of input buffers containing TPC clusters of type ClusterHardware to type ClusterNative.

This class transforms the hardware cluster raw format to the native cluster format. The output is organized in blocks per sector-padrow, the sequence of cluster blocks is stored in a flat structure. Cluster blocks consist of the property header ClusterGroupHeader with members sector, globalPadrow and nClusters, and the clusters following.

An allocator needs to be provided to allocate a char buffer of specified size from the decoding, function the cluster blocks are initialized inside the provided binary buffer.

Usage:

HardwareClusterDecoder decoder;
std::vector<char> outputBuffer;
auto outputAllocator = [&outputBuffer](size_t size) -> char* {
  outputBuffer.resize(size);
  return outputBuffer.data();
}
decoder( {pointer, n}, outputAllocator, &mcIn, &mcOut);

FIXME: The class should be in principle stateless, but right now it has an instance of the integrator for the digittal currents.

Definition at line 62 of file HardwareClusterDecoder.h.

Member Typedef Documentation

◆ OutputAllocator

using o2::tpc::HardwareClusterDecoder::OutputAllocator = std::function<char*(size_t)>

Allocator function object to provide the output buffer.

Definition at line 69 of file HardwareClusterDecoder.h.

Constructor & Destructor Documentation

◆ HardwareClusterDecoder()

o2::tpc::HardwareClusterDecoder::HardwareClusterDecoder ( )
default

◆ ~HardwareClusterDecoder()

o2::tpc::HardwareClusterDecoder::~HardwareClusterDecoder ( )
default

Member Function Documentation

◆ decodeClusters()

int HardwareClusterDecoder::decodeClusters ( std::vector< std::pair< const o2::tpc::ClusterHardwareContainer *, std::size_t > > &  inputClusters,
OutputAllocator  outputAllocator,
const std::vector< o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > > *  inMCLabels = nullptr,
o2::dataformats::MCTruthContainer< o2::MCCompLabel > *  outMCLabels = nullptr 
)

Decode clusters provided in raw pages The function uses an allocator object to request a raw char buffer of needed size. Inside this buffer, flat structures of type ClusterNativeBuffer are initialized, each block starting with a property header containing also the number of clusters immediately following the the property header.

Parameters
inputClusterslist of input pages, each entry a pair of pointer to first page and number of pages
outputAllocatorallocator object to provide the output buffer of specified size
inMCLabelsoptional pointer to MC label container
outMCLabelsoptional pointer to MC output container

Definition at line 36 of file HardwareClusterDecoder.cxx.

◆ sortClustersAndMC()

void HardwareClusterDecoder::sortClustersAndMC ( ClusterNative clusters,
size_t  nClusters,
o2::dataformats::MCTruthContainer< o2::MCCompLabel > &  mcTruth 
)
static

Sort clusters and MC labels in place ClusterNative defines the smaller-than relation used in the sorting, with time being the more significant condition in the comparison.

Definition at line 173 of file HardwareClusterDecoder.cxx.


The documentation for this class was generated from the following files: