ATLAS Offline Software
Loading...
Searching...
No Matches
IRootAuxDynIO.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef IROOTAUXDYN_IO_H
5#define IROOTAUXDYN_IO_H
6
8
9#include <string>
10#include <memory>
11#include <vector>
12#include <mutex>
13#include <tuple>
14
15#include "RVersion.h"
16
17class TBranch;
18class TTree;
19class TFile;
20class TClass;
21
22
23// Forward declarations
24namespace ROOT { class RNTupleReader; }
25
26namespace RootAuxDynIO
27{
28 // The convention for the tuple is <name, type, data>
29 typedef std::tuple<std::string, std::string, void*> attrDataTuple;
30
32 {
33 public :
42 virtual void addReaderToObject(void* object, size_t row, std::recursive_mutex* iomtx = nullptr) = 0;
43
44 virtual size_t getBytesRead() const = 0;
45
46 virtual void resetBytesRead() = 0;
47
48 virtual ~IRootAuxDynReader() {}
49 };
50
51
54 public:
55 virtual ~IRootAuxDynWriter() = default;
56
59 // may throw exceptions
60 virtual int writeAuxAttributes(const std::string& base_branch, void* object, size_t rows_written ) = 0;
61
63 virtual bool needsCommit() = 0;
64
66 virtual int commit() = 0;
67
69 virtual void setBranchFillMode(bool) = 0;
70 };
71
75 public:
77 virtual ~IRNTupleAuxDynWriter() = default;
78
80 virtual std::vector<attrDataTuple> collectAuxAttributes( const std::string& base_branch, void* object ) = 0;
81 };
82
83
84
86 {
87 public:
88 virtual ~IFactoryTool() = default;
89
90 virtual std::unique_ptr<IRootAuxDynReader>
91 getBranchAuxDynReader(TTree*, TBranch*) const = 0;
92
93 virtual std::unique_ptr<IRootAuxDynWriter>
94 getBranchAuxDynWriter(TTree&, TClass&, int bufferSize, int splitLevel,
95 int offsettab_len, bool do_branch_fill) const = 0;
96
97 virtual std::unique_ptr<IRNTupleAuxDynWriter>
98 getNTupleAuxDynWriter(TClass &tc) const = 0;
99
100 virtual std::unique_ptr<IRootAuxDynReader>
101 getNTupleAuxDynReader(const std::string& field_name, const std::string& field_type,
102 ROOT::RNTupleReader* reader) const = 0;
103
104
106 virtual bool hasAuxStore(std::string_view fieldname, TClass *tc) const = 0;
107
109 virtual bool hasAuxStoreIO(TClass *tc) const = 0;
110
115 virtual bool isAuxDynBranch(TBranch *branch) const = 0;
116 };
117
118} // namespace
119
120#endif
121
static Double_t tc
virtual std::unique_ptr< IRNTupleAuxDynWriter > getNTupleAuxDynWriter(TClass &tc) const =0
virtual std::unique_ptr< IRootAuxDynReader > getNTupleAuxDynReader(const std::string &field_name, const std::string &field_type, ROOT::RNTupleReader *reader) const =0
virtual std::unique_ptr< IRootAuxDynWriter > getBranchAuxDynWriter(TTree &, TClass &, int bufferSize, int splitLevel, int offsettab_len, bool do_branch_fill) const =0
virtual std::unique_ptr< IRootAuxDynReader > getBranchAuxDynReader(TTree *, TBranch *) const =0
virtual bool hasAuxStoreIO(TClass *tc) const =0
check if the type tc has IAuxStoreIO interface
virtual bool isAuxDynBranch(TBranch *branch) const =0
Check is a branch holds AuxStore objects.
virtual ~IFactoryTool()=default
virtual bool hasAuxStore(std::string_view fieldname, TClass *tc) const =0
check if a field/branch with fieldname and type tc has IAuxStore interface
Interface for a RNTuple-based Writer that handles AuxDyn attributes Works in conjuction with the gene...
virtual std::vector< attrDataTuple > collectAuxAttributes(const std::string &base_branch, void *object)=0
Collect Aux data information to be writting out.
virtual ~IRNTupleAuxDynWriter()=default
Default Destructor.
virtual void addReaderToObject(void *object, size_t row, std::recursive_mutex *iomtx=nullptr)=0
Attach specialized AuxStore for reading dynamic attributes.
virtual size_t getBytesRead() const =0
Interface for an AuxDyn Writer - TTree based.
virtual bool needsCommit()=0
is there a need to call commit()?
virtual ~IRootAuxDynWriter()=default
virtual void setBranchFillMode(bool)=0
set per-branch independent commit/fill mode
virtual int writeAuxAttributes(const std::string &base_branch, void *object, size_t rows_written)=0
handle writing of dynamic xAOD attributes of an AuxContainer - called from RootTreeContainer::writeOb...
virtual int commit()=0
Call Fill() on the ROOT object used by this writer.
Selection rules: declare transient members.
Definition DataVector.h:581
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
std::tuple< std::string, std::string, void * > attrDataTuple