|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef MUONCALIBIDENTIFIER_IDENTIFIERHASHCALC_H
6 #define MUONCALIBIDENTIFIER_IDENTIFIERHASHCALC_H
21 #include "GaudiKernel/MsgStream.h"
41 typedef typename T::IdentifierType
IdType;
67 void dump( std::ostream&
os = std::cout )
const;
87 : m_idFields(idFields)
106 for (
unsigned int i = 1;
i <
NFIELDS; ++
i ) {
117 for (
unsigned int i = 1;
i <
NFIELDS; ++
i ) {
130 for (
unsigned int i = 1;
i <
NFIELDS; ++
i ) {
141 bool bChanged =
false;
142 for (
unsigned int i = 0;
i <
NFIELDS; ++
i ) {
158 if ( fieldIndex >=
NFIELDS )
return;
159 if ( fieldMin > fieldMax )
return;
160 bool bChanged =
false;
174 for (
unsigned int i = 0;
i <
NFIELDS; ++
i ) {
192 log<<MSG::WARNING<<
"IdentifierHashCalc<T>::checkValidity() Table is empty."<<
endmsg;
196 unsigned int nErrors = 0;
197 #ifdef IDENTIFIERHASHCALC_DEBUG
200 for (
unsigned int i = 0;
i <
size(); ++
i ) {
205 #ifndef IDENTIFIERHASHCALC_DEBUG
208 log<<MSG::WARNING<<
"IdentifierHashCalc<T>::checkValidity() getIdentifier(" <<
i <<
")=0x" << std::hex <<
id << std::dec <<
" whereas getHash(" << std::hex <<
id << std::dec <<
")=" <<
hash<<
endmsg;
211 #ifdef IDENTIFIERHASHCALC_DEBUG
216 #ifdef IDENTIFIERHASHCALC_DEBUG
218 log<<MSG::WARNING<<
"IdentifierHashCalc<T>::checkValidity() table contains " << nErrors <<
" errors." <<
endmsg;
224 if ( nErrors )
return false;
232 unsigned int n =
size();
233 for (
unsigned int i = 0;
i <
n; ++
i ) {
237 os <<
"ID=0x" << std::hex <<
id << std::dec <<
" fields=(";
238 for (
int j =
NFIELDS-1; j >= 0; --j ) {
240 if ( j != 0 )
os <<
",";
242 os <<
") hash=" <<
i <<
"\n";
244 os <<
"IdentifierHashTable has " <<
n <<
" entries.\n";
245 os <<
"\nSummary:\n";
246 os <<
"field min max size factor\n";
247 for (
unsigned int i = 0;
i <
NFIELDS; ++
i ) {
248 os << std::setw(5) <<
i <<
" "
259 std::ostringstream oss;
267 #endif // MUONCALIBIDENTIFIER_IDENTIFIERHASHCALC_H
HashType getHash(const IdType &id) const
Get hash from 0 to size()-1.
bool addEntry(const IdType &id)
Add an identifier to the table.
singleton-like access to IMessageSvc via open function and helper
bool checkValidity() const
Check that the table is internally consistent.
IdentifierHashCalc()
Default constructor makes empty hash table.
void setFieldLimits(unsigned int fieldIndex, int fieldMin, int fieldMax)
Set the limits of a specific field.
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
std::string dumpToString() const
Dump complete table into a string.
void dump(std::ostream &os=std::cout) const
Dump complete table to output stream.
IMessageSvc * getMessageSvc(bool quiet=false)
unsigned int m_fieldsFactor[NFIELDS]
T IdFieldsType
define the type IdFieldsType
bool isInRange(const T &idFields) const
IdentifierHashCalc(const T &idFields)
Make empty table with pointer set to external idHelper, which will be transmitted to the constructor ...
T::IdentifierType IdType
define the type IdType
void clear()
Clear the hashtable.
unsigned int m_fieldsSize[NFIELDS]
T::HashType HashType
define the type HashType
unsigned int size() const
Number of hashes in the table.
IdType getIdentifier(const HashType &idHash) const
Get identifier from hash.