#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 union {
unsigned int u;
float f;}
m;
31 vf.reserve(vc.size());
32 for (const auto& value : vc){
33 unsigned int ui(value << 16);
36 }
37}
@ u
Enums for curvilinear frames.
◆ expandToFloat()
| void Compressor::expandToFloat |
( |
const std::vector< unsigned int > & | vc, |
|
|
std::vector< float > & | vf ) |
Definition at line 112 of file Compressor.cxx.
112 {
113 vf.clear();
114 if (vi.empty())
115 return;
116
117 std::vector<unsigned int>::const_iterator
i=vi.begin();
118
121
124
125 unsigned int vecs=(
format>>6)&0xfffffff;
126
128
129 vf.reserve(vi.size()*
m_bits/16+17);
130
133 int CP=0; int FP=0; int REM=0;
134 unsigned int V=0xffffffff>>(32-
L);
unsigned int R=0;
135 unsigned int ui(*i);
136
137 union {
unsigned int u;
float f;}
m;
138
139 while (vecs){
141 if (FP<=32){
142 R = ( ui >> (32-FP) ) & V;
146 if (FP < 32)
147 CP=FP;
148 else {
149 CP = 0;
151 ui = (*i);
152 }
153 }
154 else{
155 REM = FP - 32;
156 R = ( ui & (0xffffffff >> CP) ) << REM;
158 ui = (*i);
159 R |= ui >> (32-REM) ;
164 CP = REM;
165 }
166 --vecs;
167 }
168 return;
169}
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 40 of file Compressor.cxx.
40 {
41
42 vi.reserve(vf.size()*
m_bits/16+17);
43
45 unsigned int vfs=vf.size();
51 vi.push_back(format);
52
53
56 unsigned int vmax= 0x7f7<<20;
57 vmax |= 0x000fffff xor (rounding);
58 unsigned int rems=0xffffffff;
60 rems>>=(bshift+1);
61 else
62 rems>>=bshift;
63
64 union {
unsigned int u;
float f;}
m;
65
66
71 unsigned int CUR=0; int IN=0;
72 for (const auto& value : vf){
74 if ( (
m.u & 0x7fffffff) > vmax) IN=
m.u>>bshift;
76
77 IN&=rems;
78
82 }
86 vi.push_back(CUR);
88 }
89 else{
91 CUR|=(IN>>D);
92 vi.push_back(CUR);
94
95 IN &= (1U<<D)-1;
97 }
98 }
99 vi.push_back(CUR);
100
101 }
102 else
103 for (const auto& value : vf){
106 }
107
108 return;
109}
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 18 of file Compressor.cxx.
18 {
19 constexpr unsigned int max_short_flt = 0x7f7f7fff;
20 union {
unsigned int u;
float f;}
m;
21 vc.reserve(vf.size());
22 for (const auto& value : vf){
24 if ( (
m.u & 0x7fffffff) > max_short_flt) vc.push_back (
m.u>>16);
25 else vc.push_back((
m.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: