ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::TEventFormatRegistry Class Reference

Helper class for managing the event format for output files. More...

#include <TEventFormatRegistry.h>

Collaboration diagram for xAOD::TEventFormatRegistry:

Public Member Functions

EventFormatgetEventFormat (const TFile *file) const
 Access the managed EventFormat object.
void merge (const TFile *file, const EventFormat &ef)
 Merge the contents of another EventFormat object into the managed one.

Static Public Member Functions

static const TEventFormatRegistryinstance ()
 Access the only instance of the object in memory.

Protected Member Functions

 TEventFormatRegistry ()
 Hidden constructor.

Protected Attributes

std::map< const TFile *, EventFormatm_eventFormats
 The process-wide event format object.

Detailed Description

Helper class for managing the event format for output files.

If the user wants to write a single output file with multiple event-level trees, we need to keep the output EventFormat objects of the multiple TEvent instances in sync. This singleton class helps out in this.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 26 of file TEventFormatRegistry.h.

Constructor & Destructor Documentation

◆ TEventFormatRegistry()

xAOD::TEventFormatRegistry::TEventFormatRegistry ( )
protected

Hidden constructor.

Definition at line 45 of file TEventFormatRegistry.cxx.

46 : m_eventFormats() {
47
48 }
std::map< const TFile *, EventFormat > m_eventFormats
The process-wide event format object.

Member Function Documentation

◆ getEventFormat()

EventFormat & xAOD::TEventFormatRegistry::getEventFormat ( const TFile * file) const

Access the managed EventFormat object.

Definition at line 20 of file TEventFormatRegistry.cxx.

20 {
21
22 static std::mutex mutex;
23 std::scoped_lock lock(mutex);
24 auto this_nc ATLAS_THREAD_SAFE = const_cast<TEventFormatRegistry*>(this);
25 return this_nc->m_eventFormats[ file ];
26 }
#define ATLAS_THREAD_SAFE
TEventFormatRegistry()
Hidden constructor.
TFile * file

◆ instance()

const TEventFormatRegistry & xAOD::TEventFormatRegistry::instance ( )
static

Access the only instance of the object in memory.

Definition at line 14 of file TEventFormatRegistry.cxx.

14 {
15
16 static const TEventFormatRegistry instance;
17 return instance;
18 }
static const TEventFormatRegistry & instance()
Access the only instance of the object in memory.

◆ merge()

void xAOD::TEventFormatRegistry::merge ( const TFile * file,
const EventFormat & ef )

Merge the contents of another EventFormat object into the managed one.

Definition at line 28 of file TEventFormatRegistry.cxx.

29 {
30
31 // Get the local EventFormat object:
32 EventFormat& localEf = getEventFormat( file );
33
34 // Loop over the contents of the new object:
35 EventFormat::const_iterator itr = ef.begin();
37 for( ; itr != end; ++itr ) {
38 // If it's already in the output, continue:
39 if( localEf.exists( itr->first ) ) continue;
40 // If not, let's add it:
41 localEf.add( *( ef.get( itr->first ) ) );
42 }
43 }
KeyedData_t::const_iterator const_iterator
Iterator for looping over the elements of the object.
EventFormat & getEventFormat(const TFile *file) const
Access the managed EventFormat object.
EventFormat_v1 EventFormat
Definition of the current event format version.
Definition EventFormat.h:16

Member Data Documentation

◆ m_eventFormats

std::map< const TFile*, EventFormat > xAOD::TEventFormatRegistry::m_eventFormats
protected

The process-wide event format object.

Definition at line 43 of file TEventFormatRegistry.h.


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