HepMC3 event record library: ReaderLHEF.h Source File

HepMC3 event record library

ReaderLHEF.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2023 The HepMC collaboration (see AUTHORS for details)
5//
6#ifndef HEPMC3_READERLHEF_H
7#define HEPMC3_READERLHEF_H
8/**
9 * @file ReaderLHEF.h
10 * @brief Definition of \b class ReaderLHEF
11 *
12 * @class HepMC3::ReaderLHEF
13 * @brief GenEvent I/O parsing and serialization for LHEF files
14 *
15 *
16 * @ingroup IO
17 *
18 */
19#include "HepMC3/Reader.h"
20#include "HepMC3/GenEvent.h"
21#include <deque>
22#include <string>
23#include <fstream>
24#include <istream>
25#include "HepMC3/LHEFAttributes.h"
26#include "HepMC3/GenEvent.h"
27#include "HepMC3/GenParticle.h"
28#include "HepMC3/GenVertex.h"
29#include <iomanip>
30
31
32namespace HepMC3
33{
34 class ReaderLHEF : public Reader
35{
36public:
37 /// The ctor to read from stream
38 ReaderLHEF(std::istream &);
39 /** @brief Constructor */
40 ReaderLHEF(const std::string& filename);
41 /// The ctor to read from temp stream
42 ReaderLHEF(std::shared_ptr<std::istream> s_stream);
43 /// @brief skip events
44 bool skip(const int) override;
45 /** @brief Reading event */
46 bool read_event(GenEvent& ev) override;
47 /** @brief Close */
48 void close() override;
49 /** @brief State */
50 bool failed() override;
51 /** @brief Destructor */
52 ~ReaderLHEF() ;
53private:
54 void init(); ///< Init helper
55 std::shared_ptr<std::istream> m_shared_stream = nullptr; ///< Holds temporary stream
56 std::shared_ptr<LHEF::Reader> m_reader = nullptr; ///< The actual reader
57 std::shared_ptr<HEPRUPAttribute> m_hepr = nullptr; ///< Holder of attributes
58 int m_neve = 0; ///< Event counter
59 bool m_failed = false; ///< State of reader
60 std::deque<GenEvent> m_storage; ///<storage used for subevents.
61};
62}
63#endif
GenEvent.h
Definition of class GenEvent.
GenParticle.h
Definition of class GenParticle.
GenVertex.h
Definition of class GenVertex.
LHEFAttributes.h
Definition of class HEPRUPAttribute and class HEPEUAttribute.
Reader.h
Definition of interface Reader.
HepMC3::GenEvent
Stores event-related information.
Definition GenEvent.h:47
HepMC3::ReaderLHEF::~ReaderLHEF
~ReaderLHEF()
Destructor.
Definition ReaderLHEF.cc:119
HepMC3::ReaderLHEF::init
void init()
Init helper.
Definition ReaderLHEF.cc:44
HepMC3::ReaderLHEF::failed
bool failed() override
State.
Definition ReaderLHEF.cc:242
HepMC3::ReaderLHEF::read_event
bool read_event(GenEvent &ev) override
Reading event.
Definition ReaderLHEF.cc:121
HepMC3::ReaderLHEF::skip
bool skip(const int) override
skip events
Definition ReaderLHEF.cc:32
HepMC3::ReaderLHEF::m_hepr
std::shared_ptr< HEPRUPAttribute > m_hepr
Holder of attributes.
Definition ReaderLHEF.h:57
HepMC3::ReaderLHEF::close
void close() override
Close.
Definition ReaderLHEF.cc:245
HepMC3::ReaderLHEF::m_failed
bool m_failed
State of reader.
Definition ReaderLHEF.h:59
HepMC3::ReaderLHEF::m_storage
std::deque< GenEvent > m_storage
storage used for subevents.
Definition ReaderLHEF.h:60
HepMC3::ReaderLHEF::ReaderLHEF
ReaderLHEF(std::istream &)
The ctor to read from stream.
Definition ReaderLHEF.cc:19
HepMC3::ReaderLHEF::m_shared_stream
std::shared_ptr< std::istream > m_shared_stream
Holds temporary stream.
Definition ReaderLHEF.h:55
HepMC3::ReaderLHEF::m_reader
std::shared_ptr< LHEF::Reader > m_reader
The actual reader.
Definition ReaderLHEF.h:56
HepMC3::ReaderLHEF::m_neve
int m_neve
Event counter.
Definition ReaderLHEF.h:58
HepMC3::Reader::Reader
Reader()
Constructor.
Definition Reader.h:28
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24