Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:14

0001 // -*- C++ -*-
0002 //
0003 // This file is part of HepMC
0004 // Copyright (C) 2014-2023 The HepMC collaboration (see AUTHORS for details)
0005 //
0006 #ifndef HEPMC3_READERLHEF_H
0007 #define HEPMC3_READERLHEF_H
0008 /**
0009  *  @file  ReaderLHEF.h
0010  *  @brief Definition of \b class ReaderLHEF
0011  *
0012  *  @class HepMC3::ReaderLHEF
0013  *  @brief GenEvent I/O parsing and serialization for LHEF files
0014  *
0015  *
0016  *  @ingroup IO
0017  *
0018  */
0019 #include "HepMC3/Reader.h"
0020 #include "HepMC3/GenEvent.h"
0021 #include <deque>
0022 #include <string>
0023 #include <fstream>
0024 #include <istream>
0025 #include "HepMC3/LHEFAttributes.h"
0026 #include "HepMC3/GenEvent.h"
0027 #include "HepMC3/GenParticle.h"
0028 #include "HepMC3/GenVertex.h"
0029 #include <iomanip>
0030 
0031 
0032 namespace HepMC3
0033 {
0034 class ReaderLHEF : public Reader
0035 {
0036 public:
0037     /// The ctor to read from stream
0038     ReaderLHEF(std::istream &);
0039     /** @brief Constructor */
0040     ReaderLHEF(const std::string& filename);
0041     /// The ctor to read from temp stream
0042     ReaderLHEF(std::shared_ptr<std::istream> s_stream);
0043     /// @brief skip events
0044     bool skip(const int)  override;
0045     /** @brief Reading event */
0046     bool read_event(GenEvent& ev)  override;
0047     /** @brief Close */
0048     void close()  override;
0049     /** @brief State */
0050     bool failed()  override;
0051     /** @brief Destructor */
0052     ~ReaderLHEF() ;
0053 private:
0054     void init();                       ///< Init helper
0055     std::shared_ptr<std::istream> m_shared_stream = nullptr; ///< Holds temporary stream
0056     std::shared_ptr<LHEF::Reader> m_reader = nullptr;            ///< The actual reader
0057     std::shared_ptr<HEPRUPAttribute> m_hepr = nullptr; ///< Holder of attributes
0058     int m_neve = 0;                         ///< Event counter
0059     bool m_failed = false;                      ///< State of reader
0060     std::deque<GenEvent> m_storage; ///<storage used for subevents.
0061 };
0062 }
0063 #endif