#include <BitArray.h>
Classes | |
class | refToBit |
Public Member Functions | |
int | any () |
void | assign (const int p, const int n, const int val) |
void | assign (const int p, const int n, const BitArray< N > &val) |
void | assign (const int p, const int n, const char *str) |
BitArray () | |
BitArray (const BitArray< N > &br) | |
BitArray (const char *str, const int p, const int n) | |
BitArray (const unsigned i) | |
BitArray (const char *str) | |
BitArray< 8 > | byte (const int i) const |
void | cleanUnused () |
int | count () const |
unsigned | dataWord (const int i) const |
unsigned & | dataWord (const int i) |
int | element (const int pos) const |
BitArray< N > & | flip () |
unsigned & | getWord (const int pos) |
unsigned | getWord (const int pos) const |
unsigned | lastWordMask () const |
int | nBits () const |
int | none () |
int | nWords () const |
void | one () |
bool | operator!= (const BitArray< N > &a) const |
BitArray< N > | operator& (const BitArray< N > &a) |
BitArray< N > & | operator&= (const BitArray< N > &a) |
BitArray< N > | operator+ (const BitArray< N > &a) |
BitArray< N > & | operator++ (int) |
BitArray< N > & | operator+= (const BitArray< N > &a) |
BitArray< N > | operator- (const BitArray< N > &a) |
BitArray< N > & | operator-= (const BitArray< N > &a) |
bool | operator< (const BitArray< N > &a) const |
BitArray< N > | operator<< (const int n) |
BitArray< N > & | operator<<= (const int n) |
bool | operator<= (const BitArray< N > &a) const |
BitArray< N > & | operator= (const BitArray< N > &a) |
BitArray< N > & | operator= (const unsigned i) |
BitArray< N > & | operator= (const char *str) |
bool | operator== (const BitArray< N > &a) const |
bool | operator> (const BitArray< N > &a) const |
bool | operator>= (const BitArray< N > &a) const |
BitArray< N > | operator>> (const int n) |
BitArray< N > & | operator>>= (const int n) |
refToBit | operator[] (const int pos) |
int | operator[] (const int pos) const |
BitArray< N > | operator^ (const BitArray< N > &a) |
BitArray< N > & | operator^= (const BitArray< N > &a) |
BitArray< N > | operator| (const BitArray< N > &a) |
BitArray< N > & | operator|= (const BitArray< N > &a) |
BitArray< N > | operator~ () const |
std::ostream & | print (std::ostream &o=std::cout) const |
unsigned | read (const int p, const int n) const |
void | reset (const int i) |
void | reset () |
void | set (const int i) |
void | set (const int i, const int val) |
void | set (const int i, const char *str) |
int | size () const |
int | test (const int i) const |
BitArray< N > & | twoComplement () |
BitArray< N > | twoComplement () const |
void | unset (const int i) |
int | unusedBits () const |
void | zero () |
Static Public Member Functions | |
static int | getPosInWord (const int pos) |
static unsigned | getPosMask (const int pos) |
Private Attributes | |
unsigned | _data [N/32+1] |
Friends | |
class | refToBit |
Definition at line 30 of file BitArray.h.
Definition at line 83 of file BitArray.h.
{this->zero();}
Definition at line 91 of file BitArray.h.
{ this->zero(); this->assign(0,this->nBits(),str); this->cleanUnused(); }
Definition at line 100 of file BitArray.h.
{ this->zero(); _data[0] = i; // the nBit least sign. bits are considered this->cleanUnused(); }
int BitArray< N >::any | ( | ) | [inline] |
Definition at line 184 of file BitArray.h.
Referenced by DTTSTheta::runDTTSTheta().
{ int nw = this->nWords(); int ub = unusedBits(); if(this->dataWord(nw-1)<<ub!=0)return 1; if(nw>1){ for (int iw=0;iw<nw-1;iw++){ if(this->dataWord(iw)!=0) return 1; } } return 0; }
void BitArray< N >::assign | ( | const int | p, |
const int | n, | ||
const int | val | ||
) | [inline] |
Definition at line 239 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), DTSectCollPhCand::clearBits(), DTTSCand::clearBits(), DTTSCand::clearBitsBkmod(), DTSectCollPhCand::clearBitsSectColl(), DTTracoChip::insideAngWindow(), BitArray< 9 >::set(), DTSectCollPhCand::setBitsSectColl(), DTTSCand::setBitsTsm(), and DTTSCand::setBitsTss().
void BitArray< N >::assign | ( | const int | p, |
const int | n, | ||
const char * | str | ||
) | [inline] |
Definition at line 261 of file BitArray.h.
{ assert(p>=0 && p+n<=this->nBits()); // only the n least significant bits of val are considered for(int i=0; i<n;i++){ assert(str[i]=='1'||str[i]=='0'); if(str[i]=='1') { this->set(p+n-i-1); // reading a string from left to right } else { // --> most significative bit is the one this->unset(p+n-i-1); // with lower string index } } }
Definition at line 287 of file BitArray.h.
Referenced by DTTSTheta::runDTTSTheta().
void BitArray< N >::cleanUnused | ( | ) | [inline] |
Definition at line 170 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), and BitArray< 9 >::operator=().
{ _data[this->nWords()-1] &= (this->lastWordMask()); }
int BitArray< N >::count | ( | void | ) | const [inline] |
unsigned& BitArray< N >::dataWord | ( | const int | i | ) | [inline] |
unsigned BitArray< N >::dataWord | ( | const int | i | ) | const [inline] |
Definition at line 128 of file BitArray.h.
Referenced by BitArray< 9 >::any(), DTTSCand::dataword(), DTSectCollPhCand::dataword(), BitArray< 9 >::none(), BitArray< 9 >::operator&=(), BitArray< 9 >::operator<(), BitArray< 9 >::operator==(), BitArray< 9 >::operator^=(), and BitArray< 9 >::operator|=().
int BitArray< N >::element | ( | const int | pos | ) | const [inline] |
Definition at line 210 of file BitArray.h.
Referenced by DTTracoChip::add_btiT(), DTTracoChip::AdjBtiLTSuppressed(), BitArray< 9 >::assign(), BitArray< 9 >::count(), DTTSPhi::ignoreSecondTrack(), DTTracoChip::insideAngWindow(), DTSectCollPhCand::isFirst(), DTTSCand::isFirst(), DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), BitArray< 9 >::operator++(), BitArray< 9 >::operator+=(), BitArray< 9 >::operator<<=(), BitArray< 9 >::operator>>=(), BitArray< 9 >::operator[](), DTTracoChip::ovlFlag(), BitArray< 9 >::print(), DTSectCollPhCand::print(), DTConfigBti::PTMSflag(), DTTracoChip::run(), DTTSPhi::runTSPhi(), DTTSCand::setBitsTsm(), DTTSCand::setBitsTss(), DTTracoChip::setFlag(), DTTracoChip::storeCorr(), DTTracoChip::storeUncorr(), BitArray< 9 >::test(), DTConfigTraco::usedBti(), DTConfigTSPhi::usedTraco(), DTTracoChip::useSecondTrack(), and DTConfigBti::WENflag().
{ return (getWord(pos)&getPosMask(pos))!=static_cast<unsigned>(0); }
static int BitArray< N >::getPosInWord | ( | const int | pos | ) | [inline, static] |
Definition at line 148 of file BitArray.h.
Referenced by BitArray< 9 >::getPosMask(), and BitArray< N >::refToBit::refToBit().
{ // assert(pos>=0&& pos<this->nBits()); return pos%32; }
static unsigned BitArray< N >::getPosMask | ( | const int | pos | ) | [inline, static] |
Definition at line 154 of file BitArray.h.
Referenced by BitArray< 9 >::element(), BitArray< N >::refToBit::flip(), BitArray< N >::refToBit::operator int(), BitArray< N >::refToBit::operator=(), BitArray< N >::refToBit::operator~(), BitArray< 9 >::set(), and BitArray< 9 >::unset().
{ return static_cast<unsigned>(1)<<getPosInWord(pos); }
unsigned& BitArray< N >::getWord | ( | const int | pos | ) | [inline] |
Definition at line 138 of file BitArray.h.
Referenced by BitArray< 9 >::element(), BitArray< N >::refToBit::refToBit(), BitArray< 9 >::set(), and BitArray< 9 >::unset().
unsigned BitArray< N >::getWord | ( | const int | pos | ) | const [inline] |
unsigned BitArray< N >::lastWordMask | ( | ) | const [inline] |
Definition at line 165 of file BitArray.h.
Referenced by BitArray< 9 >::cleanUnused().
{ return static_cast<unsigned>(0xffffffff)>>(this->unusedBits()); }
int BitArray< N >::nBits | ( | ) | const [inline] |
Definition at line 121 of file BitArray.h.
Referenced by BitArray< 9 >::assign(), BitArray< 9 >::BitArray(), BitArray< 9 >::count(), BitArray< 9 >::getWord(), BitArray< 9 >::operator++(), BitArray< 9 >::operator+=(), BitArray< 9 >::operator<<=(), BitArray< 9 >::operator=(), BitArray< 9 >::operator>>=(), BitArray< 9 >::print(), BitArray< 9 >::read(), BitArray< 9 >::size(), and BitArray< 9 >::unusedBits().
{ return N; }
int BitArray< N >::none | ( | ) | [inline] |
Definition at line 197 of file BitArray.h.
{ int nw = this->nWords(); int ub = unusedBits(); if(this->dataWord(nw-1)<<ub!=0xffffffff)return 1; if(nw>1){ for (int iw=0;iw<nw-1;iw++){ if(this->dataWord(iw)!=0xffffffff) return 1; } } return 0; }
int BitArray< N >::nWords | ( | ) | const [inline] |
Definition at line 125 of file BitArray.h.
Referenced by BitArray< 9 >::any(), BitArray< 9 >::BitArray(), BitArray< 9 >::byte(), BitArray< 9 >::cleanUnused(), BitArray< 9 >::dataWord(), BitArray< 9 >::flip(), BitArray< 9 >::none(), BitArray< 9 >::one(), BitArray< 9 >::operator&=(), BitArray< 9 >::operator<(), BitArray< 9 >::operator=(), BitArray< 9 >::operator==(), BitArray< 9 >::operator^=(), BitArray< 9 >::operator|=(), and BitArray< 9 >::zero().
{ return N/32+1; }
void BitArray< N >::one | ( | ) | [inline] |
Definition at line 223 of file BitArray.h.
Referenced by DTTSCand::clear(), DTSectCollPhCand::clear(), DTSectCollPhCand::DTSectCollPhCand(), DTTSCand::DTTSCand(), and DTConfigTSPhi::setDefaults().
Definition at line 394 of file BitArray.h.
{ return !(a==*this); }
Definition at line 425 of file BitArray.h.
{return BitArray<N> (*this)&=a; }
Definition at line 489 of file BitArray.h.
{return BitArray<N> (*this)+=a; }
Definition at line 515 of file BitArray.h.
{return BitArray<N> (*this)-=a; }
Definition at line 510 of file BitArray.h.
{ return *this+=a.twoComplement(); }
Definition at line 371 of file BitArray.h.
{ int nw = this->nWords(); int ub = this->unusedBits(); unsigned aaa = this->dataWord(nw-1)<<ub; // ignore unused bits unsigned bbb = a.dataWord(nw-1)<<ub; // in both operands if (aaa<bbb) { return 1; } else if (aaa>bbb) { return 0; } if(nw>1){ for (int iw=nw-2;iw>=0;iw--){ if (this->dataWord(iw)<a.dataWord(iw)) { return 1; } else if (this->dataWord(iw)>a.dataWord(iw)) { return 0; } } } return 0; }
Definition at line 460 of file BitArray.h.
{ return BitArray<N> (*this)<<=n; }
Definition at line 403 of file BitArray.h.
{ return !(*this>a); }
Definition at line 307 of file BitArray.h.
{ this->zero(); _data[0] = i; // the nBit least sign. bits are considered this->cleanUnused(); return *this; }
Definition at line 328 of file BitArray.h.
{ this->zero(); for(int i=0; i<this->nBits();i++){ assert(str[i]=='1'||str[i]=='0'); if(str[i]=='1') { this->set(this->nBits()-i-1); // reading a string from left to right } else if(str[i]=='0') { // --> most significative bit is the one this->unset(this->nBits()-i-1); // with lower string index } else { break; // exit when find a char which is not 0 or 1 } } this->cleanUnused(); return *this; }
Definition at line 357 of file BitArray.h.
Definition at line 400 of file BitArray.h.
{ return !(*this<a||*this==a); }
Definition at line 397 of file BitArray.h.
{ return !(*this<a); }
Definition at line 473 of file BitArray.h.
{ return BitArray<N> (*this)>>=n; }
Definition at line 353 of file BitArray.h.
int BitArray< N >::operator[] | ( | const int | pos | ) | const [inline] |
Definition at line 354 of file BitArray.h.
Definition at line 447 of file BitArray.h.
{return BitArray<N> (*this)^=a; }
Definition at line 436 of file BitArray.h.
{return BitArray<N> (*this)|=a;}
Definition at line 414 of file BitArray.h.
{ return BitArray<N> (*this).flip(); }
std::ostream& BitArray< N >::print | ( | std::ostream & | o = std::cout | ) | const [inline] |
Definition at line 345 of file BitArray.h.
Referenced by DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), DTTSCand::print(), DTConfigTSPhi::print(), and DTSectCollPhCand::print().
unsigned BitArray< N >::read | ( | const int | p, |
const int | n | ||
) | const [inline] |
Definition at line 275 of file BitArray.h.
Referenced by DTTracoChip::insideAngWindow().
void BitArray< N >::reset | ( | const int | i | ) | [inline] |
Definition at line 232 of file BitArray.h.
void BitArray< N >::reset | ( | void | ) | [inline] |
void BitArray< N >::set | ( | const int | i, |
const char * | str | ||
) | [inline] |
Definition at line 236 of file BitArray.h.
void BitArray< N >::set | ( | const int | i, |
const int | val | ||
) | [inline] |
Definition at line 235 of file BitArray.h.
void BitArray< N >::set | ( | const int | i | ) | [inline] |
Definition at line 230 of file BitArray.h.
Referenced by DTBtiChip::acceptMask(), DTTSTheta::add_btiT(), DTTracoChip::add_btiT(), DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), DTTracoChip::raiseOverlap(), DTTracoChip::run(), DTConfigTraco::setDefaults(), DTConfigBti::setDefaults(), DTTracoChip::setFlag(), DTConfigBti::setPTMSflag(), DTTSCand::setSecondTrack(), DTSectCollPhCand::setSecondTrack(), DTConfigTSPhi::setTsmStatus(), DTConfigTraco::setUsedBti(), DTConfigTSPhi::setUsedTraco(), and DTConfigBti::setWENflag().
{ getWord(i) |= getPosMask(i); }
int BitArray< N >::size | ( | void | ) | const [inline] |
Definition at line 122 of file BitArray.h.
{ return this->nBits(); }
int BitArray< N >::test | ( | const int | i | ) | const [inline] |
Definition at line 213 of file BitArray.h.
Referenced by BitArray< 9 >::read().
Definition at line 503 of file BitArray.h.
{ (*this).flip(); (*this)++; return *this; }
Definition at line 500 of file BitArray.h.
Referenced by DTTracoChip::insideAngWindow(), and BitArray< 9 >::operator-=().
{ return BitArray<N> (~*this)++; }
void BitArray< N >::unset | ( | const int | i | ) | [inline] |
Definition at line 231 of file BitArray.h.
Referenced by BitArray< 9 >::assign(), DTSectCollPhCand::DTSectCollPhCand(), DTTSCand::DTTSCand(), BitArray< 9 >::operator++(), BitArray< 9 >::operator<<=(), BitArray< 9 >::operator=(), BitArray< 9 >::operator>>=(), BitArray< 9 >::reset(), DTTSCand::setBitsBkmod(), DTSectCollPhCand::setBitsSectColl(), DTTSCand::setBitsTsm(), DTTSCand::setBitsTss(), and DTConfigTSPhi::setDefaults().
{ getWord(i) &= ~getPosMask(i); }
int BitArray< N >::unusedBits | ( | ) | const [inline] |
Definition at line 159 of file BitArray.h.
Referenced by BitArray< 9 >::any(), BitArray< 9 >::lastWordMask(), BitArray< 9 >::none(), BitArray< 9 >::operator<(), and BitArray< 9 >::operator==().
void BitArray< N >::zero | ( | ) | [inline] |
Definition at line 216 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), DTTracoChip::clear(), DTTracoChip::DTTracoChip(), DTTSTheta::DTTSTheta(), DTTSTheta::localClear(), BitArray< 9 >::operator=(), and BitArray< 9 >::reset().
friend class refToBit [friend] |
Definition at line 33 of file BitArray.h.
Referenced by BitArray< 9 >::operator[]().
Definition at line 519 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), BitArray< 9 >::byte(), BitArray< 9 >::cleanUnused(), BitArray< 9 >::dataWord(), BitArray< 9 >::flip(), BitArray< 9 >::getWord(), BitArray< 9 >::one(), BitArray< 9 >::operator=(), and BitArray< 9 >::zero().