ATLAS Offline Software
Loading...
Searching...
No Matches
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 (const SG::ReadHandleKey< TileMuonReceiverContainer > &key, const EventContext &ctx)
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.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

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.

Private Attributes

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

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 11 of file TGCTMDB.cxx.

12: AthMessaging("LVL1TGC::TGCTMDB")
13{
14 for (size_t side=0; side < TGCSide::kNSide; side++) {
15 for (size_t mod=0; mod < kNTileModule; mod++) {
16 m_buffer[side][mod] = std::make_shared<TGCTMDBOut>(side, mod);
17 }
18 }
19}
AthMessaging()
Default constructor:
std::array< std::array< std::shared_ptr< TGCTMDBOut >, kNTileModule >, TGCSide::kNSide > m_buffer
Definition TGCTMDB.h:46
static constexpr unsigned int kNTileModule
Definition TGCTMDB.h:38

◆ ~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 147 of file TGCTMDB.cxx.

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

◆ getInnerTileBits()

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

Definition at line 153 of file TGCTMDB.cxx.

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

◆ getOutput() [1/2]

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

Definition at line 119 of file TGCTMDB.cxx.

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

◆ getOutput() [2/2]

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

Definition at line 113 of file TGCTMDB.cxx.

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

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ 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_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ 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 172 of file TGCTMDB.cxx.

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

◆ retrieve()

StatusCode LVL1TGC::TGCTMDB::retrieve ( const SG::ReadHandleKey< TileMuonReceiverContainer > & key,
const EventContext & ctx )

Definition at line 22 of file TGCTMDB.cxx.

24{
25 ATH_MSG_DEBUG("fillTMDB");
26
27 // clear TMDB
28 this->eraseOutput();
29
30 SG::ReadHandle<TileMuonReceiverContainer> readTileMuonReceiverContainer(key, ctx);
31 ATH_CHECK( readTileMuonReceiverContainer.isValid() );
32
33 // loop over all TileMuonReceiverObj in container
34 TileMuonReceiverContainer::const_iterator tmItr = readTileMuonReceiverContainer->begin();
35
36 const TileMuonReceiverObj * tmObj_Thresholds = *tmItr;
37 if ( (tmObj_Thresholds->GetThresholds()).size() == 4) {
38 float thresholds[4];
39 for (size_t ip=0;ip<4;ip++){
40 thresholds[ip] = (tmObj_Thresholds->GetThresholds()).at(ip);
41 }
42 ATH_MSG_DEBUG("thresholds[] :" << thresholds[0] << thresholds[1] << thresholds[2] << thresholds[3] );
43 ATH_MSG_DEBUG("type of GetThreshold : " << typeid((tmObj_Thresholds->GetThresholds())).name()
44 << " ID of GetThreshold : "
45 << tmObj_Thresholds->GetID() );
46 }
47
48
49 //clear tmobj_Threshols
50 tmObj_Thresholds = 0;
51 // m_id and decision , etc ... from
52 ++tmItr;
53
54 for ( ; tmItr != readTileMuonReceiverContainer->end(); ++tmItr) {
55
56 const TileMuonReceiverObj * tmObj = *tmItr;
57 // Tile Module
58 unsigned int moduleID = static_cast<unsigned int>(tmObj->GetID());
59 unsigned int sideID = (moduleID & 0xf00) >> 8;
60 unsigned int mod = (moduleID & 0x0ff); // 0...63
61 // TMDB decision
62 bool tile2SL[4];
63 // [0] [1] [2] [3]
64 // d5d6_hi d5d6_lo d6_hi d6_lo
65 for (size_t ip=0;ip<4;ip++){
66 tile2SL[ip] = (tmObj->GetDecision()).at(ip);
67 }
68 //if ( moduleID < 300 || (moduleID > 363 && moduleID < 400) || moduleID > 463 ||
69 if ( mod > 63 || (sideID !=3 && sideID !=4) ||
70 ((tmObj->GetDecision()).size() != 4) ) {
71 continue;
72 } else {
73
75 if (sideID == 3) {
77 } else if (sideID == 4) {
79 }
80 // setOutput(side, mod, hit56, hit6) -> hit56, 6
83 if (tile2SL[0] == true && tile2SL[1] == false) {
84 hit56 = TGCTMDBOut::TM_HIGH;
85 } else if (tile2SL[0] == false && tile2SL[1] == true) {
86 hit56 = TGCTMDBOut::TM_LOW;
87 } else if (tile2SL[0] == false && tile2SL[1] == false) {
89 }
90
91 if (tile2SL[2] == true && tile2SL[3] == false) {
93 } else if (tile2SL[2] == false && tile2SL[3] == true) {
94 hit6 = TGCTMDBOut::TM_LOW;
95 } else if (tile2SL[2] == false && tile2SL[3] == false) {
97 }
98
99 TGCTMDBOut::TileModuleHit prehit56 = this->getOutput(side, mod)->getHit56();
100 TGCTMDBOut::TileModuleHit prehit6 = this->getOutput(side, mod)->getHit6();
101 if(prehit56 != TGCTMDBOut::TM_NA && prehit56 > hit56) { hit56=prehit56; }
102 if(prehit6 != TGCTMDBOut::TM_NA && prehit6 > hit6) { hit6=prehit6; }
103
104 this->setOutput(side, mod, hit56, hit6);
105 }
106 }
107
108 return StatusCode::SUCCESS;
109}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
void setOutput(const TGCSide side, const unsigned int module, const TGCTMDBOut::TileModuleHit hit56, const TGCTMDBOut::TileModuleHit hit6)
Definition TGCTMDB.cxx:138
const std::vector< float > & GetThresholds() const
const std::vector< bool > & GetDecision() const
TGCSide
The sides of TGC (A- or C-side)

◆ 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 138 of file TGCTMDB.cxx.

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

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

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.

135{ nullptr };

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ 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: