1#include "Recon/Event/HgcrocTrigDigi.h"
9 : tid_(tid), tp_{tp} {}
11 void HgcrocTrigDigi::Print()
const { std::cout << *
this << std::endl; }
13 uint8_t HgcrocTrigDigi::linear2Compressed(uint32_t lin) {
14 if (lin >= 0x40000)
return 0x7F;
15 if (lin >= 0x20000)
return 0x78 | ((lin >> 14) & 0x7);
16 if (lin >= 0x10000)
return 0x70 | ((lin >> 13) & 0x7);
17 if (lin >= 0x8000)
return 0x68 | ((lin >> 12) & 0x7);
18 if (lin >= 0x4000)
return 0x60 | ((lin >> 11) & 0x7);
19 if (lin >= 0x2000)
return 0x58 | ((lin >> 10) & 0x7);
20 if (lin >= 0x1000)
return 0x50 | ((lin >> 9) & 0x7);
21 if (lin >= 0x800)
return 0x48 | ((lin >> 8) & 0x7);
22 if (lin >= 0x400)
return 0x40 | ((lin >> 7) & 0x7);
23 if (lin >= 0x200)
return 0x38 | ((lin >> 6) & 0x7);
24 if (lin >= 0x100)
return 0x30 | ((lin >> 5) & 0x7);
25 if (lin >= 0x80)
return 0x28 | ((lin >> 4) & 0x7);
26 if (lin >= 0x40)
return 0x20 | ((lin >> 3) & 0x7);
27 if (lin >= 0x20)
return 0x18 | ((lin >> 2) & 0x7);
28 if (lin >= 0x10)
return 0x10 | ((lin >> 1) & 0x7);
30 return 0x08 | ((lin >> 0) & 0x7);
35 uint32_t HgcrocTrigDigi::compressed2Linear(uint8_t comp) {
36 uint32_t v1 = ((comp & 0x78) == 0)
38 : ((0x8 | (comp & 0x7)) << ((comp >> 3) - 1));
39 uint8_t comp2 = comp + 1;
40 uint32_t v2 = ((comp2 & 0x78) == 0)
42 : ((0x8 | (comp2 & 0x7)) << ((comp2 >> 3) - 1));
47 s <<
"HgcrocTrigDigi { "
48 <<
"(id : 0x" << std::hex << digi.
getId() << std::dec <<
") ";
49 s <<
"0x" << std::hex << int(digi.
getPrimitive()) <<
" (" << std::dec
54 std::ostream &operator<<(std::ostream &s,
55 const ldmx::HgcrocTrigDigiCollection &digis) {
56 s <<
"HgcrocTrigDigiCollection { " << std::endl;
57 for (
auto digi : digis) s <<
" " << digi << std::endl;
Contains the trigger output for a single trigger hgcroc channel.
uint32_t linearPrimitive() const
Get the linearized value of the trigger primitive.
HgcrocTrigDigi()=default
Default Constructor.
uint8_t getPrimitive() const
Get the trigger primitive (7 bits) for the given link on a channel.
uint32_t getId() const
Get the id of the digi.