Project
Loading...
Searching...
No Matches
IDC.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
22
23#ifndef ALICEO2_DATAFORMATSTPC_IDC_H
24#define ALICEO2_DATAFORMATSTPC_IDC_H
25
26#include <bitset>
27
28namespace o2::tpc::idc
29{
30static constexpr uint32_t Links = 10;
31static constexpr uint32_t Channels = 80;
32static constexpr uint32_t DataWordSizeBits = 256;
33static constexpr uint32_t DataWordSizeBytes = DataWordSizeBits / 8;
34static constexpr uint32_t IDCvalueBits = 25;
35static constexpr uint32_t IDCvalueBitsMask = (uint32_t(1) << IDCvalueBits) - 1;
36static constexpr uint32_t SignificantBits = 2;
37static constexpr float FloatConversion = 1.f / float(1 << SignificantBits);
38
41struct Header {
42 static constexpr uint32_t MagicWord = 0xDC;
43 union {
45 struct {
51 };
52 };
54 union {
56 struct {
61 };
62 };
64 union {
66 struct {
68 };
69 };
71 union {
73 struct {
75 };
76 };
78};
79
83struct Data {
84 uint8_t dataWords[DataWordSizeBytes] = {0};
85
87 {
88 const auto valPtr = dataWords;
89 const uint32_t offset = link * IDCvalueBits;
90 const uint32_t selectedWord = offset / 8;
91 const uint32_t requiredShift = offset % 8;
92 const uint32_t value = (*(uint32_t*)(dataWords + selectedWord)) >> requiredShift;
93 return value & IDCvalueBitsMask;
94 }
95
97 {
98 const uint32_t offset = link * IDCvalueBits;
99 const uint32_t selectedWord = offset / 8;
100 const uint32_t requiredShift = offset % 8;
101 auto dataWrite = (uint64_t*)&dataWords[selectedWord];
102 *dataWrite = (value & IDCvalueBitsMask) << requiredShift;
103 }
104};
105
107struct Container {
109 Data channelData[Channels];
110
112 {
113 return (header.linkMask & (1 << link));
114 }
115
116 uint32_t getChannelValue(const uint32_t link, const uint32_t channel) const
117 {
118 return channelData[channel].getLinkValue(link);
119 }
120
122 {
124 }
125
126 float getChannelValueFloat(const uint32_t link, const uint32_t channel) const
127 {
128 return float(channelData[channel].getLinkValue(link)) * FloatConversion;
129 }
130
131 void setChannelValueFloat(const uint32_t link, const uint32_t channel, float value)
132 {
133 channelData[channel].setLinkValue(link, uint32_t((value + 0.5f * FloatConversion) / FloatConversion));
134 }
135};
136} // namespace o2::tpc::idc
137#endif
unsigned int uint32_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
configStandalone Reconstruction rec_tpc float
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLintptr offset
Definition glcorearb.h:660
IDC full data container.
Definition IDC.h:107
void setChannelValue(const uint32_t link, const uint32_t channel, uint32_t value)
Definition IDC.h:121
Header header
IDC data header.
Definition IDC.h:108
float getChannelValueFloat(const uint32_t link, const uint32_t channel) const
Definition IDC.h:126
Data channelData[Channels]
data values for all channels in each link
Definition IDC.h:109
void setChannelValueFloat(const uint32_t link, const uint32_t channel, float value)
Definition IDC.h:131
bool hasLink(const uint32_t link)
Definition IDC.h:111
uint32_t getChannelValue(const uint32_t link, const uint32_t channel) const
Definition IDC.h:116
uint8_t dataWords[DataWordSizeBytes]
25bit ADC values
Definition IDC.h:84
uint32_t getLinkValue(const uint32_t link) const
Definition IDC.h:86
void setLinkValue(const uint32_t link, const uint32_t value)
Definition IDC.h:96
uint32_t errorCode
errors
Definition IDC.h:48
uint32_t heartbeatOrbit
heart beat orbit of the IDC value
Definition IDC.h:50
static constexpr uint32_t MagicWord
Definition IDC.h:42
uint32_t heartbeatBC
BC id of IDC value.
Definition IDC.h:57
uint64_t word1
bits 64 - 127
Definition IDC.h:55
uint64_t unused3
lower bits of the 80 bit bitmask
Definition IDC.h:74
uint32_t integrationTime
integration time used for the IDCs
Definition IDC.h:58
uint32_t linkMask
mask of active links
Definition IDC.h:59
uint32_t magicWord
magic word
Definition IDC.h:49
uint32_t packetID
packet id
Definition IDC.h:47
uint32_t unused1
Definition IDC.h:60
uint64_t word2
bits 128 - 191
Definition IDC.h:65
uint32_t version
lower bits of the 80 bit bitmask
Definition IDC.h:46
uint64_t word0
bits 0 - 63
Definition IDC.h:44
uint64_t word3
bits 192 - 255
Definition IDC.h:72
uint64_t unused2
lower bits of the 80 bit bitmask
Definition IDC.h:67