Skip to content

TPC: Processing of common mode values in O2#15137

Merged
wiechula merged 19 commits intoAliceO2Group:devfrom
tubagundem:TPC_CMV
Apr 13, 2026
Merged

TPC: Processing of common mode values in O2#15137
wiechula merged 19 commits intoAliceO2Group:devfrom
tubagundem:TPC_CMV

Conversation

@tubagundem
Copy link
Copy Markdown
Contributor

@tubagundem tubagundem commented Mar 9, 2026

This PR introduces end-to-end infrastructure for reading, processing and storing TPC Common Mode Values (CMVs) within the O2 framework.

New data structures

  • DataFormatsTPC/CMV.h — defines the CMV dataformat as received from the CRU: a 256-bit Header (version, packetID, errorCode, magic word, heartbeat orbit/BC) followed by one 16-bit CMV word per timebin, covering 3564 timebins per packet. Includes fixed-point to float conversion helpers
  • CMVLinkID = 23 added to RDHUtils.h to identify CMV data in raw RDH streams
  • CMVContainer.h/.cxx — accumulator struct for one aggregation interval, storing CMV values together with CRU index, timebin, first orbit/BC, first and last TF counter

New workflows

  • CMVToVectorSpec / tpc-cmv-to-vector — extracts CMVs from raw data into vectors
  • TPCFLPCMVSpec / tpc-flp-cmv — FLP side processing of CMV data
  • TPCDistributeCMVSpec / tpc-distribute-cmv — distributes CMVs and serializes CMVContainer

Compression and size reduction strategies

The following techniques are available for reducing CMV data size:

  • Delta encoding
  • Zigzag transform
  • Varint encoding
  • Huffman encoding
  • Sparse representation
  • Small-value zeroing
  • Rounding to the closest integer
  • Dynamic Gaussian precision option

Visualization

  • drawCMV.C — ROOT macro to inspect and visualize CMV data.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2026

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

Copy link
Copy Markdown
Collaborator

@shahor02 shahor02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the class methods with lot of code be moved from the header to cxx file (including needed headers, like TFile.h and TTree.h in https://github.com/AliceO2Group/AliceO2/pull/15137/changes#diff-74cad5f291e0478b7a6334eb7e3dcdabbad615a01df0db129d836a337e76582aR26-R27 ?

Copy link
Copy Markdown
Collaborator

@wiechula wiechula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tubagundem , some minor things and a couple questions:

  • How different are the CMVToVectorSpec.h and the corresponding IDC code? Could it have a common base to?
  • What is done in the TPCFactorizeCMVSpec.h? I think in the CMV we don't do factorization.

@tubagundem tubagundem marked this pull request as ready for review April 10, 2026 07:45
@tubagundem tubagundem requested a review from davidrohr as a code owner April 10, 2026 07:45
@tubagundem tubagundem marked this pull request as draft April 10, 2026 08:52
@tubagundem tubagundem marked this pull request as ready for review April 10, 2026 12:26
@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for d218dec at 2026-04-12 10:50:

## sw/BUILD/O2-latest/log
ninja: error: dependency cycle: stage/lib64/G__O2GPUDataTypes_rdict.pcm -> stage/lib64/libO2TPCFastTransformation.so -> GPU/TPCFastTransformation/CMakeFiles/O2lib-TPCFastTransformation.dir/SplineSpec.cxx.o -> cmake_object_order_depends_target_O2lib-TPCFastTransformation -> GPU/TPCFastTransformation/G__O2TPCFastTransformation.cxx -> stage/lib64/G__O2GPUDataTypes_rdict.pcm

Full log here.

Copy link
Copy Markdown
Collaborator

@wiechula wiechula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment can be postponed to a follow up PR.

@wiechula wiechula merged commit 14ff7db into AliceO2Group:dev Apr 13, 2026
13 checks passed
ehellbar pushed a commit that referenced this pull request Apr 13, 2026
* TPC: Processing of common mode values in O2

* Added CMVContainer.cxx, fixed missing links and includes

* Fix formatting

* Removed unused includes, directly write the TTree object to CCDB without TMem file, small fixes

* Changed the decoding and encoding of CMVs, removed grouping per side

* Update the dataformat of CMV

* Updated the CMVContainer, corrected the timestamp range for CCDB

* Fix formatting

* Removed factorize workflow, updated the distribute workflow accordingly

* Fix formatting

* Extend error tracking in CMVToVectorSpec.cxx

* Replace CMVPerInterval with per TF TTree accumulation and raw uint16_t storage, fix CCDB timestamp for partial intervals, fix TMemFile padding

* Added delta+zigzag+varint compression, added drawCMV.C macro for visualization

* Added small value zeroing, added `--use-compression` and `--cmv-zero-threshold` flags to TPCDistributeCMVSpec, updated drawCMV.C macro to auto detect branch format (compressed or not)

* Added sparse and HUffman encoding to the CMVContainer, updatet the drawCMV.C macro and TPCDistributeCMVSpec.h accordingly

* Added CMVPerTFCombined to CMVContainer to combine sparse encoding with varint/Huffman compression, updated drawing macro and workflow options accordingly

* Added gaussian dynamic precision

* Refactored CMVContainer, unified CMV compression in a flag based container

* Added CMV workflow documentation to README and fixed CMV packet size mismatch handling
@tubagundem tubagundem deleted the TPC_CMV branch April 13, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants