ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1TGC::TGCNSW Class Reference

#include <TGCNSW.h>

Inheritance diagram for LVL1TGC::TGCNSW:
Collaboration diagram for LVL1TGC::TGCNSW:

Public Member Functions

 TGCNSW ()
virtual ~TGCNSW ()=default
 TGCNSW (const TGCNSW &right)=delete
const TGCNSWoperator= (const TGCNSW &right)=delete
bool operator== (const TGCNSW &right) const =delete
bool operator!= (const TGCNSW &right) const =delete
StatusCode retrieve (const SG::ReadHandleKey< Muon::NSW_TrigRawDataContainer > &key, const EventContext &ctx)
std::shared_ptr< const NSWTrigOutgetOutput (LVL1TGCTrigger::TGCRegionType region, int side, int TGC_TriggerSector) 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 Types

enum  { NumberOfNSWTriggerProcesser = 16 }

Private Member Functions

void setOutput (int side, int NSWTriggerProcesser, uint8_t NSWeta_8bit, uint8_t NSWphi_6bit, uint8_t NSWDtheta_5bit, bool lowRes, bool phiRes, bool NSWmonitor)
void eraseOutput ()
void print () const
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::shared_ptr< NSWTrigOutm_buffer [LVL1TGC::TGCSide::kNSide][NumberOfNSWTriggerProcesser]
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)

Detailed Description

Definition at line 21 of file TGCNSW.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
NumberOfNSWTriggerProcesser 

Definition at line 34 of file TGCNSW.h.

@ NumberOfNSWTriggerProcesser
Definition TGCNSW.h:34

Constructor & Destructor Documentation

◆ TGCNSW() [1/2]

LVL1TGC::TGCNSW::TGCNSW ( )

Definition at line 14 of file TGCNSW.cxx.

15: AthMessaging("LVL1TGC::TGCNSW") {
16 for (int side=0; side < 2; side++) {
17 for (int TP=0; TP < NumberOfNSWTriggerProcesser; TP++) {
18 m_buffer[side][TP] = std::make_shared<NSWTrigOut>(side, std::vector<int>{TP});
19 }
20 }
21}
AthMessaging()
Default constructor:
std::shared_ptr< NSWTrigOut > m_buffer[LVL1TGC::TGCSide::kNSide][NumberOfNSWTriggerProcesser]
Definition TGCNSW.h:41

◆ ~TGCNSW()

virtual LVL1TGC::TGCNSW::~TGCNSW ( )
virtualdefault

◆ TGCNSW() [2/2]

LVL1TGC::TGCNSW::TGCNSW ( const TGCNSW & right)
delete

Member Function Documentation

◆ eraseOutput()

void LVL1TGC::TGCNSW::eraseOutput ( )
private

Definition at line 152 of file TGCNSW.cxx.

153{
154 for(int idx1=0; idx1<2; idx1++){
155 for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){
156 m_buffer[idx1][idx2]->clear();
157 }
158 }
159}

◆ getOutput()

std::shared_ptr< const NSWTrigOut > LVL1TGC::TGCNSW::getOutput ( LVL1TGCTrigger::TGCRegionType region,
int side,
int TGC_TriggerSector ) const

Definition at line 52 of file TGCNSW.cxx.

53{
54 auto indexIsOk = [this](int idx)->bool{
55 if (not ((idx >=0 ) and (idx < NumberOfNSWTriggerProcesser))){
56 ATH_MSG_ERROR("index out of range in TGCNSW::getOutput");
57 return false;
58 }
59 return true;
60 };
61
62 auto trigNSW_output = std::make_shared<NSWTrigOut>();
63 if ( (side<0)||(side>1) ) return 0;
65 if ( TGC_TriggerSector<0 || TGC_TriggerSector>47 ) return 0;
66
67 int temp=int((TGC_TriggerSector-2)/6);
68 int NSW_TriggerSector=temp*2+int((TGC_TriggerSector-1-6*temp)/5);
69 if(TGC_TriggerSector==0 || TGC_TriggerSector==1) {
70 NSW_TriggerSector=15;
71 }
72
73 //
74 // SL input 0-1
75 if (not indexIsOk(NSW_TriggerSector)) return nullptr;
76 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector];
77 // SL input 2-3
78 if ( NSW_TriggerSector == 15 ) {
79 *trigNSW_output+=*m_buffer[side][0];
80 } else {
81 if (not indexIsOk(NSW_TriggerSector + 1)) return nullptr;
82 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector+1];
83 }
84
85 if( !(TGC_TriggerSector%6==4 || TGC_TriggerSector%6==5) ){
86 return trigNSW_output;
87 }
88
90 if ( NSW_TriggerSector==14 ) {
92 *trigNSW_output+=*m_buffer[side][0];
93 } else {
95 if (not indexIsOk(NSW_TriggerSector + 2)) return nullptr;
96 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector+2];
97 }
98
99 return trigNSW_output;
100 }
101
103 if ( TGC_TriggerSector<0 || TGC_TriggerSector>23 ) return 0;
104
106 int temp=int((TGC_TriggerSector-4)/6);
107 int NSW_TriggerSector=temp*4+int((TGC_TriggerSector-6*temp-4)/2)+2;
108 if(TGC_TriggerSector==0 || TGC_TriggerSector==1)
109 NSW_TriggerSector=15;
110 else if(TGC_TriggerSector==2 || TGC_TriggerSector==3)
111 NSW_TriggerSector=0;
112
114 if (not indexIsOk(NSW_TriggerSector)) return nullptr;
115 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector];
117 if(TGC_TriggerSector==0 || TGC_TriggerSector==1){
118 *trigNSW_output+=*m_buffer[side][0];
119 *trigNSW_output+=*m_buffer[side][1];
120 }else if(TGC_TriggerSector==22 || TGC_TriggerSector==23){
121 if (not indexIsOk(NSW_TriggerSector + 1)) return nullptr;
122 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector+1];
123 *trigNSW_output+=*m_buffer[side][0];
124 }else{
125 if (not indexIsOk(NSW_TriggerSector + 2)) return nullptr;
126 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector+1];
127 *trigNSW_output+=*m_buffer[side][NSW_TriggerSector+2];
128 }
129
130 return trigNSW_output;
131 }
132
133
134 return 0;
135}
#define ATH_MSG_ERROR(x)

◆ 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!=()

bool LVL1TGC::TGCNSW::operator!= ( const TGCNSW & right) const
delete

◆ operator=()

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

◆ operator==()

bool LVL1TGC::TGCNSW::operator== ( const TGCNSW & right) const
delete

◆ print()

void LVL1TGC::TGCNSW::print ( ) const
private

Definition at line 161 of file TGCNSW.cxx.

162{
163 for(int idx1=0; idx1<2; idx1++){
164 for (int idx2=0; idx2<NumberOfNSWTriggerProcesser; idx2++){
165 m_buffer[idx1][idx2]->print();
166 }
167 }
168}

◆ retrieve()

StatusCode LVL1TGC::TGCNSW::retrieve ( const SG::ReadHandleKey< Muon::NSW_TrigRawDataContainer > & key,
const EventContext & ctx )

Definition at line 23 of file TGCNSW.cxx.

24 {
25 ATH_MSG_DEBUG("retrieve");
26 this->eraseOutput();
27
28 //The following part will be available when NSW Trigger Output is available.
29
30 SG::ReadHandle<Muon::NSW_TrigRawDataContainer> readNSW_TrigRawDataContainer(key, ctx);
31 ATH_CHECK( readNSW_TrigRawDataContainer.isValid() );
32
33 for(const Muon::NSW_TrigRawData* nsw_sector : *readNSW_TrigRawDataContainer){
34 for(const Muon::NSW_TrigRawDataSegment* nsw_trk : *nsw_sector){
35 int nsw_sideId = (nsw_sector->sectorSide()=='A')?0:1;
36 this->setOutput(nsw_sideId, // side
37 nsw_sector->sectorId(), // Sector number in NSW
38 nsw_trk->rIndex(), // R-index
39 nsw_trk->phiIndex(), // Phi-index
40 nsw_trk->deltaTheta(), // Delta theta index
41 nsw_trk->lowRes(),
42 nsw_trk->phiRes(),
43 nsw_trk->monitor()); // monitoring flag
44 }
45 }
46
47 return StatusCode::SUCCESS;
48}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
void setOutput(int side, int NSWTriggerProcesser, uint8_t NSWeta_8bit, uint8_t NSWphi_6bit, uint8_t NSWDtheta_5bit, bool lowRes, bool phiRes, bool NSWmonitor)
Definition TGCNSW.cxx:138
void eraseOutput()
Definition TGCNSW.cxx:152

◆ 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::TGCNSW::setOutput ( int side,
int NSWTriggerProcesser,
uint8_t NSWeta_8bit,
uint8_t NSWphi_6bit,
uint8_t NSWDtheta_5bit,
bool lowRes,
bool phiRes,
bool NSWmonitor )
private

Definition at line 138 of file TGCNSW.cxx.

139{
140 if ( (side<0)||(side>1) ) return; //side 0::Aside 1::Cside
141 if ( (NSWTriggerProcesser<0) || (NSWTriggerProcesser>=NumberOfNSWTriggerProcesser) ) return;
142 m_buffer[side][NSWTriggerProcesser]->setSide(side);
143 m_buffer[side][NSWTriggerProcesser]->setNSWTriggerProcessor(NSWTriggerProcesser);
144 m_buffer[side][NSWTriggerProcesser]->setEta(NSWeta_8bit);
145 m_buffer[side][NSWTriggerProcesser]->setPhi(NSWphi_6bit);
146 m_buffer[side][NSWTriggerProcesser]->setDtheta(NSWDtheta_5bit);
147 m_buffer[side][NSWTriggerProcesser]->setLowRes(lowRes);
148 m_buffer[side][NSWTriggerProcesser]->setPhiRes(phiRes);
149 m_buffer[side][NSWTriggerProcesser]->setMonitor(NSWmonitor);
150}

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.

◆ m_buffer

std::shared_ptr<NSWTrigOut> LVL1TGC::TGCNSW::m_buffer[LVL1TGC::TGCSide::kNSide][NumberOfNSWTriggerProcesser]
private

Definition at line 41 of file TGCNSW.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: