2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
7 void TLArBadChanBitPackingBase<T>::addBit( typename T::ProblemType pb, const std::string& name,
8 GainDependence gaindep)
10 m_enumVec.push_back( std::make_pair( pb, gaindep));
11 m_nameVec.push_back(name);
16 const std::string& TLArBadChanBitPackingBase<T>::stringName( typename T::ProblemType pb) const
18 return m_nameVec.at(index(pb));
22 std::pair<bool, typename T::ProblemType>
23 TLArBadChanBitPackingBase<T>::enumName( const std::string& str) const
25 typename std::map<std::string, typename T::ProblemType>::const_iterator i = m_nameMap.find( str);
26 if (i != m_nameMap.end()) { return std::make_pair(true,i->second);}
27 else return std::make_pair(false, (typename T::ProblemType) 0);
32 void TLArBadChanBitPackingBase<T>::setBit( typename T::ProblemType pb, LArBadChannel::BitWord& word, bool value) const {
33 LArBadChannel::BitWord mask = 1;
34 mask = mask << m_bitPos[static_cast<LArBadChannel::PosType>(pb)]; // all at 0 except pb bit
35 if (value) word |= mask;
40 bool TLArBadChanBitPackingBase<T>::setBit( const std::string& name,
41 LArBadChannel::BitWord& word, bool value) const
43 std::pair<bool, typename T::ProblemType> res = enumName( name);
44 if (res.first) { // name corresponds to enum
45 setBit( res.second, word, value);
48 else return false; // name not recognized
52 void TLArBadChanBitPackingBase<T>::setBit( typename T::ProblemType pb, LArBadChannel& word, bool value) const
54 setBit( pb, word.packedDataRef(), value);
58 bool TLArBadChanBitPackingBase<T>::setBit( const std::string& name, LArBadChannel& word, bool value) const
60 return setBit( name, word.packedDataRef(), value);
64 std::string TLArBadChanBitPackingBase<T>::stringStatus( const LArBadChannel& bc) const
67 for (unsigned int i=0; i<m_enumVec.size(); ++i) {
68 if ( ! bc.statusOK( m_enumVec.at(i).first )) {
69 if (!res.empty()) res += " ";
70 res += m_nameVec.at(i);
77 void TLArBadChanBitPackingBase<T>::initMasks()
79 for( typename std::vector< std::pair<typename T::ProblemType, GainDependence> >::const_iterator iter = m_enumVec.begin();
80 iter != m_enumVec.end(); ++iter) //loop over all problems
82 // set the appropriate bits in each mask according to the GainDependence of the T::ProblemType
83 if(iter->second == independent)
85 setBit(iter->first, m_highGainMask);
86 setBit(iter->first, m_mediumGainMask);
87 setBit(iter->first, m_lowGainMask);
89 else if(iter->second == high)
90 setBit(iter->first, m_highGainMask);
91 else if(iter->second == medium)
92 setBit(iter->first, m_mediumGainMask);
93 else if(iter->second == low)
94 setBit(iter->first, m_lowGainMask);