1 #ifndef DataFormats_L1TrackTrigger_TTBV_h 2 #define DataFormats_L1TrackTrigger_TTBV_h 36 const char*
c =
reinterpret_cast<const char*
>(&
d);
37 for (
int iByte = 0; iByte < (
int)
sizeof(
d); iByte++) {
38 const std::bitset<std::numeric_limits<unsigned char>::digits> byte(*(
c + iByte));
39 for (
int bit = 0; bit < std::numeric_limits<unsigned char>::digits;
bit++)
71 const std::bitset<S_>&
bs()
const {
return bs_; }
85 bool all()
const {
return bs_.all(); }
86 bool any()
const {
return bs_.any(); }
175 bs_ = std::bitset<S_>(
bs_.to_ullong() + 1);
213 TTBV&
set(std::vector<int> vpos) {
244 }
else if (size < size_ && size > 0) {
315 for (
int e =
size_ - 1;
e > -1;
e--)
334 std::vector<int>
ids(
bool b =
true,
bool singed =
false)
const {
336 v.reserve(
bs_.count());
339 v.push_back(singed ?
i +
size_ / 2 :
i);
348 std::array<unsigned long long int, S_> lut = {};
349 for (
int i = 0;
i <
S_;
i++)
355 unsigned long long int iMax()
const {
356 static const std::array<unsigned long long int, S_> lut =
powersOfTwo();
double extract(double base, int size, bool twos=false)
double val(double base, int start, int end=0, bool twos=false) const
unsigned long long int iMax() const
TTBV(const std::bitset< S_ > &bs, bool twos=false)
int plEncode(bool b=true) const
TTBV(unsigned long long int value, int size)
TTBV operator+(const TTBV &rhs) const
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
TTBV(const std::string &str, bool twos=false)
int extract(int size, bool twos=false)
const std::bitset< S_ > & bs() const
std::string str(int start, int end=0) const
constexpr std::array< unsigned long long int, S_ > powersOfTwo() const
TTBV & operator+=(const TTBV &rhs)
int val(int start, int end=0, bool twos=false) const
TTBV & operator &=(const TTBV &rhs)
TTBV & operator|=(const TTBV &rhs)
bool operator==(const TTBV &rhs) const
TTBV & operator>>=(int pos)
double val(double base) const
TTBV(double value, double base, int size, bool twos=false)
TTBV(int value, int size, bool twos=false)
TTBV operator>>(int pos) const
std::vector< int > ids(bool b=true, bool singed=false) const
friend std::ostream & operator<<(std::ostream &os, const TTBV &ttBV)
TTBV operator<<(int pos) const
TTBV(const TTBV &ttBV, int begin, int end=0, bool twos=false)
int count(int begin, int end, bool b=true) const
bool operator[](int pos) const
std::bitset< S_ >::reference operator[](int pos)
int encode(int n, bool b=true) const
std::bitset< S_ >::reference msb()
TTBV & operator^=(const TTBV &rhs)
bool operator!=(const TTBV &rhs) const
TTBV slice(int size, bool twos=false)
int pmEncode(bool b=true) const
TTBV & operator<<=(int pos)
Power< A, B >::type pow(const A &a, const B &b)