ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MdtCsmIdHash Class Reference

Hash function for Mdt module Identifier to be used in MdtDigitContainer (IdentifiableContainer) More...

#include <MdtCsmIdHash.h>

Collaboration diagram for MdtCsmIdHash:

Public Types

typedef Identifier ID
 

Public Member Functions

 MdtCsmIdHash ()
 
virtual ~MdtCsmIdHash ()
 
int operator() (const ID &id) const
 Convert ID to int. More...
 
int max () const
 return maximum number of IDs More...
 
ID identifier (int i) const
 reverse conversion More...
 

Static Public Member Functions

static int offset ()
 return offset More...
 

Private Attributes

int m_size
 total number of IDs More...
 
std::map< Identifier, int > m_lookup
 lookup table More...
 
std::vector< IDm_int2id
 reverse lookup More...
 

Detailed Description

Hash function for Mdt module Identifier to be used in MdtDigitContainer (IdentifiableContainer)

Author
Hong Ma
Version
00-00-01 , Aug 28, 2002

Definition at line 17 of file MdtCsmIdHash.h.

Member Typedef Documentation

◆ ID

Definition at line 21 of file MdtCsmIdHash.h.

Constructor & Destructor Documentation

◆ MdtCsmIdHash()

MdtCsmIdHash::MdtCsmIdHash ( )

Definition at line 21 of file MdtCsmIdHash.cxx.

22 {
23  const MdtIdHelper* mdtHelper=nullptr;
24  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
25 
26  StatusCode sc = detStore->retrieve( mdtHelper, "MDTIDHELPER" );
27  if (sc.isFailure()) {
28  throw GaudiException("can not get MdtIdHelper",
29  "MdtCsmIdHash::MdtCsmIdHash()", sc);
30  }
31 
32  unsigned int used = mdtHelper->module_hash_max();
33  IdContext context = mdtHelper->module_context();
34 
35  if( mdtHelper->stationNameIndex("BME") != -1 ) {
36  used = mdtHelper->detectorElement_hash_max();
37  context = mdtHelper->detectorElement_context();
38  }
39 
40  for(unsigned int hash=0; hash < used; ++hash){
41  Identifier id;
42  if (!mdtHelper->get_id(hash,id,&context)) {
43  m_lookup[id]=(int) hash;
44  m_int2id.push_back(id);
45  } else {
46  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "MdtCscIdHash") <<
47  "MDT hash constructor failed!" << endmsg;
48  }
49  }
50 
51  m_size = (int) used;
52 }

◆ ~MdtCsmIdHash()

virtual MdtCsmIdHash::~MdtCsmIdHash ( )
inlinevirtual

Definition at line 24 of file MdtCsmIdHash.h.

24 { };

Member Function Documentation

◆ identifier()

MdtCsmIdHash::ID MdtCsmIdHash::identifier ( int  i) const

reverse conversion

Definition at line 54 of file MdtCsmIdHash.cxx.

54  {
55 
56  if(index>=0 && index < m_size) {
57  return m_int2id[index] ;
58  }
59  // return blank id for invalid index
60  std::cout <<" MdtCsmIdHash::ERROR : identifier invalid ID "<<std::endl;
61  Identifier id;
62  return id;
63 
64 }

◆ max()

int MdtCsmIdHash::max ( ) const

return maximum number of IDs

Definition at line 78 of file MdtCsmIdHash.cxx.

78  {
79 
80 return m_size;
81 
82 }

◆ offset()

int MdtCsmIdHash::offset ( )
static

return offset

Definition at line 84 of file MdtCsmIdHash.cxx.

84  {
85 
86 return 0;
87 
88 }

◆ operator()()

int MdtCsmIdHash::operator() ( const ID id) const

Convert ID to int.

Definition at line 66 of file MdtCsmIdHash.cxx.

66  {
67 
68  std::map<ID,int>::const_iterator it = m_lookup.find(id);
69  if(it!=m_lookup.end()){
70  return (*it).second;
71  }
72 
73  // FIXME -1 for invalid ID?
74  return -1;
75 
76 }

Member Data Documentation

◆ m_int2id

std::vector<ID> MdtCsmIdHash::m_int2id
private

reverse lookup

Definition at line 49 of file MdtCsmIdHash.h.

◆ m_lookup

std::map<Identifier,int> MdtCsmIdHash::m_lookup
private

lookup table

Definition at line 45 of file MdtCsmIdHash.h.

◆ m_size

int MdtCsmIdHash::m_size
private

total number of IDs

Definition at line 41 of file MdtCsmIdHash.h.


The documentation for this class was generated from the following files:
used
MuonIdHelper::stationNameIndex
int stationNameIndex(const std::string &name) const
Definition: MuonIdHelper.cxx:842
MuonIdHelper::detectorElement_context
IdContext detectorElement_context() const
id for detector element
Definition: MuonIdHelper.cxx:736
MuonIdHelper::get_id
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
Definition: MuonIdHelper.cxx:70
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
MuonIdHelper::detectorElement_hash_max
size_type detectorElement_hash_max() const
Definition: MuonIdHelper.h:186
MdtCsmIdHash::m_size
int m_size
total number of IDs
Definition: MdtCsmIdHash.h:41
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MdtCsmIdHash::m_int2id
std::vector< ID > m_int2id
reverse lookup
Definition: MdtCsmIdHash.h:49
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MdtIdHelper
Definition: MdtIdHelper.h:61
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
MuonIdHelper::module_hash_max
size_type module_hash_max() const
the maximum hash value
Definition: MuonIdHelper.cxx:748
DeMoScan.index
string index
Definition: DeMoScan.py:364
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
MuonIdHelper::module_context
IdContext module_context() const
id for module
Definition: MuonIdHelper.cxx:731
MdtCsmIdHash::m_lookup
std::map< Identifier, int > m_lookup
lookup table
Definition: MdtCsmIdHash.h:45
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
Identifier
Definition: IdentifierFieldParser.cxx:14