| 1 |
// -*- C++ -*- |
| 2 |
// |
| 3 |
// This file is part of HepMC |
| 4 |
// Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details) |
| 5 |
// |
| 6 |
#ifndef HEPMC3_READERROOT_H |
| 7 |
#define HEPMC3_READERROOT_H |
| 8 |
/** |
| 9 |
* @file ReaderRoot.h |
| 10 |
* @brief Definition of \b class ReaderRoot |
| 11 |
* |
| 12 |
* @class HepMC3::ReaderRoot |
| 13 |
* @brief GenEvent I/O parsing and serialization for root files |
| 14 |
* |
| 15 |
* If HepMC was compiled with path to ROOT available, this class can be used |
| 16 |
* for root file I/O in the same manner as with HepMC::ReaderAscii class. |
| 17 |
* |
| 18 |
* @ingroup IO |
| 19 |
* |
| 20 |
*/ |
| 21 |
#include "HepMC3/Reader.h" |
| 22 |
#include "HepMC3/GenEvent.h" |
| 23 |
#include "HepMC3/Data/GenEventData.h" |
| 24 |
#include "HepMC3/Data/GenRunInfoData.h" |
| 25 |
|
| 26 |
// ROOT header files |
| 27 |
#include "TFile.h" |
| 28 |
#include "TKey.h" |
| 29 |
|
| 30 |
namespace HepMC3 { |
| 31 |
|
| 32 |
class ReaderRoot : public Reader { |
| 33 |
// |
| 34 |
// Constructors |
| 35 |
// |
| 36 |
public: |
| 37 |
/** @brief Default constructor */ |
| 38 |
ReaderRoot(const std::string &filename); |
| 39 |
|
| 40 |
// |
| 41 |
// Functions |
| 42 |
// |
| 43 |
public: |
| 44 |
|
| 45 |
/** @brief Read event from file |
| 46 |
* |
| 47 |
* @param[out] evt Contains parsed event |
| 48 |
*/ |
| 49 |
bool read_event(GenEvent &evt); |
| 50 |
|
| 51 |
/** @brief Close file stream */ |
| 52 |
void close(); |
| 53 |
|
| 54 |
/** @brief Get stream error state */ |
| 55 |
bool failed(); |
| 56 |
// |
| 57 |
// Fields |
| 58 |
// |
| 59 |
private: |
| 60 |
TFile* m_file; //!< File handler |
| 61 |
TIter* m_next; //!< Iterator for event reading |
| 62 |
}; |
| 63 |
|
| 64 |
} // namespace HepMC3 |
| 65 |
|
| 66 |
#endif |