ATLAS Offline Software
Loading...
Searching...
No Matches
LArBadFebBitPacking Class Reference

#include <LArBadFebBitPacking.h>

Inheritance diagram for LArBadFebBitPacking:
Collaboration diagram for LArBadFebBitPacking:

Public Types

typedef std::vector< PosTypePosContainer
enum  ProblemType {
  deadAllBit = 0 , deadReadoutBit = 1 , inErrorBit = 2 , deactivatedInOKSBit = 3 ,
  maskParity = 16 , maskBCID =17 , maskSampleHeader = 18 , maskEVTID = 19 ,
  maskScacStatus = 20 , maskScaOutOfRange = 21 , maskGainMismatch = 22 , maskTypeMismatch = 23 ,
  maskNumOfSamples = 24 , maskEmptyDataBlock = 25 , maskDspBlockSize = 26 , maskCheckSum = 27 ,
  maskMissingHeader = 28 , maskBadGain = 29
}
typedef unsigned int PosType
typedef unsigned int BitWord

Public Member Functions

 LArBadFebBitPacking ()
const std::string & stringName (ProblemType pb) const
std::pair< bool, ProblemTypeenumName (const std::string &str) const
PosType bitPosition (ProblemType pb) const
PosType wordSize () const
void setBit (ProblemType pb, BitWord &word, bool value=true) const
void setBit (ProblemType pb, LArBadFeb &word, bool value=true) const
bool setBit (const std::string &name, BitWord &word, bool value=true) const
bool setBit (const std::string &name, LArBadFeb &word, bool value=true) const
std::string stringStatus (const LArBadFeb &bc) const
int numberOfProblemTypes () const

Private Member Functions

void addBit (ProblemType pb, const std::string &name)
int index (ProblemType pb) const

Private Attributes

std::vector< int > m_index
std::vector< ProblemTypem_enumVec
std::vector< std::string > m_nameVec
std::map< std::string, ProblemTypem_nameMap

Detailed Description

Definition at line 16 of file LArBadFebBitPacking.h.

Member Typedef Documentation

◆ BitWord

typedef unsigned int LArBadFebEnum::BitWord
inherited

Definition at line 13 of file LArBadFebEnum.h.

◆ PosContainer

Definition at line 19 of file LArBadFebBitPacking.h.

◆ PosType

typedef unsigned int LArBadFebEnum::PosType
inherited

Definition at line 12 of file LArBadFebEnum.h.

Member Enumeration Documentation

◆ ProblemType

Enumerator
deadAllBit 
deadReadoutBit 
inErrorBit 
deactivatedInOKSBit 
maskParity 
maskBCID 
maskSampleHeader 
maskEVTID 
maskScacStatus 
maskScaOutOfRange 
maskGainMismatch 
maskTypeMismatch 
maskNumOfSamples 
maskEmptyDataBlock 
maskDspBlockSize 
maskCheckSum 
maskMissingHeader 
maskBadGain 

Definition at line 15 of file LArBadFebEnum.h.

15 {
16 deadAllBit = 0,
17 deadReadoutBit = 1,
18 inErrorBit = 2,
19 deactivatedInOKSBit = 3, //From LArFebErrorSummary.h:
20 maskParity = 16, //Parity,
21 maskBCID =17, //BCID,
22 maskSampleHeader = 18, //SampleHeader,
23 maskEVTID = 19, //EVTID,
24 maskScacStatus = 20, //ScacStatus,
25 maskScaOutOfRange = 21, //ScaOutOfRange,
26 maskGainMismatch = 22, //GainMismatch,
27 maskTypeMismatch = 23, //TypeMismatch,
28 maskNumOfSamples = 24, //NumOfSamples,
29 maskEmptyDataBlock = 25, //EmptyDataBlock,
30 maskDspBlockSize = 26, //DspBlockSize,
31 maskCheckSum = 27, //CheckSum,
32 maskMissingHeader = 28, //MissingHeader,
33 maskBadGain = 29 //BadGain,
34 //N_LArFebErrorType
35 };

Constructor & Destructor Documentation

◆ LArBadFebBitPacking()

LArBadFebBitPacking::LArBadFebBitPacking ( )

Definition at line 8 of file LArBadFebBitPacking.cxx.

8 :
9 m_index( 8*sizeof(BitWord),-1)
10{
11 // Here, specify each problem and its name
12 addBit( deadAllBit, "deadAll");
13 addBit( deadReadoutBit, "deadReadout");
14 addBit( inErrorBit, "inError");
15 addBit( deactivatedInOKSBit, "deactivatedInOKS");
16 addBit( maskParity, "maskParity");
17 addBit( maskBCID, "maskBCID");
18 addBit( maskSampleHeader, "maskSampleHeader");
19 addBit( maskEVTID, "maskEVTID");
20 addBit( maskScacStatus, "maskScacStatus");
21 addBit( maskScaOutOfRange, "maskScaOutOfRange");
22 addBit( maskGainMismatch, "maskGainMismatch");
23 addBit( maskTypeMismatch, "maskTypeMismatch");
24 addBit( maskNumOfSamples, "maskNumOfSamples");
25 addBit( maskEmptyDataBlock, "maskEmptyDataBlock");
26 addBit( maskDspBlockSize, "maskDspBlockSize");
27 addBit( maskCheckSum, "maskCheckSum");
28 addBit( maskMissingHeader, "maskMissingHeader");
29 addBit( maskBadGain, "maskBadGain");
30
31 for (unsigned int i=0; i<m_enumVec.size(); i++) {
32 m_index[m_enumVec[i]] = i;
33 }
34}
std::vector< int > m_index
std::vector< ProblemType > m_enumVec
void addBit(ProblemType pb, const std::string &name)
unsigned int BitWord

Member Function Documentation

◆ addBit()

void LArBadFebBitPacking::addBit ( ProblemType pb,
const std::string & name )
private

Definition at line 36 of file LArBadFebBitPacking.cxx.

37{
38 m_enumVec.push_back(pb);
39 m_nameVec.push_back(name);
40 m_nameMap[name] = pb;
41}
std::map< std::string, ProblemType > m_nameMap
std::vector< std::string > m_nameVec

◆ bitPosition()

PosType LArBadFebBitPacking::bitPosition ( ProblemType pb) const
inline

Definition at line 27 of file LArBadFebBitPacking.h.

27{return LArBadFeb::bitPosition(pb);}
static PosType bitPosition(ProblemType pb)
Definition LArBadFeb.h:43

◆ enumName()

std::pair< bool, LArBadFebEnum::ProblemType > LArBadFebBitPacking::enumName ( const std::string & str) const

Definition at line 50 of file LArBadFebBitPacking.cxx.

51 {
52 std::map<std::string, ProblemType>::const_iterator i = m_nameMap.find( str);
53 if (i != m_nameMap.end()) { return std::make_pair(true,i->second);}
54 else return std::make_pair(false, (ProblemType) 0);
55 }

◆ index()

int LArBadFebBitPacking::index ( ProblemType pb) const
inlineprivate

Definition at line 50 of file LArBadFebBitPacking.h.

50{return m_index[pb];}

◆ numberOfProblemTypes()

int LArBadFebBitPacking::numberOfProblemTypes ( ) const
inline

Definition at line 39 of file LArBadFebBitPacking.h.

39{ return m_nameVec.size();}

◆ setBit() [1/4]

bool LArBadFebBitPacking::setBit ( const std::string & name,
BitWord & word,
bool value = true ) const

Definition at line 65 of file LArBadFebBitPacking.cxx.

67 {
68 std::pair<bool, ProblemType> res = enumName( name);
69 if (res.first) { // name corresponds to enum
70 setBit( res.second, word, value);
71 return true;
72 }
73 else return false; // name not recognized
74 }
std::pair< std::vector< unsigned int >, bool > res
std::pair< bool, ProblemType > enumName(const std::string &str) const
void setBit(ProblemType pb, BitWord &word, bool value=true) const

◆ setBit() [2/4]

bool LArBadFebBitPacking::setBit ( const std::string & name,
LArBadFeb & word,
bool value = true ) const

Definition at line 81 of file LArBadFebBitPacking.cxx.

82 {
83 return setBit( name, word.packedDataRef(), value);
84 }
BitWord & packedDataRef()
Definition LArBadFeb.h:58

◆ setBit() [3/4]

void LArBadFebBitPacking::setBit ( ProblemType pb,
BitWord & word,
bool value = true ) const

Definition at line 58 of file LArBadFebBitPacking.cxx.

58 {
59 BitWord mask = 1;
60 mask = mask << bitPosition(pb); // all at 0 except pb bit
61 if (value) word |= mask;
62 else word &= ~mask;
63 }
PosType bitPosition(ProblemType pb) const

◆ setBit() [4/4]

void LArBadFebBitPacking::setBit ( ProblemType pb,
LArBadFeb & word,
bool value = true ) const

Definition at line 76 of file LArBadFebBitPacking.cxx.

77 {
78 setBit( pb, word.packedDataRef(), value);
79 }

◆ stringName()

const std::string & LArBadFebBitPacking::stringName ( ProblemType pb) const

Definition at line 44 of file LArBadFebBitPacking.cxx.

45 {
46 return m_nameVec.at(index(pb));
47 }
int index(ProblemType pb) const

◆ stringStatus()

std::string LArBadFebBitPacking::stringStatus ( const LArBadFeb & bc) const

Definition at line 86 of file LArBadFebBitPacking.cxx.

87 {
88 std::string res;
89 for (unsigned int i=0; i<m_enumVec.size(); ++i) {
90 if ( ! bc.statusOK( m_enumVec.at(i))) {
91 if (!res.empty()) res += " ";
92 res += m_nameVec.at(i);
93 }
94 }
95 return res;
96 }
bool statusOK(ProblemType pb) const
Returns true if there is no problem in corresponding status bit.
Definition LArBadFeb.h:24

◆ wordSize()

PosType LArBadFebBitPacking::wordSize ( ) const
inline

Definition at line 29 of file LArBadFebBitPacking.h.

29{return sizeof(BitWord);}

Member Data Documentation

◆ m_enumVec

std::vector< ProblemType> LArBadFebBitPacking::m_enumVec
private

Definition at line 45 of file LArBadFebBitPacking.h.

◆ m_index

std::vector<int> LArBadFebBitPacking::m_index
private

Definition at line 43 of file LArBadFebBitPacking.h.

◆ m_nameMap

std::map<std::string, ProblemType> LArBadFebBitPacking::m_nameMap
private

Definition at line 47 of file LArBadFebBitPacking.h.

◆ m_nameVec

std::vector<std::string> LArBadFebBitPacking::m_nameVec
private

Definition at line 46 of file LArBadFebBitPacking.h.


The documentation for this class was generated from the following files: