@@ -891,7 +891,7 @@ void zsEncoderDenseLinkBased::decodePage(std::vector<o2::tpc::Digit>& outputBuff
891891
892892template <class T >
893893struct zsEncoderRun : public T {
894- unsigned int run (std::vector<zsPage>* buffer, std::vector<o2::tpc::Digit>& tmpBuffer);
894+ unsigned int run (std::vector<zsPage>* buffer, std::vector<o2::tpc::Digit>& tmpBuffer, size_t * totalSize = nullptr );
895895 size_t compare (std::vector<zsPage>* buffer, std::vector<o2::tpc::Digit>& tmpBuffer);
896896
897897 using T::bcShiftInFirstHBF;
@@ -926,7 +926,7 @@ struct zsEncoderRun : public T {
926926};
927927
928928template <class T >
929- inline unsigned int zsEncoderRun<T>::run(std::vector<zsPage>* buffer, std::vector<o2::tpc::Digit>& tmpBuffer)
929+ inline unsigned int zsEncoderRun<T>::run(std::vector<zsPage>* buffer, std::vector<o2::tpc::Digit>& tmpBuffer, size_t * totalSize )
930930{
931931 unsigned int totalPages = 0 ;
932932 zsPage singleBuffer;
@@ -971,6 +971,9 @@ inline unsigned int zsEncoderRun<T>::run(std::vector<zsPage>* buffer, std::vecto
971971
972972 if (page && mustWritePage) {
973973 const rdh_utils::FEEIDType rawfeeid = rdh_utils::getFEEID (rawcru, rawendpoint, rawlnk);
974+ if (totalSize) {
975+ *totalSize += (lastEndpoint == -1 || hbf == nexthbf) ? TPCZSHDR ::TPC_ZS_PAGE_SIZE : (pagePtr - (unsigned char *)page);
976+ }
974977 size_t size = (padding || lastEndpoint == -1 || hbf == nexthbf) ? TPCZSHDR ::TPC_ZS_PAGE_SIZE : (pagePtr - (unsigned char *)page);
975978 size = CAMath::nextMultipleOf<o2::raw::RDHUtils::GBTWord>(size);
976979#ifdef GPUCA_O2_LIB
@@ -1001,6 +1004,9 @@ inline unsigned int zsEncoderRun<T>::run(std::vector<zsPage>* buffer, std::vecto
10011004 if (buffer[endpoint].size () == 0 && nexthbf > orbitShift) {
10021005 buffer[endpoint].emplace_back ();
10031006 ZSfillEmpty (&buffer[endpoint].back (), bcShiftInFirstHBF, rdh_utils::getFEEID (iSector * 10 + endpoint / 2 , endpoint & 1 , rawlnk), orbitShift); // Emplace empty page with RDH containing beginning of TF
1007+ if (totalSize) {
1008+ *totalSize += sizeof (o2::header::RAWDataHeader);
1009+ }
10041010 totalPages++;
10051011 }
10061012 buffer[endpoint].emplace_back ();
@@ -1095,6 +1101,7 @@ void GPUReconstructionConvert::RunZSEncoder(const S& in, std::unique_ptr<unsigne
10951101#ifdef GPUCA_TPC_GEOMETRY_O2
10961102 std::vector<zsPage> buffer[NSLICES ][GPUTrackingInOutZS::NENDPOINTS ];
10971103 unsigned int totalPages = 0 ;
1104+ size_t totalSize = 0 ;
10981105 size_t nErrors = 0 ;
10991106 // clang-format off
11001107 GPUCA_OPENMP (parallel for reduction (+ : totalPages) reduction (+ : nErrors))
@@ -1112,7 +1119,7 @@ void GPUReconstructionConvert::RunZSEncoder(const S& in, std::unique_ptr<unsigne
11121119 auto runZS = [&](auto & encoder) {
11131120 encoder.zsVersion = version;
11141121 encoder.init ();
1115- totalPages += encoder.run (buffer[i], tmpBuffer);
1122+ totalPages += encoder.run (buffer[i], tmpBuffer, &totalSize );
11161123 if (verify) {
11171124 nErrors += encoder.compare (buffer[i], tmpBuffer); // Verification
11181125 }
0 commit comments