ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L0MuonNSW
src
NSWSimulation.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
NSWSimulation.h
"
6
7
namespace
L0Muon
{
8
9
StatusCode
NSWSimulation::initialize
() {
10
ATH_MSG_DEBUG
(
"Initializing "
<< name() <<
"..."
);
11
12
ATH_CHECK
(
m_keyMmDigit
.initialize());
13
ATH_CHECK
(
m_keySTgcDigit
.initialize());
14
16
ATH_CHECK
(
m_outputKey
.initialize());
17
19
if
(!
m_monTool
.empty())
ATH_CHECK
(
m_monTool
.retrieve());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
NSWSimulation::execute
(
const
EventContext& ctx)
const
{
25
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
26
27
SG::ReadHandle<MmDigitContainer>
mmDigits(
m_keyMmDigit
, ctx);
28
if
( !mmDigits.
isValid
() ){
29
ATH_MSG_ERROR
(
"Cannot retrieve MmDigitContainer"
);
30
return
StatusCode::FAILURE;
31
}
32
33
SG::ReadHandle<sTgcDigitContainer>
stgcDigits(
m_keySTgcDigit
, ctx);
34
if
(!stgcDigits.
isValid
()) {
35
ATH_MSG_ERROR
(
"Failed to retrieve the sTGC Digit container"
);
36
return
StatusCode::FAILURE;
37
}
38
39
ATH_MSG_DEBUG
(
"Number of MM Digits: "
<< mmDigits->size());
40
ATH_MSG_DEBUG
(
"Number of sTGC Digits: "
<< stgcDigits->size());
41
ATH_MSG_DEBUG
(
"Number of NSW Digits: "
<< (mmDigits->size() + stgcDigits->size()));
42
44
auto
nMMDigits =
Monitored::Scalar<unsigned int>
(
"nMMDigits"
, mmDigits->size() );
45
auto
nsTGCDigits =
Monitored::Scalar<unsigned int>
(
"nsTGCDigits"
, stgcDigits->size() );
46
Monitored::Group
(
m_monTool
, nMMDigits, nsTGCDigits);
47
48
SG::WriteHandle<xAOD::NSWCandDataContainer>
output(
m_outputKey
, ctx);
49
50
auto
container = std::make_unique<xAOD::NSWCandDataContainer>();
51
auto
auxContainer = std::make_unique<xAOD::NSWCandDataAuxContainer>();
52
container->
setStore
(auxContainer.get());
53
55
xAOD::NSWCandData
* cand = container->push_back(std::make_unique<xAOD::NSWCandData>());
56
cand->
setBCID
(ctx.eventID().bunch_crossing_id());
57
cand->
setNSegments
(2);
58
cand->
setOverflow
(
false
);
59
cand->
setBoardId
(1);
60
cand->
setFiberId
(0);
61
62
// Push Segment #0
63
cand->
addSegment
(100, 50, 2, 4);
64
65
// Push Segment #1
66
cand->
addSegment
(250, 120, 5, 3);
67
68
// Read Segment #0 properties (Index 0)
69
uint16_t eta0 = cand->
segEtaIndex
(0);
70
uint16_t phi0 = cand->
segPhiIndex
(0);
71
uint8_t dth0 = cand->
segDeltaThetaIndex
(0);
72
uint8_t qual0 = cand->
segQuality
(0);
73
74
// Read Segment #1 properties (Index 1)
75
uint16_t eta1 = cand->
segEtaIndex
(1);
76
uint16_t phi1 = cand->
segPhiIndex
(1);
77
uint8_t dth1 = cand->
segDeltaThetaIndex
(1);
78
uint8_t qual1 = cand->
segQuality
(1);
79
80
ATH_MSG_DEBUG
(
"Verification check:"
81
<<
"\n Seg0 -> Eta: "
<< eta0 <<
", Phi: "
<< phi0
82
<<
", DeltaTheta: "
<<
static_cast<
int
>
(dth0) <<
", Quality: "
<<
static_cast<
int
>
(qual0)
83
<<
"\n Seg1 -> Eta: "
<< eta1 <<
", Phi: "
<< phi1
84
<<
", DeltaTheta: "
<<
static_cast<
int
>
(dth1) <<
", Quality: "
<<
static_cast<
int
>
(qual1));
85
86
ATH_MSG_DEBUG
(*cand);
87
88
cand->
clearSegments
();
89
cand->
addSegment
(200, 100, 2, 3);
90
cand->
setNSegments
(1);
91
92
ATH_MSG_DEBUG
(*cand);
93
94
ATH_CHECK
(output.record(std::move(container), std::move(auxContainer)));
95
96
ATH_MSG_DEBUG
(
"Recorded NSW candidate container with "
<< output->size() <<
" candidate(s)"
);
97
98
return
StatusCode::SUCCESS;
99
}
100
101
}
// end of namespace L0Muon
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
NSWSimulation.h
L0Muon::NSWSimulation::m_outputKey
SG::WriteHandleKey< xAOD::NSWCandDataContainer > m_outputKey
Output NSW trigger candidate container.
Definition
NSWSimulation.h:38
L0Muon::NSWSimulation::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
NSWSimulation.h:40
L0Muon::NSWSimulation::m_keySTgcDigit
SG::ReadHandleKey< sTgcDigitContainer > m_keySTgcDigit
sTGC digits
Definition
NSWSimulation.h:36
L0Muon::NSWSimulation::initialize
virtual StatusCode initialize() override
Definition
NSWSimulation.cxx:9
L0Muon::NSWSimulation::m_keyMmDigit
SG::ReadHandleKey< MmDigitContainer > m_keyMmDigit
MM Digit container.
Definition
NSWSimulation.h:34
L0Muon::NSWSimulation::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
NSWSimulation.cxx:24
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
SG::AuxVectorData::setStore
void setStore(SG::IAuxStore *store)
Set the store associated with this object.
Definition
AuxVectorData.cxx:116
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
xAOD::NSWCandData_v1::setBCID
void setBCID(uint16_t bcid)
Setters.
xAOD::NSWCandData_v1::setFiberId
void setFiberId(uint8_t fiber)
Set the fiber id.
xAOD::NSWCandData_v1::segEtaIndex
uint16_t segEtaIndex(size_t i) const
Element-by-Element Index.
Definition
NSWCandData_v1.cxx:46
xAOD::NSWCandData_v1::setNSegments
void setNSegments(uint8_t nseg)
Set the total number of segments sent from NSW-TP to Sector Logic.
xAOD::NSWCandData_v1::clearSegments
void clearSegments()
Clear all recorded segment vectors.
Definition
NSWCandData_v1.cxx:86
xAOD::NSWCandData_v1::addSegment
void addSegment(uint16_t etaIndex, uint16_t phiIndex, uint8_t deltaThetaIndex, uint8_t quality)
Pack and append a single segment.
Definition
NSWCandData_v1.cxx:72
xAOD::NSWCandData_v1::segPhiIndex
uint16_t segPhiIndex(size_t i) const
Retrieve the phi index for a specific segment.
Definition
NSWCandData_v1.cxx:50
xAOD::NSWCandData_v1::segDeltaThetaIndex
uint8_t segDeltaThetaIndex(size_t i) const
Retrieve the delta theta index for a specific segment.
Definition
NSWCandData_v1.cxx:54
xAOD::NSWCandData_v1::setBoardId
void setBoardId(uint8_t board)
Set the board id.
xAOD::NSWCandData_v1::setOverflow
void setOverflow(bool ovf)
Set the segment total capacity overflow state flag.
Definition
NSWCandData_v1.cxx:34
xAOD::NSWCandData_v1::segQuality
uint8_t segQuality(size_t i) const
Retrieve the quality flag for a specific segment.
Definition
NSWCandData_v1.cxx:58
L0Muon
Definition
NSWTPBits.h:7
xAOD::NSWCandData
NSWCandData_v1 NSWCandData
Definition
NSWCandData.h:12
Generated on
for ATLAS Offline Software by
1.17.0