#include #include #include using namespace RAT::DU; #include using namespace std; ClassImp( RAT::DU::TrigBits ) map TrigBits::fsBitMap; map TrigBits::fsInverseBitMap; void TrigBits::BeginOfRun() { fsBitMap["N100Low"] = N100Low; fsBitMap["N100Med"] = N100Med; fsBitMap["N100High"] = N100High; fsBitMap["N20"] = N20; fsBitMap["N20LB"] = N20LB; fsBitMap["ESLow"] = ESLow; fsBitMap["ESHigh"] = ESHigh; fsBitMap["OWLN"] = OWLN; fsBitMap["OWLESLow"] = OWLESLow; fsBitMap["OWLESHigh"] = OWLESHigh; fsBitMap["PulseGT"] = PulseGT; fsBitMap["Prescale"] = Prescale; fsBitMap["Pedestal"] = Pedestal; fsBitMap["Pong"] = Pong; fsBitMap["Sync"] = Sync; fsBitMap["EXTASY"] = EXTASY; fsBitMap["EXT2"] = EXT2; fsBitMap["EXT3"] = EXT3; fsBitMap["EXT4"] = EXT4; fsBitMap["EXT5"] = EXT5; fsBitMap["EXT6"] = EXT6; fsBitMap["EXT7"] = EXT7; fsBitMap["EXT8PulseAsy"] = EXT8PulseAsy; fsBitMap["SPRaw"] = SPRaw; fsBitMap["NCD"] = NCD; fsBitMap["SoftGT"] = SoftGT; fsBitMap["MissTrig"] = MissTrig; for( map::iterator iter = fsBitMap.begin(); iter != fsBitMap.end(); ++iter ) fsInverseBitMap[iter->second] = iter->first; } string TrigBits::GetBitName( const size_t index ) { Log::Assert( fsInverseBitMap.count( index ) > 0, "TrigBits::GetBitName: Index '" + ::to_string( index ) + "' is invalid." ); return fsInverseBitMap.at( index ); } size_t TrigBits::GetBitIndex( const std::string& name ) { Log::Assert( fsBitMap.count( name ) > 0, "TrigBits::GetBitIndex: Name '" + name + "' is invalid." ); return fsBitMap.at( name ); } unsigned int TrigBits::GetMask( const std::string& names ) { const vector bitNames = split( names, "," ); unsigned int mask = 0; for( size_t iBit = 0; iBit < bitNames.size(); iBit++ ) mask |= ( 1 << GetBitIndex( bitNames[iBit] ) ); return mask; } void TrigBits::DumpNames() { info << "TrigBits::Dump: Bit index and name" << newline; for( map::iterator iTer = fsInverseBitMap.begin(); iTer != fsInverseBitMap.end(); ++iTer ) info << dformat("%3d : %s", iTer->first, iTer->second.c_str() ) << newline; }