ATLAS Offline Software
Loading...
Searching...
No Matches
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
7namespace NSWL1 {
8 NSWL1Simulation::NSWL1Simulation( const std::string& name, ISvcLocator* pSvcLocator )
9 : AthReentrantAlgorithm( name, pSvcLocator ),
10 m_histSvc( "THistSvc/THistSvc", name )
11 {}
12
13
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
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
80 if(m_doNtuple) ATH_CHECK(m_altree.write());
81 return StatusCode::SUCCESS;
82 }
83}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
ToolHandle< IMMTriggerTool > m_mmtrigger
Gaudi::Property< bool > m_dosTGC
ServiceHandle< ITHistSvc > m_histSvc
ToolHandle< ITriggerProcessorTool > m_trigProcessor
virtual StatusCode execute(const EventContext &ctx) const override
ToolHandle< IPadEmulatorTool > m_pad_emulator
SG::WriteHandleKey< Muon::NSW_TrigRawDataContainer > m_trigRdoContainer
Gaudi::Property< bool > m_doMMDiamonds
Gaudi::Property< bool > m_doPad
Gaudi::Property< bool > m_doMM
MuonVal::MuonTesterTree m_altree ATLAS_THREAD_SAFE
NSWL1Simulation(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
Gaudi::Property< bool > m_doStrip
virtual StatusCode finalize() override
Gaudi::Property< bool > m_doNtuple
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
STL class.
PadEmulatorCoincidences.