ATLAS Offline Software
Loading...
Searching...
No Matches
FileReaderWriter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGDFEMULATOR_FILEREADERWRITER_H_
6#define TRIGDFEMULATOR_FILEREADERWRITER_H_
7
8#include <memory>
9#include <vector>
10#include <exception>
11
12#include <boost/property_tree/ptree.hpp>
13
14#include "EventStorage/DataReader.h"
15#include "EventStorage/pickDataReader.h"
16#include "EventStorage/DataWriter.h"
17
18#include "ers/ers.h"
19
20namespace DFEF {
21
22class NoMoreEventsInFile: public std::exception { };
23
24class ProblemReadingFromFile: public std::exception { };
25
26class BadConfiguration: public std::exception { };
27
32 public:
33 FileReaderWriter(const boost::property_tree::ptree & tree);
35
37 void print();
38
40 std::unique_ptr<uint32_t[]> getNextEvent();
41
43 void writeEvent(const unsigned int & size_in_bytes, const uint32_t *event);
44
45 private:
47 std::unique_ptr<uint32_t[]> getEventFromFile();
48
49 // Reader methods and variables
50 bool nextFile();
51 void skipEvents(uint num);
52 std::vector<std::string> m_fileNames;
53 std::unique_ptr<EventStorage::DataReader> m_currReader;
54 int m_nMaxEvents; // Maximum events to read
55 int m_nEvents; // Current number of event that is read
56 uint m_nSkip; // Number of events to skip
61
62 // Writer methods and variables
63 std::unique_ptr<EventStorage::DataWriter> m_writer;
64 std::string m_outFileName;
65};
66} // namespace DFEF
67#endif
68
unsigned int uint
FileReaderWriter(const boost::property_tree::ptree &tree)
std::unique_ptr< EventStorage::DataWriter > m_writer
std::vector< std::string > m_fileNames
void print()
Print configuration of the FileReaderWriter.
void writeEvent(const unsigned int &size_in_bytes, const uint32_t *event)
Write event to file.
std::unique_ptr< uint32_t[]> getNextEvent()
Get serialized next event and put the FullEventFragment in the memory location.
std::unique_ptr< uint32_t[]> getEventFromFile()
Read the current Event from File.
std::unique_ptr< EventStorage::DataReader > m_currReader
TChain * tree