hej is hosted by Hepforge, IPPP Durham
HEJ 2.1.4
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
BufferedEventReader.hh
Go to the documentation of this file.
1
8#pragma once
9
10#include <cstddef>
11#include <memory>
12#include <stack>
13#include <string>
14#include <utility>
15#include <vector>
16
17#include "LHEF/LHEF.h"
18
19#include "HEJ/EventReader.hh"
20#include "HEJ/optional.hh"
21
22namespace HEJ {
23
25
30 public:
31 explicit BufferedEventReader(std::unique_ptr<EventReader> reader):
32 reader_{std::move(reader)}
33 {}
34
36 bool read_event() override;
37
39 std::string const & header() const override {
40 return reader_->header();
41 }
42
44 LHEF::HEPRUP const & heprup() const override {
45 return reader_->heprup();
46 }
47
49 LHEF::HEPEUP const & hepeup() const override {
50 return cur_event_;
51 }
52
55 return reader_->number_events();
56 }
57
59 template< class... T>
60 void emplace(T&&... args) {
61 buffer_.emplace(std::forward<T>(args)...);
62 }
63
64 private:
65 std::stack<LHEF::HEPEUP, std::vector<LHEF::HEPEUP>> buffer_;
66 std::unique_ptr<EventReader> reader_;
67 LHEF::HEPEUP cur_event_;
68 };
69} // namespace HEJ
Header file for event reader interface.
Event reader with internal buffer.
Definition: BufferedEventReader.hh:29
optional< std::size_t > number_events() const override
Guess number of events from header.
Definition: BufferedEventReader.hh:54
BufferedEventReader(std::unique_ptr< EventReader > reader)
Definition: BufferedEventReader.hh:31
LHEF::HEPEUP const & hepeup() const override
Access last read event.
Definition: BufferedEventReader.hh:49
void emplace(T &&... args)
Push event back into reader.
Definition: BufferedEventReader.hh:60
std::string const & header() const override
Access header text.
Definition: BufferedEventReader.hh:39
LHEF::HEPRUP const & heprup() const override
Access run information.
Definition: BufferedEventReader.hh:44
bool read_event() override
Read an event.
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
boost::optional< T > optional
Definition: optional.hh:23
Defines the optional type.
Abstract base class for reading events from files.
Definition: EventReader.hh:26