EventAnalysis  1.3.0
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
EA::RootPersistenceService Class Reference

#include <RootPersistenceService.h>

Inheritance diagram for EA::RootPersistenceService:
EA::PersistenceService EA::Info EA::Configurable EA::DataStoreUser EA::ObjectConsumer

Classes

struct  EvObjInfo
 
struct  GlobObjInfo
 
struct  ObjInfo
 

Public Member Functions

 RootPersistenceService (const std::string &name, const std::string &output)
 
bool Connect () override
 
bool Disconnect () override
 
bool BookEventObject (const std::string &objName, const std::string &objStore) override
 Books an event object for persistence. More...
 
bool BookPassObject (const std::string &objName, const std::string &objStore) override
 
bool BookGlobalObject (const std::string &objName, const std::string &objStore) override
 
std::vector< BookedObjectGetBookedEventObjects () override
 Gets the list of booked event objects. More...
 
std::vector< BookedObjectGetBookedPassObjects () override
 Gets the list of booked pass objects. More...
 
std::vector< BookedObjectGetBookedGlobalObjects () override
 Gets the list of booked global objects. More...
 
bool BeginOfEvent () override
 
bool EndOfEvent () override
 Save event objects on persistence medium. More...
 
bool BeginOfPass () override
 
bool EndOfPass () override
 
bool BeginOfProcessing () override
 
bool EndOfProcessing () override
 
std::unique_ptr< PersistenceServiceCopy (const std::string &name, const std::string &output) override
 Copies the persistence service. More...
 
- Public Member Functions inherited from EA::PersistenceService
 PersistenceService (const std::string &name, const std::string &output)
 
virtual ~PersistenceService ()
 
const std::string & GetOutput ()
 
- Public Member Functions inherited from EA::Info
 Info (const std::string &name)
 Constructor. More...
 
virtual ~Info ()
 Destructor. More...
 
virtual const std::string GetType () const
 
virtual const std::string GetName () const
 The type (i.e. class) of the object. More...
 
virtual const std::string GetVersion () const
 The name of the object. More...
 
- Public Member Functions inherited from EA::Configurable
 Configurable ()
 Constructor. More...
 
template<typename T >
bool SetParameter (const std::string &name, const T &value)
 Set the value of a parameter. More...
 
bool SetParameter (const std::string &name, const char *value)
 Set the value of a string parameter using a string literal. More...
 
std::vector< std::string > GetParameters ()
 Get the names of the parameters. More...
 
- Public Member Functions inherited from EA::DataStoreUser
 DataStoreUser ()
 
virtual ~DataStoreUser ()
 Destructor. More...
 
virtual bool SetDataStoreManager (observer_ptr< DataStoreManager > dsManager)
 Injector for dependency on DataStoreManager. More...
 
observer_ptr< DataStoreManagerGetDataStoreManager ()
 Getter for the Data store manager. More...
 
- Public Member Functions inherited from EA::ObjectConsumer
 ObjectConsumer ()
 Constructor. More...
 
void DeclareConsumedObject (std::string name, ObjectCategory category, std::string store, bool optional=false)
 Declare a consumed objects. More...
 
void DeclareAlternative (const std::string &name, ObjectCategory category, std::string store, const std::string &alternativeName, ObjectCategory alternativeCategory, std::string alternativeStore)
 Declares two already declared objects as alternatives. More...
 
const ConsumedObjectsGetConsumedObjects () const
 Getter method for consumed objects. More...
 

Protected Member Functions

observer_ptr< TFile > GetOutputFile ()
 Getter method for the output file. More...
 
observer_ptr< TTree > GetEventTree ()
 Getter method for the event tree. More...
 
- Protected Member Functions inherited from EA::Info
 Info (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::Configurable
template<typename T >
bool DefineParameter (const std::string &name, T &variable)
 Set a parameter. More...
 
 Configurable (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::DataStoreUser
 DataStoreUser (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::ObjectConsumer
 ObjectConsumer (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 

Private Types

using EvObjectsBook = std::unordered_map< std::string, EvObjInfo >
 
using GlobObjectsBook = std::unordered_map< std::string, GlobObjInfo >
 

Private Member Functions

bool BookEventObjectImpl (const std::string &objName, const std::string &objStore, EvObjectsBook &book)
 
bool BookGlobalObjectImpl (const std::string &objName, const std::string &objStore, GlobObjectsBook &book)
 
template<typename T >
bool _ResolveGlobAndBook (std::unordered_map< std::string, T > &objBook, ObjectCategory objCategory)
 
bool _EndOfEventForEventObject (const std::string &objName, EvObjInfo &objInfo)
 
bool _EndOfEventForGlobalObject (const std::string &objName, GlobObjInfo &objInfo)
 
bool _SaveGlobalObject (const std::string &objName, GlobObjInfo &objInfo)
 

Private Attributes

EvObjectsBook _eventBook
 
EvObjectsBook _newEventAliasesBook
 
GlobObjectsBook _globalBook
 
GlobObjectsBook _newGlobalAliasesBook
 
TFile * _outputFile
 
TTree * _eventTree
 

Additional Inherited Members

- Public Types inherited from EA::ObjectConsumer
using ConsumedObjects = std::vector< ConsumedObject >
 Type for container of produced objects. More...
 

Member Typedef Documentation

◆ EvObjectsBook

using EA::RootPersistenceService::EvObjectsBook = std::unordered_map<std::string, EvObjInfo>
private

◆ GlobObjectsBook

using EA::RootPersistenceService::GlobObjectsBook = std::unordered_map<std::string, GlobObjInfo>
private

Constructor & Destructor Documentation

◆ RootPersistenceService()

EA::RootPersistenceService::RootPersistenceService ( const std::string &  name,
const std::string &  output 
)

Member Function Documentation

◆ _EndOfEventForEventObject()

bool EA::RootPersistenceService::_EndOfEventForEventObject ( const std::string &  objName,
EvObjInfo objInfo 
)
private

◆ _EndOfEventForGlobalObject()

bool EA::RootPersistenceService::_EndOfEventForGlobalObject ( const std::string &  objName,
GlobObjInfo objInfo 
)
private

◆ _ResolveGlobAndBook()

template<typename T >
bool EA::RootPersistenceService::_ResolveGlobAndBook ( std::unordered_map< std::string, T > &  objBook,
ObjectCategory  objCategory 
)
private

◆ _SaveGlobalObject()

bool EA::RootPersistenceService::_SaveGlobalObject ( const std::string &  objName,
GlobObjInfo objInfo 
)
private

◆ BeginOfEvent()

bool EA::RootPersistenceService::BeginOfEvent ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ BeginOfPass()

bool EA::RootPersistenceService::BeginOfPass ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ BeginOfProcessing()

bool EA::RootPersistenceService::BeginOfProcessing ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ BookEventObject()

bool EA::RootPersistenceService::BookEventObject ( const std::string &  objName,
const std::string &  objStore 
)
overridevirtual

Books an event object for persistence.

The given object from the given event data store will be saved in the persistence medium at the end of each event. The object can be booked even if it or its data store do not exist yet. The actual check about the existence of the given object in the given store is done at the end of the event.

Parameters
objNameThe name of the object.
objStoreThe name of the event store containing the object.
Returns
false if the object cannot be booked (e.g. another event object with the same name has already been booked), true otherwise
See also
EndOfEvent

Reimplemented from EA::PersistenceService.

◆ BookEventObjectImpl()

bool EA::RootPersistenceService::BookEventObjectImpl ( const std::string &  objName,
const std::string &  objStore,
EvObjectsBook book 
)
private

◆ BookGlobalObject()

bool EA::RootPersistenceService::BookGlobalObject ( const std::string &  objName,
const std::string &  objStore 
)
overridevirtual

Reimplemented from EA::PersistenceService.

◆ BookGlobalObjectImpl()

bool EA::RootPersistenceService::BookGlobalObjectImpl ( const std::string &  objName,
const std::string &  objStore,
GlobObjectsBook book 
)
private

◆ BookPassObject()

bool EA::RootPersistenceService::BookPassObject ( const std::string &  objName,
const std::string &  objStore 
)
overridevirtual

Reimplemented from EA::PersistenceService.

◆ Connect()

bool EA::RootPersistenceService::Connect ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ Copy()

std::unique_ptr< PersistenceService > EA::RootPersistenceService::Copy ( const std::string &  name,
const std::string &  output 
)
overridevirtual

Copies the persistence service.

The copy will have the same booked objects as the original service.

Returns a pointer to a copy of the persistence service.

Parameters
nameThe name of the copied service.
outputThe output of the copied service.
Returns
a unique_ptr to the copied service.

Reimplemented from EA::PersistenceService.

◆ Disconnect()

bool EA::RootPersistenceService::Disconnect ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ EndOfEvent()

bool EA::RootPersistenceService::EndOfEvent ( )
overridevirtual

Save event objects on persistence medium.

This method transfers all the booked event objects to the persistence medium. It fails if an object does not exist in its data store, or if the data store supposed to contain such an object does not exist.

Returns
true if the object has been successfully saved.

Reimplemented from EA::PersistenceService.

◆ EndOfPass()

bool EA::RootPersistenceService::EndOfPass ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ EndOfProcessing()

bool EA::RootPersistenceService::EndOfProcessing ( )
overridevirtual

Reimplemented from EA::PersistenceService.

◆ GetBookedEventObjects()

std::vector< PersistenceService::BookedObject > EA::RootPersistenceService::GetBookedEventObjects ( )
overridevirtual

Gets the list of booked event objects.

Returns
a vector with the booked event objects.

Reimplemented from EA::PersistenceService.

◆ GetBookedGlobalObjects()

std::vector< PersistenceService::BookedObject > EA::RootPersistenceService::GetBookedGlobalObjects ( )
overridevirtual

Gets the list of booked global objects.

Returns
a vector with the booked global objects.

Reimplemented from EA::PersistenceService.

◆ GetBookedPassObjects()

std::vector< PersistenceService::BookedObject > EA::RootPersistenceService::GetBookedPassObjects ( )
overridevirtual

Gets the list of booked pass objects.

Returns
a vector with the booked pass objects.

Reimplemented from EA::PersistenceService.

◆ GetEventTree()

observer_ptr<TTree> EA::RootPersistenceService::GetEventTree ( )
inlineprotected

Getter method for the event tree.

Derived classes can use this method to get access to the output event tree.

Returns
A pointer to the event tree.

◆ GetOutputFile()

observer_ptr<TFile> EA::RootPersistenceService::GetOutputFile ( )
inlineprotected

Getter method for the output file.

Derived classes can use this method to get access to the output file.

Returns
A pointer to the output file.

Member Data Documentation

◆ _eventBook

EvObjectsBook EA::RootPersistenceService::_eventBook
private

◆ _eventTree

TTree* EA::RootPersistenceService::_eventTree
private

◆ _globalBook

GlobObjectsBook EA::RootPersistenceService::_globalBook
private

◆ _newEventAliasesBook

EvObjectsBook EA::RootPersistenceService::_newEventAliasesBook
private

◆ _newGlobalAliasesBook

GlobObjectsBook EA::RootPersistenceService::_newGlobalAliasesBook
private

◆ _outputFile

TFile* EA::RootPersistenceService::_outputFile
private

The documentation for this class was generated from the following files: