ATLAS Offline Software
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 
11 void
12 LUCID_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 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LUCID_RodEncoder::Cache::hitcounter1
unsigned int hitcounter1
Definition: LUCID_RodEncoder.h:26
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LUCID_RodEncoder::Cache::Digits
VDIGIT Digits
Definition: LUCID_RodEncoder.h:29
LUCID_RodEncoder::Cache::hitcounter3
unsigned int hitcounter3
Definition: LUCID_RodEncoder.h:28
LUCID_RodEncoder::encode
void encode(std::vector< uint32_t > &data_block, Cache &cache, MsgStream &log) const
Definition: LUCID_RodEncoder.cxx:12
LUCID_RodEncoder::Cache
Definition: LUCID_RodEncoder.h:24
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LUCID_RodEncoder::Cache::hitcounter2
unsigned int hitcounter2
Definition: LUCID_RodEncoder.h:27
LUCID_RodEncoder.h
LUCID_RodEncoder::LUCID_RodEncoder
LUCID_RodEncoder()
Definition: LUCID_RodEncoder.cxx:7
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LUCID_RodEncoder::~LUCID_RodEncoder
~LUCID_RodEncoder()
Definition: LUCID_RodEncoder.cxx:9
LUCID_RodEncoder::Cache::hitcounter0
unsigned int hitcounter0
Definition: LUCID_RodEncoder.h:25