ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LVL1TGC::TGCTMDB Class Reference

#include <TGCTMDB.h>

Inheritance diagram for LVL1TGC::TGCTMDB:
Collaboration diagram for LVL1TGC::TGCTMDB:

Public Member Functions

 TGCTMDB ()
 
virtual ~TGCTMDB ()=default
 
 TGCTMDB (const TGCTMDB &right)=delete
 
TGCTMDBoperator= (const TGCTMDB &right)=delete
 
int operator== (const TGCTMDB &right) const =delete
 
int operator!= (const TGCTMDB &right) const =delete
 
StatusCode retrieve (SG::ReadHandleKey< TileMuonReceiverContainer > key)
 
std::shared_ptr< const TGCTMDBOutgetOutput (const TGCSide side, unsigned int moduleID) const
 
std::shared_ptr< const TGCTMDBOutgetOutput (const TGCSide side, int sectorID, unsigned int mod) const
 
int getInnerTileBits (const TGCSide side, int sectorID) const
 
void print () const
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void setOutput (const TGCSide side, const unsigned int module, const TGCTMDBOut::TileModuleHit hit56, const TGCTMDBOut::TileModuleHit hit6)
 
void eraseOutput ()
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::array< std::array< std::shared_ptr< TGCTMDBOut >, kNTileModule >, TGCSide::kNSide > m_buffer
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Static Private Attributes

static constexpr unsigned int kNTileModule = 64
 

Detailed Description

Definition at line 19 of file TGCTMDB.h.

Constructor & Destructor Documentation

◆ TGCTMDB() [1/2]

LVL1TGC::TGCTMDB::TGCTMDB ( )

Definition at line 9 of file TGCTMDB.cxx.

10 : AthMessaging("LVL1TGC::TGCTMDB")
11 {
12  for (size_t side=0; side < TGCSide::kNSide; side++) {
13  for (size_t mod=0; mod < kNTileModule; mod++) {
14  m_buffer[side][mod].reset(new TGCTMDBOut(side, mod));
15  }
16  }
17 }

◆ ~TGCTMDB()

virtual LVL1TGC::TGCTMDB::~TGCTMDB ( )
virtualdefault

◆ TGCTMDB() [2/2]

LVL1TGC::TGCTMDB::TGCTMDB ( const TGCTMDB right)
delete

Member Function Documentation

◆ eraseOutput()

void LVL1TGC::TGCTMDB::eraseOutput ( )
private

Definition at line 148 of file TGCTMDB.cxx.

148  {
149  for (auto &perside : m_buffer) {
150  for (auto &mod : perside) mod->clear();
151  }
152 }

◆ getInnerTileBits()

int LVL1TGC::TGCTMDB::getInnerTileBits ( const TGCSide  side,
int  sectorID 
) const

Definition at line 154 of file TGCTMDB.cxx.

155 {
156  int inner_tile = 0;
157 
158  for (int ii = 0; ii < 4; ii++) {
159  TGCTMDBOut::TileModuleHit hit56 = getOutput(side, sector, ii)->getHit56();
160  TGCTMDBOut::TileModuleHit hit6 = getOutput(side, sector, ii)->getHit6();
161 
162  int tmp_56 = (hit56 == TGCTMDBOut::TM_LOW || hit56 == TGCTMDBOut::TM_HIGH) ? 1 : 0;
163  int tmp_6 = (hit6 == TGCTMDBOut::TM_LOW || hit6 == TGCTMDBOut::TM_HIGH) ? 1 : 0;
164 
165  int tmp_all = (tmp_6 << 1) | (tmp_56);
166 
167  inner_tile |= (tmp_all << (ii*2));
168  }
169 
170  return inner_tile;
171 }

◆ getOutput() [1/2]

std::shared_ptr< const TGCTMDBOut > LVL1TGC::TGCTMDB::getOutput ( const TGCSide  side,
int  sectorID,
unsigned int  mod 
) const

Definition at line 120 of file TGCTMDB.cxx.

121 {
122  if (side >= TGCSide::kNSide) return 0;
123  if ((sector<0)||(sector>47)) return 0;
124  if (mod>3) return 0;
125  int octant = sector / 6;
126  int sec = sector % 6;
127  int offset = 0;
128  if (sec==0) offset = -4;
129  else if (sec==1) offset = -4; // same SL board as sec#0
130  else if (sec==2) offset = 0;
131  else if (sec==3) offset = 0; // same SL board as sec#1
132  else if (sec==4) offset = 2;
133  else if (sec==5) offset = 2; // same SL board as sec#2
134  int moduleID = (octant*(kNTileModule/8) + offset + kNTileModule) % kNTileModule;
135  moduleID = (moduleID + mod) % kNTileModule;
136  return m_buffer[side][moduleID];
137 }

◆ getOutput() [2/2]

std::shared_ptr< const TGCTMDBOut > LVL1TGC::TGCTMDB::getOutput ( const TGCSide  side,
unsigned int  moduleID 
) const

Definition at line 114 of file TGCTMDB.cxx.

114  {
115  if (side >= TGCSide::kNSide) return 0;
116  if (mod >= kNTileModule) return 0;
117  return m_buffer[side][mod];
118 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ operator!=()

int LVL1TGC::TGCTMDB::operator!= ( const TGCTMDB right) const
delete

◆ operator=()

TGCTMDB& LVL1TGC::TGCTMDB::operator= ( const TGCTMDB right)
delete

◆ operator==()

int LVL1TGC::TGCTMDB::operator== ( const TGCTMDB right) const
delete

◆ print()

void LVL1TGC::TGCTMDB::print ( ) const

Definition at line 173 of file TGCTMDB.cxx.

173  {
174  for (auto &perside : m_buffer) {
175  for (auto &mod : perside) mod->print();
176  }
177 }

◆ retrieve()

StatusCode LVL1TGC::TGCTMDB::retrieve ( SG::ReadHandleKey< TileMuonReceiverContainer key)

Definition at line 20 of file TGCTMDB.cxx.

21 {
22  ATH_MSG_DEBUG("fillTMDB");
23 
24  // clear TMDB
25  this->eraseOutput();
26 
27  SG::ReadHandle<TileMuonReceiverContainer> readTileMuonReceiverContainer(key);
28  if(!readTileMuonReceiverContainer.isValid()){
29  ATH_MSG_ERROR("Cannot retrieve Tile Muon Receiver Container.");
30  return StatusCode::FAILURE;
31  }
32  const TileMuonReceiverContainer* tileMuRecCont = readTileMuonReceiverContainer.cptr();
33 
34  // loop over all TileMuonReceiverObj in container
35  TileMuonReceiverContainer::const_iterator tmItr = tileMuRecCont->begin();
36 
37  const TileMuonReceiverObj * tmObj_Thresholds = *tmItr;
38  if ( (tmObj_Thresholds->GetThresholds()).size() == 4) {
39  float thresholds[4];
40  for (size_t ip=0;ip<4;ip++){
41  thresholds[ip] = (tmObj_Thresholds->GetThresholds()).at(ip);
42  }
43  ATH_MSG_DEBUG("thresholds[] :" << thresholds[0] << thresholds[1] << thresholds[2] << thresholds[3] );
44  ATH_MSG_DEBUG("type of GetThreshold : " << typeid((tmObj_Thresholds->GetThresholds())).name()
45  << " ID of GetThreshold : "
46  << tmObj_Thresholds->GetID() );
47  }
48 
49 
50  //clear tmobj_Threshols
51  tmObj_Thresholds = 0;
52  // m_id and decision , etc ... from
53  ++tmItr;
54 
55  for ( ; tmItr != tileMuRecCont->end(); ++tmItr) {
56 
57  const TileMuonReceiverObj * tmObj = *tmItr;
58  // Tile Module
59  unsigned int moduleID = static_cast<unsigned int>(tmObj->GetID());
60  unsigned int sideID = (moduleID & 0xf00) >> 8;
61  unsigned int mod = (moduleID & 0x0ff); // 0...63
62  // TMDB decision
63  bool tile2SL[4];
64  // [0] [1] [2] [3]
65  // d5d6_hi d5d6_lo d6_hi d6_lo
66  for (size_t ip=0;ip<4;ip++){
67  tile2SL[ip] = (tmObj->GetDecision()).at(ip);
68  }
69  //if ( moduleID < 300 || (moduleID > 363 && moduleID < 400) || moduleID > 463 ||
70  if ( mod > 63 || (sideID !=3 && sideID !=4) ||
71  ((tmObj->GetDecision()).size() != 4) ) {
72  continue;
73  } else {
74 
76  if (sideID == 3) {
78  } else if (sideID == 4) {
80  }
81  // setOutput(side, mod, hit56, hit6) -> hit56, 6
84  if (tile2SL[0] == true && tile2SL[1] == false) {
85  hit56 = TGCTMDBOut::TM_HIGH;
86  } else if (tile2SL[0] == false && tile2SL[1] == true) {
87  hit56 = TGCTMDBOut::TM_LOW;
88  } else if (tile2SL[0] == false && tile2SL[1] == false) {
89  hit56 = TGCTMDBOut::TM_NOHIT;
90  }
91 
92  if (tile2SL[2] == true && tile2SL[3] == false) {
93  hit6 = TGCTMDBOut::TM_HIGH;
94  } else if (tile2SL[2] == false && tile2SL[3] == true) {
95  hit6 = TGCTMDBOut::TM_LOW;
96  } else if (tile2SL[2] == false && tile2SL[3] == false) {
97  hit6 = TGCTMDBOut::TM_NOHIT;
98  }
99 
100  TGCTMDBOut::TileModuleHit prehit56 = this->getOutput(side, mod)->getHit56();
101  TGCTMDBOut::TileModuleHit prehit6 = this->getOutput(side, mod)->getHit6();
102  if(prehit56 != TGCTMDBOut::TM_NA && prehit56 > hit56) { hit56=prehit56; }
103  if(prehit6 != TGCTMDBOut::TM_NA && prehit6 > hit6) { hit6=prehit6; }
104 
105  this->setOutput(side, mod, hit56, hit6);
106  }
107  }
108 
109  return StatusCode::SUCCESS;
110 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setOutput()

void LVL1TGC::TGCTMDB::setOutput ( const TGCSide  side,
const unsigned int  module,
const TGCTMDBOut::TileModuleHit  hit56,
const TGCTMDBOut::TileModuleHit  hit6 
)
private

Definition at line 139 of file TGCTMDB.cxx.

142 {
143  if (module>=kNTileModule) return;
144  m_buffer.at(side)[module]->setHit56(hit56);
145  m_buffer.at(side)[module]->setHit6(hit6);
146 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ kNTileModule

constexpr unsigned int LVL1TGC::TGCTMDB::kNTileModule = 64
staticconstexprprivate

Definition at line 38 of file TGCTMDB.h.

◆ m_buffer

std::array<std::array<std::shared_ptr<TGCTMDBOut>, kNTileModule>, TGCSide::kNSide> LVL1TGC::TGCTMDB::m_buffer
private

Definition at line 46 of file TGCTMDB.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
LVL1TGC::TGCTMDB::getOutput
std::shared_ptr< const TGCTMDBOut > getOutput(const TGCSide side, unsigned int moduleID) const
Definition: TGCTMDB.cxx:114
LVL1TGC::CSIDE
@ CSIDE
Definition: TGCNumbering.h:15
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:134
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
LVL1TGC::TGCTMDBOut::TM_NOHIT
@ TM_NOHIT
Definition: TGCTMDBOut.h:13
LVL1TGC::TGCTMDBOut::TM_HIGH
@ TM_HIGH
Definition: TGCTMDBOut.h:13
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
TileMuonReceiverObj::GetDecision
const std::vector< bool > & GetDecision() const
Definition: TileMuonReceiverObj.h:109
TileMuonReceiverObj::GetThresholds
const std::vector< float > & GetThresholds() const
Definition: TileMuonReceiverObj.h:110
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
LVL1TGC::TGCTMDBOut::TM_NA
@ TM_NA
Definition: TGCTMDBOut.h:13
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
LVL1TGC::TGCTMDB::eraseOutput
void eraseOutput()
Definition: TGCTMDB.cxx:148
TileMuonReceiverObj::GetID
int GetID() const
Definition: TileMuonReceiverObj.h:105
LVL1TGC::ASIDE
@ ASIDE
Definition: TGCNumbering.h:14
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TileMuonReceiverObj
Definition: TileMuonReceiverObj.h:28
LVL1TGC::TGCTMDBOut::TM_LOW
@ TM_LOW
Definition: TGCTMDBOut.h:13
LVL1TGC::TGCTMDB::m_buffer
std::array< std::array< std::shared_ptr< TGCTMDBOut >, kNTileModule >, TGCSide::kNSide > m_buffer
Definition: TGCTMDB.h:46
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1TGC::kNSide
@ kNSide
Definition: TGCNumbering.h:16
LVL1TGC::TGCTMDBOut::TileModuleHit
TileModuleHit
Definition: TGCTMDBOut.h:13
LVL1TGC::TGCSide
TGCSide
The sides of TGC (A- or C-side)
Definition: TGCNumbering.h:13
LVL1TGC::TGCTMDB::setOutput
void setOutput(const TGCSide side, const unsigned int module, const TGCTMDBOut::TileModuleHit hit56, const TGCTMDBOut::TileModuleHit hit6)
Definition: TGCTMDB.cxx:139
LVL1TGC::TGCTMDB::kNTileModule
static constexpr unsigned int kNTileModule
Definition: TGCTMDB.h:38
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
TileContainer
Definition: TileContainer.h:38
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37