ATLAS Offline Software
MuCTPI_DataWord_Decoder.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 // Local/Trigger include(s):
9 
10 // Gaudi/Athena include(s):
11 #include "GaudiKernel/Bootstrap.h"
12 #include "GaudiKernel/ISvcLocator.h"
13 #include "GaudiKernel/IMessageSvc.h"
14 #include "GaudiKernel/MsgStream.h"
15 #include "GaudiKernel/StatusCode.h"
22  : m_dataWord( dataword ) {
23 
24 }
25 
30  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_OVERFLOW_SHIFT) &
31  LVL1::MuCTPIBits::CAND_OVERFLOW_MASK);
32 }
33 
38  return ((m_dataWord >> LVL1::MuCTPIBits::ROI_OVERFLOW_SHIFT) &
39  LVL1::MuCTPIBits::ROI_OVERFLOW_MASK);
40 }
41 
46 
47  uint16_t roi = 0;
48  switch( getSectorLocation() ) {
49  case MuCTPI_RDO::ENDCAP:
50  roi = (m_dataWord >> LVL1::MuCTPIBits::ROI_SHIFT) & LVL1::MuCTPIBits::ENDCAP_ROI_MASK;
51  break;
53  roi = (m_dataWord >> LVL1::MuCTPIBits::ROI_SHIFT) & LVL1::MuCTPIBits::FORWARD_ROI_MASK;
54  break;
55  case MuCTPI_RDO::BARREL:
56  roi = (m_dataWord >> LVL1::MuCTPIBits::ROI_SHIFT) & LVL1::MuCTPIBits::BARREL_ROI_MASK;
57  break;
58  default:
59  roi = 99;
60  break;
61  }
62 
63  return roi;
64 }
65 
70 
71  uint16_t ol = 0;
72  switch( getSectorLocation() ) {
73  case MuCTPI_RDO::ENDCAP:
74  ol = (m_dataWord >> LVL1::MuCTPIBits::ENDCAP_OL_SHIFT) & LVL1::MuCTPIBits::ENDCAP_OL_MASK;
75  break;
77  ol = 0;
78  break;
79  case MuCTPI_RDO::BARREL:
80  ol = (m_dataWord >> LVL1::MuCTPIBits::BARREL_OL_SHIFT) & LVL1::MuCTPIBits::BARREL_OL_MASK;
81  break;
82  default:
83  ol = 99;
84  break;
85  }
86 
87  return ol;
88 }
89 
94 
95  if( getSectorAddress() & LVL1::MuCTPIBits::ENDCAP_ADDRESS_MASK ) {
96  return MuCTPI_RDO::ENDCAP;
97  } else if( getSectorAddress() & LVL1::MuCTPIBits::FORWARD_ADDRESS_MASK ) {
98  return MuCTPI_RDO::FORWARD;
99  } else {
100  return MuCTPI_RDO::BARREL;
101  }
102 }
103 
108  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_SECTOR_ADDRESS_SHIFT) &
109  LVL1::MuCTPIBits::CAND_SECTOR_ADDRESS_MASK);
110 }
111 
116 
118  return ((getSectorAddress() >> 1) & LVL1::MuCTPIBits::ENDCAP_SECTORID_MASK);
119  }
120  else if( getSectorLocation() == MuCTPI_RDO::BARREL ) {
121  if(newScheme)
122  return ((getSectorAddress() >> 1) & LVL1::MuCTPIBits::BARREL_SECTORID_MASK);
123  else{
124  uint16_t id = (getSectorAddress() >> 1) & LVL1::MuCTPIBits::BARREL_SECTORID_MASK;
125  if( getHemisphere() ) id += 32;
126  return id;
127  }
128  }
129  else if( getSectorLocation() == MuCTPI_RDO::FORWARD ) {
130  return ((getSectorAddress() >> 1) & LVL1::MuCTPIBits::FORWARD_SECTORID_MASK);
131  }
132  return 0;
133 }
134 
139  return (getSectorAddress() & LVL1::MuCTPIBits::SECTOR_HEMISPHERE_MASK);
140 }
141 
146  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_PT_SHIFT) &
147  LVL1::MuCTPIBits::CAND_PT_MASK);
148 }
149 
155  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_BCID_SHIFT) &
156  LVL1::MuCTPIBits::CAND_BCID_MASK);
157 }
158 
164  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_HIGHEST_PT_SHIFT) &
165  LVL1::MuCTPIBits::CAND_HIGHEST_PT_MASK);
166 }
167 
173  return ((m_dataWord >> LVL1::MuCTPIBits::CAND_SENT_ROI_SHIFT) &
174  LVL1::MuCTPIBits::CAND_SENT_ROI_MASK);
175 }
176 
181 
182  // This bit is not defined for barrel candidates:
184  return 100;
185  }
186 
187  return ( ( m_dataWord >> LVL1::MuCTPIBits::CAND_TGC_CHARGE_SIGN_SHIFT ) &
188  0x1 );
189 }
190 
195 
196  return ( ( m_dataWord >> LVL1::MuCTPIBits::CAND_VETO_SHIFT )
197  & 0x1 );
198 }
199 
205 
206  IMessageSvc* msgSvc;
207  ISvcLocator* svcLoc = Gaudi::svcLocator();
208  StatusCode sc = svcLoc->service( "MessageSvc", msgSvc );
209  if( sc.isFailure() ) {
210  return;
211  }
212  MsgStream log( msgSvc, "MuCTPI_DataWord_Decoder" );
213  dumpData( log );
214 
215  return;
216 }
217 
223 void MuCTPI_DataWord_Decoder::dumpData( MsgStream& log ) const {
224 
225  uint16_t sectorLocation = getSectorLocation();
226  std::string locString = "BARREL";
227  if( sectorLocation == MuCTPI_RDO::ENDCAP ) locString = "ENDCAP";
228  else if( sectorLocation == MuCTPI_RDO::FORWARD ) locString = "FORWARD";
229  uint16_t candHighestPt = getCandidateIsHighestPt();
230  std::string isHigh = "NO";
231  if( candHighestPt ) isHigh = "YES";
232  uint16_t candSentRoi = getSentRoi();
233  std::string sentRoi = "NO";
234  if( candSentRoi ) sentRoi = "YES";
235  uint16_t secOf = getSectorOverflow();
236  std::string ofString = "NO";
237  if( secOf ) ofString = "YES";
238  uint16_t roiOf = getRoiOverflow();
239  std::string roiString = "NO";
240  if( roiOf ) roiString = "YES";
241  uint16_t ol = getOverlapBits();
242  std::string olString = "NO";
243  if( ol ) olString = "YES";
244 
245  log << MSG::DEBUG << "Data word : 0x" << MSG::hex << m_dataWord << MSG::dec << endmsg;
246  log << MSG::DEBUG << "BCID : " << getBCID() << endmsg;
247  log << MSG::DEBUG << "Pt : " << getPt() << endmsg;
248  log << MSG::DEBUG << "Is highest Pt : " << isHigh << endmsg;
249  log << MSG::DEBUG << "RoI ID : " << getRoiNumber() << endmsg;
250  log << MSG::DEBUG << "Sent RoI : " << sentRoi << endmsg;
251  log << MSG::DEBUG << "Sector address : 0x" << MSG::hex << getSectorAddress() << MSG::dec << endmsg;
252  log << MSG::DEBUG << "Sector ID : " << getSectorID() << endmsg;
253  log << MSG::DEBUG << "Sector location : " << locString << endmsg;
254  log << MSG::DEBUG << "Sector overflow : " << ofString << endmsg;
255  log << MSG::DEBUG << "RoI overflow : " << roiString << endmsg;
256  log << MSG::DEBUG << "Overlap found : " << olString << endmsg;
257  log << MSG::DEBUG << "Hemisphere : " << getHemisphere() << endmsg;
258  log << MSG::DEBUG << "=================================================" << endmsg;
259 
260  return;
261 }
MuCTPI_DataWord_Decoder::getOverlapBits
uint16_t getOverlapBits() const
2-bit overlap bits given to the candidate by the SL
Definition: MuCTPI_DataWord_Decoder.cxx:69
MuCTPI_RDO::SectorLocation
SectorLocation
Enumeration defining the different sources for the muon candidates.
Definition: MuCTPI_RDO.h:45
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
MuCTPI_DataWord_Decoder::getVetoed
uint16_t getVetoed() const
Flag showing if the candidate was vetoed in the multiplicity sum.
Definition: MuCTPI_DataWord_Decoder.cxx:194
MuCTPI_DataWord_Decoder::getRoiNumber
uint16_t getRoiNumber() const
RoI number (sub-sector in which the candidate was detected)
Definition: MuCTPI_DataWord_Decoder.cxx:45
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
MuCTPI_DataWord_Decoder::getSectorOverflow
uint16_t getSectorOverflow() const
Flag showing whether there were more than 2 candidates in this candidate's sector.
Definition: MuCTPI_DataWord_Decoder.cxx:29
MuCTPI_DataWord_Decoder::getSectorAddress
uint16_t getSectorAddress() const
8-bit address of the sector that detected the candidate
Definition: MuCTPI_DataWord_Decoder.cxx:107
MuCTPI_RDO::BARREL
@ BARREL
Definition: MuCTPI_RDO.h:45
MuCTPI_DataWord_Decoder::MuCTPI_DataWord_Decoder
MuCTPI_DataWord_Decoder(uint32_t dataword=0)
Constructor.
Definition: MuCTPI_DataWord_Decoder.cxx:21
MuCTPI_RDO::FORWARD
@ FORWARD
Definition: MuCTPI_RDO.h:45
MuCTPI_DataWord_Decoder::getSectorLocation
MuCTPI_RDO::SectorLocation getSectorLocation() const
The system that detected the muon candidate.
Definition: MuCTPI_DataWord_Decoder.cxx:93
MuCTPI_DataWord_Decoder::getHemisphere
uint16_t getHemisphere() const
The hemisphere in which the candidate was detected.
Definition: MuCTPI_DataWord_Decoder.cxx:138
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuCTPI_DataWord_Decoder::getSectorID
uint16_t getSectorID(bool newScheme=0) const
Number of the sector that detected the candidate.
Definition: MuCTPI_DataWord_Decoder.cxx:115
MuCTPI_DataWord_Decoder::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_DataWord_Decoder.cxx:204
MuCTPI_RDO::ENDCAP
@ ENDCAP
Definition: MuCTPI_RDO.h:45
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
MuCTPI_DataWord_Decoder::getRoiOverflow
uint16_t getRoiOverflow() const
Flag showing whether there was more than 1 candidate in this candidate's RoI.
Definition: MuCTPI_DataWord_Decoder.cxx:37
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuCTPI_DataWord_Decoder::getBCID
uint16_t getBCID() const
3-bit BCID fragment saved with the candidate
Definition: MuCTPI_DataWord_Decoder.cxx:154
MuCTPI_DataWord_Decoder::getCandidateIsHighestPt
uint16_t getCandidateIsHighestPt() const
Flag showing whether the candidate had the highest pT in its sector.
Definition: MuCTPI_DataWord_Decoder.cxx:163
MuCTPI_DataWord_Decoder::getPt
uint16_t getPt() const
3-bit pT threshold of the candidate
Definition: MuCTPI_DataWord_Decoder.cxx:145
MuCTPI_DataWord_Decoder.h
MuCTPI_DataWord_Decoder::m_dataWord
uint32_t m_dataWord
The 32-bit data word to decode.
Definition: MuCTPI_DataWord_Decoder.h:86
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
MuCTPI_Bits.h
MuCTPI_DataWord_Decoder::getSentRoi
uint16_t getSentRoi() const
Flag showing whether the candidate was sent to the RoIB.
Definition: MuCTPI_DataWord_Decoder.cxx:172
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:878
MuCTPI_DataWord_Decoder::getSign
uint16_t getSign() const
Get the candidate's sign (0=negative, 1=positive, 100=undefined)
Definition: MuCTPI_DataWord_Decoder.cxx:180