6 using namespace trklet;
8 FPGAWord::FPGAWord() {}
10 FPGAWord::FPGAWord(
int value,
int nbits,
bool positive,
int line,
const char*
file) {
11 set(value, nbits, positive, line, file);
14 void FPGAWord::set(
int value,
int nbits,
bool positive,
int line,
const char*
file) {
20 edm::LogProblem(
"Tracklet") <<
"FPGAWord got negative value:" << value <<
" (" << file <<
":" << line <<
")";
25 edm::LogPrint(
"Tracklet") <<
"FPGAWord got too many bits:" << nbits <<
" (" << file <<
":" << line <<
")";
29 edm::LogPrint(
"Tracklet") <<
"FPGAWord got too few bits:" << nbits <<
" (" << file <<
":" << line <<
")";
33 if (value >= (1 << nbits)) {
34 if (file !=
nullptr) {
35 edm::LogProblem(
"Tracklet") <<
"value too large:" << value <<
" " << (1 << nbits) <<
" (" << file <<
":" << line
39 assert(value < (1 << nbits));
41 if (value > (1 << (nbits - 1))) {
42 edm::LogProblem(
"Tracklet") <<
"value too large:" << value <<
" " << (1 << (nbits - 1)) <<
" (" << file <<
":"
45 assert(value <= (1 << (nbits - 1)));
46 if (value < -(1 << (nbits - 1))) {
47 edm::LogProblem(
"Tracklet") <<
"value too negative:" << value <<
" " << -(1 << (nbits - 1)) <<
" (" << file <<
":"
50 assert(value >= -(1 << (nbits - 1)));
55 const int nbit = nbits_;
57 if (!(nbit > 0 && nbit < 22))
66 for (
int i = 0;
i < nbit;
i++) {
67 str = ((valtmp & 1) ?
"1" :
"0") +
str;
74 unsigned int FPGAWord::bits(
unsigned int lsb,
unsigned int nbit)
const {
75 assert(lsb + nbit <= (
unsigned int)nbits());
76 return (value_ >> lsb) & ((1 << nbit) - 1);
79 bool FPGAWord::atExtreme()
const {
81 return (value_ == 0) || (value_ == (1 << nbits_) - 1);
83 return ((value_ == (-(1 << (nbits_ - 1)))) || (value_ == ((1 << (nbits_ - 1)) - 1)));
Log< level::Info, true > LogVerbatim
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Log< level::Warning, true > LogPrint
Log< level::Error, true > LogProblem