Convenient helper class for setting single bits in a 32bit-field, such as collection flags or hit types - extends std::bitset<32>. More...
#include <UTIL/BitSet32.h>
Public Member Functions | |
BitSet32 (int val) | |
Allow to construct this from an int. | |
BitSet32 & | operator= (int val) |
Allow assignment from an int. | |
operator int () | |
Direct conversion to int. | |
Convenient helper class for setting single bits in a 32bit-field, such as collection flags or hit types - extends std::bitset<32>.
Use convenient methods make_bitset32(...) to create a bit set with some bits set.
Examples:
// set collection flags : LCCollectionVec* calVec = new LCCollectionVec( LCIO::SIMCALORIMETERHIT ) ; calVec->setFlag( UTIL::make_bitset32( LCIO::CHBIT_LONG, LCIO::CHBIT_STEP ) );
// check TrackerHit type: BitSet32 type( hit->getType() ) ; bool isComposite = type.test( ILDTrkHitTypeBit::COMPOSITE_SPACEPOINT ) ; // test w/ range check // or shorter: if( BitSet32( hit->getType() )[ ILDTrkHitTypeBit::COMPOSITE_SPACEPOINT ] ) {...}