File indexing completed on 2025-01-18 09:55:32
0001
0002
0003 #ifndef EDM4EIC_Tensor_CollectionData_H
0004 #define EDM4EIC_Tensor_CollectionData_H
0005
0006
0007 #include "edm4eic/TensorData.h"
0008 #include "edm4eic/TensorObj.h"
0009
0010
0011
0012
0013 #include "podio/CollectionBuffers.h"
0014 #include "podio/ICollectionProvider.h"
0015
0016 #include <deque>
0017 #include <memory>
0018
0019 namespace edm4eic {
0020
0021
0022 using TensorObjPointerContainer = std::deque<TensorObj*>;
0023 using TensorDataContainer = std::vector<TensorData>;
0024
0025
0026
0027
0028
0029
0030 class TensorCollectionData {
0031 public:
0032
0033
0034
0035 TensorObjPointerContainer entries{};
0036
0037
0038
0039
0040 TensorCollectionData();
0041
0042
0043
0044
0045 TensorCollectionData(podio::CollectionReadBuffers buffers, bool isSubsetColl);
0046
0047
0048
0049
0050 TensorCollectionData(const TensorCollectionData&) = delete;
0051 TensorCollectionData& operator=(const TensorCollectionData&) = delete;
0052 TensorCollectionData(TensorCollectionData&& other) = default;
0053 TensorCollectionData& operator=(TensorCollectionData&& other) = default;
0054
0055
0056
0057
0058 ~TensorCollectionData() = default;
0059
0060 void clear(bool isSubsetColl);
0061
0062 podio::CollectionWriteBuffers getCollectionBuffers(bool isSubsetColl);
0063
0064 void prepareForWrite(bool isSubsetColl);
0065
0066 void prepareAfterRead(uint32_t collectionID);
0067
0068 void makeSubsetCollection();
0069
0070 void createRelations(TensorObj* obj);
0071
0072 bool setReferences(const podio::ICollectionProvider* collectionProvider, bool isSubsetColl);
0073
0074 private:
0075
0076
0077
0078 podio::UVecPtr<std::int64_t> m_vec_shape{nullptr};
0079 std::vector<podio::UVecPtr<std::int64_t>> m_vecs_shape{};
0080 podio::UVecPtr<float> m_vec_floatData{nullptr};
0081 std::vector<podio::UVecPtr<float>> m_vecs_floatData{};
0082 podio::UVecPtr<std::int64_t> m_vec_int64Data{nullptr};
0083 std::vector<podio::UVecPtr<std::int64_t>> m_vecs_int64Data{};
0084
0085
0086 podio::CollRefCollection m_refCollections{};
0087 podio::VectorMembersInfo m_vecmem_info{};
0088 std::unique_ptr<TensorDataContainer> m_data{nullptr};
0089 };
0090
0091
0092 }
0093
0094
0095 #endif