ATLAS Offline Software
Loading...
Searching...
No Matches
LUCID_RodEncoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
10
11void
12LUCID_RodEncoder::encode(std::vector<uint32_t>& data_block,
14 MsgStream& log) const
15{
16
17 VDIGIT::iterator digit_it = cache.Digits.begin();
18 VDIGIT::iterator digit_it_end = cache.Digits.end();
19
20 uint32_t data_word0 = 0;
21 uint32_t data_word1 = 0;
22 uint32_t data_word2 = 0;
23 uint32_t data_word3 = 0;
24
25 cache.hitcounter0 = 0;
26 cache.hitcounter1 = 0;
27 cache.hitcounter2 = 0;
28 cache.hitcounter3 = 0;
29
30 for (; digit_it != digit_it_end; ++digit_it) {
31
32 unsigned short tubeID = (*digit_it)->getTubeID();
33 bool isHit = (*digit_it)->isHit();
34
35 if (tubeID < 16) {
36 data_word0 |= (isHit << (tubeID - 0));
37 cache.hitcounter0 += isHit;
38 } else if (tubeID < 20) {
39 data_word2 |= (isHit << (tubeID - 16));
40 cache.hitcounter2 += isHit;
41 } else if (tubeID < 36) {
42 data_word1 |= (isHit << (tubeID - 20));
43 cache.hitcounter1 += isHit;
44 } else if (tubeID < 40) {
45 data_word3 |= (isHit << (tubeID - 36));
46 cache.hitcounter3 += isHit;
47 } else {
48 log << MSG::ERROR << " Unknown tubeID: " << tubeID << endmsg;
49 }
50 }
51
52 data_word0 |= (cache.hitcounter0 << 24);
53 data_word1 |= (cache.hitcounter1 << 24);
54 data_word2 |= (cache.hitcounter2 << 24);
55 data_word3 |= (cache.hitcounter3 << 24);
56
57 data_block.push_back(data_word0);
58 data_block.push_back(data_word1);
59 data_block.push_back(data_word2);
60 data_block.push_back(data_word3);
61
62 cache.Digits.clear();
63}
#define endmsg
void encode(std::vector< uint32_t > &data_block, Cache &cache, MsgStream &log) const