18TEST(_GTestCbmDigiEvent, CheckSerialization)
22 int32_t maxUnit = (1 << 6) - 1;
23 int32_t maxLadd = (1 << 5) - 1;
24 int32_t maxHlad = (1 << 1) - 1;
25 int32_t maxModu = (1 << 5) - 1;
26 uint16_t maxChan = (1 << 11) - 1;
27 int32_t maxTime = (1 << 30) - 1;
28 uint16_t maxChrg = (1 << 5) - 1;
31 std::random_device rd;
32 std::mt19937 gen(rd());
33 std::uniform_int_distribution<int32_t> rEvtNumber(1, 1000);
34 std::uniform_real_distribution<double> rEvtTime(0., 1.e10);
35 std::uniform_int_distribution<int32_t> rNumDigis(1, 10);
36 std::uniform_int_distribution<int32_t> rUnit(0, maxUnit);
37 std::uniform_int_distribution<int32_t> rLadd(0, maxLadd);
38 std::uniform_int_distribution<int32_t> rHlad(0, maxHlad);
39 std::uniform_int_distribution<int32_t> rModu(0, maxModu);
40 std::uniform_int_distribution<uint16_t> rChan(0, maxChan);
41 std::uniform_int_distribution<int32_t> rTime(0, maxTime);
42 std::uniform_int_distribution<uint16_t> rChrg(0, maxChrg);
46 int32_t evtNumber = rEvtNumber(gen);
47 double evtTime = rEvtTime(gen);
49 eventOut.
fTime = evtTime;
52 int32_t numDigis = rNumDigis(gen);
53 std::vector<int32_t> vAddr(numDigis);
54 std::vector<uint16_t> vChan(numDigis);
55 std::vector<int32_t> vTime(numDigis);
56 std::vector<uint16_t> vChrg(numDigis);
57 for (int32_t iDigi = 0; iDigi < numDigis; iDigi++) {
58 int32_t unit = rUnit(gen);
59 int32_t ladd = rLadd(gen);
60 int32_t hlad = rHlad(gen);
61 int32_t modu = rModu(gen);
63 uint16_t chan = rChan(gen);
64 int32_t time = rTime(gen);
65 uint16_t chrg = rChrg(gen);
75 boost::archive::binary_oarchive outArchive(s);
76 outArchive << eventOut;
80 boost::archive::binary_iarchive inArchive(s);
84 EXPECT_EQ(eventIn.
fNumber, evtNumber);
85 EXPECT_FLOAT_EQ(eventIn.
fTime, evtTime);
87 for (int32_t iDigi = 0; iDigi < numDigis; iDigi++) {
int32_t GetAddress(uint32_t unit=0, uint32_t ladder=0, uint32_t halfladder=0, uint32_t module=0, uint32_t sensor=0, uint32_t side=0, uint32_t version=kCurrentVersion)
Construct address.