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 ICollectionCursorcursor () final override
 Returns a cursor for 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)
 
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
 
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 47 of file RNTCollection.h.

Member Typedef Documentation

◆ Factory

Definition at line 50 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
  • 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

◆ ~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.

◆ cursor()

virtual ICollectionCursor& pool::RootCollection::RNTCollection::cursor ( )
finaloverridevirtual

Returns a cursor for 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.

◆ 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  // If user did not set an explicit level, set a default
43  if (m_lvl == MSG::NIL) {
44  m_lvl = m_imsg ?
45  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46  MSG::INFO;
47  }
48 }

◆ 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 163 of file AthMessaging.h.

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

◆ 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 178 of file AthMessaging.h.

179 { 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_lvl <= lvl) {
154  msg() << lvl;
155  return true;
156  } else {
157  return false;
158  }
159 }

◆ 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

◆ 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 108 of file RNTCollection.h.

◆ m_file

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

Definition at line 115 of file RNTCollection.h.

◆ m_fileMgr

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

Definition at line 119 of file RNTCollection.h.

◆ m_fileName

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

Definition at line 113 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 114 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 112 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 117 of file RNTCollection.h.

◆ m_reader

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

Definition at line 109 of file RNTCollection.h.

◆ m_rntupleWriter

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

Definition at line 110 of file RNTCollection.h.

◆ m_session

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

Definition at line 116 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:163
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
TrigConf::MSGTC::NIL
@ NIL
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:22
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