ATLAS Offline Software
InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <iomanip>
7 
8 namespace TRTCond
9 {
10 
11  void ExpandedIdentifier::print(std::ostream& os) const {
12  for(int i=BARRELEC; i<=STRAW; ++i) os << name(i) << "=" << int(id(i)) << "," ;
13  os << "level=" << level() << std::endl ;
14  }
15 
16  void ExpandedIdentifier::write( std::ostream& os) const {
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  }
29 
30  void ExpandedIdentifier::read( std::istream& is) {
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  }
41 
42 }
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
TRTCond::ExpandedIdentifier::BARRELEC
@ BARRELEC
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
ExpandedIdentifier.h
TRTCond::ExpandedIdentifier::print
void print(std::ostream &os=std::cout) const
print the object
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx:11
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:92
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::STRAW
@ STRAW
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::ExpandedIdentifier::read
void read(std::istream &is)
read the object from file
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx:30
TRTCond
Definition: BasicRtRelation.cxx:8
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::write
void write(std::ostream &os) const
write the object to file
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/src/ExpandedIdentifier.cxx:16
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