ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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. More...
 
void merge (const TFile *file, const EventFormat &ef)
 Merge the contents of another EventFormat object into the managed one. More...
 

Static Public Member Functions

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

Protected Member Functions

 TEventFormatRegistry ()
 Hidden constructor. More...
 

Protected Attributes

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

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  }

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  }

◆ 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  }

◆ 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  }

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:
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
xAOD::TEventFormatRegistry::m_eventFormats
std::map< const TFile *, EventFormat > m_eventFormats
The process-wide event format object.
Definition: TEventFormatRegistry.h:43
file
TFile * file
Definition: tile_monitor.h:29
xAOD::TEventFormatRegistry::instance
static const TEventFormatRegistry & instance()
Access the only instance of the object in memory.
Definition: TEventFormatRegistry.cxx:14
xAOD::TEventFormatRegistry::getEventFormat
EventFormat & getEventFormat(const TFile *file) const
Access the managed EventFormat object.
Definition: TEventFormatRegistry.cxx:20
xAOD::EventFormat
EventFormat_v1 EventFormat
Definition of the current event format version.
Definition: EventFormat.h:16
xAOD::EventFormat_v1::const_iterator
KeyedData_t::const_iterator const_iterator
Iterator for looping over the elements of the object.
Definition: EventFormat_v1.h:67
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
xAOD::TEventFormatRegistry::TEventFormatRegistry
TEventFormatRegistry()
Hidden constructor.
Definition: TEventFormatRegistry.cxx:45
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7