ATLAS Offline Software
TrigCOOLUpdateHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGSERVICES_TRIGCOOLUPDATEHELPER_H
6 #define TRIGSERVICES_TRIGCOOLUPDATEHELPER_H
7 
13 // STL includes
14 #include <map>
15 #include <string>
16 #include <vector>
17 
18 // Framework includes
19 #include "GaudiKernel/ServiceHandle.h"
20 #include "GaudiKernel/StatusCode.h"
21 
23 #include "AthenaKernel/IIOVDbSvc.h"
24 #include "AthenaKernel/IIOVSvc.h"
27 #include "GaudiKernel/EventIDBase.h"
29 
30 // TDAQ includes
31 #include "CTPfragment/CTPExtraWordsFormat.h"
32 
36 struct FolderInfo {
37  CLID clid{CLID_NULL};
38  std::string key;
39 };
40 
44 struct FolderUpdate {
49  needsUpdate(true) {}
50 
52  CTPfragment::FolderIndex folderIndex;
54 };
55 
60 public:
61  TrigCOOLUpdateHelper(const std::string& type, const std::string& name, const IInterface* parent);
62 
63  virtual StatusCode initialize() override;
64  virtual StatusCode start() override;
65  virtual StatusCode stop() override;
66 
71  StatusCode hltCoolUpdate(const EventContext& ctx);
72 
77  StatusCode hltCoolUpdate(const std::string& folder);
78 
84  StatusCode getFolderName(CTPfragment::FolderIndex idx, std::string& folderName) const;
85 
89  StatusCode extractFolderUpdates(const EventContext& ctx);
90 
94  StatusCode readFolderInfo ATLAS_NOT_THREAD_SAFE ();
95 
96 private:
101  StatusCode resetFolder(const std::string& folder);
102 
107  StatusCode resetFolders(const std::vector<std::string>& folders);
108 
110  std::map<std::string, FolderInfo> m_folderInfo;
111 
113  std::map<CTPfragment::FolderIndex, FolderUpdate> m_folderUpdates;
114 
116  std::map<CTPfragment::FolderIndex, std::string> m_folderNames;
117 
118  // Services and Tools
119  SmartIF<IIOVSvc> m_iovSvc;
120  SmartIF<IIOVDbSvc> m_iovDbSvc;
122 
123  // Properties
124  ToolHandle<GenericMonitoringTool> m_monTool{this, "MonTool", {}, "Monitoring tool"};
125 
126  Gaudi::Property<std::string> m_coolFolderName{
127  this, "CoolFolderMap", {}, "Name of COOL folder containing folder map"};
128 
129  Gaudi::Property<std::vector<std::string>> m_folders{
130  this, "Folders", {}, "List of folders that can be updated during the run"};
131 
132  Gaudi::Property<uint32_t> m_ctpRobId{
133  this, "CtpRobId", 0x770001, "ROB ID of CTP fragment containing the extra payload"};
134 };
135 
136 #endif
TrigCOOLUpdateHelper::m_folderNames
std::map< CTPfragment::FolderIndex, std::string > m_folderNames
Map to store the folder update index -> name mapping.
Definition: TrigCOOLUpdateHelper.h:116
TrigCOOLUpdateHelper::resetFolders
StatusCode resetFolders(const std::vector< std::string > &folders)
Reset list of COOL folders.
Definition: TrigCOOLUpdateHelper.cxx:118
FolderUpdate::FolderUpdate
FolderUpdate()
Definition: TrigCOOLUpdateHelper.h:45
TrigCOOLUpdateHelper
Tool to perform COOL updates during the run.
Definition: TrigCOOLUpdateHelper.h:59
TrigCOOLUpdateHelper::m_folders
Gaudi::Property< std::vector< std::string > > m_folders
Definition: TrigCOOLUpdateHelper.h:129
AtlasMcWeight::number_type
unsigned int number_type
Definition: AtlasMcWeight.h:20
TrigCOOLUpdateHelper::m_folderInfo
std::map< std::string, FolderInfo > m_folderInfo
CLID/name mapping of COOL folders.
Definition: TrigCOOLUpdateHelper.h:110
IIOVDbSvc.h
Abstract interface to IOVDbSvc to access IOVRange and tag information.
FolderUpdate::needsUpdate
bool needsUpdate
Definition: TrigCOOLUpdateHelper.h:53
FolderInfo::key
std::string key
Definition: TrigCOOLUpdateHelper.h:38
FolderUpdate::FolderUpdate
FolderUpdate(const CTPfragment::FolderEntry &entry)
Definition: TrigCOOLUpdateHelper.h:46
TrigCOOLUpdateHelper::initialize
virtual StatusCode initialize() override
Definition: TrigCOOLUpdateHelper.cxx:39
TrigCOOLUpdateHelper::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigCOOLUpdateHelper.h:124
TrigCOOLUpdateHelper::m_iovSvc
SmartIF< IIOVSvc > m_iovSvc
Definition: TrigCOOLUpdateHelper.h:119
TrigCOOLUpdateHelper::extractFolderUpdates
StatusCode extractFolderUpdates(const EventContext &ctx)
Decode COOL folder updates according to extra payload in CTP fragment.
Definition: TrigCOOLUpdateHelper.cxx:251
TrigCOOLUpdateHelper::m_iovDbSvc
SmartIF< IIOVDbSvc > m_iovDbSvc
Definition: TrigCOOLUpdateHelper.h:120
TrigCOOLUpdateHelper::m_folderUpdates
std::map< CTPfragment::FolderIndex, FolderUpdate > m_folderUpdates
Map to store scheduled/done COOL folder updates.
Definition: TrigCOOLUpdateHelper.h:113
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
TrigCOOLUpdateHelper::getFolderName
StatusCode getFolderName(CTPfragment::FolderIndex idx, std::string &folderName) const
Return folder name to index.
Definition: TrigCOOLUpdateHelper.cxx:231
test_pyathena.parent
parent
Definition: test_pyathena.py:15
FolderInfo::clid
CLID clid
Definition: TrigCOOLUpdateHelper.h:37
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
TrigCOOLUpdateHelper::TrigCOOLUpdateHelper
TrigCOOLUpdateHelper(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigCOOLUpdateHelper.cxx:31
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
FolderInfo
Struct to hold CLID <-> folder name mapping.
Definition: TrigCOOLUpdateHelper.h:36
FolderUpdate::folderIndex
CTPfragment::FolderIndex folderIndex
Definition: TrigCOOLUpdateHelper.h:52
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:20
TrigCOOLUpdateHelper::m_ctpRobId
Gaudi::Property< uint32_t > m_ctpRobId
Definition: TrigCOOLUpdateHelper.h:132
TrigCOOLUpdateHelper::m_coolFolderName
Gaudi::Property< std::string > m_coolFolderName
Definition: TrigCOOLUpdateHelper.h:126
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigCOOLUpdateHelper::ATLAS_NOT_THREAD_SAFE
StatusCode readFolderInfo ATLAS_NOT_THREAD_SAFE()
Read information about existing COOL folders.
FolderUpdate::lumiBlock
EventIDBase::number_type lumiBlock
Definition: TrigCOOLUpdateHelper.h:51
IIOVSvc.h
TrigCOOLUpdateHelper::start
virtual StatusCode start() override
Definition: TrigCOOLUpdateHelper.cxx:51
TrigCOOLUpdateHelper::resetFolder
StatusCode resetFolder(const std::string &folder)
Reset COOL folder.
Definition: TrigCOOLUpdateHelper.cxx:131
makeDTCalibBlob_pickPhase.folders
folders
Definition: makeDTCalibBlob_pickPhase.py:346
TrigCOOLUpdateHelper::m_robDataProviderSvc
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
Definition: TrigCOOLUpdateHelper.h:121
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCOOLUpdateHelper::stop
virtual StatusCode stop() override
Definition: TrigCOOLUpdateHelper.cxx:57
TrigCOOLUpdateHelper::hltCoolUpdate
StatusCode hltCoolUpdate(const EventContext &ctx)
Perform COOL udpates if needed.
Definition: TrigCOOLUpdateHelper.cxx:171
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
AthAlgTool
Definition: AthAlgTool.h:26
checker_macros.h
Define macros for attributes used to control the static checker.
FolderUpdate
Folder update entry.
Definition: TrigCOOLUpdateHelper.h:44
python.CTPfragment.FolderEntry
FolderEntry
Definition: CTPfragment.py:24
IROBDataProviderSvc.h
ServiceHandle< IROBDataProviderSvc >