ATLAS Offline Software
CoolRpc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 //*************************************************
6 // Class for the RPC interface with the COOL DB
7 // author Monica Verducci monica.verducci@cern.ch
8 //************************************************
9 
10 #ifndef dqutilsCoolRpc_h
11 #define dqutilsCoolRpc_h
12 
13 // Protect CINT from some system definitions that cause problems
14 #ifndef __CINT__
15 //COOL API include files (CoolKernel)
16  #include "CoolKernel/pointers.h"
17  #include "CoolKernel/ValidityKey.h"
18 #else
19 namespace cool {
20  class IDatabasePtr;
21  class IFolderPtr;
22 }
23 #endif
24 
25 
26 #include <iostream>
27 #include <string>
28 #include <cstdlib>
29 
30 #include <TObject.h>
31 
32 //CORAL API include files
33 #include "CoralBase/AttributeList.h"
34 
35 //COOL API include files (CoolApplication)
36 #include "CoolApplication/Application.h"
37 // --> limits.h is needed for CoolKernel/types.h
38 #include <limits.h>
39 #include "CoolKernel/types.h"
40 #include "CoolKernel/ChannelId.h"
41 #include "CoolKernel/RecordSpecification.h"
42 #include "CoolKernel/ChannelSelection.h"
43 
44 
45 
46 #include <sstream>
47 #include <fstream>
48 #include <TCanvas.h>
49 #include <TDirectory.h>
50 #include <TFile.h>
51 #include <TGraph.h>
52 #include <TGraphErrors.h>
53 #include <TH1.h>
54 #include <TH2.h>
55 #include <TIterator.h>
56 #include <TKey.h>
57 #include <TLegend.h>
58 #include <TProfile.h>
59 #include <TROOT.h>
60 #include <TStyle.h>
61 #include <TLatex.h>
62 #include <TMath.h>
63 #include <TTree.h>
64 
65 
66 namespace coral {
67  class AttributeList;
68 }
69 
70 namespace cool {
71  class RecordSpecification;
72  class ChannelSelection;
73 }
74 
75 
76 namespace dqutils {
77  class CoolRpc: public cool::Application, public TObject {
78  private:
79 // Protect CINT from some system definitions that cause problems
80 // CINT does not need to know about these private variables
81 #ifndef __CINT__
82  cool::ValidityKey m_since {};
83  cool::ValidityKey m_until {};
84  cool::IDatabasePtr m_coolDb {};
85  cool::IFolderPtr m_coolFolder {};
86 #endif
87  public:
88  // Connects to the database. Throws a "DatabaseDoesNotExis" exception if database does not exist.
89  cool::IDatabasePtr coolDbInstance(const std::string& dbStr, bool readOnly);
90  //cool::IDatabasePtr write(std::string stringa);
91  //cool::IDatabasePtr coolDbInstance(std::string dbStr);
92 
93 
94  // Browses the COOL folder. Throws a "FolderNotFound" exception if folder does not exist.
95  cool::IFolderPtr coolFolderInstance(const std::string& folderStr);
96  // Various methods to set and print the intervall of validity.
97 
98  void coolDbFolder(const std::string& dbStr, const std::string& folderStr);
99  void setSince(cool::Int64 run, cool::Int64 lumi);
100  void setUntil(cool::Int64 iovmax, cool::Int64 lumi);
101  void printIOV();
102  void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU);
103  void setIOV(cool::Int64 run);
104 
105  // Methods needed to come up to COOL framework.
106  cool::RecordSpecification createSpecData();
107  coral::AttributeList createPayloadData(const std::string& recEta,
108  const std::string& DetEta,
109  const std::string& recPhi1,
110  const std::string& recPhi2,
111  const std::string& detPhi1,
112  const std::string& detPhi2,
113  const cool::RecordSpecification& spec);
114 
115  cool::RecordSpecification createSpecDataCondDB();
116  coral::AttributeList createPayloadDataCondDB(const std::string& PanelRes, const std::string& StripStatus,
117  const cool::RecordSpecification& spec);
118 
119  // Constructors and Destructors.
120  void CoolOpen(const std::string& dbStr);
121 
122  //CoolRpc();
123  virtual ~CoolRpc ();
124 
125 
126  void dump(cool::ChannelSelection selection);
127  std::string dumpField(cool::ChannelId channelId, std::string field);
128  int dumpCode(const std::string& channelName);
129 
130  void dumpall();
131 
132  void insert(cool::Int64 run,
133  cool::ChannelId channelId,
134  const std::string& recEta,
135  const std::string& DetEta,
136  const std::string& recPhi1,
137  const std::string& recPhi2,
138  const std::string& detPhi1,
139  const std::string& detPhi2);
140  void insert_withTag(cool::Int64 run,
141  cool::ChannelId channelId,
142  const std::string& recEta,
143  const std::string& DetEta,
144  const std::string& recPhi1,
145  const std::string& recPhi2,
146  const std::string& detPhi1,
147  const std::string& detPhi2,
148  const std::string& cool_tag);
149  void insertCondDB_withTag(cool::Int64 run,
150  cool::ChannelId channelId,
151  const std::string& PanelRes,
152  const std::string& StringStatus,
153  const std::string& cool_tag);
154 
155  cool::IFolderPtr getCoolFolder();
156  cool::IDatabasePtr getCoolDb();
157 
158 
159  // Needed for the ROOT interface.
160  ClassDef(CoolRpc, 0) // A class for modifying DQ info in the COOL database
161  };
162 }
163 
164 #endif
dqutils::CoolRpc::~CoolRpc
virtual ~CoolRpc()
dqutils::CoolRpc::getCoolDb
cool::IDatabasePtr getCoolDb()
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
dqutils::CoolRpc::createSpecData
cool::RecordSpecification createSpecData()
dqutils::CoolRpc::m_coolFolder
cool::IFolderPtr m_coolFolder
Definition: CoolRpc.h:85
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
dqutils::CoolRpc::printIOV
void printIOV()
dqutils::CoolRpc::setUntil
void setUntil(cool::Int64 iovmax, cool::Int64 lumi)
cool
Definition: CoolTagInfo.h:12
dqutils::CoolRpc::insert
void insert(cool::Int64 run, cool::ChannelId channelId, const std::string &recEta, const std::string &DetEta, const std::string &recPhi1, const std::string &recPhi2, const std::string &detPhi1, const std::string &detPhi2)
dqutils::CoolRpc::m_coolDb
cool::IDatabasePtr m_coolDb
Definition: CoolRpc.h:84
coral
Definition: ISecondaryEventSelector.h:19
CalibDbCompareRT.cool_tag
cool_tag
Definition: CalibDbCompareRT.py:12
dqutils::CoolRpc::CoolOpen
void CoolOpen(const std::string &dbStr)
dqutils::CoolRpc
Definition: CoolRpc.h:77
dqutils::CoolRpc::m_until
cool::ValidityKey m_until
Definition: CoolRpc.h:83
dqutils::CoolRpc::coolDbFolder
void coolDbFolder(const std::string &dbStr, const std::string &folderStr)
dqutils::CoolRpc::createPayloadDataCondDB
coral::AttributeList createPayloadDataCondDB(const std::string &PanelRes, const std::string &StripStatus, const cool::RecordSpecification &spec)
dqutils::CoolRpc::createSpecDataCondDB
cool::RecordSpecification createSpecDataCondDB()
dqutils::CoolRpc::coolDbInstance
cool::IDatabasePtr coolDbInstance(const std::string &dbStr, bool readOnly)
run
Definition: run.py:1
dqutils::CoolRpc::insertCondDB_withTag
void insertCondDB_withTag(cool::Int64 run, cool::ChannelId channelId, const std::string &PanelRes, const std::string &StringStatus, const std::string &cool_tag)
dqutils
Definition: CoolMdt.h:76
dqutils::CoolRpc::insert_withTag
void insert_withTag(cool::Int64 run, cool::ChannelId channelId, const std::string &recEta, const std::string &DetEta, const std::string &recPhi1, const std::string &recPhi2, const std::string &detPhi1, const std::string &detPhi2, const std::string &cool_tag)
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
selection
std::string selection
Definition: fbtTestBasics.cxx:73
dqutils::CoolRpc::dumpCode
int dumpCode(const std::string &channelName)
dqutils::CoolRpc::getCoolFolder
cool::IFolderPtr getCoolFolder()
dqutils::CoolRpc::coolFolderInstance
cool::IFolderPtr coolFolderInstance(const std::string &folderStr)
dqutils::CoolRpc::dump
void dump(cool::ChannelSelection selection)
dqutils::CoolRpc::dumpall
void dumpall()
dqutils::CoolRpc::setSince
void setSince(cool::Int64 run, cool::Int64 lumi)
dqutils::CoolRpc::dumpField
std::string dumpField(cool::ChannelId channelId, std::string field)
lumiFormat.lumi
lumi
Definition: lumiFormat.py:113
dqutils::CoolRpc::createPayloadData
coral::AttributeList createPayloadData(const std::string &recEta, const std::string &DetEta, const std::string &recPhi1, const std::string &recPhi2, const std::string &detPhi1, const std::string &detPhi2, const cool::RecordSpecification &spec)
dqutils::CoolRpc::setIOV
void setIOV(cool::Int64 run)
dqutils::CoolRpc::setIOV
void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU)
dqutils::CoolRpc::m_since
cool::ValidityKey m_since
Definition: CoolRpc.h:82