ATLAS Offline Software
LArBadChanFEBHasher.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LArBadChanFEBHasher_H
6 #define LArBadChanFEBHasher_H
7 
9 
11 public:
12 
14  m_maxHash(0), m_maxFEBHash(0), m_onlineID(0) {}
15 
16  LArBadChanFEBHasher( unsigned int firstFEB, unsigned int lastFEB,
17  unsigned int febShift, const LArOnlineID* onlineID) :
18  m_firstFEBid(firstFEB),
19  m_shift( febShift - 7), // 7 bits shift to the left for mult. by 128
20  m_FEBShift( febShift),
21  m_onlineID( onlineID)
22  {
23  m_maxFEBHash = (((lastFEB - firstFEB) >> febShift) + 1);
24  m_maxHash = m_maxFEBHash // range of FEBs
25  * maxChannel(); // number of channels per FEB
26  }
27 
28  unsigned int hash( const HWIdentifier& FEBid, int chan) const {
29  return ((FEBid.get_identifier32().get_compact() - m_firstFEBid) >> m_shift) + chan;
30  }
31 
32  unsigned int hash( const HWIdentifier& onlineID) const {
33  return hash( m_onlineID->feb_Id( onlineID), m_onlineID->channel(onlineID));
34  }
35 
36  // channel
37  unsigned int hash( unsigned int febHash, unsigned int chan) const {
38  return febHash * maxChannel() + chan;
39  }
40 
41  unsigned int hashFEB( const HWIdentifier& FEBid) const {
42  return ((FEBid.get_identifier32().get_compact() - m_firstFEBid) >> m_FEBShift);
43  }
44 
45  unsigned int febHashByChan( const HWIdentifier& chanID) const {
46  return hashFEB( m_onlineID->feb_Id( chanID));
47  }
48 
49  unsigned int channelInFeb( const HWIdentifier& chanID) const {
50  return m_onlineID->channel(chanID);
51  }
52 
53  unsigned int maxHash() const { return m_maxHash;}
54  unsigned int maxFEBHash() const { return m_maxFEBHash;}
55  unsigned int maxChannel() const {return 128;} // max # of channels per FEB
56 
57  bool initialized() const {return ((m_onlineID != 0) && (m_maxHash != 0));}
58 
59 private:
60 
61  unsigned int m_firstFEBid;
62  unsigned int m_shift;
63  unsigned int m_FEBShift;
64  unsigned int m_maxHash;
65  unsigned int m_maxFEBHash;
67 };
68 
69 #endif
LArBadChanFEBHasher::hash
unsigned int hash(const HWIdentifier &FEBid, int chan) const
Definition: LArBadChanFEBHasher.h:28
LArBadChanFEBHasher::LArBadChanFEBHasher
LArBadChanFEBHasher()
Definition: LArBadChanFEBHasher.h:13
LArBadChanFEBHasher::maxChannel
unsigned int maxChannel() const
Definition: LArBadChanFEBHasher.h:55
LArBadChanFEBHasher
Definition: LArBadChanFEBHasher.h:10
LArBadChanFEBHasher::maxFEBHash
unsigned int maxFEBHash() const
Definition: LArBadChanFEBHasher.h:54
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
HWIdentifier
Definition: HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
LArBadChanFEBHasher::m_maxHash
unsigned int m_maxHash
Definition: LArBadChanFEBHasher.h:64
LArBadChanFEBHasher::initialized
bool initialized() const
Definition: LArBadChanFEBHasher.h:57
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1963
LArBadChanFEBHasher::LArBadChanFEBHasher
LArBadChanFEBHasher(unsigned int firstFEB, unsigned int lastFEB, unsigned int febShift, const LArOnlineID *onlineID)
Definition: LArBadChanFEBHasher.h:16
LArBadChanFEBHasher::hash
unsigned int hash(unsigned int febHash, unsigned int chan) const
Definition: LArBadChanFEBHasher.h:37
LArBadChanFEBHasher::maxHash
unsigned int maxHash() const
Definition: LArBadChanFEBHasher.h:53
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LArBadChanFEBHasher::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArBadChanFEBHasher.h:66
LArBadChanFEBHasher::m_maxFEBHash
unsigned int m_maxFEBHash
Definition: LArBadChanFEBHasher.h:65
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
LArBadChanFEBHasher::hash
unsigned int hash(const HWIdentifier &onlineID) const
Definition: LArBadChanFEBHasher.h:32
LArBadChanFEBHasher::m_firstFEBid
unsigned int m_firstFEBid
Definition: LArBadChanFEBHasher.h:61
LArOnlineID
Definition: LArOnlineID.h:20
LArBadChanFEBHasher::hashFEB
unsigned int hashFEB(const HWIdentifier &FEBid) const
Definition: LArBadChanFEBHasher.h:41
LArBadChanFEBHasher::channelInFeb
unsigned int channelInFeb(const HWIdentifier &chanID) const
Definition: LArBadChanFEBHasher.h:49
LArBadChanFEBHasher::m_FEBShift
unsigned int m_FEBShift
Definition: LArBadChanFEBHasher.h:63
LArOnlineID.h
LArBadChanFEBHasher::m_shift
unsigned int m_shift
Definition: LArBadChanFEBHasher.h:62
LArBadChanFEBHasher::febHashByChan
unsigned int febHashByChan(const HWIdentifier &chanID) const
Definition: LArBadChanFEBHasher.h:45