5#ifndef TILEBYTESTREAM_TILERAWCHANNEL2BYTES5_H
6#define TILEBYTESTREAM_TILERAWCHANNEL2BYTES5_H
92 inline void unpack_reco(
unsigned int w,
unsigned int unit,
int &
fmt,
int &gain,
double &,
double &time)
const;
93 inline bool unpack_reco_bin(
unsigned int w,
int &
fmt,
int &gain,
int &,
int &time)
const;
96 inline double getSum(
const uint32_t* ptr_frag,
int n)
const;
98 inline double getSumEt(
const uint32_t* ptr_frag)
const;
99 inline double getSumEz(
const uint32_t* ptr_frag)
const;
100 inline double getSumE (
const uint32_t* ptr_frag)
const;
107 int code = reco >> 24;
118 printf(
"\nTileRawChannel2Bytes5::get_code ERROR\n");
126 if (code ==
code_ped4) printf(
"ped4");
else
127 if (code ==
code_ped5) printf(
"ped5");
else
128 if (code ==
code_amp5) printf(
"amp5");
else
129 if (code ==
code_amp6) printf(
"amp6");
else
130 if (code ==
code_raws) printf(
"raws");
else
131 if (code ==
code_rawf) printf(
"rawf");
else
132 if (code ==
code_full) printf(
"full");
else
133 if (code ==
code_dump) printf(
"dump");
else
134 if (code ==
code_null) printf(
"null");
else
160 for (
int code = 0; code < 0xFF; code++) {
175 int amplitude(
const uint32_t* ofw,
int unit,
int chan,
int gain,
int s[])
const;
177 void unpack(
const uint32_t* ofw,
const uint32_t* ptr_frag, TileChanData* ChanData)
const;
178 bool check_raw(
const uint32_t* feb,
int of_energy[], TileChanData* ChanData)
const;
179 bool check_reco(
const uint32_t* frag,
int of_energy[])
const;
183#define if_Frag5_DO_PED(w, code, gain, amp, time) \
184if (TileRawChannel2Bytes5::is_code_ped(code)) { \
186 amp = (w & 0x1FF) - 256; \
191#define if_Frag5_DO_AMP_RAW_DUMP(w, code, gain, amp, time) \
192if (TileRawChannel2Bytes5::is_code_amp_raw_dump(code)) { \
194 amp = (w & 0x7FFF) - AMPLITUDE_OFFSET5[gain]; \
195 if (TileRawChannel2Bytes5::is_code_amp(code)) { \
196 time = ((int32_t)(w << (32 - 15 - 6)) >> (32 - 6)); \
203#define if_Frag5_DO_NULL(w, code, gain, amp, time) \
204if (TileRawChannel2Bytes5::is_code_null(code)) { \
212#define if_Frag5_DO_FULL(w, code, gain, amp, time) \
213if (TileRawChannel2Bytes5::is_code_full(code)) { \
215 int overflow = (w >> 23) & 0x1; \
216 amp = (overflow ? 0x7FFF : 0x0) - AMPLITUDE_OFFSET5[gain]; \
221#define if_Frag5_unpack_reco_bin(w, code, gain, amp, time) \
222 if_Frag5_DO_PED(w, code, gain, amp, time) else \
223 if_Frag5_DO_AMP_RAW_DUMP(w, code, gain, amp, time) else \
224 if_Frag5_DO_NULL(w, code, gain, amp, time) else \
225 if_Frag5_DO_FULL(w, code, gain, amp, time) \
228#define Frag5_unpack_reco_bin(w, code, gain, amp, time) \
229 if_Frag5_unpack_reco_bin(w, code, gain, amp, time);
232#define Frag5_unpack_bin2reco(unit, gain, amp_bin, amp, time_bin, time) \
234 time = time_bin/2.0; \
235 amp = (gain) ? amp_bin/AMPLITUDE_FACTOR5_HG[unit] \
236 : amp_bin/AMPLITUDE_FACTOR5_LG[unit]; \
240#define Frag5_unpack_bin2sum(unit, amp_bin) \
241 amp_bin/AMPLITUDE_FACTOR5_HG[unit]
248 uint32_t code = w >> 24;
253 gain = 0; amp = 0; time = 0;
254 printf(
"\nTileRawChannel2Bytes5::unpack_reco_bin.ERROR reco = %08X\n", w);
261 int &
fmt,
int &gain,
double &,
double &time)
const
263 int amp_bin, time_bin;
267 amp = 0.0; time = 0.0;
273 int unit = ptr_frag[2] >> (32 - 2);
274 int amp_bin = (int) (ptr_frag[3 + 48 + n]);
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
const double AMPLITUDE_FACTOR5_HG[4]
const double AMPLITUDE_FACTOR5_LG[4]
const int AMPLITUDE_OFFSET5[2]
const int NOFWORDS_WEIGHTS_7S
#define Frag5_unpack_bin2sum(unit, amp_bin)
unpack_bin2sum
#define if_Frag5_unpack_reco_bin(w, code, gain, amp, time)
if_unpack_reco_bin
const int NOFWORDS_WEIGHTS_7S_1GAIN
#define Frag5_unpack_bin2reco(unit, gain, amp_bin, amp, time_bin, time)
unpack_bin2reco
uint8_t m_FormatLookup[256]
int get_format(int code) const
static void print_code(uint32_t code)
double getSumEz(const uint32_t *ptr_frag) const
static bool is_code_amp6(uint32_t code)
static int get_code(uint32_t reco)
bool check_reco(const uint32_t *frag, int of_energy[]) const
bool unpack_reco_bin(unsigned int w, int &fmt, int &gain, int &, int &time) const
static bool is_code_ped(uint32_t code)
int amplitude(const uint32_t *ofw, int unit, int chan, int gain, int s[]) const
double getSumE(const uint32_t *ptr_frag) const
static bool is_code_ped5(uint32_t code)
static bool is_code_raws(uint32_t code)
void unpack_reco(unsigned int w, unsigned int unit, int &fmt, int &gain, double &, double &time) const
Unpack Frag5 reco from 32-bit word w.
static bool is_code_amp_raw_dump(uint32_t code)
static bool is_code_ped4(uint32_t code)
static bool is_code_null(uint32_t code)
static bool is_code_dump(uint32_t code)
double getSumEt(const uint32_t *ptr_frag) const
static bool is_code_rawf(uint32_t code)
static int get_quality(int bad, int format)
void setVerbose(bool)
Sets verbose mode true or false.
static bool is_code_amp5(uint32_t code)
Compression Format Code inlile functions.
static bool is_code_amp(uint32_t code)
double getSum(const uint32_t *ptr_frag, int n) const
Get SumEt, SumEz, SumE value.
static bool is_code_full(uint32_t code)
void unpack(const uint32_t *ofw, const uint32_t *ptr_frag, TileChanData *ChanData) const
static int get_size_code(uint32_t code)
bool check_raw(const uint32_t *feb, int of_energy[], TileChanData *ChanData) const