ATLAS Offline Software
Loading...
Searching...
No Matches
Identifier Class Reference

#include <Identifier.h>

Inheritance diagram for Identifier:
Collaboration diagram for Identifier:

Public Types

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

Static Public Attributes

static constexpr unsigned int NBITS = sizeof(value_type) * 8
static constexpr value_type MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1))
static constexpr value_type ALL_BITS = ~(static_cast<value_type>(0))

Private Types

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

Private Member Functions

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

Private Attributes

value_type m_id = max_value
 The only data member.

Friends

class IdDictDictionary
class IdDictFieldImplementation
class AtlasDetectorID
class PixelID

Detailed Description

Member Typedef Documentation

◆ bit_defs

typedef enum Identifier::bit_defs_enum Identifier::bit_defs

◆ diff_type

using Identifier::diff_type = long long

◆ id_type

using Identifier::id_type = Identifier

◆ max_value_type

typedef enum Identifier::max_value_type_enum Identifier::max_value_type

◆ size_type

using Identifier::size_type = unsigned long long

◆ value_type [1/2]

using Identifier::value_type = unsigned long long

◆ value_type [2/2]

typedef Long64_t Identifier::value_type

Member Enumeration Documentation

◆ bit_defs_enum

enum Identifier::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;
#define NBITS

◆ max_value_type

enum Identifier::max_value_type
private
Enumerator
max_value 

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

126 {
127 max_value = ~(static_cast<value_type>(0))
128 };

◆ max_value_type_enum

enum Identifier::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))
30 } max_value_type;

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)
default

◆ 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 value_type()

Identifier::operator value_type ( ) const
inline

◆ operator!=() [1/2]

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

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

41{return (m_id != other.m_id);}

◆ operator!=() [2/2]

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

◆ operator&=()

Identifier & Identifier::operator&= ( value_type value)
private

◆ operator<()

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

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

42{return (m_id < other.m_id);}

◆ operator<=()

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

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

44{return (m_id <= other.m_id);}

◆ operator<=>()

auto Identifier::operator<=> ( const Identifier & other) const
inline

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

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

◆ operator=() [1/6]

Identifier & Identifier::operator= ( const Identifier & old)
default

◆ operator=() [2/6]

Identifier & Identifier::operator= ( const Identifier32 & old)

Assignment operators overloads.

◆ operator=() [3/6]

Identifier & Identifier::operator= ( Identifier32::value_type value)

Assignment to avoid common implicit conversions and shift properly.

◆ operator=() [4/6]

Identifier & Identifier::operator= ( int value)

◆ operator=() [5/6]

Identifier & Identifier::operator= ( value_type value)

◆ operator=() [6/6]

Identifier & Identifier::operator= ( value_type value)
inline

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

39{m_id=value;return (*this);};

◆ operator==() [1/6]

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

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

40{return (m_id == other.m_id);}

◆ operator==() [2/6]

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

◆ operator==() [3/6]

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

◆ 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

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

43{return (m_id > other.m_id);}

◆ operator>=()

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

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

45{return (m_id >= other.m_id);}

◆ operator|=()

Identifier & Identifier::operator|= ( value_type value)
private

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}
std::string base
Definition hcg.cxx:81

◆ 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}
std::string getString() const
Provide a string form of the identifier - hexadecimal.

◆ AtlasDetectorID

friend class AtlasDetectorID
friend

◆ IdDictDictionary

friend class IdDictDictionary
friend

◆ IdDictFieldImplementation

◆ PixelID

friend class PixelID
friend

Member Data Documentation

◆ ALL_BITS

value_type Identifier::ALL_BITS = ~(static_cast<value_type>(0))
staticconstexpr

◆ m_id

value_type Identifier::m_id = max_value
private

The only data member.

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

◆ MAX_BIT

value_type Identifier::MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1))
staticconstexpr

◆ NBITS

unsigned int Identifier::NBITS = sizeof(value_type) * 8
staticconstexpr

The documentation for this class was generated from the following files: