hej is hosted by Hepforge, IPPP Durham
HEJ  2.1.4
High energy resummation for hadron colliders
LesHouchesReader.hh
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <string>
11 
12 #include "LHEF/LHEF.h"
13 
14 #include "HEJ/EventReader.hh"
15 #include "HEJ/stream.hh"
16 
17 namespace HEJ {
18 
20  class LesHouchesReader : public EventReader{
21  public:
23  explicit LesHouchesReader(std::string const & filename):
24  stream_{filename},
25  reader_{stream_}
26  {
27  // always use the newest LHE version
28  reader_.heprup.version = LHEF::HEPRUP().version;
29  }
30 
32  bool read_event() override {
33  return reader_.readEvent();
34  }
35 
37  std::string const & header() const override {
38  return reader_.headerBlock;
39  }
40 
42  LHEF::HEPRUP const & heprup() const override {
43  return reader_.heprup;
44  }
45 
47  LHEF::HEPEUP const & hepeup() const override {
48  return reader_.hepeup;
49  }
50 
51  private:
52  istream stream_;
53  LHEF::Reader reader_;
54 
55  protected:
57  LHEF::Reader & reader(){
58  return reader_;
59  }
60  };
61 
70  public:
72  explicit SherpaLHEReader(std::string const & filename);
73 
74  bool read_event() override;
75 
76  optional<size_t> number_events() const override {
77  return num_events_;
78  }
79 
80  private:
81  double num_trials_;
82  size_t num_events_;
83  };
84 
85 } // namespace HEJ
Header file for event reader interface.
Class for reading events from a file in the Les Houches Event File format.
Definition: LesHouchesReader.hh:20
LHEF::HEPEUP const & hepeup() const override
Access last read event.
Definition: LesHouchesReader.hh:47
bool read_event() override
Read an event.
Definition: LesHouchesReader.hh:32
LHEF::HEPRUP const & heprup() const override
Access run information.
Definition: LesHouchesReader.hh:42
LHEF::Reader & reader()
Underlying reader.
Definition: LesHouchesReader.hh:57
LesHouchesReader(std::string const &filename)
Contruct object reading from the given file.
Definition: LesHouchesReader.hh:23
std::string const & header() const override
Access header text.
Definition: LesHouchesReader.hh:37
Les Houches Event file reader for LHE files created by Sherpa.
Definition: LesHouchesReader.hh:69
bool read_event() override
Read an event.
optional< size_t > number_events() const override
Guess number of events from header.
Definition: LesHouchesReader.hh:76
SherpaLHEReader(std::string const &filename)
Inialise Reader for a Sherpa LHE file.
Small wrapper around boost's filtering_istream.
Definition: stream.hh:19
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
boost::optional< T > optional
Definition: optional.hh:23
Declares input streams.
Abstract base class for reading events from files.
Definition: EventReader.hh:26