ATLAS Offline Software
Loading...
Searching...
No Matches
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
33MuCTPI_MultiplicityWord_Decoder::MuCTPI_MultiplicityWord_Decoder( const uint32_t multword, const bool inclusiveTriggerMode)
35 if (inclusiveTriggerMode) m_triggerMode = inclusive;
36}
37
38
43
44 uint16_t nCand = 0;
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
61uint16_t MuCTPI_MultiplicityWord_Decoder::getMultiplicity( const uint16_t candidateNumber ) const {
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)) &
73}
74
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
105void MuCTPI_MultiplicityWord_Decoder::dumpData( MsgStream& log ) const {
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}
#define endmsg
void dumpData() const
Function dumping the stored information to the message stream.
uint16_t getBCID() const
Function returning the 3-bit BCID fragment in the multiplicity word.
uint16_t getMultiplicity(const uint16_t candidateNumber) const
Function returning the 3-bit candidate multiplicity for the specified threshold.
uint16_t getNCandidates() const
Function returning the total number of muon candidates.
uint32_t m_multiplicityWord
The 32-bit multiplicity word to decode.
MuCTPI_MultiplicityWord_Decoder(const uint32_t multword=0, const TriggerMode_t mode=exclusive)
Constructor.
TriggerMode_t m_triggerMode
Trigger threshold mode (inclusive/exclusive)
TriggerMode_t
Possible trigger threshold modes.
static constexpr uint32_t MULT_BITS
Number of multiplicity bits reserved per threshold.
Definition MuCTPI_Bits.h:16
static constexpr uint32_t MULT_THRESH_NUM
Definition MuCTPI_Bits.h:19
static constexpr uint32_t MULT_BCID_POS
Definition MuCTPI_Bits.h:22
static constexpr uint32_t MULT_VAL
Binary 111 representing the maximal multiplicity value for a given threshold.
Definition MuCTPI_Bits.h:14