ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
pool::RootCollection::RNTCollection Class Reference

Collection (and CollectionProxy) implementation based on RNTuple. More...

#include <RNTCollection.h>

Inheritance diagram for pool::RootCollection::RNTCollection:
Collaboration diagram for pool::RootCollection::RNTCollection:

Public Types

typedef Gaudi::PluginService::Factory< ICollection *(const ICollectionDescription *, ICollection::OpenMode, ISession *)> Factory
 
enum  OpenMode { CREATE, CREATE_AND_OVERWRITE, UPDATE, READ }
 Enumeration of the possible open modes of the collection. More...
 

Public Member Functions

 RNTCollection (const pool::ICollectionDescription *description, pool::ICollection::OpenMode mode, pool::ISession *)
 Constructor. More...
 
 ~RNTCollection ()
 Destructor. More...
 
virtual ICollection::OpenMode openMode () const final override
 Return openMode. More...
 
virtual void open () final override
 Explicitly re-opens the collection after it has been closed. More...
 
virtual bool isOpen () const final override
 Checks if the collection is open. More...
 
virtual void insertRow (const pool::CollectionRowBuffer &inputRowBuffer) final override
 Adds a new row of data to the collection. More...
 
virtual void commit (bool restartTransaction=false) final override
 Commits the last changes made to the collection. More...
 
virtual void close () final override
 Explicitly closes the collection. More...
 
virtual const ICollectionDescriptiondescription () const final override
 Returns an object used to describe the collection properties. More...
 
virtual ICollectionQuerynewQuery () final override
 Returns an object used to query the collection. More...
 
virtual void initNewRow (pool::CollectionRowBuffer &row) const
 Initialize a new RowBuffer by adding all Attributes adn Tokens of this collection to it. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

 RNTCollection (const RNTCollection &)=delete
 copying unimplemented in this class. More...
 
RNTCollectionoperator= (const RNTCollection &)=delete
 
void delayedFileOpen (const std::string &method)
 
std::unique_ptr< ROOT::RNTupleReader > getCollectionRNTuple ()
 
void addField (ROOT::RNTupleModel *model, const std::string &field_name, const std::string &field_type)
 
bool fileCatalogRequired () const
 
std::string retrievePFN () const
 
std::string retrieveFID ()
 
std::string retrieveUniquePFN (const FileCatalog::FileID &fid)
 
std::string retrieveBestPFN (const FileCatalog::FileID &fid) const
 
void retrieveFileCatalog () const
 
void cleanup ()
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

CollectionDescription m_description
 
std::unique_ptr< ROOT::RNTupleReader > m_reader
 
std::unique_ptr< ROOT::RNTupleWriter > m_rntupleWriter
 
std::string m_name
 
std::string m_fileName
 
ICollection::OpenMode m_mode
 
TFile * m_file
 
ISessionm_session
 
bool m_open
 
bool m_readOnly
 
std::unique_ptr< pool::IFileCatalogm_fileCatalog
 
SmartIF< IFileMgr > m_fileMgr
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Collection (and CollectionProxy) implementation based on RNTuple.

Definition at line 48 of file RNTCollection.h.

Member Typedef Documentation

◆ Factory

Definition at line 51 of file RNTCollection.h.

Member Enumeration Documentation

◆ OpenMode

Enumeration of the possible open modes of the collection.

Enumerator
CREATE 
CREATE_AND_OVERWRITE 
UPDATE 
READ 

Definition at line 26 of file ICollection.h.

Constructor & Destructor Documentation

◆ RNTCollection() [1/2]

pool::RootCollection::RNTCollection::RNTCollection ( const pool::ICollectionDescription description,
pool::ICollection::OpenMode  mode,
pool::ISession  
)

Constructor.

Parameters
sessionIf you want to access the referenced objects you have to provide an ISession
connectionThe location of the collection file is uniquely defined by the parameters name and connection
nameThe location of the collection file is uniquely defined by the parameters name and connection
modeThe open mode of the collection
  • Without use of FileCatalog:
    • The path to the collection file is simply created by the following concatenation:
      connection+name+".root"
    • name: Name of the collection file
    • connection:
      • It can be a relative or absolute path
      • In case of an empty connection string it is assumed that the file is located in the current directory
      • Remote access via rootd: e.g. "root://pcepsft02.cern.ch:9090//localdisk/
        Further documentation can be found in the class description of TNetFile (http://root.cern.ch/root/html/TNetFile.html)
  • Utilization of FileCatalog:
    • This mode is triggered if the name parameter starts with one of the following prefixes "PFN:", "FID:" or "LFN:".
    • According to the prefix the name is interpreted as Physical File Name, unique File ID or Logical File Name
    • The connection string is interpreted as URI of the FileCatalog. The collection retrieves the FileCatalog defined by the given URI from FileCatalogMap. A default file catalog (empty connection string) can be defined there.

◆ ~RNTCollection()

pool::RootCollection::RNTCollection::~RNTCollection ( )

Destructor.

◆ RNTCollection() [2/2]

pool::RootCollection::RNTCollection::RNTCollection ( const RNTCollection )
privatedelete

copying unimplemented in this class.

Member Function Documentation

◆ addField()

void pool::RootCollection::RNTCollection::addField ( ROOT::RNTupleModel *  model,
const std::string &  field_name,
const std::string &  field_type 
)
private

◆ cleanup()

void pool::RootCollection::RNTCollection::cleanup ( )
private

◆ close()

virtual void pool::RootCollection::RNTCollection::close ( )
finaloverridevirtual

Explicitly closes the collection.

Implements pool::ICollection.

◆ commit()

virtual void pool::RootCollection::RNTCollection::commit ( bool  restartTransaction = false)
finaloverridevirtual

Commits the last changes made to the collection.

Implements pool::ICollection.

◆ delayedFileOpen()

void pool::RootCollection::RNTCollection::delayedFileOpen ( const std::string &  method)
private

◆ description()

virtual const ICollectionDescription& pool::RootCollection::RNTCollection::description ( ) const
finaloverridevirtual

Returns an object used to describe the collection properties.

Implements pool::ICollection.

◆ fileCatalogRequired()

bool pool::RootCollection::RNTCollection::fileCatalogRequired ( ) const
private

◆ getCollectionRNTuple()

std::unique_ptr<ROOT::RNTupleReader> pool::RootCollection::RNTCollection::getCollectionRNTuple ( )
private

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ initNewRow()

virtual void pool::ICollection::initNewRow ( pool::CollectionRowBuffer row) const
virtualinherited

Initialize a new RowBuffer by adding all Attributes adn Tokens of this collection to it.

◆ insertRow()

virtual void pool::RootCollection::RNTCollection::insertRow ( const pool::CollectionRowBuffer inputRowBuffer)
finaloverridevirtual

Adds a new row of data to the collection.

Implements pool::ICollection.

◆ isOpen()

virtual bool pool::RootCollection::RNTCollection::isOpen ( ) const
finaloverridevirtual

Checks if the collection is open.

Implements pool::ICollection.

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ newQuery()

virtual ICollectionQuery* pool::RootCollection::RNTCollection::newQuery ( )
finaloverridevirtual

Returns an object used to query the collection.

Implements pool::ICollection.

◆ open()

virtual void pool::RootCollection::RNTCollection::open ( )
finaloverridevirtual

Explicitly re-opens the collection after it has been closed.

Implements pool::ICollection.

◆ openMode()

virtual ICollection::OpenMode pool::RootCollection::RNTCollection::openMode ( ) const
finaloverridevirtual

Return openMode.

Implements pool::ICollection.

◆ operator=()

RNTCollection& pool::RootCollection::RNTCollection::operator= ( const RNTCollection )
privatedelete

◆ retrieveBestPFN()

std::string pool::RootCollection::RNTCollection::retrieveBestPFN ( const FileCatalog::FileID fid) const
private

◆ retrieveFID()

std::string pool::RootCollection::RNTCollection::retrieveFID ( )
private

◆ retrieveFileCatalog()

void pool::RootCollection::RNTCollection::retrieveFileCatalog ( ) const
private

◆ retrievePFN()

std::string pool::RootCollection::RNTCollection::retrievePFN ( ) const
private

◆ retrieveUniquePFN()

std::string pool::RootCollection::RNTCollection::retrieveUniquePFN ( const FileCatalog::FileID fid)
private

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_description

CollectionDescription pool::RootCollection::RNTCollection::m_description
private

Definition at line 130 of file RNTCollection.h.

◆ m_file

TFile* pool::RootCollection::RNTCollection::m_file
private

Definition at line 137 of file RNTCollection.h.

◆ m_fileCatalog

std::unique_ptr<pool::IFileCatalog> pool::RootCollection::RNTCollection::m_fileCatalog
private

Definition at line 142 of file RNTCollection.h.

◆ m_fileMgr

SmartIF<IFileMgr> pool::RootCollection::RNTCollection::m_fileMgr
private

Definition at line 144 of file RNTCollection.h.

◆ m_fileName

std::string pool::RootCollection::RNTCollection::m_fileName
private

Definition at line 135 of file RNTCollection.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_mode

ICollection::OpenMode pool::RootCollection::RNTCollection::m_mode
private

Definition at line 136 of file RNTCollection.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string pool::RootCollection::RNTCollection::m_name
private

Definition at line 134 of file RNTCollection.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_open

bool pool::RootCollection::RNTCollection::m_open
private

Definition at line 139 of file RNTCollection.h.

◆ m_reader

std::unique_ptr<ROOT::RNTupleReader> pool::RootCollection::RNTCollection::m_reader
private

Definition at line 131 of file RNTCollection.h.

◆ m_readOnly

bool pool::RootCollection::RNTCollection::m_readOnly
private

Definition at line 140 of file RNTCollection.h.

◆ m_rntupleWriter

std::unique_ptr<ROOT::RNTupleWriter> pool::RootCollection::RNTCollection::m_rntupleWriter
private

Definition at line 132 of file RNTCollection.h.

◆ m_session

ISession* pool::RootCollection::RNTCollection::m_session
private

Definition at line 138 of file RNTCollection.h.


The documentation for this class was generated from the following file:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
pool::ICollection::CREATE
@ CREATE
Definition: ICollection.h:26
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
pool::ICollection::OpenMode
OpenMode
Enumeration of the possible open modes of the collection.
Definition: ICollection.h:26
pool::ICollection::CREATE_AND_OVERWRITE
@ CREATE_AND_OVERWRITE
Definition: ICollection.h:26
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
pool::ICollection::READ
@ READ
Definition: ICollection.h:26
pool::ICollection::UPDATE
@ UPDATE
Definition: ICollection.h:26
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148