Warning, file /include/celeritas/io/EventReader.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <memory>
0011 #include <string>
0012 #include <vector>
0013
0014 #include "corecel/Config.hh"
0015
0016 #include "corecel/Assert.hh"
0017 #include "corecel/Macros.hh"
0018 #include "corecel/Types.hh"
0019
0020 #include "EventIOInterface.hh"
0021
0022 namespace HepMC3
0023 {
0024 class Reader;
0025 }
0026
0027 namespace celeritas
0028 {
0029
0030 class ParticleParams;
0031 struct Primary;
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 class EventReader : public EventReaderInterface
0044 {
0045 public:
0046
0047
0048 using SPConstParticles = std::shared_ptr<ParticleParams const>;
0049 using result_type = std::vector<Primary>;
0050
0051
0052 public:
0053
0054 EventReader(std::string const& filename, SPConstParticles particles);
0055
0056
0057 CELER_DELETE_COPY_MOVE(EventReader);
0058
0059
0060 result_type operator()() final;
0061
0062
0063 size_type num_events() const final { return num_events_; }
0064
0065 private:
0066 using SPReader = std::shared_ptr<HepMC3::Reader>;
0067
0068
0069 SPConstParticles particles_;
0070
0071
0072 SPReader reader_;
0073
0074
0075 size_type event_count_{0};
0076
0077
0078 size_type num_events_;
0079 };
0080
0081
0082
0083 void set_hepmc3_verbosity_from_env();
0084
0085
0086
0087 std::shared_ptr<HepMC3::Reader> open_hepmc3(std::string const& filename);
0088
0089
0090
0091
0092 #if !CELERITAS_USE_HEPMC3
0093 inline EventReader::EventReader(std::string const&, SPConstParticles)
0094 {
0095 CELER_DISCARD(particles_);
0096 CELER_DISCARD(reader_);
0097 CELER_DISCARD(event_count_);
0098 CELER_DISCARD(num_events_);
0099 CELER_NOT_CONFIGURED("HepMC3");
0100 }
0101
0102 inline auto EventReader::operator()() -> result_type
0103 {
0104 CELER_ASSERT_UNREACHABLE();
0105 }
0106
0107 inline void set_hepmc3_verbosity_from_env() {}
0108 #endif
0109
0110
0111 }