ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Identifier Class Reference

#include <Identifier.h>

Inheritance diagram for Identifier:
Collaboration diagram for Identifier:

Classes

struct  get_compact_func
 A get_compact functional for use in STL algorithms. More...
 

Public Types

enum  bit_defs { NBITS = sizeof(value_type) * 8, MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)), ALL_BITS = ~(static_cast<value_type>(0)) }
 
enum  bit_defs_enum { NBITS = sizeof(value_type) * 8, MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)), ALL_BITS = ~(static_cast<value_type>(0)) }
 
enum  max_value_type_enum { max_value = ~(static_cast<value_type>(0)) }
 
using id_type = Identifier
 
using value_type = unsigned long long
 
using diff_type = long long
 
using size_type = unsigned long long
 
typedef Long64_t value_type
 
typedef enum Identifier::bit_defs_enum bit_defs
 
typedef enum Identifier::max_value_type_enum max_value_type
 

Public Member Functions

 Identifier ()=default
 Default constructor. More...
 
Identifieroperator= (const Identifier32 &old)
 Assignment operators overloads. More...
 
Identifieroperator= (value_type value)
 
Identifieroperator= (Identifier32::value_type value)
 Assignment to avoid common implicit conversions and shift properly. More...
 
Identifieroperator= (int value)
 
void set (const std::string &id)
 build from a string form - hexadecimal More...
 
void clear ()
 Reset to invalid state. More...
 
Identifierset_literal (value_type value)
 Set literal value. More...
 
Identifier32 get_identifier32 () const
 Get the 32-bit version Identifier, will be invalid if >32 bits needed. More...
 
value_type get_compact () const
 Get the compact id. More...
 
bool operator== (const Identifier &other) const =default
 
auto operator (const Identifier &other) const
 
bool operator== (value_type other) const
 Comparison operators with value_type. More...
 
bool operator== (Identifier32::value_type other) const
 
bool operator== (int other) const
 
bool is_valid () const
 Check if id is in a valid state. More...
 
std::string getString () const
 Provide a string form of the identifier - hexadecimal. More...
 
void show () const
 Print out in hex form. More...
 
 Identifier ()
 
 Identifier (const Identifier &value)
 
 Identifier (value_type value)
 
 operator value_type () const
 
Identifieroperator= (const Identifier &old)
 
Identifieroperator= (value_type value)
 
bool operator== (const Identifier &other) const
 
bool operator!= (const Identifier &other) const
 
bool operator< (const Identifier &other) const
 
bool operator> (const Identifier &other) const
 
bool operator<= (const Identifier &other) const
 
bool operator>= (const Identifier &other) const
 
bool operator== (Identifier::value_type other) const
 
bool operator!= (Identifier::value_type other) const
 
 Identifier (value_type value)
 
 Identifier (const Identifier32 &other)
 Constructor from Identifier32. More...
 
 Identifier (Identifier32::value_type value)
 Constructor from 32-bit value_type and int (to avoid common implicit conversions) More...
 
 Identifier (int value)
 

Private Types

enum  max_value_type { max_value = ~(static_cast<value_type>(0)) }
 

Private Member Functions

Identifieroperator|= (value_type value)
 Bitwise operations. More...
 
Identifieroperator&= (value_type value)
 
value_type extract (size_type shift, size_type mask) const
 extract field from identifier (shift first, then mask) More...
 
value_type mask_shift (value_type mask, size_type shift) const
 extract field(s) by masking first, then shifting More...
 
value_type extract (size_type shift) const
 extract field, no mask More...
 

Private Attributes

value_type m_id = max_value
 The only data member. More...
 

Friends

class IdDictDictionary
 
class IdDictFieldImplementation
 
class AtlasDetectorID
 
class PixelID
 

Detailed Description

Definition at line 23 of file DetectorDescription/Identifier/Identifier/Identifier.h.

Member Typedef Documentation

◆ bit_defs

◆ diff_type

using Identifier::diff_type = long long

◆ id_type

◆ max_value_type

◆ size_type

using Identifier::size_type = unsigned long long

◆ value_type [1/2]

typedef Long64_t Identifier::value_type

◆ value_type [2/2]

using Identifier::value_type = unsigned long long

Member Enumeration Documentation

◆ bit_defs

Enumerator
NBITS 
MAX_BIT 
ALL_BITS 

Definition at line 31 of file DetectorDescription/Identifier/Identifier/Identifier.h.

31  {
32  NBITS = sizeof(value_type) * 8, // bits per byte
33  MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)),
34  ALL_BITS = ~(static_cast<value_type>(0))
35  };

◆ bit_defs_enum

Enumerator
NBITS 
MAX_BIT 
ALL_BITS 

Definition at line 20 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

21  {
22  NBITS = sizeof(value_type) * 8, // bits per byte
23  MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)),
24  ALL_BITS = ~(static_cast<value_type>(0))
25  } bit_defs;

◆ max_value_type

Enumerator
max_value 

Definition at line 128 of file DetectorDescription/Identifier/Identifier/Identifier.h.

128  {
129  max_value = ~(static_cast<value_type>(0))
130  };

◆ max_value_type_enum

Enumerator
max_value 

Definition at line 27 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

27  {
28  //max_value = 0xFFFFFFFFFFFFFFFFULL
29  max_value = ~(static_cast<value_type>(0))

Constructor & Destructor Documentation

◆ Identifier() [1/8]

Identifier::Identifier ( )
default

Default constructor.

◆ Identifier() [2/8]

Identifier::Identifier ( value_type  value)
explicit

Additional ctors Constructor from value_type

◆ Identifier() [3/8]

Identifier::Identifier ( const Identifier32 other)

Constructor from Identifier32.

◆ Identifier() [4/8]

Identifier::Identifier ( Identifier32::value_type  value)
explicit

Constructor from 32-bit value_type and int (to avoid common implicit conversions)

◆ Identifier() [5/8]

Identifier::Identifier ( int  value)
explicit

◆ Identifier() [6/8]

Identifier::Identifier ( )
inline

◆ Identifier() [7/8]

Identifier::Identifier ( const Identifier value)
inline

◆ Identifier() [8/8]

Identifier::Identifier ( value_type  value)
inline

Member Function Documentation

◆ clear()

void Identifier::clear ( )

Reset to invalid state.

◆ extract() [1/2]

value_type Identifier::extract ( size_type  shift) const
private

extract field, no mask

◆ extract() [2/2]

value_type Identifier::extract ( size_type  shift,
size_type  mask 
) const
private

extract field from identifier (shift first, then mask)

◆ get_compact()

value_type Identifier::get_compact ( ) const

Get the compact id.

◆ get_identifier32()

Identifier32 Identifier::get_identifier32 ( ) const

Get the 32-bit version Identifier, will be invalid if >32 bits needed.

◆ getString()

std::string Identifier::getString ( ) const

Provide a string form of the identifier - hexadecimal.

Definition at line 25 of file Identifier.cxx.

25  {
26  return std::format("0x{:0x}", m_id);
27 }

◆ is_valid()

bool Identifier::is_valid ( ) const

Check if id is in a valid state.

◆ mask_shift()

value_type Identifier::mask_shift ( value_type  mask,
size_type  shift 
) const
private

extract field(s) by masking first, then shifting

◆ operator()

auto Identifier::operator ( const Identifier other) const
inline

Definition at line 92 of file DetectorDescription/Identifier/Identifier/Identifier.h.

92 {return m_id <=> other.m_id;}

◆ operator value_type()

Identifier::operator value_type ( ) const
inline

◆ operator!=() [1/2]

bool Identifier::operator!= ( const Identifier other) const
inline

◆ operator!=() [2/2]

bool Identifier::operator!= ( Identifier::value_type  other) const
inline

◆ operator&=()

◆ operator<()

bool Identifier::operator< ( const Identifier other) const
inline

◆ operator<=()

bool Identifier::operator<= ( const Identifier other) const
inline

◆ operator=() [1/6]

◆ operator=() [2/6]

Assignment operators overloads.

◆ operator=() [3/6]

Assignment to avoid common implicit conversions and shift properly.

◆ operator=() [4/6]

Identifier& Identifier::operator= ( int  value)

◆ operator=() [5/6]

◆ operator=() [6/6]

◆ operator==() [1/6]

bool Identifier::operator== ( const Identifier other) const
inline

◆ operator==() [2/6]

bool Identifier::operator== ( const Identifier other) const
default

◆ operator==() [3/6]

◆ operator==() [4/6]

bool Identifier::operator== ( Identifier::value_type  other) const
inline

◆ operator==() [5/6]

bool Identifier::operator== ( int  other) const

◆ operator==() [6/6]

bool Identifier::operator== ( value_type  other) const

Comparison operators with value_type.

This is a hack, only because GeoAdaptors/GeoMuonHits wants to to compare explicitly with 0 as a test of whether the identifier has been constructed properly. But is_valid() here compares with max_value, not 0, since presumably it is possible to have a zero value - just not in muons.

◆ operator>()

bool Identifier::operator> ( const Identifier other) const
inline

◆ operator>=()

bool Identifier::operator>= ( const Identifier other) const
inline

◆ operator|=()

Bitwise operations.

◆ set()

void Identifier::set ( const std::string &  id)

build from a string form - hexadecimal

Definition at line 12 of file Identifier.cxx.

12  {
13  const auto start = id.data();
14  const auto end = start + id.size();
15  static constexpr int base = 16;
16  //add 2 to start to get past the Ox prefix.
17  const auto [p,ec] = std::from_chars(start+2, end, m_id, base);
18  if (ec != std::errc()){
19  throw std::runtime_error("Number was not parsed in Identifier::set");
20  }
21 }

◆ set_literal()

Identifier& Identifier::set_literal ( value_type  value)

Set literal value.

◆ show()

void Identifier::show ( ) const

Print out in hex form.

Definition at line 30 of file Identifier.cxx.

30  {
31  const Identifier& me = *this;
32  std::cout << me.getString();
33 }

Friends And Related Function Documentation

◆ AtlasDetectorID

friend class AtlasDetectorID
friend

◆ IdDictDictionary

friend class IdDictDictionary
friend

◆ IdDictFieldImplementation

friend class IdDictFieldImplementation
friend

◆ PixelID

friend class PixelID
friend

Member Data Documentation

◆ m_id

value_type Identifier::m_id = max_value
private

The only data member.

Definition at line 132 of file DetectorDescription/Identifier/Identifier/Identifier.h.


The documentation for this class was generated from the following files:
base
std::string base
Definition: hcg.cxx:78
vtune_athena.format
format
Definition: vtune_athena.py:14
Identifier::MAX_BIT
@ MAX_BIT
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:33
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
Identifier::max_value
@ max_value
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:129
athena.value
value
Definition: athena.py:124
Identifier::m_id
value_type m_id
The only data member.
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:132
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Identifier::bit_defs
bit_defs
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:31
Identifier::ALL_BITS
@ ALL_BITS
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:34
Identifier::NBITS
@ NBITS
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
Identifier::max_value_type
max_value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:128
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
value_type
Definition: EDM_MasterSearch.h:11
Identifier
Definition: IdentifierFieldParser.cxx:14