|
| MCTruthContainer ()=default |
|
| ~MCTruthContainer ()=default |
|
| MCTruthContainer (const MCTruthContainer &other)=default |
|
| MCTruthContainer (MCTruthContainer &&other)=default |
|
| MCTruthContainer (std::vector< MCTruthHeaderElement > &header, std::vector< TruthElement > &truthArray) |
|
MCTruthContainer & | operator= (const MCTruthContainer &other)=default |
|
MCTruthContainer & | operator= (MCTruthContainer &&other)=default |
|
MCTruthHeaderElement const & | getMCTruthHeader (uint32_t dataindex) const |
|
TruthElement const & | getElement (uint32_t elementindex) const |
|
size_t | getIndexedSize () const |
|
size_t | getNElements () const |
|
const std::vector< TruthElement > & | getTruthArray () const |
|
gsl::span< TruthElement > | getLabels (uint32_t dataindex) |
|
gsl::span< const TruthElement > | getLabels (uint32_t dataindex) const |
|
void | clear () |
|
void | clear_andfreememory () |
|
void | addElement (uint32_t dataindex, TruthElement const &element, bool noElement=false) |
|
void | addNoLabelIndex (uint32_t dataindex) |
| adds a data index that has no label
|
|
template<typename CompatibleLabel > |
void | addElements (uint32_t dataindex, gsl::span< CompatibleLabel > elements) |
|
template<typename CompatibleLabel > |
void | addElements (uint32_t dataindex, const std::vector< CompatibleLabel > &v) |
|
void | addElementRandomAccess (uint32_t dataindex, TruthElement const &element) |
|
void | setFrom (std::vector< MCTruthHeaderElement > &header, std::vector< TruthElement > &truthArray) |
|
void | mergeAtBack (MCTruthContainer< TruthElement > const &other) |
|
void | mergeAtBack (MCTruthContainer< TruthElement > const &other, size_t from, size_t n) |
|
template<typename ContainerType > |
size_t | flatten_to (ContainerType &container) const |
|
void | restore_from (const char *buffer, size_t bufferSize) |
|
template<typename Stream > |
void | print (Stream &stream) |
| Print some info.
|
|
void | inflate () |
|
void | deflate () |
|
| ClassDefNV (MCTruthContainer, 2) |
|
void | Streamer (TBuffer &R__b) |
|
template<typename TruthElement>
class o2::dataformats::MCTruthContainer< TruthElement >
A container to hold and manage MC truth information/labels.
The actual MCtruth type is a generic template type and can be supplied by the user It is meant to manage associations from one "dataobject" identified by an index into an array to multiple TruthElements. Each "dataobject" is identified by a sequential index. Truth elements belonging to one object are always in contingous sequence in the truth element storage. Since multiple truth elements can be associated with one object, the header array stores the start of the associated truth element sequence.
Since the class contains two subsequent vectors, it is not POD even if the TruthElement is POD. ROOT serialization is rather inefficient and in addition has a large memory footprint if the container has lots of (>1000000) elements. between 3 and 4x more than the actual size is allocated. If the two vectors are flattend to a raw vector before streaming, the serialization works without memory overhead. The deflate/inflate methods are called from a custom streamer, storing the vectors in the raw buffer and vice versa, each of the methods emptying the source data.
TODO:
- add move assignment from a source vector, by that passing an object which has access to different underlying memory resources, until that, the pmr::MemoryResource has been removed again
- add interface to access header and truth elements directly from the raw buffer, by that inflation can be postponed until new elements are added, with the effect that inflation can be avoided in most cases
Note: The two original vector members could be transient, however reading serialized version 1 objects does not work correctly. In a different approach, the two vectors have been removed completely with an efficient interface to the binary buffer, but the read pragma was not able to access the member offset from the StreamerInfo.
Definition at line 82 of file MCTruthContainer.h.