|
||||
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_WRITERROOT_H 0007 #define HEPMC3_WRITERROOT_H 0008 /** 0009 * @file WriterRoot.h 0010 * @brief Definition of \b class WriterRoot 0011 * 0012 * @class HepMC3::WriterRoot 0013 * @brief GenEvent I/O serialization for root files 0014 * 0015 * If HepMC was compiled with path to ROOT available, this class can be used 0016 * for root writing in the same manner as with HepMC::WriterAscii class. 0017 * 0018 * @ingroup IO 0019 * 0020 */ 0021 #include <string> 0022 #include <memory> 0023 #include "HepMC3/Writer.h" 0024 #include "HepMC3/GenEvent.h" 0025 #include "HepMC3/Data/GenEventData.h" 0026 #include "HepMC3/Data/GenRunInfoData.h" 0027 0028 // ROOT header files 0029 #ifdef __CINT__ 0030 #include "TFile.h" 0031 #else 0032 class TFile; 0033 #endif 0034 0035 namespace HepMC3 { 0036 0037 class WriterRoot : public Writer { 0038 // 0039 // Constructors 0040 // 0041 public: 0042 /** @brief Default constructor 0043 * @warning If file exists, it will be overwritten 0044 */ 0045 WriterRoot(const std::string& filename, 0046 std::shared_ptr<GenRunInfo> run = std::shared_ptr<GenRunInfo>()); 0047 0048 // 0049 // Functions 0050 // 0051 public: 0052 /** @brief Write event to file 0053 * 0054 * @param[in] evt Event to be serialized 0055 */ 0056 void write_event(const GenEvent &evt) override; 0057 0058 /** @brief Write the GenRunInfo object to file. */ 0059 void write_run_info(); 0060 0061 /** @brief Close file stream */ 0062 void close() override; 0063 0064 /** @brief Get stream error state flag */ 0065 bool failed() override; 0066 // 0067 // Fields 0068 // 0069 private: 0070 TFile* m_file; //!< File handler 0071 int m_events_count; //!< Events count. Needed to generate unique object name 0072 }; 0073 0074 } // namespace HepMC3 0075 0076 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |