ATLAS Offline Software
Loading...
Searching...
No Matches
EFInterfaceEmulator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGDFEMULATOR_EFINTERFACEEMULATOR_H
6#define TRIGDFEMULATOR_EFINTERFACEEMULATOR_H
7
8#include <mutex>
9#include <utility>
10#include <queue>
11#include <future>
12#include <unordered_map>
13#include <vector>
14
15#include "ers/ers.h"
16#include "eformat/eformat.h"
17#include "eformat/index.h"
18#include "eformat/write/eformat.h"
19#include "eformat/SourceIdentifier.h"
20#include "eformat/FullEventFragmentNoTemplates.h"
21
22#include <boost/interprocess/shared_memory_object.hpp>
23#include "df_ef_interface/df_ef_interface.h"
25#include "FileReaderWriter.h"
26
37
38namespace DFEF{
39 class EFInterfaceEmulator:public daq::df_ef_interface::EventHandler{
40
41 public:
42
43 EFInterfaceEmulator(const boost::property_tree::ptree &args);
44
47 virtual void open() override;
48
51 virtual void close() override;
52
55 virtual std::future<std::unique_ptr<uint32_t[]>> getNext() override;
56
59 virtual std::future<void> accept(uint64_t l0id, std::unique_ptr<uint32_t[]> hltr) override;
60
63 virtual std::future<void> reject(uint64_t l0id) override;
64
65 virtual ~EFInterfaceEmulator();
66
67
68 private:
69
70 std::string m_name;
71 std::unique_ptr<FileReaderWriter> m_file_rw;
72 eformat::Compression m_comp;
73 unsigned int m_compLevel;
74
79
81 std::unique_ptr<HLT::LoopThread> m_inputThread;
83 std::unique_ptr<HLT::LoopThread> m_outputThread;
84
86 std::queue<std::promise<std::unique_ptr<uint32_t[]>>> m_inputQueue;
88 std::mutex m_iQMutex;
89
91 std::queue<std::pair<uint64_t, std::unique_ptr<uint32_t[]>>> m_outputQueue;
93 std::mutex m_oQMutex;
94
96 std::unordered_map<uint64_t, std::vector<std::unique_ptr<uint32_t[]>>> m_events;
98 std::mutex m_mMutex;
99
101 std::mutex m_RWMutex;
102
103 };
104}
105#endif
std::unordered_map< uint64_t, std::vector< std::unique_ptr< uint32_t[]> > > m_events
Map of events read from the input (stores duplicates per L1ID)
EFInterfaceEmulator(const boost::property_tree::ptree &args)
std::unique_ptr< HLT::LoopThread > m_outputThread
Output handling thread (triggers post-processing of finished events)
std::mutex m_iQMutex
queue mutex
unsigned int m_compLevel
Compression type of built event.
virtual std::future< void > accept(uint64_t l0id, std::unique_ptr< uint32_t[]> hltr) override
Marks the event as accepted by the High-Level Trigger.
void inputThreadCallback()
Compression level of built event.
std::queue< std::promise< std::unique_ptr< uint32_t[]> > > m_inputQueue
queue of promises for getNext() calls
void outputThreadCallback()
The method executed by the output handling thread.
std::unique_ptr< HLT::LoopThread > m_inputThread
Input handling thread (triggers reading new events)
virtual void open() override
Opens the Session.
std::mutex m_oQMutex
queue mutex
std::mutex m_mMutex
Map mutex.
std::unique_ptr< FileReaderWriter > m_file_rw
std::mutex m_RWMutex
ReadWrite mutex for the file reader/writer.
eformat::Compression m_comp
std::queue< std::pair< uint64_t, std::unique_ptr< uint32_t[]> > > m_outputQueue
queue of promises for accept() calls
virtual void close() override
Closes the Session.
virtual std::future< void > reject(uint64_t l0id) override
Marks the event as rejected by the High-Level Trigger.
virtual std::future< std::unique_ptr< uint32_t[]> > getNext() override
Returns a pointer to the next Event object to be processed.