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_READERROOT_H
0007 #define HEPMC3_READERROOT_H
0008 /**
0009  *  @file  ReaderRoot.h
0010  *  @brief Definition of \b class ReaderRoot
0011  *
0012  *  @class HepMC3::ReaderRoot
0013  *  @brief GenEvent I/O parsing and serialization for root files
0014  *
0015  *  If HepMC was compiled with path to ROOT available, this class can be used
0016  *  for root file I/O in the same manner as with HepMC::ReaderAscii class.
0017  *
0018  *  @ingroup IO
0019  *
0020  */
0021 #include <string>
0022 #include "HepMC3/Reader.h"
0023 #include "HepMC3/GenEvent.h"
0024 #include "HepMC3/Data/GenEventData.h"
0025 #include "HepMC3/Data/GenRunInfoData.h"
0026 
0027 // ROOT header files
0028 #include "TFile.h"
0029 #include "TKey.h"
0030 
0031 namespace HepMC3 {
0032 
0033 class ReaderRoot : public Reader {
0034 //
0035 // Constructors
0036 //
0037 public:
0038     /** @brief Default constructor */
0039     ReaderRoot(const std::string &filename);
0040 
0041 //
0042 // Functions
0043 //
0044 public:
0045     /// @brief skip events
0046     bool skip(const int)  override;
0047 
0048     /** @brief Read event from file
0049      *
0050      *  @param[out] evt Contains parsed event
0051      */
0052     bool read_event(GenEvent &evt)  override;
0053 
0054     /** @brief Close file stream */
0055     void close()  override;
0056 
0057     /** @brief Get stream error state */
0058     bool failed()  override;
0059 //
0060 // Fields
0061 //
0062 private:
0063     TFile* m_file; //!< File handler
0064     TIter* m_next; //!< Iterator for event reading
0065 };
0066 
0067 } // namespace HepMC3
0068 
0069 #endif