ATLAS Offline Software
Loading...
Searching...
No Matches
RootCollection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ROOTCOLLECTION_ROOTCOLLECTION_H
6#define ROOTCOLLECTION_ROOTCOLLECTION_H
7
11
12#include "POOLCore/DbPrint.h"
13
14#include "GaudiKernel/IFileMgr.h"
15#include "GaudiKernel/SmartIF.h"
16#include "Gaudi/PluginService.h"
17
18#include <string>
19#include <memory>
20
21class TTree;
22class TFile;
23class IFileMgr;
24namespace ROOT {
25 class RNTupleModel;
26 class RNTupleWriter;
27 class RNTupleReader;
28}
29
30namespace pool {
31
32 class ISession;
33
34 namespace RootCollection {
35
36 class Attribute;
37
47 class RootCollection : public ICollection, public APRMessaging {
48
49 public:
50 typedef Gaudi::PluginService::Factory<ICollection*( const ICollectionDescription*, ICollection::OpenMode, ISession*)> Factory;
51
64
65
69
72
73 virtual void addTreeBranch( const std::string& name, const std::string& type_name );
74
76 virtual void open() final override;
77
79 virtual void insertRow( const pool::CollectionRowBuffer& inputRowBuffer ) final override;
80
82 virtual void commit( bool restartTransaction = false ) final override;
83
85 virtual void close() final override;
86
88 virtual const ICollectionDescription& description() const final override;
89
91 virtual ICollectionCursor& cursor() final override;
92
93 private:
94
97 RootCollection & operator = (const RootCollection &) = delete;
98
100 void addField(ROOT::RNTupleModel* model, const std::string& field_name, const std::string& field_type);
101
102 void cleanup();
103
105
106 std::string m_name;
109 TTree* m_tree;
110 TFile* m_file;
111 std::unique_ptr<ROOT::RNTupleReader> m_reader;
113
115 bool m_open;
116
117 SmartIF<IFileMgr> m_fileMgr;
118 };
119 }
120}
121#endif
APRMessaging(const std::string &name)
An implementation of the ICollectionDescription interface used to define the properties of a collecti...
A class that acts as a buffer to be filled with the event reference and associated metadata values of...
An interface used to navigate the result of a query on a collection.
An interface used to define the properties of a collection to be constructed and to retrieve these pr...
An interface to a storage technology specific collection of event references and attributes.
Definition ICollection.h:23
OpenMode
Enumeration of the possible open modes of the collection.
Definition ICollection.h:26
ISession is the interface class for user (macroscopic) sessions Every transaction and connection to a...
Definition ISession.h:32
virtual void open() final override
Explicitly re-opens the collection after it has been closed.
virtual void close() final override
Explicitly closes the collection.
virtual void insertRow(const pool::CollectionRowBuffer &inputRowBuffer) final override
Adds a new row of data to the collection.
virtual void addTreeBranch(const std::string &name, const std::string &type_name)
void addField(ROOT::RNTupleModel *model, const std::string &field_name, const std::string &field_type)
virtual void commit(bool restartTransaction=false) final override
Commits the last changes made to the collection.
virtual ICollectionCursor & cursor() final override
Returns a cursor for the collection.
virtual const ICollectionDescription & description() const final override
Returns an object used to describe the collection properties.
RootCollection(const pool::ICollectionDescription *description, pool::ICollection::OpenMode mode, pool::ISession *)
Constructor.
Gaudi::PluginService::Factory< ICollection *(const ICollectionDescription *, ICollection::OpenMode, ISession *)> Factory
std::unique_ptr< ROOT::RNTupleReader > m_reader
std::unique_ptr< ROOT::RNTupleWriter > m_rntupleWriter
STL class.
Selection rules: declare transient members.
Definition DataVector.h:581
pool namespace
Definition libname.h:15
STL namespace.
#define private