ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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 (SG::ReadHandleKey< Muon::NSW_TrigRawDataContainer > key)
 
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. 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 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. More...
 

Private Attributes

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

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.

Constructor & Destructor Documentation

◆ TGCNSW() [1/2]

LVL1TGC::TGCNSW::TGCNSW ( )

Definition at line 11 of file TGCNSW.cxx.

12 : AthMessaging("LVL1TGC::TGCNSW") {
13  for (int side=0; side < 2; side++) {
14  for (int TP=0; TP < NumberOfNSWTriggerProcesser; TP++) {
15  std::vector<int> vecTP;
16  vecTP.push_back(TP);
17  m_buffer[side][TP].reset(new NSWTrigOut(side, vecTP));
18  }
19  }
20 }

◆ ~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 155 of file TGCNSW.cxx.

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

◆ getOutput()

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

Definition at line 53 of file TGCNSW.cxx.

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

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

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 164 of file TGCNSW.cxx.

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

◆ retrieve()

StatusCode LVL1TGC::TGCNSW::retrieve ( SG::ReadHandleKey< Muon::NSW_TrigRawDataContainer key)

Definition at line 22 of file TGCNSW.cxx.

22  {
23  ATH_MSG_DEBUG("retrieve");
24  this->eraseOutput();
25 
26  //The following part will be available when NSW Trigger Output is available.
27 
28  SG::ReadHandle<Muon::NSW_TrigRawDataContainer> readNSW_TrigRawDataContainer(key);
29  if(!readNSW_TrigRawDataContainer.isValid()){
30  ATH_MSG_ERROR("Cannot retrieve NSW TrigRawData Container.");
31  return StatusCode::FAILURE;
32  }
33  const Muon::NSW_TrigRawDataContainer* nsw_TrigRawDataContainer = readNSW_TrigRawDataContainer.cptr();
34  for(const Muon::NSW_TrigRawData* nsw_sector : *nsw_TrigRawDataContainer){
35  for(const Muon::NSW_TrigRawDataSegment* nsw_trk : *nsw_sector){
36  int nsw_sideId = (nsw_sector->sectorSide()=='A')?0:1;
37  this->setOutput(nsw_sideId, // side
38  nsw_sector->sectorId(), // Sector number in NSW
39  nsw_trk->rIndex(), // R-index
40  nsw_trk->phiIndex(), // Phi-index
41  nsw_trk->deltaTheta(), // Delta theta index
42  nsw_trk->lowRes(),
43  nsw_trk->phiRes(),
44  nsw_trk->monitor()); // monitoring flag
45  }
46  }
47 
48  return StatusCode::SUCCESS;
49 }

◆ 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 141 of file TGCNSW.cxx.

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

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.

◆ 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
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGC::TGCNSW::eraseOutput
void eraseOutput()
Definition: TGCNSW.cxx:155
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
Muon::NSW_TrigRawData
Definition: NSW_TrigRawData.h:15
LVL1TGCTrigger::TGCRegionType::FORWARD
@ FORWARD
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
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
Muon::NSW_TrigRawDataSegment
Definition: NSW_TrigRawDataSegment.h:15
LVL1TGC::TGCNSW::setOutput
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:141
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
LVL1TGC::TGCNSW::m_buffer
std::shared_ptr< NSWTrigOut > m_buffer[LVL1TGC::TGCSide::kNSide][NumberOfNSWTriggerProcesser]
Definition: TGCNSW.h:41
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1TGC::TGCNSW::NumberOfNSWTriggerProcesser
@ NumberOfNSWTriggerProcesser
Definition: TGCNSW.h:34
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
Muon::NSW_TrigRawDataContainer
Definition: NSW_TrigRawDataContainer.h:14
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37