ATLAS Offline Software
HistogramDataCOOL.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 #ifndef dqutilsHistogramDataCOOL_h
6 #define dqutilsHistogramDataCOOL_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 
40 
41 #include <sstream>
42 #include <fstream>
43 #include <TCanvas.h>
44 #include <TDirectory.h>
45 #include <TFile.h>
46 #include <TGraph.h>
47 #include <TGraphErrors.h>
48 #include <TH1.h>
49 #include <TH2.h>
50 #include <TIterator.h>
51 #include <TKey.h>
52 #include <TLegend.h>
53 #include <TProfile.h>
54 #include <TROOT.h>
55 #include <TStyle.h>
56 #include <TLatex.h>
57 #include <TMath.h>
58 #include <TTree.h>
59 
60 namespace coral {
61  class AttributeList;
62 }
63 
64 namespace cool {
65  class RecordSpecification;
66  class ChannelSelection;
67 }
68 
69 
70 namespace dqutils {
71  class ATLAS_NOT_THREAD_SAFE HistogramDataCOOL: public cool::Application, public TObject {
72  private:
73 // Protect CINT from some system definitions that cause problems
74 // CINT does not need to know about these private variables
75 #ifndef __CINT__
76  cool::ValidityKey m_since {};
77  cool::ValidityKey m_until {};
78  cool::IDatabasePtr m_coolDb {};
79  cool::IFolderPtr m_coolFolder {};
80  cool::IFolderPtr m_coolFolderH {};
81 #endif
82  public:
83  // Connects to the database. Throws a "DatabaseDoesNotExis" exception if database does not exist.
84  cool::IDatabasePtr coolDbInstance(const std::string& dbStr, bool readOnly);
85 
86  // Browses the COOL folder. Throws a "FolderNotFound" exception if folder does not exist.
87  cool::IFolderPtr coolFolderInstance(const std::string& folderStr);
88 
89  // Various methods to set and print the intervall of validity.
90  void setSince(cool::Int64 run, cool::Int64 lumi);
91  void setUntil(cool::Int64 run, cool::Int64 lumi);
92  void printIOV();
93  void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU);
94  void setIOV(cool::Int64 run);
95 
96  // Methods needed to come up to COOL framework.
97  cool::RecordSpecification createSpec();
98  coral::AttributeList createPayload(int colourCode, float dfrac, float thrust, const
99  cool::RecordSpecification& spec);
100  cool::RecordSpecification createSpecH();
102  const std::string& algo,
103  int entries, float par1, float par2, float par3, float par4, float par5, const
104  cool::RecordSpecification& specH);
105 
106  // Constructors and Destructors.
107  HistogramDataCOOL(const std::string& dbStr, const std::string& folderStr, int runS, int lumiS, int runU, int lumiU);
108  HistogramDataCOOL(int runS, int lumiS, int runU, int lumiU);
110  virtual ~HistogramDataCOOL ();
111 
112  // Methods of "interest". To insert a status flag you can use either ChannelId or ChannelName.
113  void dump(cool::ChannelSelection selection, std::string tag_name);
114  std::string dumpHisto(cool::ChannelId channelId, std::string field, std::string tag_name);
115  int dumpCode(const std::string& channelName, const std::string& tag_name);
116  void dumpall(const std::string& tag_name);
117 
118  void insertH(cool::ChannelId channelId, int code,
119  const std::string& algo,
120  int entries, float par1, float par2, float par3, float par4, float par5,
121  const std::string& tag_name);
122  void insertH(std::string channelName, int code, std::string algo, int entries, float par1, float par2, float par3,
123  float par4, float par5, std::string tag_name);
124 
125  virtual void ntupleDB(int HistoId, const std::string& nameHisto, const std::string& configuration, int Irun,
126  int Frun);
127  virtual void historyDB(int HistoId, const std::string& nameHisto, const std::string& tag_name);
128  std::string defParName(const std::string& Algorithm, const std::string& nameHisto, int i);
129  virtual void formatGraph(TCanvas* c, TGraphErrors* gr) const;
130 
131  // Some further getters.
132  cool::IFolderPtr getCoolFolderH();
133  cool::IDatabasePtr getCoolDb();
134 
135 
136  // Needed for the ROOT interface.
137  ClassDef(HistogramDataCOOL, 0) // A class for modifying DQ info in the COOL database
138  };
139 }
140 
141 #endif
dqutils::ATLAS_NOT_THREAD_SAFE
void getImageBuffer ATLAS_NOT_THREAD_SAFE(TImage **img, TCanvas *myC, char **x, int *y)
Definition: HanOutputFile.cxx:1130
dqutils::HistogramDataCOOL::setIOV
void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU)
dqutils::HistogramDataCOOL::printIOV
void printIOV()
dqutils::HistogramDataCOOL::formatGraph
virtual void formatGraph(TCanvas *c, TGraphErrors *gr) const
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
extractSporadic.nameHisto
nameHisto
Definition: extractSporadic.py:120
dqutils::HistogramDataCOOL::ntupleDB
virtual void ntupleDB(int HistoId, const std::string &nameHisto, const std::string &configuration, int Irun, int Frun)
gr
#define gr
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
dqutils::HistogramDataCOOL::insertH
void insertH(cool::ChannelId channelId, int code, const std::string &algo, int entries, float par1, float par2, float par3, float par4, float par5, const std::string &tag_name)
dqutils::HistogramDataCOOL::getCoolDb
cool::IDatabasePtr getCoolDb()
cool
Definition: CoolTagInfo.h:12
dqutils::HistogramDataCOOL::~HistogramDataCOOL
virtual ~HistogramDataCOOL()
dqutils::HistogramDataCOOL::createPayloadH
coral::AttributeList createPayloadH(int colourCode, const std::string &algo, int entries, float par1, float par2, float par3, float par4, float par5, const cool::RecordSpecification &specH)
coral
Definition: ISecondaryEventSelector.h:19
histSizes.code
code
Definition: histSizes.py:129
lumiFormat.i
int i
Definition: lumiFormat.py:85
FourMomUtils::thrust
CLHEP::Hep3Vector thrust(const I4MomIter_t &iBeg, const I4MomIter_t &iEnd, double &thrust_major, double &thrust_minor, bool useThreeD=false)
Definition: Event/FourMomUtils/src/Thrust.cxx:19
dqutils::HistogramDataCOOL::dump
void dump(cool::ChannelSelection selection, std::string tag_name)
dqutils::HistogramDataCOOL::dumpCode
int dumpCode(const std::string &channelName, const std::string &tag_name)
dqutils::HistogramDataCOOL::createSpec
cool::RecordSpecification createSpec()
run
Definition: run.py:1
dqutils::HistogramDataCOOL::historyDB
virtual void historyDB(int HistoId, const std::string &nameHisto, const std::string &tag_name)
dqutils
Definition: CoolMdt.h:76
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
selection
std::string selection
Definition: fbtTestBasics.cxx:75
dqutils::HistogramDataCOOL::setSince
void setSince(cool::Int64 run, cool::Int64 lumi)
dqutils::HistogramDataCOOL::setIOV
void setIOV(cool::Int64 run)
dqutils::HistogramDataCOOL::coolDbInstance
cool::IDatabasePtr coolDbInstance(const std::string &dbStr, bool readOnly)
dqutils::HistogramDataCOOL::insertH
void insertH(std::string channelName, int code, std::string algo, int entries, float par1, float par2, float par3, float par4, float par5, std::string tag_name)
dqutils::HistogramDataCOOL::defParName
std::string defParName(const std::string &Algorithm, const std::string &nameHisto, int i)
dqutils::HistogramDataCOOL::createSpecH
cool::RecordSpecification createSpecH()
dqutils::HistogramDataCOOL::setUntil
void setUntil(cool::Int64 run, cool::Int64 lumi)
dqutils::HistogramDataCOOL::dumpHisto
std::string dumpHisto(cool::ChannelId channelId, std::string field, std::string tag_name)
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
dqutils::HistogramDataCOOL::dumpall
void dumpall(const std::string &tag_name)
dqutils::HistogramDataCOOL
Definition: HistogramDataCOOL.h:71
entries
double entries
Definition: listroot.cxx:49
dqutils::HistogramDataCOOL::createPayload
coral::AttributeList createPayload(int colourCode, float dfrac, float thrust, const cool::RecordSpecification &spec)
dqutils::HistogramDataCOOL::getCoolFolderH
cool::IFolderPtr getCoolFolderH()
dqutils::HistogramDataCOOL::coolFolderInstance
cool::IFolderPtr coolFolderInstance(const std::string &folderStr)
checker_macros.h
Define macros for attributes used to control the static checker.
dqutils::HistogramDataCOOL::HistogramDataCOOL
HistogramDataCOOL(const std::string &dbStr, const std::string &folderStr, int runS, int lumiS, int runU, int lumiU)
dqutils::HistogramDataCOOL::HistogramDataCOOL
HistogramDataCOOL(int runS, int lumiS, int runU, int lumiU)
python.compressB64.c
def c
Definition: compressB64.py:93
dqutils::HistogramDataCOOL::HistogramDataCOOL
HistogramDataCOOL()