#include <Compressor.h>
Definition at line 26 of file Compressor.h.
◆ Compressor()
| Compressor::Compressor |
( |
| ) |
|
|
inline |
◆ ~Compressor()
| Compressor::~Compressor |
( |
| ) |
|
|
default |
◆ expandFromUStoFloat()
| void Compressor::expandFromUStoFloat |
( |
const std::vector< unsigned short > & | vi, |
|
|
std::vector< float > & | vf ) |
Definition at line 29 of file Compressor.cxx.
29 {
30 vf.reserve(vc.size());
31 for (const auto& value : vc){
32 unsigned int u(value << 16);
33 vf.push_back(std::bit_cast<float>(u));
34 }
35}
@ u
Enums for curvilinear frames.
◆ expandToFloat()
| void Compressor::expandToFloat |
( |
const std::vector< unsigned int > & | vc, |
|
|
std::vector< float > & | vf ) |
Definition at line 106 of file Compressor.cxx.
106 {
107 vf.clear();
108 if (vi.empty())
109 return;
110
111 std::vector<unsigned int>::const_iterator
i=vi.begin();
112
115
118
119 unsigned int vecs=(
format>>6)&0xfffffff;
120
122
123 vf.reserve(vi.size()*
m_bits/16+17);
124
127 int CP=0; int FP=0; int REM=0;
128 unsigned int V=0xffffffff>>(32-
L);
unsigned int R=0;
129 unsigned int ui(*i);
130
131
132 while (vecs){
134 if (FP<=32){
135 R = ( ui >> (32-FP) ) & V;
137 vf.push_back(std::bit_cast<float>(R));
138 if (FP < 32)
139 CP=FP;
140 else {
141 CP = 0;
143 ui = (*i);
144 }
145 }
146 else{
147 REM = FP - 32;
148 R = ( ui & (0xffffffff >> CP) ) << REM;
150 ui = (*i);
151 R |= ui >> (32-REM) ;
154 vf.push_back(std::bit_cast<float>(R));
155 CP = REM;
156 }
157 --vecs;
158 }
159 return;
160}
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
◆ reduce()
| void Compressor::reduce |
( |
const std::vector< float > & | vf, |
|
|
std::vector< unsigned int > & | vi ) |
Definition at line 38 of file Compressor.cxx.
38 {
39
40 vi.reserve(vf.size()*
m_bits/16+17);
41
43 unsigned int vfs=vf.size();
49 vi.push_back(format);
50
51
54 unsigned int vmax= 0x7f7<<20;
55 vmax |= 0x000fffff xor (rounding);
56 unsigned int rems=0xffffffff;
58 rems>>=(bshift+1);
59 else
60 rems>>=bshift;
61
66 unsigned int CUR=0; int IN=0;
67 for (const auto& value : vf){
68 auto u = std::bit_cast<unsigned int>(value);
69 if ( (u & 0x7fffffff) > vmax) IN=
u>>bshift;
71
72 IN&=rems;
73
77 }
81 vi.push_back(CUR);
83 }
84 else{
86 CUR|=(IN>>D);
87 vi.push_back(CUR);
89
90 IN &= (1U<<D)-1;
92 }
93 }
94 vi.push_back(CUR);
95
96 }
97 else
98 for (const auto& value : vf){
99 vi.push_back(std::bit_cast<unsigned int>(value));
100 }
101
102 return;
103}
int rounding
Check if the tune/PDF part is needed, and if so whether it's present.
◆ reduceToUS()
| void Compressor::reduceToUS |
( |
const std::vector< float > & | vf, |
|
|
std::vector< unsigned short > & | vi ) |
Definition at line 19 of file Compressor.cxx.
19 {
20 constexpr unsigned int max_short_flt = 0x7f7f7fff;
21 vc.reserve(vf.size());
22 for (const auto& value : vf){
23 auto u = std::bit_cast<unsigned int>(value);
24 if ( (u & 0x7fffffff) > max_short_flt) vc.push_back (u>>16);
25 else vc.push_back((u+0x8000)>>16);
26 }
27}
◆ setIgnoreSign()
| void Compressor::setIgnoreSign |
( |
| ) |
|
|
inline |
◆ setNrBits()
| void Compressor::setNrBits |
( |
int | bits | ) |
|
|
inline |
Definition at line 36 of file Compressor.h.
36 {
39 if (bits<12){
40 std::cout<<"WARNING -> Too large compression requested. Will leave 12 bits instead!"<<std::endl;
42 }
43 else if(bits>=32 || bits==0){
44 std::cout<<"WARNING -> Compression to "<<bits<<" bits is not possible. Compressing to 31 bits !"<<std::endl;
46 }
47 }
◆ m_bits
◆ m_bitStrip
| bool Compressor::m_bitStrip |
|
private |
◆ m_sign
The documentation for this class was generated from the following files: