fire v0.19.0
Framework for sImulation and Reconstruction of Events
Reader.h
1#ifndef FIRE_IO_READER_H
2#define FIRE_IO_READER_H
3
4#include <iostream>
5#include <vector>
6
7#include "fire/factory/Factory.h"
8#include "fire/io/AbstractData.h"
9
13namespace fire::io {
14
29class Reader {
30 public:
36 Reader(const std::string& file_name) {}
37
41 virtual ~Reader() = default;
42
59 virtual void load_into(BaseData& d) = 0;
60
65 virtual std::string name() const = 0;
66
71 virtual std::size_t entries() const = 0;
72
77 virtual std::size_t runs() const = 0;
78
84
90
97 virtual bool canCopy() const {
98 return false;
99 }
100
107 virtual void copy(long unsigned int i_entry, const std::string& path, Writer& output) {
108 std::cerr << "[ WARN ] : " << path << " is supposed to be kept but has not been accessed"
109 " with Event::get so it is not being written to the output file." << std::endl;
110 }
111
116};
117
118}
119
120#endif
121
Factory to dynamically create objects derived from a specific prototype class.
Definition: Factory.h:231
Empty data base allowing recursion.
Definition: AbstractData.h:30
Prototype for reading files within fire.
Definition: Reader.h:29
virtual void load_into(BaseData &d)=0
Load the current event into the passed data object.
Reader(const std::string &file_name)
open the file at the passed location
Definition: Reader.h:36
virtual bool canCopy() const
Event::get needs to know if the reader implements a copy that advances the entry index of the data se...
Definition: Reader.h:97
virtual std::pair< std::string, int > type(const std::string &path)=0
Get the type of the input object.
virtual std::size_t entries() const =0
Return the number of events in the file.
virtual void copy(long unsigned int i_entry, const std::string &path, Writer &output)
Copy the input object into the output file.
Definition: Reader.h:107
virtual std::size_t runs() const =0
Return the number of runs in the file.
virtual std::vector< std::pair< std::string, std::string > > availableObjects()=0
Get the event objects available in the file.
virtual std::string name() const =0
Return the name of the file.
virtual ~Reader()=default
virtual destructor so derived classes can be closed
Write the fire DataSets into a deterministic structure in the output HDF5 data file.
Definition: Writer.h:19
T endl(T... args)
Geant4 does a GLOBAL definition of the keyword TRUE.
Definition: AbstractData.h:11