ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
TRTCond::ExpandedIdentifier Class Reference

Identifier for TRT detector elements in the conditions code. More...

#include <ExpandedIdentifier.h>

Collaboration diagram for TRTCond::ExpandedIdentifier:

Public Types

enum  Level {
  DETECTOR =0, BARRELEC =1, LAYERWHEEL =2, MODULE =3,
  STRAWLAYER =4, STRAW =5
}
 enum to specify the granularity level More...
 

Public Member Functions

 ExpandedIdentifier ()
 default constructor More...
 
 ExpandedIdentifier (int bec, int layerorwheel, int module, int strawlayer, int straw, int l=STRAW)
 normal constructor More...
 
const size_t & index (size_t l) const
 returns const index at given level. More...
 
size_t & index (size_t l)
 returns index at given level More...
 
size_t level () const
 returns level More...
 
const std::string name (size_t l) const
 returns level name More...
 
void print (std::ostream &os=std::cout) const
 print the object More...
 
void write (std::ostream &os) const
 write the object to file More...
 
void read (std::istream &is)
 read the object from file More...
 
size_t becidtoindex (int becid) const
 returns subdetector index given the barrel_ec number More...
 
int becindextoid (size_t becindex) const
 returns barrel_ec number given the subdetector index
More...
 
int id (size_t l) const
 returns TRT_ID index at given level More...
 

Private Attributes

size_t m_index [5]
 Index within levels higher than DETECTOR. More...
 
size_t m_level
 Granularity level. More...
 

Detailed Description

Identifier for TRT detector elements in the conditions code.

Author
Wouter Hulsbergen

Note that this identifier is for use by clients. Inside the code elements are numbered by indices that always start at 0.

Definition at line 29 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

Member Enumeration Documentation

◆ Level

enum to specify the granularity level

Enumerator
DETECTOR 
BARRELEC 
LAYERWHEEL 
MODULE 
STRAWLAYER 
STRAW 

Definition at line 37 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

37 { DETECTOR=0,BARRELEC=1, LAYERWHEEL=2, MODULE=3, STRAWLAYER=4, STRAW=5 } ;

Constructor & Destructor Documentation

◆ ExpandedIdentifier() [1/2]

TRTCond::ExpandedIdentifier::ExpandedIdentifier ( )
inline

default constructor

Definition at line 40 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

40  : m_level(STRAW) {
41  m_index[0] = m_index[1] = m_index[2] = m_index[3] = m_index[4] = 0 ;}

◆ ExpandedIdentifier() [2/2]

TRTCond::ExpandedIdentifier::ExpandedIdentifier ( int  bec,
int  layerorwheel,
int  module,
int  strawlayer,
int  straw,
int  l = STRAW 
)
inline

normal constructor

Definition at line 44 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

45  : m_level(l) {
46  m_index[0] = becidtoindex(bec) ; // this is where we couild introduce a map
47  m_index[1] = layerorwheel ;
48  m_index[2] = module ;
49  m_index[3] = strawlayer ;
50  m_index[4] = straw ;
51  }

Member Function Documentation

◆ becidtoindex()

size_t TRTCond::ExpandedIdentifier::becidtoindex ( int  becid) const
inline

returns subdetector index given the barrel_ec number

Definition at line 82 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

82 { return becid<0 ? becid+2 : becid + 1 ; }

◆ becindextoid()

int TRTCond::ExpandedIdentifier::becindextoid ( size_t  becindex) const
inline

returns barrel_ec number given the subdetector index

Definition at line 85 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

85 { return becindex<2 ? int(becindex)-2 : becindex-1; }

◆ id()

int TRTCond::ExpandedIdentifier::id ( size_t  l) const
inline

returns TRT_ID index at given level

Definition at line 88 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

88 { return l==BARRELEC ? becindextoid(index(l)) : index(l) ; }

◆ index() [1/2]

size_t& TRTCond::ExpandedIdentifier::index ( size_t  l)
inline

returns index at given level

Definition at line 61 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

61 { return m_index[l-1] ; }

◆ index() [2/2]

const size_t& TRTCond::ExpandedIdentifier::index ( size_t  l) const
inline

returns const index at given level.

Note that internally there is no indexing of the DETECTOR level

Definition at line 58 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

58 { return m_index[l-1] ; }

◆ level()

size_t TRTCond::ExpandedIdentifier::level ( ) const
inline

◆ name()

const std::string TRTCond::ExpandedIdentifier::name ( size_t  l) const
inline

returns level name

Definition at line 67 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

67  {
68  static const std::string names[] = {"detector","barrelec","layer_or_wheel","module","straw_layer","straw"} ;
69  return names[l] ;
70  }

◆ print()

void ExpandedIdentifier::print ( std::ostream &  os = std::cout) const

print the object

Definition at line 11 of file InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx.

11  {
12  for(int i=BARRELEC; i<=STRAW; ++i) os << name(i) << "=" << int(id(i)) << "," ;
13  os << "level=" << level() << std::endl ;
14  }

◆ read()

void ExpandedIdentifier::read ( std::istream &  is)

read the object from file

Definition at line 30 of file InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx.

30  {
31  int bec,layer,sector,strawlayer,straw ;
32  is >> bec >> layer >> sector >> strawlayer >> straw ;
33  int level = STRAW ;
34  if( straw<0 ) { level = STRAWLAYER ; straw = 0 ; }
35  if( strawlayer<0 ) { level = MODULE ; strawlayer = 0 ; }
36  if( sector<0 ) { level = LAYERWHEEL ; sector = 0 ; }
37  if( layer<0 ) { level = BARRELEC ; layer = 0 ; }
38  if( bec<-2 ) { level = DETECTOR ; bec = -2 ; }
39  *this = TRTCond::ExpandedIdentifier( bec,layer,sector,strawlayer,straw,level ) ;
40  }

◆ write()

void ExpandedIdentifier::write ( std::ostream &  os) const

write the object to file

Definition at line 16 of file InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx.

16  {
17  int bec = level() >= BARRELEC ? id(BARRELEC) : -3 ;
18  int layer = level() >= LAYERWHEEL ? id(LAYERWHEEL) : -1 ;
19  int sector = level() >= MODULE ? id(MODULE) : -1 ;
20  int strawlayer = level() >= STRAWLAYER ? id(STRAWLAYER) : -1 ;
21  int straw = level() >= STRAW ? id(STRAW) : -1 ;
22  os << std::setiosflags(std::ios_base::right)
23  << std::setw(2) << bec
24  << std::setw(3) << layer
25  << std::setw(3) << sector
26  << std::setw(3) << strawlayer
27  << std::setw(3) << straw ;
28  }

Member Data Documentation

◆ m_index

size_t TRTCond::ExpandedIdentifier::m_index[5]
private

Index within levels higher than DETECTOR.

Definition at line 32 of file InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h.

◆ m_level

size_t TRTCond::ExpandedIdentifier::m_level
private

The documentation for this class was generated from the following files:
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
TRTCond::ExpandedIdentifier::id
int id(size_t l) const
returns TRT_ID index at given level
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:88
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
index
Definition: index.py:1
TRTCond::ExpandedIdentifier::BARRELEC
@ BARRELEC
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::ExpandedIdentifier::index
const size_t & index(size_t l) const
returns const index at given level.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:58
TRTCond::ExpandedIdentifier::m_level
size_t m_level
Granularity level.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:33
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
python.PyAthena.module
module
Definition: PyAthena.py:131
TRTCond::ExpandedIdentifier::level
size_t level() const
returns level
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:64
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.subdetectors.mmg.names
names
Definition: mmg.py:8
TRTCond::ExpandedIdentifier::STRAWLAYER
@ STRAWLAYER
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TRTCond::ExpandedIdentifier::DETECTOR
@ DETECTOR
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TRTCond::ExpandedIdentifier::becidtoindex
size_t becidtoindex(int becid) const
returns subdetector index given the barrel_ec number
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:82
TRTCond::ExpandedIdentifier::m_index
size_t m_index[5]
Index within levels higher than DETECTOR.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:32
TRTCond::ExpandedIdentifier::STRAW
@ STRAW
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::ExpandedIdentifier::becindextoid
int becindextoid(size_t becindex) const
returns barrel_ec number given the subdetector index
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:85
TRTCond::ExpandedIdentifier::LAYERWHEEL
@ LAYERWHEEL
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::ExpandedIdentifier::name
const std::string name(size_t l) const
returns level name
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:67
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
TRTCond::ExpandedIdentifier::MODULE
@ MODULE
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37