ATLAS Offline Software
Loading...
Searching...
No Matches
REvent.h
Go to the documentation of this file.
1// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2#ifndef XAODROOTACCESS_REVENT_H
3#define XAODROOTACCESS_REVENT_H
4
5// Local include(s).
7
8// ROOT include(s).
9#include <ROOT/RNTupleReader.hxx>
10#include <ROOT/RNTupleWriter.hxx>
11#include <ROOT/REntry.hxx>
12
13// System include(s).
14#include <memory>
15#include <string_view>
16
17// Forward declaration(s):
18class TFile;
19
20namespace xAOD::Experimental {
21
22// Forward declaration(s).
23class RObjectManager;
24
32
33class REvent : public Event {
34
35 public:
37 REvent();
38
40 virtual ~REvent();
41
44
47 StatusCode readFrom(TFile& inFile) override;
48
51 StatusCode readFrom(std::string_view fileName);
52
54 StatusCode writeTo(TFile& file) override;
55
57 StatusCode finishWritingTo(TFile& file) override;
58
60
63
65 ::Long64_t getEntries() const override;
67 ::Int_t getEntry(::Long64_t entry, ::Int_t getall = 0) override;
68
69 // Bring the definition of Event::record into scope to allow an REvent object to record object
70 using Event::record;
71
73 ::Int_t fill() override;
74
76
77
78 private:
81
83 bool hasInput() const override;
85 bool hasOutput() const override;
86
88 StatusCode getNames(const std::string& targetClassName,
89 std::vector<std::string>& vkeys,
90 bool metadata) const override;
91
93 StatusCode connectObject(const std::string& key, bool silent) override;
95 StatusCode connectMetaObject(const std::string& key, bool silent) override;
97 StatusCode connectAux(const std::string& prefix, bool standalone) override;
100 StatusCode connectMetaAux(const std::string& prefix,
101 bool standalone) override;
102
104 StatusCode setAuxStore(const std::string& key, Details::IObjectManager& mgr,
105 bool metadata) override;
106
108 StatusCode record(void* obj, const std::string& typeName,
109 const std::string& key, bool overwrite, bool metadata,
110 bool isOwner) override;
112 StatusCode recordAux(TVirtualManager& mgr, const std::string& key,
113 bool metadata) override;
114
116 StatusCode putAux( TVirtualManager& mgr, ::Bool_t metadata = kFALSE );
117
119 StatusCode addField(const std::string& key, const TVirtualManager& mgr);
120
122
124 StatusCode initStats();
125
127 StatusCode setUpDynamicStore(RObjectManager& mgr,
128 ROOT::RNTupleReader& ntupleReader);
129
131 std::unique_ptr<ROOT::RNTupleReader> m_eventReader;
135 std::unique_ptr<ROOT::RNTupleReader> m_metaReader;
136
138 ::Long64_t m_entry{};
139
141 std::unique_ptr<ROOT::RNTupleModel> m_model;
142
144 std::unique_ptr<ROOT::RNTupleWriter> m_eventWriter;
145
147 ::TFile* m_outputFile{nullptr};
148
149
150}; // class REvent
151
152} // namespace xAOD::Experimental
153
154#endif // XAODROOTACCESS_REVENT_H
Manager for EDM objects created by ROOT.
Event(std::string_view name)
Constructor with a name.
Definition EventCore.cxx:27
StatusCode record(T *obj, const std::string &key)
Add an output object to the event.
StatusCode finishWritingTo(TFile &file) override
Finish writing to an output file.
Definition REvent.cxx:372
bool m_inputNTupleIsMissing
Whether the input has an event RNTuple or not.
Definition REvent.h:133
StatusCode addField(const std::string &key, const TVirtualManager &mgr)
Add field to RNTuple model given the StoreGate key and output object manager.
Definition REvent.cxx:1677
StatusCode putAux(TVirtualManager &mgr, ::Bool_t metadata=kFALSE)
Method saving the dynamically created auxiliary properties.
Definition REvent.cxx:1497
::Int_t fill() override
Method filling one event into the output.
Definition REvent.cxx:607
StatusCode setUpDynamicStore(RObjectManager &mgr, ROOT::RNTupleReader &ntupleReader)
event uses RNTupleReader:
Definition REvent.cxx:1816
std::unique_ptr< ROOT::RNTupleWriter > m_eventWriter
The main event writer: RNTupleWeader.
Definition REvent.h:144
StatusCode record(void *obj, const std::string &typeName, const std::string &key, bool overwrite, bool metadata, bool isOwner) override
Record an object into a connected output file.
Definition REvent.cxx:1342
std::unique_ptr< ROOT::RNTupleReader > m_eventReader
The main event data reader.
Definition REvent.h:131
StatusCode connectMetaAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches for a metadata object.
Definition REvent.cxx:1142
::Int_t getEntry(::Long64_t entry, ::Int_t getall=0) override
Function loading a given entry of the input RNTuple.
Definition REvent.cxx:553
std::unique_ptr< ROOT::RNTupleModel > m_model
The RNTuple model used for event fields.
Definition REvent.h:141
StatusCode writeTo(TFile &file) override
Connect the object to an output file.
Definition REvent.cxx:342
::TFile * m_outputFile
The output file for writing.
Definition REvent.h:147
std::unique_ptr< ROOT::RNTupleReader > m_metaReader
The metadata reader.
Definition REvent.h:135
StatusCode recordAux(TVirtualManager &mgr, const std::string &key, bool metadata) override
Record an auxiliary store into a connected output file.
Definition REvent.cxx:1460
StatusCode readFrom(TFile &inFile) override
Set up the reading of an input file from TFile This method implements the interface from Event.
Definition REvent.cxx:154
StatusCode setAuxStore(const std::string &key, Details::IObjectManager &mgr, bool metadata) override
Function connecting a DV object to its auxiliary store.
Definition REvent.cxx:1217
::Long64_t getEntries() const override
Get how many entries are available from the current input file(s)
Definition REvent.cxx:527
bool hasOutput() const override
Check if an output file is connected to the object.
Definition REvent.cxx:597
StatusCode getNames(const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata) const override
Function determining the list keys associated with a type name.
Definition REvent.cxx:743
StatusCode connectObject(const std::string &key, bool silent) override
Function setting up access to a particular object.
Definition REvent.cxx:834
::Long64_t m_entry
The entry to look at from the input.
Definition REvent.h:138
REvent()
Default constructor.
Definition REvent.cxx:142
virtual ~REvent()
Destructor.
Definition REvent.cxx:144
StatusCode connectAux(const std::string &prefix, bool standalone) override
Function setting up access to a set of auxiliary branches.
Definition REvent.cxx:1072
StatusCode initStats()
Function to initialise the statistics for all RNTuple content.
Definition REvent.cxx:1723
StatusCode connectMetaObject(const std::string &key, bool silent) override
Function setting up access to a particular metadata object.
Definition REvent.cxx:983
bool hasInput() const override
Check if an input file is connected to the object.
Definition REvent.cxx:592
Manager for EDM objects created by ROOT.
Interface class for the "manager classes".
TFile * file