ATLAS Offline Software
MuCTPI_MultiplicityWord_Decoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // 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"
16 #include "GaudiKernel/GaudiException.h"
17 
24  : m_multiplicityWord( multword ), m_triggerMode(mode) {
25 
26 }
27 
33 MuCTPI_MultiplicityWord_Decoder::MuCTPI_MultiplicityWord_Decoder( const uint32_t multword, const bool inclusiveTriggerMode)
34  : m_multiplicityWord( multword ), m_triggerMode(exclusive) {
35  if (inclusiveTriggerMode) m_triggerMode = inclusive;
36 }
37 
38 
43 
44  uint16_t nCand = 0;
45  if (m_triggerMode == exclusive){
46  for( uint32_t i = 0; i < LVL1::MuCTPIBits::MULT_THRESH_NUM; ++i ) {
47  nCand += this->getMultiplicity( i );
48  }
49  } else {
50  nCand = this->getMultiplicity( 0 );
51  }
52  return nCand;
53 }
54 
62 
63  if( candidateNumber >= LVL1::MuCTPIBits::MULT_THRESH_NUM ) {
64  // throw exception? issue warning?
65 
66  throw GaudiException( "MuCTPI_MultiplicityWord_Decoder::getMultiplicity> Threshold out of range",
67  "MuCTPI_MultiplicityWord_Decoder::getMultiplicity", StatusCode::FAILURE );
68  return 99;
69  }
70 
71  return ((m_multiplicityWord >> (candidateNumber * LVL1::MuCTPIBits::MULT_BITS)) &
72  LVL1::MuCTPIBits::MULT_VAL);
73 }
74 
79 
80  return ( ( m_multiplicityWord >> ((LVL1::MuCTPIBits::MULT_BCID_POS-1) * LVL1::MuCTPIBits::MULT_BITS)) &
81  LVL1::MuCTPIBits::MULT_VAL );
82 }
83 
89 
90  SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
91  if ( !msgSvc ) {
92  return;
93  }
94  MsgStream log( msgSvc, "MuCTPI_MultiplicityWord_Decoder" );
95  dumpData( log );
96 
97  return;
98 }
99 
106 
107  log << MSG::DEBUG << "=================================================" << endmsg;
108  log << MSG::DEBUG << "Candidate Multiplicity word 0x" << MSG::hex << m_multiplicityWord << MSG::dec << endmsg;
109  for( uint16_t i = 0; i < LVL1::MuCTPIBits::MULT_THRESH_NUM; ++i ) {
110  log << MSG::DEBUG << "Pt threshold " << ( i + 1 ) << ", multiplicity " << getMultiplicity( i ) << endmsg;
111  }
112  log << MSG::DEBUG << "Number of candidates: " << getNCandidates() << endmsg;
113  log << MSG::DEBUG << "MICTP BCID: 0x" << MSG::hex
114  << getBCID() << MSG::dec << " ( " << getBCID() << " )" << endmsg;
115  log << MSG::DEBUG << "=================================================" << endmsg;
116 
117  return;
118 }
MuCTPI_MultiplicityWord_Decoder::TriggerMode_t
TriggerMode_t
Possible trigger threshold modes.
Definition: MuCTPI_MultiplicityWord_Decoder.h:36
MuCTPI_MultiplicityWord_Decoder::getMultiplicity
uint16_t getMultiplicity(const uint16_t candidateNumber) const
Function returning the 3-bit candidate multiplicity for the specified threshold.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:61
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
MuCTPI_MultiplicityWord_Decoder::inclusive
@ inclusive
Definition: MuCTPI_MultiplicityWord_Decoder.h:37
MuCTPI_MultiplicityWord_Decoder.h
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Preparation.mode
mode
Definition: Preparation.py:94
MuCTPI_MultiplicityWord_Decoder::getNCandidates
uint16_t getNCandidates() const
Function returning the total number of muon candidates.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:42
MuCTPI_MultiplicityWord_Decoder::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:88
MuCTPI_Bits.h
MuCTPI_RDO.h
MuCTPI_MultiplicityWord_Decoder::exclusive
@ exclusive
Definition: MuCTPI_MultiplicityWord_Decoder.h:37
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuCTPI_MultiplicityWord_Decoder::getBCID
uint16_t getBCID() const
Function returning the 3-bit BCID fragment in the multiplicity word.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:78
MuCTPI_MultiplicityWord_Decoder::m_multiplicityWord
uint32_t m_multiplicityWord
The 32-bit multiplicity word to decode.
Definition: MuCTPI_MultiplicityWord_Decoder.h:66
MuCTPI_MultiplicityWord_Decoder::MuCTPI_MultiplicityWord_Decoder
MuCTPI_MultiplicityWord_Decoder(const uint32_t multword=0, const TriggerMode_t mode=exclusive)
Constructor.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:23
MuCTPI_MultiplicityWord_Decoder::m_triggerMode
TriggerMode_t m_triggerMode
Trigger threshold mode (inclusive/exclusive)
Definition: MuCTPI_MultiplicityWord_Decoder.h:68