ATLAS Offline Software
LArBadChanBitPackingBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LArBadChanBitPackingBase_H
6 #define LArBadChanBitPackingBase_H
7 
9 #include <string>
10 #include <vector>
11 #include <map>
12 
13 template <class T>
15  public:
16 
17  typedef std::vector<LArBadChannel::PosType> PosContainer;
18 
20  m_index( 8*sizeof(LArBadChannel::BitWord),-1),
21  m_highGainMask(0),
23  m_lowGainMask(0) {};
24 
25  const std::string& stringName( typename T::ProblemType pb) const;
26 
27  std::pair<bool, typename T::ProblemType> enumName( const std::string& str) const;
28 
29  LArBadChannel::PosType bitPosition( typename T::ProblemType pb) const {return m_bitPos[static_cast<LArBadChannel::PosType>(pb)];}
30 
32 
33  void setBit( typename T::ProblemType pb, LArBadChannel::BitWord& word, bool value=true) const;
34  void setBit( typename T::ProblemType pb, LArBadChannel& word, bool value=true) const;
35 
36  bool setBit( const std::string& name, LArBadChannel::BitWord& word, bool value=true) const;
37  bool setBit( const std::string& name, LArBadChannel& word, bool value=true) const;
38 
39  std::string stringStatus( const LArBadChannel& bc) const;
40 
41  // These LArBadChannel::BitWord masks are used to do gain-dependent masking in LArBadChannelMasker.
45 
46  int numberOfProblemTypes() const { return m_nameVec.size();}
47 
48  protected:
49 
50  // This is used to describe the dependence of each T::ProblemType on LAr gain.
52 
54  std::vector<int> m_index;
55  std::vector< std::pair<typename T::ProblemType, GainDependence> > m_enumVec;
56 
57  std::vector<std::string> m_nameVec;
58  std::map<std::string, typename T::ProblemType> m_nameMap;
59 
60  // These are non-static so that different TLArBadChanBitPackingBase versions can be used simultaneously.
64 
65  void addBit( typename T::ProblemType pb, const std::string& name, GainDependence gaindep);
66  int index( typename T::ProblemType pb) const {return m_index[pb];}
67  void initMasks();
68 };
69 
71 
72 
73 #endif
74 
TLArBadChanBitPackingBase::bitPosition
LArBadChannel::PosType bitPosition(typename T::ProblemType pb) const
Definition: LArBadChanBitPackingBase.h:29
TLArBadChanBitPackingBase::wordSize
LArBadChannel::PosType wordSize() const
Definition: LArBadChanBitPackingBase.h:31
LArBadChanBitPackingBase.icc
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
TLArBadChanBitPackingBase::TLArBadChanBitPackingBase
TLArBadChanBitPackingBase()
Definition: LArBadChanBitPackingBase.h:19
TLArBadChanBitPackingBase::high
@ high
Definition: LArBadChanBitPackingBase.h:51
LArBadChannel.h
TLArBadChanBitPackingBase::independent
@ independent
Definition: LArBadChanBitPackingBase.h:51
TLArBadChanBitPackingBase::setBit
bool setBit(const std::string &name, LArBadChannel::BitWord &word, bool value=true) const
TLArBadChanBitPackingBase::lowGainMask
LArBadChannel::BitWord lowGainMask() const
Definition: LArBadChanBitPackingBase.h:44
TLArBadChanBitPackingBase
Definition: LArBadChanBitPackingBase.h:14
TLArBadChanBitPackingBase::addBit
void addBit(typename T::ProblemType pb, const std::string &name, GainDependence gaindep)
LArBadChannel::PosType
unsigned int PosType
Definition: LArBadChannel.h:12
athena.value
value
Definition: athena.py:124
TLArBadChanBitPackingBase::mediumGainMask
LArBadChannel::BitWord mediumGainMask() const
Definition: LArBadChanBitPackingBase.h:43
TLArBadChanBitPackingBase::m_mediumGainMask
LArBadChannel::BitWord m_mediumGainMask
Definition: LArBadChanBitPackingBase.h:62
TLArBadChanBitPackingBase::m_highGainMask
LArBadChannel::BitWord m_highGainMask
Definition: LArBadChanBitPackingBase.h:61
TLArBadChanBitPackingBase::m_bitPos
PosContainer m_bitPos
Definition: LArBadChanBitPackingBase.h:53
LArBadChannel::BitWord
unsigned int BitWord
Definition: LArBadChannel.h:13
TLArBadChanBitPackingBase::enumName
std::pair< bool, typename T::ProblemType > enumName(const std::string &str) const
TLArBadChanBitPackingBase::numberOfProblemTypes
int numberOfProblemTypes() const
Definition: LArBadChanBitPackingBase.h:46
LArBadChannel
Definition: LArBadChannel.h:10
TLArBadChanBitPackingBase::highGainMask
LArBadChannel::BitWord highGainMask() const
Definition: LArBadChanBitPackingBase.h:42
TLArBadChanBitPackingBase::initMasks
void initMasks()
TLArBadChanBitPackingBase::m_enumVec
std::vector< std::pair< typename T::ProblemType, GainDependence > > m_enumVec
Definition: LArBadChanBitPackingBase.h:55
TLArBadChanBitPackingBase::m_nameVec
std::vector< std::string > m_nameVec
Definition: LArBadChanBitPackingBase.h:57
TLArBadChanBitPackingBase::stringName
const std::string & stringName(typename T::ProblemType pb) const
TLArBadChanBitPackingBase::m_index
std::vector< int > m_index
Definition: LArBadChanBitPackingBase.h:54
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TLArBadChanBitPackingBase::index
int index(typename T::ProblemType pb) const
Definition: LArBadChanBitPackingBase.h:66
TLArBadChanBitPackingBase::medium
@ medium
Definition: LArBadChanBitPackingBase.h:51
TLArBadChanBitPackingBase::setBit
bool setBit(const std::string &name, LArBadChannel &word, bool value=true) const
TLArBadChanBitPackingBase::stringStatus
std::string stringStatus(const LArBadChannel &bc) const
TLArBadChanBitPackingBase::m_nameMap
std::map< std::string, typename T::ProblemType > m_nameMap
Definition: LArBadChanBitPackingBase.h:58
TLArBadChanBitPackingBase::m_lowGainMask
LArBadChannel::BitWord m_lowGainMask
Definition: LArBadChanBitPackingBase.h:63
TLArBadChanBitPackingBase::PosContainer
std::vector< LArBadChannel::PosType > PosContainer
Definition: LArBadChanBitPackingBase.h:17
TLArBadChanBitPackingBase::GainDependence
GainDependence
Definition: LArBadChanBitPackingBase.h:51
str
Definition: BTagTrackIpAccessor.cxx:11
TLArBadChanBitPackingBase::setBit
void setBit(typename T::ProblemType pb, LArBadChannel::BitWord &word, bool value=true) const
TLArBadChanBitPackingBase::setBit
void setBit(typename T::ProblemType pb, LArBadChannel &word, bool value=true) const
TLArBadChanBitPackingBase::low
@ low
Definition: LArBadChanBitPackingBase.h:51