ATLAS Offline Software
Loading...
Searching...
No Matches
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
11public:
12
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
59private:
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
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
const LArOnlineID * m_onlineID
unsigned int hash(const HWIdentifier &onlineID) const
unsigned int febHashByChan(const HWIdentifier &chanID) const
unsigned int maxFEBHash() const
unsigned int hash(unsigned int febHash, unsigned int chan) const
unsigned int channelInFeb(const HWIdentifier &chanID) const
unsigned int hash(const HWIdentifier &FEBid, int chan) const
LArBadChanFEBHasher(unsigned int firstFEB, unsigned int lastFEB, unsigned int febShift, const LArOnlineID *onlineID)
unsigned int maxChannel() const
unsigned int hashFEB(const HWIdentifier &FEBid) const
unsigned int maxHash() const