ATLAS Offline Software
RNTCollection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef RNTCOLLECTION_H
6 #define RNTCOLLECTION_H
7 
8 //#include "RNTCollectionDataEditor.h"
9 //#include "RNTCollectionSchemaEditor.h"
10 
13 
15 #include "CoralBase/MessageStream.h"
16 
17 #include "GaudiKernel/IFileMgr.h"
18 #include "GaudiKernel/SmartIF.h"
19 #include "Gaudi/PluginService.h"
20 
21 #include <string>
22 #include <vector>
23 
24 class TFile;
25 class IFileMgr;
26 
27 // Import classes from experimental namespace for the time being
28 namespace ROOT::Experimental {
29  class RNTupleReader;
30 }
31 
32 namespace pool {
33 
34  class ISession;
35 
36  namespace RootCollection {
37 
39  class Attribute;
40  class AttributeSpecification;
42 
47  class RNTCollection : public ICollection {
48 
49  public:
50  typedef Gaudi::PluginService::Factory<ICollection*( const ICollectionDescription*, ICollection::OpenMode, ISession*)> Factory;
51 
78 
79 
82  pool::ISession* );
83 
86 
88  virtual ICollection::OpenMode openMode() const;
89 
91  virtual void open();
92 
94  virtual bool isOpen() const;
95 
97  virtual void commit( bool restartTransaction = false );
98 
100  virtual void close();
101 
103  virtual const ICollectionDescription& description() const;
104 
107 
110 
113 
114  private:
116  RNTCollection(const RNTCollection &) = delete;
118 
119  void delayedFileOpen( const std::string& method );
120  std::unique_ptr< RNTupleReader > getCollectionRNTuple();
121 
122  bool fileCatalogRequired() const;
123  std::string retrievePFN() const;
124  std::string retrieveFID();
125  std::string retrieveUniquePFN(const FileCatalog::FileID& fid);
126  std::string retrieveBestPFN(const FileCatalog::FileID& fid)const;
127  void retrieveFileCatalog()const;
128 
129  void cleanup();
130 
131  std::unique_ptr< RNTupleReader > m_reader;
133 
134  std::string m_name;
135  std::string m_fileName;
137  TFile* m_file;
139  bool m_open;
141 
142  std::unique_ptr<pool::IFileCatalog> m_fileCatalog;
143  coral::MessageStream m_poolOut;
144 
145  std::unique_ptr<RNTCollectionSchemaEditor> m_schemaEditor;
147 
148  SmartIF<IFileMgr> m_fileMgr;
149  };
150  }
151 }
152 #endif
153 
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
pool::RootCollection::RNTCollection::m_file
TFile * m_file
Definition: RNTCollection.h:137
pool::ICollectionQuery
Definition: ICollectionQuery.h:27
pool::RootCollection::RNTCollection::openMode
virtual ICollection::OpenMode openMode() const
Return openMode.
pool::RootCollection::RNTCollection::m_session
ISession * m_session
Definition: RNTCollection.h:138
pool::RootCollection::RNTCollection::retrieveFID
std::string retrieveFID()
pool::RootCollection::RNTCollection::m_description
CollectionDescription m_description
Definition: RNTCollection.h:132
pool::ICollectionSchemaEditor
Definition: ICollectionSchemaEditor.h:22
pool::RootCollection::RNTCollection::m_fileName
std::string m_fileName
Definition: RNTCollection.h:135
CollectionDescription.h
pool::FileCatalog::FileID
std::string FileID
Definition: IFileCatalog.h:20
pool::RootCollection::RNTCollection::retrieveFileCatalog
void retrieveFileCatalog() const
pool
pool namespace
Definition: libname.h:15
IFileCatalog.h
pool::RootCollection::RNTupleReader
ROOT::Experimental::RNTupleReader RNTupleReader
Definition: RNTCollection.h:38
pool::RootCollection::RNTCollection::m_schemaEditor
std::unique_ptr< RNTCollectionSchemaEditor > m_schemaEditor
Definition: RNTCollection.h:145
pool::RootCollection::RNTCollection::m_fileCatalog
std::unique_ptr< pool::IFileCatalog > m_fileCatalog
Definition: RNTCollection.h:142
pool::RootCollection::RNTCollection::m_readOnly
bool m_readOnly
Definition: RNTCollection.h:140
pool::RootCollection::RNTCollection::RNTCollection
RNTCollection(const pool::ICollectionDescription *description, pool::ICollection::OpenMode mode, pool::ISession *)
Constructor.
pool::ISession
Definition: ISession.h:31
pool::RootCollection::RNTCollection::open
virtual void open()
Explicitly re-opens the collection after it has been closed.
pool::RootCollection::RNTCollection::m_fileMgr
SmartIF< IFileMgr > m_fileMgr
Definition: RNTCollection.h:148
pool::RootCollection::RNTCollection::RNTCollection
RNTCollection(const RNTCollection &)=delete
copying unimplemented in this class.
pool::RootCollection::RNTCollection::schemaEditor
virtual ICollectionSchemaEditor & schemaEditor()
Returns an object used to modify the collection schema.
pool::RootCollection::RNTCollection
Collection (and CollectionProxy) implementation based on RNTuple.
Definition: RNTCollection.h:47
pool::RootCollection::RNTCollection::fileCatalogRequired
bool fileCatalogRequired() const
pool::RootCollection::RNTCollection::retrieveUniquePFN
std::string retrieveUniquePFN(const FileCatalog::FileID &fid)
RNTupleReader
ROOT::Experimental::RNTupleReader RNTupleReader
Definition: RNTCollectionSchemaEditor.h:21
pool::ICollection::OpenMode
OpenMode
Enumeration of the possible open modes of the collection.
Definition: ICollection.h:27
pool::RootCollection::RNTCollection::operator=
RNTCollection & operator=(const RNTCollection &)=delete
pool::CollectionDescription
Definition: CollectionDescription.h:29
ICollection.h
pool::RootCollection::RNTCollection::Factory
Gaudi::PluginService::Factory< ICollection *(const ICollectionDescription *, ICollection::OpenMode, ISession *)> Factory
Definition: RNTCollection.h:50
pool::RootCollection::RNTCollection::close
virtual void close()
Explicitly closes the collection.
pool::RootCollection::RNTCollection::isOpen
virtual bool isOpen() const
Checks if the collection is open.
Preparation.mode
mode
Definition: Preparation.py:94
pool::RootCollection::RNTCollection::retrievePFN
std::string retrievePFN() const
pool::RootCollection::RNTCollection::m_reader
std::unique_ptr< RNTupleReader > m_reader
Definition: RNTCollection.h:131
pool::RootCollection::RNTCollection::newQuery
virtual ICollectionQuery * newQuery()
Returns an object used to query the collection.
pool::RootCollection::RNTCollection::m_open
bool m_open
Definition: RNTCollection.h:139
pool::RootCollection::RNTCollection::cleanup
void cleanup()
pool::RootCollection::RNTCollection::m_poolOut
coral::MessageStream m_poolOut
Definition: RNTCollection.h:143
pool::RootCollection::RNTCollection::commit
virtual void commit(bool restartTransaction=false)
Commits the last changes made to the collection.
pool::RootCollection::RNTCollection::m_name
std::string m_name
Definition: RNTCollection.h:134
pool::RootCollection::RNTCollection::dataEditor
virtual ICollectionDataEditor & dataEditor()
Returns an object used to add, update or delete rows of the collection.
ROOT::Experimental
Definition: RNTCollection.h:28
pool::RootCollection::RNTCollection::retrieveBestPFN
std::string retrieveBestPFN(const FileCatalog::FileID &fid) const
pool::RootCollection::RNTCollection::delayedFileOpen
void delayedFileOpen(const std::string &method)
pool::RootCollection::RNTCollection::description
virtual const ICollectionDescription & description() const
Returns an object used to describe the collection properties.
pool::RootCollection::RNTCollection::m_dataEditor
ICollectionDataEditor * m_dataEditor
Definition: RNTCollection.h:146
pool::RootCollection::RNTCollection::~RNTCollection
~RNTCollection()
Destructor.
pool::RootCollection::RNTCollection::getCollectionRNTuple
std::unique_ptr< RNTupleReader > getCollectionRNTuple()
pool::ICollection
Definition: ICollection.h:24
pool::RootCollection::RNTCollection::m_mode
ICollection::OpenMode m_mode
Definition: RNTCollection.h:136
pool::ICollectionDescription
Definition: ICollectionDescription.h:26
pool::ICollectionDataEditor
Definition: ICollectionDataEditor.h:26
pool::RootCollection::RNTCollectionSchemaEditor
Definition: RNTCollectionSchemaEditor.h:37