ATLAS Offline Software
Loading...
Searching...
No Matches
LArBadChannelDBTools Namespace Reference

Typedefs

typedef std::pair< HWIdentifier, LArBadChannelBadChanEntry
typedef std::pair< HWIdentifier, LArBadFebBadFebEntry
typedef std::vector< BadChanEntryBadChanVec
typedef std::vector< BadFebEntryBadFebVec
typedef HWIdentifier32::value_type Channel

Functions

MsgStream getDefaultMsgStream ()
 used to get default msg stream
coral::AttributeListSpecification * createCoolSpec ()
 creates the AttributeListSpecification for the LArBadChannel DB
template<class Entry>
AthenaAttributeListcreatePayload (const std::vector< Entry > &data, const coral::AttributeListSpecification &spec)
CondAttrListCollectioncreateCoolCollection (const LArBadChannelState &bcState)
AthenaAttributeListcreateChanPayload (const BadChanVec &data, const coral::AttributeListSpecification &spec)
AthenaAttributeListcreateFebPayload (const BadFebVec &data)
AthenaAttributeListcreateFebPayloadV1 (const std::vector< HWIdentifier32 > &data)
CondAttrListCollectioncreateEmptyCoolCollection ()
 Create an empty collection with no bad channels, e.g. for MC.
unsigned int badChanVersion ()
 Version of the BLOB encoding, to be incremented each time the BLOB format changes.
unsigned int badFebVersion ()
void fillControlInfo (AthenaAttributeList *attrList, unsigned int wordSize, unsigned int vers)
template<class T>
AthenaAttributeListcreatePayload (const std::vector< std::pair< HWIdentifier, T > > &data, const coral::AttributeListSpecification &spec, unsigned int vers)
std::vector< BadChanEntryreadBadChan (const coral::AttributeList &attrList, MsgStream &log)
std::vector< BadFebEntryreadBadFeb (const coral::AttributeList &attrList, MsgStream &log)
AthenaAttributeListcreateFebPayloadV1 (const std::vector< HWIdentifier > &data)

Typedef Documentation

◆ BadChanEntry

◆ BadChanVec

Definition at line 30 of file LArBadChannelDBTools.h.

◆ BadFebEntry

Definition at line 29 of file LArBadChannelDBTools.h.

◆ BadFebVec

Definition at line 31 of file LArBadChannelDBTools.h.

◆ Channel

Function Documentation

◆ badChanVersion()

unsigned int LArBadChannelDBTools::badChanVersion ( )
inline

Version of the BLOB encoding, to be incremented each time the BLOB format changes.

Definition at line 57 of file LArBadChannelDBTools.h.

57{return 1;}

◆ badFebVersion()

unsigned int LArBadChannelDBTools::badFebVersion ( )
inline

Definition at line 58 of file LArBadChannelDBTools.h.

58{return 2;}

◆ createChanPayload()

AthenaAttributeList * LArBadChannelDBTools::createChanPayload ( const BadChanVec & data,
const coral::AttributeListSpecification & spec )

Definition at line 59 of file LArBadChannelDBTools.cxx.

61 {
62 return createPayload( data, spec, badChanVersion());
63 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
unsigned int badChanVersion()
Version of the BLOB encoding, to be incremented each time the BLOB format changes.
AthenaAttributeList * createPayload(const std::vector< Entry > &data, const coral::AttributeListSpecification &spec)

◆ createCoolCollection()

CondAttrListCollection * LArBadChannelDBTools::createCoolCollection ( const LArBadChannelState & bcState)

Definition at line 82 of file LArBadChannelDBTools.cxx.

83 {
84 CondAttrListCollection* attrListColl = new CondAttrListCollection(true);
85
86 coral::AttributeListSpecification* spec = createCoolSpec();
87
88 for (int i=0; i<LArBadChannelState::NCoolChannels; i++) {
91 if (!bcState.coolChannel( cc).empty()) {
92 AthenaAttributeList* ilist =
93 createChanPayload( bcState.coolChannel( cc).stateVector(), *spec);
95 attrListColl->add(chanNum, *ilist);
96 }
97 }
98
99 return attrListColl;
100 }
An AttributeList represents a logical row of attributes in a metadata table.
This class is a collection of AttributeLists where each one is associated with a channel number.
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
const BadChanVec & stateVector() const
const CoolChannelData & coolChannel(CoolChannelEnum chan) const
coral::AttributeListSpecification * createCoolSpec()
creates the AttributeListSpecification for the LArBadChannel DB
AthenaAttributeList * createChanPayload(const BadChanVec &data, const coral::AttributeListSpecification &spec)

◆ createCoolSpec()

coral::AttributeListSpecification * LArBadChannelDBTools::createCoolSpec ( )

creates the AttributeListSpecification for the LArBadChannel DB

Definition at line 35 of file LArBadChannelDBTools.cxx.

36 {
37 coral::AttributeListSpecification* spec = new coral::AttributeListSpecification();
38 if (spec == nullptr) {
39 return spec;
40 }
41 spec->extend("ChannelSize", "unsigned int");
42 spec->extend("StatusWordSize", "unsigned int");
43 spec->extend("Endianness", "unsigned int");
44 spec->extend("Version", "unsigned int");
45 spec->extend("Blob", "blob");
46
47 return spec;
48 }

◆ createEmptyCoolCollection()

CondAttrListCollection * LArBadChannelDBTools::createEmptyCoolCollection ( )

Create an empty collection with no bad channels, e.g. for MC.

Definition at line 102 of file LArBadChannelDBTools.cxx.

103 {
104 CondAttrListCollection* attrListColl = new CondAttrListCollection(true);
105
106 coral::AttributeListSpecification* spec = createCoolSpec();
107 for (int i=0; i<2; i++) {
111 AthenaAttributeList* ilist = createChanPayload( emptyChan.stateVector(), *spec);
113 attrListColl->add(chanNum, *ilist);
114 }
115 return attrListColl;
116 }

◆ createFebPayload()

AthenaAttributeList * LArBadChannelDBTools::createFebPayload ( const BadFebVec & data)

Definition at line 65 of file LArBadChannelDBTools.cxx.

66 {
67 coral::AttributeListSpecification* spec = createCoolSpec();
68 return createPayload( data, *spec, badFebVersion());
69 }

◆ createFebPayloadV1() [1/2]

AthenaAttributeList * LArBadChannelDBTools::createFebPayloadV1 ( const std::vector< HWIdentifier > & data)

Definition at line 71 of file LArBadChannelDBTools.cxx.

72 {
73 coral::AttributeListSpecification* spec = createCoolSpec();
74
75 AthenaAttributeList* attrList = new AthenaAttributeList(*spec);
76 fillControlInfo(attrList, 0, 1);
77 coral::Blob& blob=(*attrList)["Blob"].data<coral::Blob>();
78 fillFebBlobV1( data, blob);
79 return attrList;
80 }
void fillFebBlobV1(const std::vector< HWIdentifier > &vec, coral::Blob &blob)
void fillControlInfo(AthenaAttributeList *attrList, unsigned int wordSize, unsigned int vers)

◆ createFebPayloadV1() [2/2]

AthenaAttributeList * LArBadChannelDBTools::createFebPayloadV1 ( const std::vector< HWIdentifier32 > & data)

◆ createPayload() [1/2]

template<class Entry>
AthenaAttributeList * LArBadChannelDBTools::createPayload ( const std::vector< Entry > & data,
const coral::AttributeListSpecification & spec )

◆ createPayload() [2/2]

template<class T>
AthenaAttributeList * LArBadChannelDBTools::createPayload ( const std::vector< std::pair< HWIdentifier, T > > & data,
const coral::AttributeListSpecification & spec,
unsigned int vers )

Definition at line 63 of file LArBadChannelDBTools.h.

66 {
67 AthenaAttributeList* attrList = new AthenaAttributeList(spec);
68 fillControlInfo(attrList, sizeof( typename T::BitWord), vers);
69 coral::Blob& blob=(*attrList)["Blob"].data<coral::Blob>();
71 return attrList;
72 }
void fillBlob(const std::vector< std::pair< HWIdentifier, T > > &vec, coral::Blob &blob)
Creates a BLOB of the right size and copies the content of the vector of pair<HWIdentifier,...

◆ fillControlInfo()

void LArBadChannelDBTools::fillControlInfo ( AthenaAttributeList * attrList,
unsigned int wordSize,
unsigned int vers )

Definition at line 50 of file LArBadChannelDBTools.cxx.

51 {
52 (*attrList)["ChannelSize"].setValue( (unsigned int) sizeof(Channel));
53 (*attrList)["StatusWordSize"].setValue( wordSize);
54 (*attrList)["Endianness"].setValue( (unsigned int) machineEndianness());
55 (*attrList)["Version"].setValue( vers);
56 }
Identifier32::value_type Channel

◆ getDefaultMsgStream()

MsgStream LArBadChannelDBTools::getDefaultMsgStream ( )

used to get default msg stream

Definition at line 28 of file LArBadChannelDBTools.cxx.

29 {
30 MsgStream log(Athena::getMessageSvc());
31 return log;
32 }
IMessageSvc * getMessageSvc(bool quiet=false)

◆ readBadChan()

std::vector< BadChanEntry > LArBadChannelDBTools::readBadChan ( const coral::AttributeList & attrList,
MsgStream & log )

Definition at line 119 of file LArBadChannelDBTools.cxx.

120 {
121 const coral::Blob& blob = attrList["Blob"].data<coral::Blob>();
122 unsigned int chanSize = attrList["ChannelSize"].data<unsigned int>();
123 unsigned int stateSize = attrList["StatusWordSize"].data<unsigned int>();
124 unsigned int endian = attrList["Endianness"].data<unsigned int>();
125 unsigned int version = attrList["Version"].data<unsigned int>();
126
127 return
128 LArBadChanBlobUtils::decodeBlob<LArBadChannel>( &blob, chanSize, stateSize, endian,
129 version, log);
130 }
std::vector< std::pair< HWIdentifier, T > > decodeBlob(const coral::Blob *blobp, std::size_t chanSize, std::size_t stateSize, int endian, int version, MsgStream &log)
Checks BLOB for differences in endian-ness and size of data types with respect to the architecture on...

◆ readBadFeb()

std::vector< BadFebEntry > LArBadChannelDBTools::readBadFeb ( const coral::AttributeList & attrList,
MsgStream & log )

Definition at line 133 of file LArBadChannelDBTools.cxx.

134 {
135 const coral::Blob& blob = attrList["Blob"].data<coral::Blob>();
136 unsigned int chanSize = attrList["ChannelSize"].data<unsigned int>();
137 unsigned int stateSize = attrList["StatusWordSize"].data<unsigned int>();
138 unsigned int endian = attrList["Endianness"].data<unsigned int>();
139 unsigned int version = attrList["Version"].data<unsigned int>();
140
141 if (version == 1) {
142 // Version 1 nas only HWIdentifier and no LArBadFeb, so we have to add a
143 // LArBadFeb with status "deadAll" by hand
144 std::vector<HWIdentifier> idvec =
145 LArBadChanBlobUtils::decodeFebBlobV1( &blob, chanSize, endian, version, log);
146 std::vector<BadFebEntry> result;
147 result.resize(idvec.size());
148 LArBadFeb missingState;
149 LArBadFebBitPacking febPacking;
150 febPacking.setBit( LArBadFeb::deadAllBit, missingState);
151 for (unsigned int i=0; i<idvec.size(); ++i) {
152 result[i] = BadFebEntry( idvec[i], missingState);
153 }
154 return result;
155 }
156 else {
157 return LArBadChanBlobUtils::decodeBlob<LArBadFeb>( &blob, chanSize, stateSize,
158 endian, version, log);
159 }
160 }
void setBit(ProblemType pb, BitWord &word, bool value=true) const
std::pair< HWIdentifier, LArBadFeb > BadFebEntry
std::vector< HWIdentifier > decodeFebBlobV1(const coral::Blob *blobp, std::size_t chanSize, int endian, int version, MsgStream &log)