#include <CondFormats/Calibration/interface/BitArray.h>
Public Member Functions | |
int | any () |
int | any () |
void | assign (const int p, const int n, const char *str) |
void | assign (const int p, const int n, const BitArray< N > &val) |
void | assign (const int p, const int n, const int val) |
void | assign (const int p, const int n, const char *str) |
void | assign (const int p, const int n, const BitArray< N > &val) |
void | assign (const int p, const int n, const int val) |
BitArray (const unsigned i) | |
BitArray (const char *str, const int p, const int n) | |
BitArray (const char *str) | |
BitArray (const BitArray< N > &br) | |
BitArray () | |
BitArray (const unsigned i) | |
BitArray (const char *str, const int p, const int n) | |
BitArray (const char *str) | |
BitArray (const BitArray< N > &br) | |
BitArray () | |
BitArray< 8 > | byte (const int i) const |
BitArray< 8 > | byte (const int i) const |
void | cleanUnused () |
void | cleanUnused () |
int | count () const |
int | count () const |
unsigned & | dataWord (const int i) |
unsigned | dataWord (const int i) const |
unsigned & | dataWord (const int i) |
unsigned | dataWord (const int i) const |
int | element (const int pos) const |
int | element (const int pos) const |
BitArray< N > & | flip () |
BitArray< N > & | flip () |
unsigned | getWord (const int pos) const |
unsigned & | getWord (const int pos) |
unsigned | getWord (const int pos) const |
unsigned & | getWord (const int pos) |
unsigned | lastWordMask () const |
unsigned | lastWordMask () const |
int | nBits () const |
int | nBits () const |
int | none () |
int | none () |
int | nWords () const |
int | nWords () const |
void | one () |
void | one () |
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) |
bool | operator!= (const BitArray< N > &a) const |
bool | operator!= (const BitArray< N > &a) const |
BitArray< N > | operator+ (const BitArray< N > &a) |
BitArray< N > | operator+ (const BitArray< N > &a) |
BitArray< N > & | operator++ (int) |
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) |
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 |
bool | operator< (const BitArray< N > &a) const |
BitArray< N > | operator<< (const int n) |
BitArray< N > | operator<< (const int n) |
BitArray< N > & | operator<<= (const int n) |
BitArray< N > & | operator<<= (const int n) |
bool | operator<= (const BitArray< N > &a) const |
bool | operator<= (const BitArray< N > &a) const |
BitArray< N > & | operator= (const char *str) |
BitArray< N > & | operator= (const unsigned i) |
BitArray< N > & | operator= (const BitArray< N > &a) |
BitArray< N > & | operator= (const char *str) |
BitArray< N > & | operator= (const unsigned i) |
BitArray< N > & | operator= (const BitArray< N > &a) |
bool | operator== (const BitArray< N > &a) const |
bool | operator== (const BitArray< N > &a) const |
bool | operator> (const BitArray< N > &a) const |
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) |
BitArray< N > & | operator>>= (const int n) |
BitArray< N > & | operator>>= (const int n) |
int | operator[] (const int pos) const |
refToBit | operator[] (const int pos) |
int | operator[] (const int pos) const |
refToBit | operator[] (const int pos) |
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 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 |
BitArray< N > | operator~ () const |
std::ostream & | print (std::ostream &o=std::cout) const |
std::ostream & | print (std::ostream &o=std::cout) const |
unsigned | read (const int p, const int n) const |
unsigned | read (const int p, const int n) const |
void | reset (const int i) |
void | reset () |
void | reset (const int i) |
void | reset () |
void | set (const int i, const char *str) |
void | set (const int i, const int val) |
void | set (const int i) |
void | set (const int i, const char *str) |
void | set (const int i, const int val) |
void | set (const int i) |
int | size () const |
int | size () const |
int | test (const int i) const |
int | test (const int i) const |
BitArray< N > & | twoComplement () |
BitArray< N > | twoComplement () const |
BitArray< N > & | twoComplement () |
BitArray< N > | twoComplement () const |
void | unset (const int i) |
void | unset (const int i) |
int | unusedBits () const |
int | unusedBits () const |
void | zero () |
void | zero () |
Static Public Member Functions | |
static int | getPosInWord (const int pos) |
static int | getPosInWord (const int pos) |
static unsigned | getPosMask (const int pos) |
static unsigned | getPosMask (const int pos) |
Private Attributes | |
unsigned | _data [N/32+1] |
Friends | |
class | refToBit |
Classes | |
class | refToBit |
Definition at line 30 of file BitArray.h.
Definition at line 90 of file BitArray.h.
00090 { 00091 this->zero(); 00092 this->assign(0,this->nBits(),str); 00093 this->cleanUnused(); 00094 }
Definition at line 99 of file BitArray.h.
00099 { 00100 this->zero(); 00101 _data[0] = i; // the nBit least sign. bits are considered 00102 this->cleanUnused(); 00103 }
Definition at line 91 of file BitArray.h.
00091 { 00092 this->zero(); 00093 this->assign(0,this->nBits(),str); 00094 this->cleanUnused(); 00095 }
Definition at line 100 of file BitArray.h.
00100 { 00101 this->zero(); 00102 _data[0] = i; // the nBit least sign. bits are considered 00103 this->cleanUnused(); 00104 }
Definition at line 184 of file BitArray.h.
00184 { 00185 int nw = this->nWords(); 00186 int ub = unusedBits(); 00187 if(this->dataWord(nw-1)<<ub!=0)return 1; 00188 if(nw>1){ 00189 for (int iw=0;iw<nw-1;iw++){ 00190 if(this->dataWord(iw)!=0) return 1; 00191 } 00192 } 00193 return 0; 00194 }
Definition at line 183 of file BitArray.h.
Referenced by DTTSTheta::runDTTSTheta().
00183 { 00184 int nw = this->nWords(); 00185 int ub = unusedBits(); 00186 if(this->dataWord(nw-1)<<ub!=0)return 1; 00187 if(nw>1){ 00188 for (int iw=0;iw<nw-1;iw++){ 00189 if(this->dataWord(iw)!=0) return 1; 00190 } 00191 } 00192 return 0; 00193 }
Definition at line 261 of file BitArray.h.
00261 { 00262 assert(p>=0 && p+n<=this->nBits()); 00263 // only the n least significant bits of val are considered 00264 for(int i=0; i<n;i++){ 00265 assert(str[i]=='1'||str[i]=='0'); 00266 if(str[i]=='1') { 00267 this->set(p+n-i-1); // reading a string from left to right 00268 } else { // --> most significative bit is the one 00269 this->unset(p+n-i-1); // with lower string index 00270 } 00271 } 00272 }
Definition at line 260 of file BitArray.h.
00260 { 00261 assert(p>=0 && p+n<=this->nBits()); 00262 // only the n least significant bits of val are considered 00263 for(int i=0; i<n;i++){ 00264 assert(str[i]=='1'||str[i]=='0'); 00265 if(str[i]=='1') { 00266 this->set(p+n-i-1); // reading a string from left to right 00267 } else { // --> most significative bit is the one 00268 this->unset(p+n-i-1); // with lower string index 00269 } 00270 } 00271 }
Definition at line 238 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().
00238 { 00239 assert(p>=0 && p+n<=this->nBits()); 00240 // only the n least significant bits of val are considered 00241 for(int i=0; i<n;i++){ 00242 if(val>>i&1) { 00243 this->set(p+i); 00244 } else { 00245 this->unset(p+i); 00246 } 00247 } 00248 }
Definition at line 287 of file BitArray.h.
00287 { 00288 BitArray<8> out; 00289 if(i>=0&&i<4*this->nWords()){ 00290 unsigned k=(_data[i/4]>>8*(i%4))&0xff; 00291 out=k; 00292 } 00293 return out; 00294 }
Definition at line 286 of file BitArray.h.
Referenced by DTTSTheta::runDTTSTheta().
00286 { 00287 BitArray<8> out; 00288 if(i>=0&&i<4*this->nWords()){ 00289 unsigned k=(_data[i/4]>>8*(i%4))&0xff; 00290 out=k; 00291 } 00292 return out; 00293 }
Definition at line 170 of file BitArray.h.
00170 { 00171 _data[this->nWords()-1] &= (this->lastWordMask()); 00172 }
Definition at line 169 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), and BitArray< 9 >::operator=().
00169 { 00170 _data[this->nWords()-1] &= (this->lastWordMask()); 00171 }
Definition at line 127 of file BitArray.h.
Referenced by DTTSCand::dataword(), DTSectCollPhCand::dataword(), BitArray< 9 >::operator &=(), BitArray< 9 >::operator<(), BitArray< 9 >::operator==(), BitArray< 9 >::operator^=(), and BitArray< 9 >::operator|=().
Definition at line 210 of file BitArray.h.
00210 { 00211 return (getWord(pos)&getPosMask(pos))!=static_cast<unsigned>(0); 00212 }
Definition at line 209 of file BitArray.h.
Referenced by DTTracoChip::add_btiT(), DTTracoChip::AdjBtiLTSuppressed(), BitArray< 9 >::assign(), DTTSPhi::ignoreSecondTrack(), DTTracoChip::insideAngWindow(), DTSectCollPhCand::isFirst(), DTTSCand::isFirst(), DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), 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().
00209 { 00210 return (getWord(pos)&getPosMask(pos))!=static_cast<unsigned>(0); 00211 }
Definition at line 147 of file BitArray.h.
Referenced by BitArray< 9 >::getPosMask(), and BitArray< N >::refToBit::refToBit().
Definition at line 154 of file BitArray.h.
00154 { 00155 return static_cast<unsigned>(1)<<getPosInWord(pos); 00156 }
Definition at line 153 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().
00153 { 00154 return static_cast<unsigned>(1)<<getPosInWord(pos); 00155 }
Definition at line 137 of file BitArray.h.
Referenced by BitArray< 9 >::element(), BitArray< N >::refToBit::refToBit(), BitArray< 9 >::set(), and BitArray< 9 >::unset().
unsigned BitArray< N >::lastWordMask | ( | ) | const [inline] |
unsigned BitArray< N >::lastWordMask | ( | ) | const [inline] |
Definition at line 120 of file BitArray.h.
Referenced by BitArray< 9 >::assign(), BitArray< 9 >::count(), BitArray< 9 >::getWord(), BitArray< 9 >::operator++(), BitArray< 9 >::operator+=(), BitArray< 9 >::operator<<=(), BitArray< 9 >::operator=(), BitArray< 9 >::operator>>=(), BitArray< 9 >::read(), BitArray< 9 >::size(), and BitArray< 9 >::unusedBits().
00120 { return N; }
Definition at line 197 of file BitArray.h.
00197 { 00198 int nw = this->nWords(); 00199 int ub = unusedBits(); 00200 if(this->dataWord(nw-1)<<ub!=0xffffffff)return 1; 00201 if(nw>1){ 00202 for (int iw=0;iw<nw-1;iw++){ 00203 if(this->dataWord(iw)!=0xffffffff) return 1; 00204 } 00205 } 00206 return 0; 00207 }
Definition at line 196 of file BitArray.h.
00196 { 00197 int nw = this->nWords(); 00198 int ub = unusedBits(); 00199 if(this->dataWord(nw-1)<<ub!=0xffffffff)return 1; 00200 if(nw>1){ 00201 for (int iw=0;iw<nw-1;iw++){ 00202 if(this->dataWord(iw)!=0xffffffff) return 1; 00203 } 00204 } 00205 return 0; 00206 }
Definition at line 124 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().
00124 { return N/32+1; }
Definition at line 222 of file BitArray.h.
Referenced by DTSectCollPhCand::clear(), DTTSCand::clear(), DTSectCollPhCand::DTSectCollPhCand(), DTTSCand::DTTSCand(), and DTConfigTSPhi::setDefaults().
00222 { 00223 for (int i=0;i<this->nWords();i++) { 00224 _data[i] = 0xffffffff; // set to 1 00225 } 00226 }
Definition at line 371 of file BitArray.h.
00371 { 00372 int nw = this->nWords(); 00373 int ub = this->unusedBits(); 00374 unsigned aaa = this->dataWord(nw-1)<<ub; // ignore unused bits 00375 unsigned bbb = a.dataWord(nw-1)<<ub; // in both operands 00376 if (aaa<bbb) { 00377 return 1; 00378 } else if (aaa>bbb) { 00379 return 0; 00380 } 00381 if(nw>1){ 00382 for (int iw=nw-2;iw>=0;iw--){ 00383 if (this->dataWord(iw)<a.dataWord(iw)) { 00384 return 1; 00385 } else if (this->dataWord(iw)>a.dataWord(iw)) { 00386 return 0; 00387 } 00388 } 00389 } 00390 return 0; 00391 }
Definition at line 370 of file BitArray.h.
00370 { 00371 int nw = this->nWords(); 00372 int ub = this->unusedBits(); 00373 unsigned aaa = this->dataWord(nw-1)<<ub; // ignore unused bits 00374 unsigned bbb = a.dataWord(nw-1)<<ub; // in both operands 00375 if (aaa<bbb) { 00376 return 1; 00377 } else if (aaa>bbb) { 00378 return 0; 00379 } 00380 if(nw>1){ 00381 for (int iw=nw-2;iw>=0;iw--){ 00382 if (this->dataWord(iw)<a.dataWord(iw)) { 00383 return 1; 00384 } else if (this->dataWord(iw)>a.dataWord(iw)) { 00385 return 0; 00386 } 00387 } 00388 } 00389 return 0; 00390 }
Definition at line 328 of file BitArray.h.
00328 { 00329 this->zero(); 00330 for(int i=0; i<this->nBits();i++){ 00331 assert(str[i]=='1'||str[i]=='0'); 00332 if(str[i]=='1') { 00333 this->set(this->nBits()-i-1); // reading a string from left to right 00334 } else if(str[i]=='0') { // --> most significative bit is the one 00335 this->unset(this->nBits()-i-1); // with lower string index 00336 } else { 00337 break; // exit when find a char which is not 0 or 1 00338 } 00339 } 00340 this->cleanUnused(); 00341 return *this; 00342 }
Definition at line 307 of file BitArray.h.
00307 { 00308 this->zero(); 00309 _data[0] = i; // the nBit least sign. bits are considered 00310 this->cleanUnused(); 00311 return *this; 00312 }
Definition at line 327 of file BitArray.h.
00327 { 00328 this->zero(); 00329 for(int i=0; i<this->nBits();i++){ 00330 assert(str[i]=='1'||str[i]=='0'); 00331 if(str[i]=='1') { 00332 this->set(this->nBits()-i-1); // reading a string from left to right 00333 } else if(str[i]=='0') { // --> most significative bit is the one 00334 this->unset(this->nBits()-i-1); // with lower string index 00335 } else { 00336 break; // exit when find a char which is not 0 or 1 00337 } 00338 } 00339 this->cleanUnused(); 00340 return *this; 00341 }
Definition at line 306 of file BitArray.h.
00306 { 00307 this->zero(); 00308 _data[0] = i; // the nBit least sign. bits are considered 00309 this->cleanUnused(); 00310 return *this; 00311 }
Definition at line 357 of file BitArray.h.
00357 { 00358 int nw = this->nWords(); 00359 int ub = this->unusedBits(); 00360 if(this->dataWord(nw-1)<<ub!= // check last word 00361 a.dataWord(nw-1)<<ub)return 0; 00362 if(nw>1){ 00363 for (int iw=0;iw<nw-1;iw++){ 00364 if(this->dataWord(iw)!=a.dataWord(iw)) return 0; 00365 } 00366 } 00367 return 1; 00368 }
Definition at line 356 of file BitArray.h.
00356 { 00357 int nw = this->nWords(); 00358 int ub = this->unusedBits(); 00359 if(this->dataWord(nw-1)<<ub!= // check last word 00360 a.dataWord(nw-1)<<ub)return 0; 00361 if(nw>1){ 00362 for (int iw=0;iw<nw-1;iw++){ 00363 if(this->dataWord(iw)!=a.dataWord(iw)) return 0; 00364 } 00365 } 00366 return 1; 00367 }
std::ostream& BitArray< N >::print | ( | std::ostream & | o = std::cout |
) | const [inline] |
std::ostream& BitArray< N >::print | ( | std::ostream & | o = std::cout |
) | const [inline] |
Definition at line 344 of file BitArray.h.
Referenced by DTBtiChip::keepTrig(), DTBtiChip::keepTrigPatt(), DTTSCand::print(), DTConfigTSPhi::print(), and DTSectCollPhCand::print().
00344 { 00345 for(int i = this->nBits()-1; i>=0; i--){ 00346 o << this->element(i); 00347 } 00348 return o; 00349 }
Definition at line 275 of file BitArray.h.
00275 { 00276 assert(p>=0 && p+n<=this->nBits()); 00277 assert(n<=32); // the output must fit in a 32 bit word 00278 // only the n least significant bits of val are considered 00279 unsigned out=0x0; 00280 for(int i=0; i<n;i++){ 00281 if(this->test(p+i)) out |= 1<<i; 00282 } 00283 return out; 00284 }
Definition at line 274 of file BitArray.h.
Referenced by DTTracoChip::insideAngWindow().
00274 { 00275 assert(p>=0 && p+n<=this->nBits()); 00276 assert(n<=32); // the output must fit in a 32 bit word 00277 // only the n least significant bits of val are considered 00278 unsigned out=0x0; 00279 for(int i=0; i<n;i++){ 00280 if(this->test(p+i)) out |= 1<<i; 00281 } 00282 return out; 00283 }
Definition at line 220 of file BitArray.h.
Referenced by DTBtiChip::keepTrigPatt().
00220 { zero(); }
Definition at line 229 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(), DTTSCand::setSecondTrack(), and DTSectCollPhCand::setSecondTrack().
00229 { getWord(i) |= getPosMask(i); }
Definition at line 499 of file BitArray.h.
Referenced by DTTracoChip::insideAngWindow(), and BitArray< 9 >::operator-=().
00499 { return BitArray<N> (~*this)++; }
Definition at line 230 of file BitArray.h.
Referenced by BitArray< 9 >::assign(), DTSectCollPhCand::DTSectCollPhCand(), DTTSCand::DTTSCand(), BitArray< 9 >::operator++(), BitArray< 9 >::operator=(), BitArray< 9 >::reset(), DTTSCand::setBitsBkmod(), DTSectCollPhCand::setBitsSectColl(), DTTSCand::setBitsTsm(), DTTSCand::setBitsTss(), and DTConfigTSPhi::setDefaults().
00230 { getWord(i) &= ~getPosMask(i); }
Definition at line 159 of file BitArray.h.
00159 { 00160 if(this->nBits()==0)return 32; 00161 return 31-((this->nBits()-1)%32); 00162 }
Definition at line 158 of file BitArray.h.
Referenced by BitArray< 9 >::any(), BitArray< 9 >::none(), BitArray< 9 >::operator<(), and BitArray< 9 >::operator==().
00158 { 00159 if(this->nBits()==0)return 32; 00160 return 31-((this->nBits()-1)%32); 00161 }
Definition at line 215 of file BitArray.h.
Referenced by BitArray< 9 >::BitArray(), DTTracoChip::clear(), DTTracoChip::DTTracoChip(), DTTSTheta::DTTSTheta(), DTTSTheta::localClear(), BitArray< 9 >::operator=(), and BitArray< 9 >::reset().
00215 { 00216 for (int i=0;i<this->nWords();i++) { 00217 _data[i] = 0x0; // set to 0 00218 } 00219 }
refToBit [friend] |
Definition at line 518 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().