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

#include <SCT_OnlineId.h>

Collaboration diagram for SCT_OnlineId:

Public Types

enum  {
  FIRST_FIBRE =0, LAST_FIBRE =95, INVALID_FIBRE =255, INVALID_ROD =16777215,
  NUM_FIBRES =96, MAX_INDEX =19871, NUMBER_OF_INDICES =19872, INVALID_INDEX =0xFFFFFFFF,
  INVALID_ONLINE_ID =0xFFFFFFFF
}
 Constants for evaluating hash indices of the online id. The hashing formula is in 'index()'. More...
 

Public Member Functions

 SCT_OnlineId ()
 Default constructor produces an invalid serial number. More...
 
 SCT_OnlineId (const std::uint32_t onlineId)
 Construct from uint32. More...
 
 SCT_OnlineId (const std::uint32_t rodId, const std::uint32_t fibre)
 Construct from robId and fibre; a cursory check is made on validity of the input. More...
 
std::uint32_t rod () const
 Return the rod/rob Id. More...
 
std::uint32_t fibre () const
 Return the fibre. More...
 
 operator unsigned int () const
 Overload cast to uint. More...
 
bool is_valid (const bool usingDbCabling) const
 Check whether the onlineId is valid, with flag to switch between validity from the database or text file cabling source. More...
 
bool is_valid () const
 Check whether the onlineId is valid, without knowing the data source; this is a rough check. More...
 
unsigned int index () const
 Return an index in the range 0-9215, calculated from parts of the onlineId. More...
 
SCT_OnlineIdoperator++ ()
 Implement pre-increment and post-increment for iterating over fibres in a rod. More...
 
SCT_OnlineId operator++ (int)
 

Static Public Member Functions

static bool rodIdInRange (std::uint32_t r)
 Is the rod in range? More...
 

Private Member Functions

bool fibreInRange (std::uint32_t f) const
 Simple range check. More...
 
bool couldBeValid (std::uint32_t r)
 Rough check on validity. More...
 
bool rodIdInRange (std::uint32_t r, const bool usingDbCabling) const
 Check on validity. More...
 

Private Attributes

std::uint32_t m_onlineId
 The underlying number. More...
 

Detailed Description

SCT_OnlineId is a class to hold an online id number and provide check on validity, and conversions between the different formats. In general, an SCT online id has 32 bits composed of the robId (0-23) and the fibre number (24-31)

Definition at line 22 of file SCT_OnlineId.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Constants for evaluating hash indices of the online id. The hashing formula is in 'index()'.

Enumerator
FIRST_FIBRE 
LAST_FIBRE 
INVALID_FIBRE 
INVALID_ROD 
NUM_FIBRES 
MAX_INDEX 
NUMBER_OF_INDICES 
INVALID_INDEX 
INVALID_ONLINE_ID 

Definition at line 56 of file SCT_OnlineId.h.

56  {
57  FIRST_FIBRE=0, LAST_FIBRE=95, INVALID_FIBRE=255, INVALID_ROD=16777215, NUM_FIBRES=96, MAX_INDEX=19871, NUMBER_OF_INDICES=19872, INVALID_INDEX=0xFFFFFFFF, INVALID_ONLINE_ID=0xFFFFFFFF
58  };

Constructor & Destructor Documentation

◆ SCT_OnlineId() [1/3]

SCT_OnlineId::SCT_OnlineId ( )

Default constructor produces an invalid serial number.

Definition at line 23 of file SCT_OnlineId.cxx.

24  //nop
25 }

◆ SCT_OnlineId() [2/3]

SCT_OnlineId::SCT_OnlineId ( const std::uint32_t  onlineId)

Construct from uint32.

Definition at line 28 of file SCT_OnlineId.cxx.

28  :m_onlineId(onlineId){
29  //nop
30 }

◆ SCT_OnlineId() [3/3]

SCT_OnlineId::SCT_OnlineId ( const std::uint32_t  rodId,
const std::uint32_t  fibre 
)

Construct from robId and fibre; a cursory check is made on validity of the input.

Definition at line 32 of file SCT_OnlineId.cxx.

32  {
33  //cursory checks on range only
34  if (not (fibreInRange(fibre) and rodIdInRange(rodId) )){
35  std::cout<<"SCT_OnlineId: Trying to create an invalid online Id from RodId 0x"<<std::hex<<rodId<<std::dec<<" and fibre: "<<fibre<<std::endl;
37  } else {
38  m_onlineId = rodId + (fibre<<24);
39  }
40 }

Member Function Documentation

◆ couldBeValid()

bool SCT_OnlineId::couldBeValid ( std::uint32_t  r)
private

Rough check on validity.

◆ fibre()

std::uint32_t SCT_OnlineId::fibre ( ) const

Return the fibre.

Definition at line 65 of file SCT_OnlineId.cxx.

65  {
66  return m_onlineId>>24;
67 }

◆ fibreInRange()

bool SCT_OnlineId::fibreInRange ( std::uint32_t  f) const
private

Simple range check.

Definition at line 88 of file SCT_OnlineId.cxx.

88  {
89  return (f<NUM_FIBRES);
90 }

◆ index()

unsigned int SCT_OnlineId::index ( ) const

Return an index in the range 0-9215, calculated from parts of the onlineId.

if ((Z > 11) or (nibble<1>(m_onlineId)==1) ){//its montecarlo Y=1; possible Z values at this point are 12,13,14,15 (nibble 1 is zero) and 0,1,2,3,4,5 (nibble 1 is 1) so we map these onto 0-9 Z= (Z > 11) ? (Z-6) : Z; }

Definition at line 112 of file SCT_OnlineId.cxx.

112  {
113  //number is of form 0xII2X0Y0Z, X=[1-4], Y=[0-2], Z=[0xO-0xf], II is 0 to 95
114  //so Z is nibble 0; Y is nibble 2; X is nibble 4
115  // BUT long ago...
116  //MC cabling was stored in a file with robs in different format, so the online Id will be in form
117  //0xII2X00YZ, X=[1-4], Y=[0-2], Z=[0xO-0xf], II is 0 to 95
118  unsigned int Z(nibble<0>(m_onlineId));
119  unsigned int Y(nibble<2>(m_onlineId));
127  const unsigned int X(nibble<4>(m_onlineId) - 1);
128  unsigned int result= ((X + (Y * 4)) * 16 + Z) * 96 + (fibre()); //should return an index in range 0-19872
129  if (result > MAX_INDEX){
130  std::cout<<"SCT_OnlineId: Invalid index for online Id "<<std::hex<<m_onlineId<<std::dec<<" X, Y, Z: "<<X<<", "<<Y<<", "<<Z<<std::endl;
132  }
133  return result;
134 }

◆ is_valid() [1/2]

bool SCT_OnlineId::is_valid ( ) const

Check whether the onlineId is valid, without knowing the data source; this is a rough check.

Definition at line 82 of file SCT_OnlineId.cxx.

82  {
83  return ( fibreInRange(fibre()) and rodIdInRange(rod()) );
84 }

◆ is_valid() [2/2]

bool SCT_OnlineId::is_valid ( const bool  usingDbCabling) const

Check whether the onlineId is valid, with flag to switch between validity from the database or text file cabling source.

Definition at line 76 of file SCT_OnlineId.cxx.

76  {
77  return ( fibreInRange(fibre()) and rodIdInRange(rod(), usingDbCabling) );
78 }

◆ operator unsigned int()

SCT_OnlineId::operator unsigned int ( ) const

Overload cast to uint.

Definition at line 70 of file SCT_OnlineId.cxx.

70  {
71  return m_onlineId;
72 }

◆ operator++() [1/2]

SCT_OnlineId & SCT_OnlineId::operator++ ( )

Implement pre-increment and post-increment for iterating over fibres in a rod.

Definition at line 43 of file SCT_OnlineId.cxx.

43  {
44  m_onlineId+=(1<<24);
46  return *this;
47 }

◆ operator++() [2/2]

SCT_OnlineId SCT_OnlineId::operator++ ( int  )

Definition at line 50 of file SCT_OnlineId.cxx.

50  {
51  SCT_OnlineId temp=*this;
52  m_onlineId+=(1<<24);
54  return temp;
55 }

◆ rod()

std::uint32_t SCT_OnlineId::rod ( ) const

Return the rod/rob Id.

Definition at line 59 of file SCT_OnlineId.cxx.

59  {
60  return m_onlineId & 0xFFFFFF;
61 }

◆ rodIdInRange() [1/2]

bool SCT_OnlineId::rodIdInRange ( std::uint32_t  r)
static

Is the rod in range?

Definition at line 93 of file SCT_OnlineId.cxx.

93  {
94  const std::uint32_t lowestRodId(0x210000);
95  const std::uint32_t highestRodId=0x24010F;
96  return ((r >=lowestRodId) and (r<=highestRodId)) ;
97 }

◆ rodIdInRange() [2/2]

bool SCT_OnlineId::rodIdInRange ( std::uint32_t  r,
const bool  usingDbCabling 
) const
private

Check on validity.

Definition at line 100 of file SCT_OnlineId.cxx.

100  {
101  const std::uint32_t lowestRodId(0x210000);
102  const std::uint32_t highestRodId=0x24010F;
103  //choose one unique Rod as a signature to check for either database or montecarlo.
104  //0x220010 is unique to the text file, 0x220105 is unique to the database
105  //as an alternative, more thorough (but slower) check, the SCT_OnlineIdType function should be used
106  const std::uint32_t uniqueToOppositeCase = usingDbCabling?0x220010:0x220105;
107  return ((r >=lowestRodId) and (r<=highestRodId) and (r!=uniqueToOppositeCase)) ;
108 }

Member Data Documentation

◆ m_onlineId

std::uint32_t SCT_OnlineId::m_onlineId
private

The underlying number.

Definition at line 66 of file SCT_OnlineId.h.


The documentation for this class was generated from the following files:
SCT_OnlineId::NUM_FIBRES
@ NUM_FIBRES
Definition: SCT_OnlineId.h:57
beamspotman.r
def r
Definition: beamspotman.py:676
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
get_generator_info.result
result
Definition: get_generator_info.py:21
SCT_OnlineId::MAX_INDEX
@ MAX_INDEX
Definition: SCT_OnlineId.h:57
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SCT_OnlineId::FIRST_FIBRE
@ FIRST_FIBRE
Definition: SCT_OnlineId.h:57
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
SCT_OnlineId::LAST_FIBRE
@ LAST_FIBRE
Definition: SCT_OnlineId.h:57
SCT_OnlineId
Definition: SCT_OnlineId.h:22
SCT_OnlineId::INVALID_ROD
@ INVALID_ROD
Definition: SCT_OnlineId.h:57
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
SCT_OnlineId::rodIdInRange
static bool rodIdInRange(std::uint32_t r)
Is the rod in range?
Definition: SCT_OnlineId.cxx:93
SCT_OnlineId::INVALID_ONLINE_ID
@ INVALID_ONLINE_ID
Definition: SCT_OnlineId.h:57
SCT_OnlineId::INVALID_FIBRE
@ INVALID_FIBRE
Definition: SCT_OnlineId.h:57
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
SCT_OnlineId::NUMBER_OF_INDICES
@ NUMBER_OF_INDICES
Definition: SCT_OnlineId.h:57
SCT_OnlineId::INVALID_INDEX
@ INVALID_INDEX
Definition: SCT_OnlineId.h:57
SCT_OnlineId::m_onlineId
std::uint32_t m_onlineId
The underlying number.
Definition: SCT_OnlineId.h:66
SCT_OnlineId::fibre
std::uint32_t fibre() const
Return the fibre.
Definition: SCT_OnlineId.cxx:65
SCT_OnlineId::fibreInRange
bool fibreInRange(std::uint32_t f) const
Simple range check.
Definition: SCT_OnlineId.cxx:88
SCT_OnlineId::rod
std::uint32_t rod() const
Return the rod/rob Id.
Definition: SCT_OnlineId.cxx:59