CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
TTBV Class Reference

Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within margin) sized two's complement strings. More...

#include <TTBV.h>

Public Member Functions

TTBVabs ()
 
bool all () const
 
bool any () const
 
const std::bitset< S_ > & bs () const
 
int count () const
 
int count (int begin, int end, bool b=true) const
 
int encode (int n, bool b=true) const
 
double extract (double base, int size, bool twos=false)
 
int extract (int size, bool twos=false)
 
TTBVflip ()
 
TTBVflip (int pos)
 
std::vector< int > ids (bool b=true, bool singed=false) const
 
bool msb () const
 
std::bitset< S_ >::reference msb ()
 
bool none () const
 
TTBVoperator &= (const TTBV &rhs)
 
bool operator!= (const TTBV &rhs) const
 
TTBV operator+ (const TTBV &rhs) const
 
TTBVoperator++ ()
 
TTBVoperator+= (const TTBV &rhs)
 
TTBV operator<< (int pos) const
 
TTBVoperator<<= (int pos)
 
bool operator== (const TTBV &rhs) const
 
TTBV operator>> (int pos) const
 
TTBVoperator>>= (int pos)
 
bool operator[] (int pos) const
 
std::bitset< S_ >::reference operator[] (int pos)
 
TTBVoperator^= (const TTBV &rhs)
 
TTBVoperator|= (const TTBV &rhs)
 
TTBV operator~ () const
 
int plEncode (bool b=true) const
 
int pmEncode (bool b=true) const
 
TTBVreset ()
 
TTBVreset (int pos)
 
TTBVresize (int size)
 
TTBVset ()
 
TTBVset (int pos)
 
TTBVset (std::vector< int > vpos)
 
int size () const
 
TTBV slice (int size, bool twos=false)
 
std::string str () const
 
std::string str (int start, int end=0) const
 
 TTBV ()
 
 TTBV (const double d)
 
 TTBV (unsigned long long int value, int size)
 
 TTBV (int value, int size, bool twos=false)
 
 TTBV (double value, double base, int size, bool twos=false)
 
 TTBV (const std::string &str, bool twos=false)
 
 TTBV (const std::bitset< S_ > &bs, bool twos=false)
 
 TTBV (const TTBV &ttBV, int begin, int end=0, bool twos=false)
 
bool twos () const
 
int val () const
 
int val (bool twos) const
 
int val (int start, int end=0, bool twos=false) const
 
double val (double base) const
 
double val (double base, int start, int end=0, bool twos=false) const
 

Static Public Attributes

static constexpr int S_ = 64
 

Private Member Functions

unsigned long long int iMax () const
 
constexpr std::array< unsigned long long int, S_powersOfTwo () const
 

Private Attributes

std::bitset< S_bs_
 
int size_
 
bool twos_
 

Friends

std::ostream & operator<< (std::ostream &os, const TTBV &ttBV)
 

Detailed Description

Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within margin) sized two's complement strings.

Author
Thomas Schuh
Date
2020, Jan

Definition at line 20 of file TTBV.h.

Constructor & Destructor Documentation

◆ TTBV() [1/8]

TTBV::TTBV ( )
inline

Definition at line 31 of file TTBV.h.

Referenced by val().

31 : twos_(false), size_(0), bs_() {}
bool twos_
Definition: TTBV.h:25
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ TTBV() [2/8]

TTBV::TTBV ( const double  d)
inline

Definition at line 34 of file TTBV.h.

References triggerObjects_cff::bit, bs_, HltBtagPostValidation_cff::c, ztail::d, and createfilelist::int.

34  : twos_(false), size_(S_) {
35  int index(0);
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++)
40  bs_[index++] = byte[bit];
41  }
42  }
bool twos_
Definition: TTBV.h:25
d
Definition: ztail.py:151
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
static constexpr int S_
Definition: TTBV.h:22

◆ TTBV() [3/8]

TTBV::TTBV ( unsigned long long int  value,
int  size 
)
inline

Definition at line 45 of file TTBV.h.

45 : twos_(false), size_(size), bs_(value) {}
bool twos_
Definition: TTBV.h:25
int size() const
Definition: TTBV.h:69
Definition: value.py:1
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ TTBV() [4/8]

TTBV::TTBV ( int  value,
int  size,
bool  twos = false 
)
inline

Definition at line 48 of file TTBV.h.

49  : twos_(twos), size_(size), bs_((!twos || value >= 0) ? value : value + iMax()) {}
unsigned long long int iMax() const
Definition: TTBV.h:355
bool twos() const
Definition: TTBV.h:67
bool twos_
Definition: TTBV.h:25
int size() const
Definition: TTBV.h:69
Definition: value.py:1
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ TTBV() [5/8]

TTBV::TTBV ( double  value,
double  base,
int  size,
bool  twos = false 
)
inline

Definition at line 52 of file TTBV.h.

52 : TTBV((int)std::floor(value / base), size, twos) {}
base
Main Program
Definition: newFWLiteAna.py:92
bool twos() const
Definition: TTBV.h:67
TTBV()
Definition: TTBV.h:31
int size() const
Definition: TTBV.h:69
Definition: value.py:1

◆ TTBV() [6/8]

TTBV::TTBV ( const std::string &  str,
bool  twos = false 
)
inline

Definition at line 55 of file TTBV.h.

55 : twos_(twos), size_(str.size()), bs_(str) {}
bool twos() const
Definition: TTBV.h:67
bool twos_
Definition: TTBV.h:25
std::string str() const
Definition: TTBV.h:253
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ TTBV() [7/8]

TTBV::TTBV ( const std::bitset< S_ > &  bs,
bool  twos = false 
)
inline

Definition at line 58 of file TTBV.h.

58 : twos_(twos), size_(S_), bs_(bs) {}
const std::bitset< S_ > & bs() const
Definition: TTBV.h:71
bool twos() const
Definition: TTBV.h:67
bool twos_
Definition: TTBV.h:25
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
static constexpr int S_
Definition: TTBV.h:22

◆ TTBV() [8/8]

TTBV::TTBV ( const TTBV ttBV,
int  begin,
int  end = 0,
bool  twos = false 
)
inline

Definition at line 61 of file TTBV.h.

References bs_, mps_fire::end, and S_.

61  : twos_(twos), size_(begin - end), bs_(ttBV.bs_) {
62  bs_ <<= S_ - begin;
63  bs_ >>= S_ - begin + end;
64  }
bool twos() const
Definition: TTBV.h:67
bool twos_
Definition: TTBV.h:25
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
static constexpr int S_
Definition: TTBV.h:22

Member Function Documentation

◆ abs()

TTBV& TTBV::abs ( )
inline

Definition at line 226 of file TTBV.h.

References flip(), msb(), and twos_.

226  {
227  if (twos_) {
228  twos_ = false;
229  if (this->msb())
230  this->flip();
231  size_--;
232  }
233  return *this;
234  }
bool msb() const
Definition: TTBV.h:78
TTBV & flip()
Definition: TTBV.h:194
bool twos_
Definition: TTBV.h:25
int size_
Definition: TTBV.h:26

◆ all()

bool TTBV::all ( ) const
inline

Definition at line 85 of file TTBV.h.

References bs_.

85 { return bs_.all(); }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ any()

bool TTBV::any ( ) const
inline

Definition at line 86 of file TTBV.h.

References bs_.

86 { return bs_.any(); }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ bs()

const std::bitset<S_>& TTBV::bs ( ) const
inline

Definition at line 71 of file TTBV.h.

References bs_.

Referenced by trackerTFP::DataFormats::convertStub(), and trackerTFP::DataFormats::convertTrack().

71 { return bs_; }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ count() [1/2]

int TTBV::count ( void  ) const
inline

Definition at line 88 of file TTBV.h.

References bs_.

Referenced by trackerTFP::State::fill(), trackerTFP::State::State(), and trackerTFP::TrackKFin::ttStubRefs().

88 { return bs_.count(); }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ count() [2/2]

int TTBV::count ( int  begin,
int  end,
bool  b = true 
) const
inline

Definition at line 297 of file TTBV.h.

References b, bs_, HltBtagPostValidation_cff::c, mps_fire::end, and mps_fire::i.

297  {
298  int c(0);
299  for (int i = begin; i < end; i++)
300  if (bs_[i] == b)
301  c++;
302  return c;
303  }
double b
Definition: hdecay.h:120
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ encode()

int TTBV::encode ( int  n,
bool  b = true 
) const
inline

Definition at line 322 of file TTBV.h.

References b, bs_, MillePedeFileConverter_cfg::e, dqmiodumpmetadata::n, and size_.

322  {
323  int sum(0);
324  for (int e = 0; e < size_; e++) {
325  if (bs_[e] == b) {
326  sum++;
327  if (sum == n)
328  return e;
329  }
330  }
331  return size_;
332  }
double b
Definition: hdecay.h:120
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ extract() [1/2]

double TTBV::extract ( double  base,
int  size,
bool  twos = false 
)
inline

Definition at line 276 of file TTBV.h.

References operator>>=(), size(), twos(), and val().

Referenced by trackerTFP::StubHT::fillTrackId(), trackerTFP::StubMHT::fillTrackId(), trackerTFP::StubZHT::fillTrackId(), and tt::Setup::layerMap().

276  {
277  double val = this->val(base, size, 0, twos);
278  this->operator>>=(size);
279  return val;
280  }
base
Main Program
Definition: newFWLiteAna.py:92
bool twos() const
Definition: TTBV.h:67
TTBV & operator>>=(int pos)
Definition: TTBV.h:133
int size() const
Definition: TTBV.h:69
int val() const
Definition: TTBV.h:259

◆ extract() [2/2]

int TTBV::extract ( int  size,
bool  twos = false 
)
inline

Definition at line 283 of file TTBV.h.

References operator>>=(), twos(), and val().

283  {
284  double val = this->val(size, 0, twos);
285  this->operator>>=(size);
286  return val;
287  }
bool twos() const
Definition: TTBV.h:67
TTBV & operator>>=(int pos)
Definition: TTBV.h:133
int size() const
Definition: TTBV.h:69
int val() const
Definition: TTBV.h:259

◆ flip() [1/2]

TTBV& TTBV::flip ( )
inline

Definition at line 194 of file TTBV.h.

References bs_, dqmiodumpmetadata::n, and size_.

Referenced by abs(), and operator~().

194  {
195  for (int n = 0; n < size_; n++)
196  bs_.flip(n);
197  return *this;
198  }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ flip() [2/2]

TTBV& TTBV::flip ( int  pos)
inline

Definition at line 220 of file TTBV.h.

References bs_.

220  {
221  bs_.flip(pos);
222  return *this;
223  }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ ids()

std::vector<int> TTBV::ids ( bool  b = true,
bool  singed = false 
) const
inline

Definition at line 334 of file TTBV.h.

References b, bs_, mps_fire::i, size_, and findQualityFiles::v.

Referenced by trackerTFP::StubGP::inv2RBins(), L1FPGATrackProducer::produce(), and trackerTFP::StubPP::sectors().

334  {
335  std::vector<int> v;
336  v.reserve(bs_.count());
337  for (int i = 0; i < size_; i++)
338  if (bs_[i] == b)
339  v.push_back(singed ? i + size_ / 2 : i);
340  return v;
341  }
double b
Definition: hdecay.h:120
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ iMax()

unsigned long long int TTBV::iMax ( ) const
inlineprivate

Definition at line 355 of file TTBV.h.

References powersOfTwo(), and size_.

Referenced by val().

355  {
356  static const std::array<unsigned long long int, S_> lut = powersOfTwo();
357  return lut[size_];
358  }
constexpr std::array< unsigned long long int, S_ > powersOfTwo() const
Definition: TTBV.h:347
int size_
Definition: TTBV.h:26

◆ msb() [1/2]

bool TTBV::msb ( ) const
inline

Definition at line 78 of file TTBV.h.

References bs_, and size_.

Referenced by abs(), resize(), and val().

78 { return bs_[size_ - 1]; }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ msb() [2/2]

std::bitset<S_>::reference TTBV::msb ( )
inline

Definition at line 81 of file TTBV.h.

References bs_, and size_.

81 { return bs_[size_ - 1]; }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ none()

bool TTBV::none ( ) const
inline

Definition at line 87 of file TTBV.h.

References bs_.

87 { return bs_.none(); }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ operator &=()

TTBV& TTBV::operator&= ( const TTBV rhs)
inline

Definition at line 97 of file TTBV.h.

References bs_, visualization-live-secondInstance_cfg::m, SiStripPI::max, resize(), size(), and size_.

97  {
98  const int m(std::max(size_, rhs.size()));
99  this->resize(m);
100  TTBV bv(rhs);
101  bv.resize(m);
102  bs_ &= bv.bs_;
103  return *this;
104  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20
TTBV & resize(int size)
Definition: TTBV.h:237
int size() const
Definition: TTBV.h:69
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator!=()

bool TTBV::operator!= ( const TTBV rhs) const
inline

Definition at line 94 of file TTBV.h.

References bs_.

94 { return bs_ != rhs.bs_; }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ operator+()

TTBV TTBV::operator+ ( const TTBV rhs) const
inline

Definition at line 168 of file TTBV.h.

168  {
169  TTBV lhs(*this);
170  return lhs += rhs;
171  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20

◆ operator++()

TTBV& TTBV::operator++ ( )
inline

Definition at line 174 of file TTBV.h.

References bs_, and resize().

174  {
175  bs_ = std::bitset<S_>(bs_.to_ullong() + 1);
176  this->resize(size_);
177  return *this;
178  }
TTBV & resize(int size)
Definition: TTBV.h:237
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator+=()

TTBV& TTBV::operator+= ( const TTBV rhs)
inline

Definition at line 160 of file TTBV.h.

References bs_, size(), and size_.

160  {
161  bs_ <<= rhs.size();
162  bs_ |= rhs.bs_;
163  size_ += rhs.size();
164  return *this;
165  }
int size() const
Definition: TTBV.h:69
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator<<()

TTBV TTBV::operator<< ( int  pos) const
inline

Definition at line 148 of file TTBV.h.

148  {
149  TTBV bv(*this);
150  return bv <<= pos;
151  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20

◆ operator<<=()

TTBV& TTBV::operator<<= ( int  pos)
inline

Definition at line 140 of file TTBV.h.

References bs_, S_, and size_.

Referenced by resize().

140  {
141  bs_ <<= S_ - size_ + pos;
142  bs_ >>= S_ - size_ + pos;
143  size_ -= pos;
144  return *this;
145  }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
static constexpr int S_
Definition: TTBV.h:22

◆ operator==()

bool TTBV::operator== ( const TTBV rhs) const
inline

Definition at line 91 of file TTBV.h.

References bs_.

91 { return bs_ == rhs.bs_; }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ operator>>()

TTBV TTBV::operator>> ( int  pos) const
inline

Definition at line 154 of file TTBV.h.

154  {
155  TTBV bv(*this);
156  return bv >>= pos;
157  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20

◆ operator>>=()

TTBV& TTBV::operator>>= ( int  pos)
inline

Definition at line 133 of file TTBV.h.

References bs_, and size_.

Referenced by extract(), and slice().

133  {
134  bs_ >>= pos;
135  size_ -= pos;
136  return *this;
137  }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator[]() [1/2]

bool TTBV::operator[] ( int  pos) const
inline

Definition at line 74 of file TTBV.h.

References bs_.

74 { return bs_[pos]; }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ operator[]() [2/2]

std::bitset<S_>::reference TTBV::operator[] ( int  pos)
inline

Definition at line 75 of file TTBV.h.

References bs_.

75 { return bs_[pos]; }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ operator^=()

TTBV& TTBV::operator^= ( const TTBV rhs)
inline

Definition at line 117 of file TTBV.h.

References bs_, visualization-live-secondInstance_cfg::m, SiStripPI::max, resize(), size(), and size_.

117  {
118  const int m(std::max(size_, rhs.size()));
119  this->resize(m);
120  TTBV bv(rhs);
121  bv.resize(m);
122  bs_ ^= bv.bs_;
123  return *this;
124  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20
TTBV & resize(int size)
Definition: TTBV.h:237
int size() const
Definition: TTBV.h:69
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator|=()

TTBV& TTBV::operator|= ( const TTBV rhs)
inline

Definition at line 107 of file TTBV.h.

References bs_, visualization-live-secondInstance_cfg::m, SiStripPI::max, resize(), size(), and size_.

107  {
108  const int m(std::max(size_, rhs.size()));
109  this->resize(m);
110  TTBV bv(rhs);
111  bv.resize(m);
112  bs_ |= bv.bs_;
113  return *this;
114  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20
TTBV & resize(int size)
Definition: TTBV.h:237
int size() const
Definition: TTBV.h:69
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ operator~()

TTBV TTBV::operator~ ( ) const
inline

Definition at line 127 of file TTBV.h.

References flip().

127  {
128  TTBV bv(*this);
129  return bv.flip();
130  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20

◆ plEncode()

int TTBV::plEncode ( bool  b = true) const
inline

Definition at line 306 of file TTBV.h.

References b, bs_, MillePedeFileConverter_cfg::e, and size_.

Referenced by trackerTFP::State::State().

306  {
307  for (int e = 0; e < size_; e++)
308  if (bs_[e] == b)
309  return e;
310  return size_;
311  }
double b
Definition: hdecay.h:120
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ pmEncode()

int TTBV::pmEncode ( bool  b = true) const
inline

Definition at line 314 of file TTBV.h.

References b, bs_, MillePedeFileConverter_cfg::e, and size_.

Referenced by trackerTFP::State::finish().

314  {
315  for (int e = size_ - 1; e > -1; e--)
316  if (bs_[e] == b)
317  return e;
318  return size_;
319  }
double b
Definition: hdecay.h:120
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ powersOfTwo()

constexpr std::array<unsigned long long int, S_> TTBV::powersOfTwo ( ) const
inlineprivate

Definition at line 347 of file TTBV.h.

References mps_fire::i, funct::pow(), and S_.

Referenced by iMax().

347  {
348  std::array<unsigned long long int, S_> lut = {};
349  for (int i = 0; i < S_; i++)
350  lut[i] = std::pow(2, i);
351  return lut;
352  }
static constexpr int S_
Definition: TTBV.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ reset() [1/2]

TTBV& TTBV::reset ( void  )
inline

Definition at line 181 of file TTBV.h.

References bs_.

181  {
182  bs_.reset();
183  return *this;
184  }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ reset() [2/2]

TTBV& TTBV::reset ( int  pos)
inline

Definition at line 201 of file TTBV.h.

References bs_.

201  {
202  bs_.reset(pos);
203  return *this;
204  }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ resize()

TTBV& TTBV::resize ( int  size)
inline

Definition at line 237 of file TTBV.h.

References bs_, msb(), dqmiodumpmetadata::n, operator<<=(), size(), size_, and twos_.

Referenced by operator &=(), operator++(), operator^=(), operator|=(), and trklet::ProducerKFout::produce().

237  {
238  bool msb = this->msb();
239  if (size > size_) {
240  if (twos_)
241  for (int n = size_; n < size; n++)
242  bs_.set(n, msb);
243  size_ = size;
244  } else if (size < size_ && size > 0) {
245  this->operator<<=(size - size_);
246  if (twos_)
247  this->msb() = msb;
248  }
249  return *this;
250  }
bool msb() const
Definition: TTBV.h:78
bool twos_
Definition: TTBV.h:25
int size() const
Definition: TTBV.h:69
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
TTBV & operator<<=(int pos)
Definition: TTBV.h:140

◆ set() [1/3]

TTBV& TTBV::set ( )
inline

Definition at line 187 of file TTBV.h.

References bs_, dqmiodumpmetadata::n, and size_.

Referenced by trackerTFP::MiniHoughTransform::dlb(), trklet::ProducerKFout::produce(), L1FPGATrackProducer::produce(), trackerTFP::State::State(), trackerTFP::StubGP::StubGP(), trackerTFP::TrackKFin::TrackKFin(), and trackerTFP::TrackKF::ttTrack().

187  {
188  for (int n = 0; n < size_; n++)
189  bs_.set(n);
190  return *this;
191  }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26

◆ set() [2/3]

TTBV& TTBV::set ( int  pos)
inline

Definition at line 207 of file TTBV.h.

References bs_.

207  {
208  bs_.set(pos);
209  return *this;
210  }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ set() [3/3]

TTBV& TTBV::set ( std::vector< int >  vpos)
inline

Definition at line 213 of file TTBV.h.

References bs_.

213  {
214  for (int pos : vpos)
215  bs_.set(pos);
216  return *this;
217  }
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ size()

int TTBV::size ( void  ) const
inline

◆ slice()

TTBV TTBV::slice ( int  size,
bool  twos = false 
)
inline

Definition at line 290 of file TTBV.h.

References operator>>=(), size(), and twos().

290  {
291  TTBV ttBV(*this, size, 0, twos);
292  this->operator>>=(size);
293  return ttBV;
294  }
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20
bool twos() const
Definition: TTBV.h:67
TTBV & operator>>=(int pos)
Definition: TTBV.h:133
int size() const
Definition: TTBV.h:69

◆ str() [1/2]

std::string TTBV::str ( ) const
inline

Definition at line 253 of file TTBV.h.

References S_, and size_.

Referenced by trklet::KFin::consume(), and trackerDTC::Stub::formatTMTT().

253 { return bs_.to_string().substr(S_ - size_, S_); }
std::bitset< S_ > bs_
Definition: TTBV.h:27
int size_
Definition: TTBV.h:26
static constexpr int S_
Definition: TTBV.h:22

◆ str() [2/2]

std::string TTBV::str ( int  start,
int  end = 0 
) const
inline

Definition at line 256 of file TTBV.h.

References mps_fire::end, size_, and str().

Referenced by str().

256 { return this->str().substr(size_ - start, size_ - end); }
Definition: start.py:1
std::string str() const
Definition: TTBV.h:253
int size_
Definition: TTBV.h:26

◆ twos()

bool TTBV::twos ( ) const
inline

Definition at line 67 of file TTBV.h.

References twos_.

Referenced by extract(), slice(), and val().

67 { return twos_; }
bool twos_
Definition: TTBV.h:25

◆ val() [1/5]

int TTBV::val ( ) const
inline

Definition at line 259 of file TTBV.h.

References bs_, iMax(), createfilelist::int, msb(), and twos_.

Referenced by trklet::DRin::consume(), extract(), tt::Setup::stubPos(), tt::Setup::stubR(), trackerTFP::TrackKF::ttTrack(), and val().

259 { return (twos_ && this->msb()) ? (int)bs_.to_ullong() - iMax() : bs_.to_ullong(); }
unsigned long long int iMax() const
Definition: TTBV.h:355
bool msb() const
Definition: TTBV.h:78
bool twos_
Definition: TTBV.h:25
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ val() [2/5]

int TTBV::val ( bool  twos) const
inline

Definition at line 262 of file TTBV.h.

References bs_, iMax(), createfilelist::int, msb(), and twos().

262 { return (twos && this->msb()) ? (int)bs_.to_ullong() - iMax() : bs_.to_ullong(); }
unsigned long long int iMax() const
Definition: TTBV.h:355
bool msb() const
Definition: TTBV.h:78
bool twos() const
Definition: TTBV.h:67
std::bitset< S_ > bs_
Definition: TTBV.h:27

◆ val() [3/5]

int TTBV::val ( int  start,
int  end = 0,
bool  twos = false 
) const
inline

Definition at line 265 of file TTBV.h.

References mps_fire::end, TTBV(), and twos().

265 { return TTBV(*this, start, end).val(twos); }
Definition: start.py:1
bool twos() const
Definition: TTBV.h:67
TTBV()
Definition: TTBV.h:31

◆ val() [4/5]

double TTBV::val ( double  base) const
inline

Definition at line 268 of file TTBV.h.

References newFWLiteAna::base, and val().

Referenced by val().

268 { return (this->val() + .5) * base; }
base
Main Program
Definition: newFWLiteAna.py:92
int val() const
Definition: TTBV.h:259

◆ val() [5/5]

double TTBV::val ( double  base,
int  start,
int  end = 0,
bool  twos = false 
) const
inline

Definition at line 271 of file TTBV.h.

References newFWLiteAna::base, mps_fire::end, twos(), and val().

271  {
272  return (this->val(start, end, twos) + .5) * base;
273  }
Definition: start.py:1
base
Main Program
Definition: newFWLiteAna.py:92
bool twos() const
Definition: TTBV.h:67
int val() const
Definition: TTBV.h:259

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const TTBV ttBV 
)
friend

Definition at line 343 of file TTBV.h.

343 { return os << ttBV.str(); }
std::string str() const
Definition: TTBV.h:253

Member Data Documentation

◆ bs_

std::bitset<S_> TTBV::bs_
private

◆ S_

constexpr int TTBV::S_ = 64
static

◆ size_

int TTBV::size_
private

◆ twos_

bool TTBV::twos_
private

Definition at line 25 of file TTBV.h.

Referenced by abs(), resize(), twos(), and val().