ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1NSW
src
NSWL1Simulation.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
NSWL1Simulation.h
"
6
7
namespace
NSWL1
{
8
NSWL1Simulation::NSWL1Simulation
(
const
std::string& name, ISvcLocator* pSvcLocator )
9
:
AthReentrantAlgorithm
( name, pSvcLocator ),
10
m_histSvc
(
"THistSvc/THistSvc"
, name )
11
{}
12
13
14
StatusCode
NSWL1Simulation::initialize
() {
15
ATH_MSG_DEBUG
(
"initialize "
<< name() );
16
ATH_CHECK
(
m_trigRdoContainer
.initialize() );
17
18
// Do not allow debug ntuple in multi-threaded mode
19
if
(
m_doNtuple
and Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents() > 1) {
20
ATH_MSG_ERROR
(
"DoNtuple is not possible in multi-threaded mode"
);
21
return
StatusCode::FAILURE;
22
}
23
24
if
(
m_dosTGC
){
25
if
(
m_doPad
) {
26
ATH_CHECK
(
m_pad_emulator
.retrieve());
27
if
(
m_doNtuple
)
ATH_CHECK
(
m_pad_emulator
->attachBranches(m_altree));
28
}
29
if
(
m_doStrip
){
30
ATH_MSG_ERROR
(
"No sTGC Strip Trigger algorithm defined. Please, check whether the hardware implementation is available before implementing any kind of tool!"
);
31
return
StatusCode::FAILURE;
32
}
33
}
34
35
if
(
m_doMM
){
36
ATH_CHECK
(
m_mmtrigger
.retrieve());
37
if
(
m_doNtuple
)
ATH_CHECK
(
m_mmtrigger
->attachBranches(m_altree));
38
}
39
40
ATH_CHECK
(
m_trigProcessor
.retrieve());
41
42
if
(
m_doNtuple
)
ATH_CHECK
(m_altree.init(
this
));
43
return
StatusCode::SUCCESS;
44
}
45
46
47
StatusCode
NSWL1Simulation::execute
(
const
EventContext& ctx)
const
{
48
auto
padTriggerContainer = std::make_unique<Muon::NSW_PadTriggerDataContainer>();
49
auto
stripTriggerContainer = std::make_unique<Muon::NSW_TrigRawDataContainer>();
50
auto
MMTriggerContainer = std::make_unique<Muon::NSW_TrigRawDataContainer>();
51
52
// sTGC Trigger
53
if
(
m_dosTGC
) {
54
if
(
m_doPad
) {
55
ATH_CHECK
(
m_pad_emulator
->emulate(ctx, padTriggerContainer.get()) );
56
}
57
}
58
59
// MM Trigger
60
if
(
m_doMM
) {
61
ATH_CHECK
(
m_mmtrigger
->runTrigger(ctx, MMTriggerContainer.get(),
m_doMMDiamonds
) );
62
}
63
64
// Store output in debug ntuple when running in single-thread only
65
if
(
m_doNtuple
) {
66
static
std::mutex
mutex
;
67
std::scoped_lock
lock
(
mutex
);
68
bool
success
ATLAS_THREAD_SAFE
= m_altree.fill(ctx);
69
if
(!success)
return
StatusCode::FAILURE;
70
}
71
72
SG::WriteHandle<Muon::NSW_TrigRawDataContainer>
rdohandle(
m_trigRdoContainer
, ctx );
73
auto
trgContainer=std::make_unique<Muon::NSW_TrigRawDataContainer>();
74
ATH_CHECK
(
m_trigProcessor
->mergeRDO(padTriggerContainer.get(), stripTriggerContainer.get(), MMTriggerContainer.get(), trgContainer.get()) );
75
ATH_CHECK
(rdohandle.
record
(std::move(trgContainer)));
76
return
StatusCode::SUCCESS;
77
}
78
79
StatusCode
NSWL1Simulation::finalize
() {
80
if
(
m_doNtuple
)
ATH_CHECK
(m_altree.write());
81
return
StatusCode::SUCCESS;
82
}
83
}
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
lock
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
NSWL1Simulation.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
NSWL1::NSWL1Simulation::m_mmtrigger
ToolHandle< IMMTriggerTool > m_mmtrigger
Definition
NSWL1Simulation.h:52
NSWL1::NSWL1Simulation::m_dosTGC
Gaudi::Property< bool > m_dosTGC
Definition
NSWL1Simulation.h:58
NSWL1::NSWL1Simulation::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition
NSWL1Simulation.h:63
NSWL1::NSWL1Simulation::m_trigProcessor
ToolHandle< ITriggerProcessorTool > m_trigProcessor
Definition
NSWL1Simulation.h:53
NSWL1::NSWL1Simulation::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
NSWL1Simulation.cxx:47
NSWL1::NSWL1Simulation::m_pad_emulator
ToolHandle< IPadEmulatorTool > m_pad_emulator
Definition
NSWL1Simulation.h:51
NSWL1::NSWL1Simulation::m_trigRdoContainer
SG::WriteHandleKey< Muon::NSW_TrigRawDataContainer > m_trigRdoContainer
Definition
NSWL1Simulation.h:48
NSWL1::NSWL1Simulation::m_doMMDiamonds
Gaudi::Property< bool > m_doMMDiamonds
Definition
NSWL1Simulation.h:57
NSWL1::NSWL1Simulation::m_doPad
Gaudi::Property< bool > m_doPad
Definition
NSWL1Simulation.h:60
NSWL1::NSWL1Simulation::m_doMM
Gaudi::Property< bool > m_doMM
Definition
NSWL1Simulation.h:56
NSWL1::NSWL1Simulation::ATLAS_THREAD_SAFE
MuonVal::MuonTesterTree m_altree ATLAS_THREAD_SAFE
Definition
NSWL1Simulation.h:64
NSWL1::NSWL1Simulation::NSWL1Simulation
NSWL1Simulation(const std::string &name, ISvcLocator *pSvcLocator)
Definition
NSWL1Simulation.cxx:8
NSWL1::NSWL1Simulation::initialize
virtual StatusCode initialize() override
Definition
NSWL1Simulation.cxx:14
NSWL1::NSWL1Simulation::m_doStrip
Gaudi::Property< bool > m_doStrip
Definition
NSWL1Simulation.h:59
NSWL1::NSWL1Simulation::finalize
virtual StatusCode finalize() override
Definition
NSWL1Simulation.cxx:79
NSWL1::NSWL1Simulation::m_doNtuple
Gaudi::Property< bool > m_doNtuple
Definition
NSWL1Simulation.h:55
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
mutex
STL class.
NSWL1
PadEmulatorCoincidences.
Definition
NSWL1Simulation.cxx:7
Generated on
for ATLAS Offline Software by
1.17.0