ATLAS Offline Software
TEventFormatRegistry.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <TFile.h>
9 
10 #include <mutex>
11 
12 namespace xAOD {
13 
15 
16  static const TEventFormatRegistry instance;
17  return instance;
18  }
19 
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  }
27 
28  void TEventFormatRegistry::merge( const TFile* file,
29  const EventFormat& ef ) {
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  }
44 
46  : m_eventFormats() {
47 
48  }
49 
50 } // namespace xAOD
TEventFormatRegistry.h
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
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
xAOD::TEventFormatRegistry
Helper class for managing the event format for output files.
Definition: TEventFormatRegistry.h:26
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::EventFormat_v1
Event format metadata for xAOD files.
Definition: EventFormat_v1.h:38
xAOD::TEventFormatRegistry::getEventFormat
EventFormat & getEventFormat(const TFile *file) const
Access the managed EventFormat object.
Definition: TEventFormatRegistry.cxx:20
xAOD::TEventFormatRegistry::merge
void merge(const TFile *file, const EventFormat &ef)
Merge the contents of another EventFormat object into the managed one.
Definition: TEventFormatRegistry.cxx:28
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
xAOD::EventFormat_v1::add
void add(const EventFormatElement &element, bool updatePersistent=true)
Add the description of a new branch.
Definition: EventFormat_v1.cxx:43
checker_macros.h
Define macros for attributes used to control the static checker.
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7
xAOD::EventFormat_v1::exists
bool exists(const std::string &key) const
Check if a description exists about a given branch.
Definition: EventFormat_v1.cxx:65