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_READERHEPEVT_H
0007 #define HEPMC3_READERHEPEVT_H
0008 /**
0009  *  @file  ReaderHEPEVT.h
0010  *  @brief Definition of \b class ReaderHEPEVT
0011  *
0012  *  @class HepMC3::ReaderHEPEVT
0013  *  @brief GenEvent I/O parsing and serialization for HEPEVT files
0014  *
0015  *
0016  *  @ingroup IO
0017  *
0018  */
0019 #include <set>
0020 #include <string>
0021 #include <fstream>
0022 #include <istream>
0023 #include "HepMC3/Reader.h"
0024 #include "HepMC3/GenEvent.h"
0025 #include "HepMC3/GenRunInfo.h"
0026 #include "HepMC3/Data/GenEventData.h"
0027 #include "HepMC3/HEPEVT_Wrapper_Template.h"
0028 
0029 namespace HepMC3
0030 {
0031 
0032 class ReaderHEPEVT : public Reader
0033 {
0034 //
0035 // Constructors
0036 //
0037 public:
0038     /** @brief Default constructor */
0039     ReaderHEPEVT(const std::string &filename);
0040     /// The ctor to read from stream
0041     ReaderHEPEVT(std::istream &);
0042     /// The ctor to read from temp stream
0043     ReaderHEPEVT(std::shared_ptr<std::istream> s_stream);
0044 //
0045 // Functions
0046 //
0047 public:
0048     /** @brief Find and read event header line  from file
0049     *
0050     */
0051     virtual bool read_hepevt_event_header();
0052     /** @brief read particle from file
0053     *
0054     * @param[in] i Particle id
0055     */
0056     virtual bool read_hepevt_particle(int i);
0057 
0058     /// @brief skip events
0059     bool skip(const int)  override;
0060 
0061 
0062     /** @brief Read event from file*/
0063     bool read_event(GenEvent &evt)  override;
0064 
0065 
0066     /** @brief Close file stream */
0067     void close()  override;
0068 
0069     /** @brief Get stream error state */
0070     bool failed()  override;
0071 
0072     char* hepevtbuffer = nullptr; //!< Pointer to HEPEVT Fortran common block/C struct
0073 private:
0074     std::ifstream m_file; //!< Input file
0075     std::shared_ptr<std::istream> m_shared_stream = nullptr; //!< For ctor when reading from temp stream
0076     std::istream* m_stream = nullptr; //!< For ctor when reading from stream
0077     bool m_isstream; //!< toggles usage of m_file or m_stream
0078     HEPEVT_Wrapper_Template<100000> m_hepevt_interface; //!< Templated HEPEVT interface
0079 };
0080 
0081 } // namespace HepMC3
0082 
0083 #endif