diff --git a/include/HEJ/EventReader.hh b/include/HEJ/EventReader.hh index f92f26a..a9c623c 100644 --- a/include/HEJ/EventReader.hh +++ b/include/HEJ/EventReader.hh @@ -1,63 +1,55 @@ /** \file * \brief Header file for event reader interface * * This header defines an abstract base class for reading events from files. * * \authors The HEJ collaboration (see AUTHORS for details) * \date 2019-2022 * \copyright GPLv2 or later */ #pragma once #include #include #include #include namespace LHEF { class HEPEUP; class HEPRUP; } namespace HEJ { //! Abstract base class for reading events from files struct EventReader { //! Read an event virtual bool read_event() = 0; //! Access header text virtual std::string const & header() const = 0; //! Access run information virtual LHEF::HEPRUP const & heprup() const = 0; //! Access last read event virtual LHEF::HEPEUP const & hepeup() const = 0; //! Guess number of events from header - virtual std::optional number_events() const { - std::size_t start = header().rfind("Number of Events"); - start = header().find_first_of("123456789", start); - if(start == std::string::npos) { - return {}; - } - const std::size_t end = header().find_first_not_of("0123456789", start); - return std::stoi(header().substr(start, end - start)); - } + virtual std::optional number_events() const = 0; virtual double scalefactor() { return 1.; }; virtual ~EventReader() = default; }; //! Factory function for event readers /** * @param filename The name of the input file * @returns A pointer to an instance of an EventReader * for the input file */ std::unique_ptr make_reader(std::string const & filename); } // namespace HEJ