ATLAS Offline Software
IOVDbMetaDataTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IOVDBMETADATATOOLS_IOVDBMETADATATOOL_H
6 #define IOVDBMETADATATOOLS_IOVDBMETADATATOOL_H
7 
21 #include "GaudiKernel/ServiceHandle.h"
22 #include "GaudiKernel/IIncidentListener.h"
24 
25 #include <string>
26 #include <shared_mutex>
27 
28 class StoreGateSvc;
30 
39 class IOVDbMetaDataTool : virtual public AthAlgTool,
40  virtual public IIncidentListener,
41  virtual public IIOVDbMetaDataTool
42 {
43 public:
44  // Constructor
45  IOVDbMetaDataTool(const std::string& type,
46  const std::string& name,
47  const IInterface* parent);
48  // Standard Destructor
49  virtual ~IOVDbMetaDataTool();
50 
52  virtual StatusCode initialize() override;
53 
55  virtual StatusCode finalize() override;
56 
58  virtual StatusCode beginInputFile(const SG::SourceID&) override;
59 
61  virtual StatusCode endInputFile(const SG::SourceID&) override;
62 
64  virtual StatusCode metaDataStop() override;
65 
67  virtual void handle(const Incident& incident) override;
68 
70  virtual StatusCode registerFolder(const std::string& folderName,
71  const std::string& folderDescription) const override;
72 
75  virtual StatusCode registerFolder(const std::string& folderName) const override;
76 
79  virtual StatusCode addPayload(const std::string& folderName,
80  CondAttrListCollection* payload) const override;
81 
88  virtual StatusCode processInputFileMetaData(const std::string& fileName) override;
89 
90  virtual IOVMetaDataContainer* findMetaDataContainer(const std::string& folderName) const override final;
91 
92  // ILockableTool API implementation
93  virtual void lock_shared() const override final { m_mutex.lock_shared(); }
94  virtual void unlock_shared() const override final { m_mutex.unlock_shared(); }
95 
96 private:
97 
100  const std::string& folderDescription) const;
101 
103  void checkOverrideRunNumber();
104 
107 
110  StatusCode modifyPayload (const std::string& folderName,
112 
117 
118  // Has the FirstInputFileIncident fired? Used to skip the first
119  // BeginInputFile incident
121 
122  // Flag to check whether we need to override run number for MC
123  // events in incoming file meta data. This is needed for example
124  // for incoming simulation or digitization parameters.
127 
128  // Values for changing run number
129  unsigned int m_newRunNumber;
130  unsigned int m_oldRunNumber;
131 
132  unsigned int m_minRunNumber;
133  unsigned int m_maxRunNumber;
134 
135  // Files already processed, maintain a set
136  std::set<std::string> m_filesProcessed;
137 
138  // Min/max run numbers for overriding meta data IOV
139  UnsignedIntegerArrayProperty m_minMaxRunNumbers;
140 
141  // Folders and attributes to be deleted
142  StringArrayProperty m_foldersToBeModified;
143  StringArrayProperty m_attributesToBeRemoved;
145 
146  // mutex for R/W locking of the entire tool (and supposedly all metadata objects it works with)
147  mutable std::shared_mutex m_mutex;
148 };
149 
150 #endif // IOVDBMETADATATOOLS_IOVDBMETADATATOOL_H
151 
152 
IOVDbMetaDataTool::m_processedFirstInputFileIncident
bool m_processedFirstInputFileIncident
Definition: IOVDbMetaDataTool.h:120
IOVMetaDataContainer
This class is a container for conditions data. It is intended to be used to store conditions data fro...
Definition: IOVMetaDataContainer.h:37
IOVDbMetaDataTool::handle
virtual void handle(const Incident &incident) override
Incident service handle listening for BeginInputFile and EndInputFile.
Definition: IOVDbMetaDataTool.cxx:92
IOVDbMetaDataTool::getMetaDataContainer
IOVMetaDataContainer * getMetaDataContainer(const std::string &folderName, const std::string &folderDescription) const
return meta data container from the meta data store
Definition: IOVDbMetaDataTool.cxx:398
IOVDbMetaDataTool::m_metaDataStore
StoreGateSvc_t m_metaDataStore
Definition: IOVDbMetaDataTool.h:115
IOVDbMetaDataTool::metaDataStop
virtual StatusCode metaDataStop() override
Function called when the tool should write out its metadata.
Definition: IOVDbMetaDataTool.cxx:126
IOVDbMetaDataTool::m_attributesToBeRemoved
StringArrayProperty m_attributesToBeRemoved
Definition: IOVDbMetaDataTool.h:143
IOVDbMetaDataTool::m_minRunNumber
unsigned int m_minRunNumber
Definition: IOVDbMetaDataTool.h:132
IOVDbMetaDataTool::StoreGateSvc_t
ServiceHandle< StoreGateSvc > StoreGateSvc_t
Handles to the meta data stores.
Definition: IOVDbMetaDataTool.h:114
IOVDbMetaDataTool::m_modifyFolders
bool m_modifyFolders
Definition: IOVDbMetaDataTool.h:144
IOVDbMetaDataTool::finalize
virtual StatusCode finalize() override
Finalize AlgTool.
Definition: IOVDbMetaDataTool.cxx:85
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
IOVDbMetaDataTool::addPayload
virtual StatusCode addPayload(const std::string &folderName, CondAttrListCollection *payload) const override
Add an IOV and Payload for a particular folder - replaces payloads if there is an IOV overlap.
Definition: IOVDbMetaDataTool.cxx:248
IOVDbMetaDataTool::overrideIOV
StatusCode overrideIOV(CondAttrListCollection *&coll) const
override IOV with new run number
Definition: IOVDbMetaDataTool.cxx:610
IOVDbMetaDataTool::m_minMaxRunNumbers
UnsignedIntegerArrayProperty m_minMaxRunNumbers
Definition: IOVDbMetaDataTool.h:139
IOVDbMetaDataTool::lock_shared
virtual void lock_shared() const override final
Lock the tool.
Definition: IOVDbMetaDataTool.h:93
IOVDbMetaDataTool::unlock_shared
virtual void unlock_shared() const override final
Unlock the tool.
Definition: IOVDbMetaDataTool.h:94
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
IOVDbMetaDataTool::m_overrideMinMaxRunNumber
bool m_overrideMinMaxRunNumber
Definition: IOVDbMetaDataTool.h:126
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IIOVDbMetaDataTool
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
Definition: IIOVDbMetaDataTool.h:44
IOVDbMetaDataTool::modifyPayload
StatusCode modifyPayload(const std::string &folderName, CondAttrListCollection *&payload) const
Modify a Payload for a particular folder - replaces one of the internal attributes.
Definition: IOVDbMetaDataTool.cxx:302
IOVDbMetaDataTool::m_maxRunNumber
unsigned int m_maxRunNumber
Definition: IOVDbMetaDataTool.h:133
IOVDbMetaDataTool::m_foldersToBeModified
StringArrayProperty m_foldersToBeModified
Definition: IOVDbMetaDataTool.h:142
IOVDbMetaDataTool::m_newRunNumber
unsigned int m_newRunNumber
Definition: IOVDbMetaDataTool.h:129
IOVDbMetaDataTool
This is an interface to a tool used to manage the IOV Meta Data for a given object in the Meta Data S...
Definition: IOVDbMetaDataTool.h:42
IOVDbMetaDataTool::m_oldRunNumber
unsigned int m_oldRunNumber
Definition: IOVDbMetaDataTool.h:130
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IOVDbMetaDataTool::m_mutex
std::shared_mutex m_mutex
Definition: IOVDbMetaDataTool.h:147
IOVDbMetaDataTool::endInputFile
virtual StatusCode endInputFile(const SG::SourceID &) override
Function called when the currently open input file got completely processed.
Definition: IOVDbMetaDataTool.cxx:121
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
IOVDbMetaDataTool::m_inputStore
StoreGateSvc_t m_inputStore
Definition: IOVDbMetaDataTool.h:116
IOVDbMetaDataTool::IOVDbMetaDataTool
IOVDbMetaDataTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: IOVDbMetaDataTool.cxx:25
IOVDbMetaDataTool::checkOverrideRunNumber
void checkOverrideRunNumber()
check if we should override the run number in the incoming meta data
Definition: IOVDbMetaDataTool.cxx:134
IOVDbMetaDataTool::~IOVDbMetaDataTool
virtual ~IOVDbMetaDataTool()
Definition: IOVDbMetaDataTool.cxx:56
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IOVDbMetaDataTool::registerFolder
virtual StatusCode registerFolder(const std::string &folderName, const std::string &folderDescription) const override
Register folder in the IOV Db MetaData - done once at initialize.
Definition: IOVDbMetaDataTool.cxx:227
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:23
IOVDbMetaDataTool::m_filesProcessed
std::set< std::string > m_filesProcessed
Definition: IOVDbMetaDataTool.h:136
IOVDbMetaDataTool::beginInputFile
virtual StatusCode beginInputFile(const SG::SourceID &) override
Function called when a new input file is opened.
Definition: IOVDbMetaDataTool.cxx:108
IOVDbMetaDataTool::m_overrideRunNumber
bool m_overrideRunNumber
Definition: IOVDbMetaDataTool.h:125
IIOVDbMetaDataTool.h
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
IOVDbMetaDataTool::findMetaDataContainer
virtual IOVMetaDataContainer * findMetaDataContainer(const std::string &folderName) const override final
Definition: IOVDbMetaDataTool.cxx:389
AthAlgTool
Definition: AthAlgTool.h:26
IOVDbMetaDataTool::initialize
virtual StatusCode initialize() override
Initialize AlgTool.
Definition: IOVDbMetaDataTool.cxx:62
IOVDbMetaDataTool::processInputFileMetaData
virtual StatusCode processInputFileMetaData(const std::string &fileName) override
Explicit call to process IOV meta data from the input meta data store, transferring it to the main me...
Definition: IOVDbMetaDataTool.cxx:431
ServiceHandle< StoreGateSvc >