ATLAS Offline Software
StatusFlagCOOLBase.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 dqutilsStatusFlagCOOLBase_h
6 #define dqutilsStatusFlagCOOLBase_h
7 
8 // Protect CINT from some system definitions that cause problems
9 #ifndef __CINT__
10 //COOL API include files (CoolKernel)
11  #include "CoolKernel/pointers.h"
12  #include "CoolKernel/ValidityKey.h"
13 #else
14 namespace cool {
15  class IDatabasePtr;
16  class IFolderPtr;
17 }
18 #endif
19 
20 
21 #include <iostream>
22 #include <string>
23 #include <cstdlib>
24 
25 #include <TObject.h>
26 
27 //CORAL API include files
28 #include "CoralBase/AttributeList.h"
29 
30 //COOL API include files (CoolApplication)
31 #include "CoolApplication/Application.h"
32 // --> limits.h is needed for CoolKernel/types.h
33 #include <limits.h>
34 #include "CoolKernel/types.h"
35 #include "CoolKernel/ChannelId.h"
36 #include "CoolKernel/RecordSpecification.h"
37 #include "CoolKernel/ChannelSelection.h"
38 
39 
40 namespace coral {
41  class AttributeList;
42 }
43 
44 namespace cool {
45  class RecordSpecification;
46  class ChannelSelection;
47 }
48 
49 
50 namespace dqutils {
51  class StatusFlagCOOLBase: public cool::Application, public TObject {
52  protected:
53 // Protect CINT from some system definitions that cause problems
54 // CINT does not need to know about these private variables
55 #ifndef __CINT__
56  cool::ValidityKey m_since;
57  cool::ValidityKey m_until;
58  cool::IDatabasePtr m_coolDb;
59  cool::IFolderPtr m_coolFolder;
60 #endif
61 
62  void insert_helper(cool::ChannelId channelId,
64  const std::string& tag_name);
65  void Initialize(const std::string& dbStr, const std::string& folderStr,
66  int runS, int lumiS, int runU, int lumiU);
67  public:
68  // Connects to the database. Throws a "DatabaseDoesNotExist" exception if database does not exist.
69  cool::IDatabasePtr coolDbInstance(const std::string& dbStr, bool readOnly);
70 
71  // Browses the COOL folder. Throws a "FolderNotFound" exception if folder does not exist.
72  cool::IFolderPtr coolFolderInstance(const std::string& folderStr);
73 
74  // Various methods to set and print the intervall of validity.
75  void setSince(cool::Int64 run, cool::Int64 lumi);
76  void setUntil(cool::Int64 run, cool::Int64 lumi);
77  void printIOV();
78  void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU);
79  void setIOV(cool::Int64 run);
80 
81  // to flush after insertions!
82  void flush();
83 
84  // Constructors and Destructors.
85  StatusFlagCOOLBase(const std::string& dbStr, const std::string& folderStr, int runS, int lumiS, int runU,
86  int lumiU);
87  StatusFlagCOOLBase(int runS, int lumiS, int runU, int lumiU);
89  virtual ~StatusFlagCOOLBase ();
90 
91  // Methods of "interest". To insert a status flag you can use either ChannelId or ChannelName.
92  void dump(cool::ChannelSelection selection, std::string tag_name);
93  std::string dumpField(cool::ChannelId channelId, std::string field, std::string tag_name);
94  int dumpCode(const std::string& channelName, const std::string& tag_name);
95  void dumpall(const std::string& tag_name);
96 
97  // Some further getters.
98  cool::IFolderPtr getCoolFolder();
99  cool::IDatabasePtr getCoolDb();
100 
101 
102  // Needed for the ROOT interface.
103  ClassDef(StatusFlagCOOLBase, 0) // A class for modifying DQ info in the COOL database
104  };
105 }
106 
107 #endif
dqutils::StatusFlagCOOLBase
Definition: StatusFlagCOOLBase.h:51
dqutils::StatusFlagCOOLBase::m_coolFolder
cool::IFolderPtr m_coolFolder
Definition: StatusFlagCOOLBase.h:59
dqutils::StatusFlagCOOLBase::getCoolDb
cool::IDatabasePtr getCoolDb()
dqutils::StatusFlagCOOLBase::coolDbInstance
cool::IDatabasePtr coolDbInstance(const std::string &dbStr, bool readOnly)
dqutils::StatusFlagCOOLBase::flush
void flush()
dqutils::StatusFlagCOOLBase::dump
void dump(cool::ChannelSelection selection, std::string tag_name)
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
dqutils::StatusFlagCOOLBase::dumpField
std::string dumpField(cool::ChannelId channelId, std::string field, std::string tag_name)
dqutils::StatusFlagCOOLBase::setIOV
void setIOV(cool::Int64 run)
dqutils::StatusFlagCOOLBase::coolFolderInstance
cool::IFolderPtr coolFolderInstance(const std::string &folderStr)
dqutils::StatusFlagCOOLBase::m_coolDb
cool::IDatabasePtr m_coolDb
Definition: StatusFlagCOOLBase.h:58
cool
Definition: CoolTagInfo.h:12
coral
Definition: ISecondaryEventSelector.h:19
dqutils::StatusFlagCOOLBase::StatusFlagCOOLBase
StatusFlagCOOLBase()
dqutils::StatusFlagCOOLBase::getCoolFolder
cool::IFolderPtr getCoolFolder()
run
Definition: run.py:1
dqutils::StatusFlagCOOLBase::m_since
cool::ValidityKey m_since
Definition: StatusFlagCOOLBase.h:56
dqutils
Definition: CoolMdt.h:76
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
selection
std::string selection
Definition: fbtTestBasics.cxx:73
dqutils::StatusFlagCOOLBase::insert_helper
void insert_helper(cool::ChannelId channelId, coral::AttributeList &payload, const std::string &tag_name)
dqutils::StatusFlagCOOLBase::~StatusFlagCOOLBase
virtual ~StatusFlagCOOLBase()
dqutils::StatusFlagCOOLBase::StatusFlagCOOLBase
StatusFlagCOOLBase(int runS, int lumiS, int runU, int lumiU)
dqutils::StatusFlagCOOLBase::StatusFlagCOOLBase
StatusFlagCOOLBase(const std::string &dbStr, const std::string &folderStr, int runS, int lumiS, int runU, int lumiU)
dqutils::StatusFlagCOOLBase::dumpCode
int dumpCode(const std::string &channelName, const std::string &tag_name)
dqutils::StatusFlagCOOLBase::m_until
cool::ValidityKey m_until
Definition: StatusFlagCOOLBase.h:57
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
dqutils::StatusFlagCOOLBase::setUntil
void setUntil(cool::Int64 run, cool::Int64 lumi)
dqutils::StatusFlagCOOLBase::Initialize
void Initialize(const std::string &dbStr, const std::string &folderStr, int runS, int lumiS, int runU, int lumiU)
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113
dqutils::StatusFlagCOOLBase::setSince
void setSince(cool::Int64 run, cool::Int64 lumi)
dqutils::StatusFlagCOOLBase::setIOV
void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU)
dqutils::StatusFlagCOOLBase::printIOV
void printIOV()
dqutils::StatusFlagCOOLBase::dumpall
void dumpall(const std::string &tag_name)