hej
is hosted by
Hepforge
,
IPPP Durham
HEJ
2.1.4
High energy resummation for hadron colliders
Loading...
Searching...
No Matches
include
HEJ
EventReader.hh
Go to the documentation of this file.
1
10
#pragma once
11
12
#include <cstddef>
13
#include <memory>
14
#include <string>
15
16
#include "
HEJ/optional.hh
"
17
18
namespace
LHEF
{
19
class
HEPEUP;
20
class
HEPRUP;
21
}
22
23
namespace
HEJ
{
24
26
struct
EventReader
{
28
virtual
bool
read_event
() = 0;
29
31
virtual
std::string
const
&
header
()
const
= 0;
32
34
virtual
LHEF::HEPRUP
const
&
heprup
()
const
= 0;
35
37
virtual
LHEF::HEPEUP
const
&
hepeup
()
const
= 0;
38
40
virtual
optional<std::size_t>
number_events
()
const
{
41
std::size_t start =
header
().rfind(
"Number of Events"
);
42
start =
header
().find_first_of(
"123456789"
, start);
43
if
(start == std::string::npos) {
44
return
{};
45
}
46
const
std::size_t end =
header
().find_first_not_of(
"0123456789"
, start);
47
return
std::stoi(
header
().substr(start, end - start));
48
}
49
50
virtual
~EventReader
() =
default
;
51
};
52
54
59
std::unique_ptr<EventReader>
make_reader
(std::string
const
& filename);
60
}
// namespace HEJ
HEJ
Main HEJ 2 Namespace.
Definition:
mainpage.dox:1
HEJ::make_reader
std::unique_ptr< EventReader > make_reader(std::string const &filename)
Factory function for event readers.
HEJ::optional
boost::optional< T > optional
Definition:
optional.hh:23
LHEF
Definition:
Analysis.hh:14
optional.hh
Defines the optional type.
HEJ::EventReader
Abstract base class for reading events from files.
Definition:
EventReader.hh:26
HEJ::EventReader::hepeup
virtual LHEF::HEPEUP const & hepeup() const =0
Access last read event.
HEJ::EventReader::header
virtual std::string const & header() const =0
Access header text.
HEJ::EventReader::~EventReader
virtual ~EventReader()=default
HEJ::EventReader::read_event
virtual bool read_event()=0
Read an event.
HEJ::EventReader::heprup
virtual LHEF::HEPRUP const & heprup() const =0
Access run information.
HEJ::EventReader::number_events
virtual optional< std::size_t > number_events() const
Guess number of events from header.
Definition:
EventReader.hh:40
Generated by
1.9.5