ATLAS Offline Software
TGCBIS78.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "TrigT1TGC/TGCBIS78.h"
8 #include <iostream> // will be removed
9 
10 namespace LVL1TGC {
11 
13 : AthMessaging("LVL1TGC::TGCBIS78") {
14  for (size_t PadBoard=0; PadBoard < kNPadBoards; PadBoard++) {
15  std::vector<int> vecPadBoard;
16  vecPadBoard.push_back(PadBoard);
17  m_buffer[PadBoard].reset(new BIS78TrigOut(vecPadBoard));
18  }
19 }
20 
21 
23  ATH_MSG_DEBUG("retrieve");
24 
25  this->eraseOutput();
26 
27  //The following part will be available when RPC BIS78 Trigger Output is available.
28  SG::ReadHandle<Muon::RpcBis78_TrigRawDataContainer> readBIS78_TrigRawDataContainer(key);
29  if(!readBIS78_TrigRawDataContainer.isValid()){
30  ATH_MSG_ERROR("Cannot retrieve RPC BIS78 TrigRawData Container.");
31  return StatusCode::FAILURE;
32  }
33  const Muon::RpcBis78_TrigRawDataContainer* bis78_TrigRawDataContainer = readBIS78_TrigRawDataContainer.cptr();
34  for(const Muon::RpcBis78_TrigRawData* bis78_sector : *bis78_TrigRawDataContainer){
35  if ( bis78_sector->sideId() != 1 ) continue; // BIS78 is only in A side!
36  for(const Muon::RpcBis78_TrigRawDataSegment* bis78_hit : *bis78_sector){
37  this->setOutput(bis78_sector->sectorId(),
38  bis78_hit->etaIndex(), // Eta-index
39  bis78_hit->phiIndex(), // Phi-index
40  bis78_hit->deltaEta(), // Delta eta
41  bis78_hit->deltaPhi(), // Delta phi
42  bis78_hit->flag3over3Eta(), //
43  bis78_hit->flag3over3Phi() );
44  }
45  }
46 
47  return StatusCode::SUCCESS;
48 }
49 
50 
51 std::shared_ptr<const BIS78TrigOut> TGCBIS78::getOutput(int TGC_TriggerSector) const
52 {
53  std::shared_ptr<BIS78TrigOut> trigBIS78_output;
54  trigBIS78_output.reset(new BIS78TrigOut());
55  trigBIS78_output->clear();
56  if ( TGC_TriggerSector<0 || TGC_TriggerSector>47 ) return 0;
57  int BIS78_TriggerSect = (TGC_TriggerSector - 2)/6;
58  if(TGC_TriggerSector < 2) BIS78_TriggerSect=7;
59  if(BIS78_TriggerSect>=0 && BIS78_TriggerSect<=7){
60  *trigBIS78_output+=*m_buffer[BIS78_TriggerSect];
61  }
62 
63  return trigBIS78_output;
64 }
65 
66 void TGCBIS78::setOutput(unsigned int BIS78PadBoard, uint8_t BIS78eta_6bit, uint8_t BIS78phi_6bit, uint8_t BIS78Deta_3bit, uint8_t BIS78Dphi_3bit, uint8_t BIS78flag3over3eta_1bit, uint8_t BIS78flag3over3phi_1bit) {
67 
68  if (BIS78PadBoard >= kNPadBoards) return;
69  m_buffer[BIS78PadBoard]->setBIS78PadBoard(BIS78PadBoard);
70  m_buffer[BIS78PadBoard]->setEta(BIS78eta_6bit);
71  m_buffer[BIS78PadBoard]->setPhi(BIS78phi_6bit);
72  m_buffer[BIS78PadBoard]->setDeta(BIS78Deta_3bit);
73  m_buffer[BIS78PadBoard]->setDphi(BIS78Dphi_3bit);
74  m_buffer[BIS78PadBoard]->setflag3over3eta(BIS78flag3over3eta_1bit);
75  m_buffer[BIS78PadBoard]->setflag3over3phi(BIS78flag3over3phi_1bit);
76 }
77 
78 
80 {
81  for (size_t idx=0; idx < kNPadBoards; idx++){
82  m_buffer[idx]->clear();
83  }
84 }
85 
86 void TGCBIS78::print() const
87 {
88  for (size_t idx=0; idx < kNPadBoards; idx++){
89  m_buffer[idx]->print();
90  }
91 }
92 
93 
94 } // end of namespace
LVL1TGC::TGCBIS78::m_buffer
std::shared_ptr< BIS78TrigOut > m_buffer[kNPadBoards]
Definition: TGCBIS78.h:43
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LVL1TGC::TGCBIS78::print
void print() const
Definition: TGCBIS78.cxx:86
LVL1TGC::BIS78TrigOut
Definition: BIS78TrigOut.h:16
SG::ReadHandleKey< Muon::RpcBis78_TrigRawDataContainer >
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LVL1TGC::TGCBIS78::setOutput
void setOutput(unsigned int BIS78PadBoard, uint8_t BIS78eta_6bit, uint8_t BIS78phi_6bit, uint8_t BIS78Deta_3bit, uint8_t BIS78Dphi_3bit, uint8_t BIS78flag3over3eta_1bit, uint8_t BIS78flag3over3phi_1bit)
Definition: TGCBIS78.cxx:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LVL1TGC
Definition: BigWheelCoincidenceLUT.cxx:20
TGCBIS78.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
Muon::RpcBis78_TrigRawDataContainer
Definition: RpcBis78_TrigRawDataContainer.h:21
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
BIS78TrigOut.h
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1TGC::TGCBIS78::eraseOutput
void eraseOutput()
Definition: TGCBIS78.cxx:79
LVL1TGC::TGCBIS78::kNPadBoards
static constexpr unsigned int kNPadBoards
Definition: TGCBIS78.h:40
Muon::RpcBis78_TrigRawData
Definition: RpcBis78_TrigRawData.h:22
LVL1TGC::TGCBIS78::retrieve
StatusCode retrieve(SG::ReadHandleKey< Muon::RpcBis78_TrigRawDataContainer > key)
Definition: TGCBIS78.cxx:22
LVL1TGC::TGCBIS78::getOutput
std::shared_ptr< const BIS78TrigOut > getOutput(int TGC_TriggerSector) const
Definition: TGCBIS78.cxx:51
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
LVL1TGC::TGCBIS78::TGCBIS78
TGCBIS78()
Definition: TGCBIS78.cxx:12
Muon::RpcBis78_TrigRawDataSegment
Definition: RpcBis78_TrigRawDataSegment.h:21