ATLAS Offline Software
CoolMdt.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 MDT interface with the COOL DB
7 // author Monica Verducci monica.verducci@cern.ch
8 //************************************************
9 
10 #ifndef dqutilsCoolMdt_h
11 #define dqutilsCoolMdt_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 CoolMdt: 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;
87 #endif
88  public:
89  // Connects to the database. Throws a "DatabaseDoesNotExis" exception if database does not exist.
90  cool::IDatabasePtr coolDbInstance(const std::string& dbStr, bool readOnly);
91 
92 
93  // Browses the COOL folder. Throws a "FolderNotFound" exception if folder does not exist.
94  cool::IFolderPtr coolFolderInstance(const std::string& folderStr);
95  // Various methods to set and print the intervall of validity.
96 
97  void initialize();
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 run, 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 createSpecDataDead();
107  cool::RecordSpecification createSpecDataNoisy();
108  coral::AttributeList createPayloadDataNoisy(const std::string& ChamberName,
109  const std::string& NoisyMultilayer,
110  const std::string& NoisyLayer,
111  const std::string& NoisyMezz,
112  const std::string& NoisyAsd,
113  const std::string& NoisyTube,
114  const cool::RecordSpecification& spec);
115  coral::AttributeList createPayloadDataDead(const std::string& ChamberName,
116  const std::string& DeadMultilayer,
117  const std::string& DeadLayer,
118  const std::string& DeadMezz,
119  const std::string& DeadAsd,
120  const std::string& DeadTube,
121  const cool::RecordSpecification& spec);
122 
123  // Constructors and Destructors.
124  void CoolOpen(const std::string& dbStr);
125 
126  //CoolMdt();
127  virtual ~CoolMdt ();
128 
129 
130  void dump(cool::ChannelSelection selection);
131  std::string dumpField(cool::ChannelId channelId, std::string field);
132  int dumpCode(const std::string& channelName);
133 
134  void dumpall();
135 
136  void insertNoisyFlag(cool::Int64 run,
137  cool::ChannelId channelId,
138  const std::string& ChamberName,
139  const std::string& NoisyMultilayer,
140  const std::string& NoisyLayer,
141  const std::string& NoisyMezz,
142  const std::string& NoisyAsd,
143  const std::string& NoisyTube);
144  void insertNoisyFlag_withTag(cool::Int64 run,
145  cool::ChannelId channelId,
146  const std::string& ChamberName,
147  const std::string& NoisyMultilayer,
148  const std::string& NoisyLayer,
149  const std::string& NoisyMezz,
150  const std::string& NoisyAsd,
151  const std::string& NoisyTube,
152  const std::string& cool_tag);
153 
154  void insertDeadFlag(cool::Int64 run,
155  cool::ChannelId channelId,
156  const std::string& ChamberName,
157  const std::string& DeadMultilayer,
158  const std::string& DeadLayer,
159  const std::string& DeadMezz,
160  const std::string& DeadAsd,
161  const std::string& DeadTube);
162  void insertDeadFlag_withTag(cool::Int64 run,
163  cool::ChannelId channelId,
164  const std::string& ChamberName,
165  const std::string& DeadMultilayer,
166  const std::string& DeadLayer,
167  const std::string& DeadMezz,
168  const std::string& DeadAsd,
169  const std::string& DeadTube,
170  const std::string& cool_tag);
171 
172  cool::IFolderPtr getCoolFolder();
173  cool::IDatabasePtr getCoolDb();
174 
175 
176  // Needed for the ROOT interface.
177  ClassDef(CoolMdt, 0) // A class for modifying DQ info in the COOL database
178  };
179 }
180 
181 #endif
dqutils::CoolMdt::printIOV
void printIOV()
dqutils::CoolMdt::setIOV
void setIOV(cool::Int64 runS, cool::Int64 lumiS, cool::Int64 runU, cool::Int64 lumiU)
dqutils::CoolMdt::~CoolMdt
virtual ~CoolMdt()
dqutils::CoolMdt::createPayloadDataNoisy
coral::AttributeList createPayloadDataNoisy(const std::string &ChamberName, const std::string &NoisyMultilayer, const std::string &NoisyLayer, const std::string &NoisyMezz, const std::string &NoisyAsd, const std::string &NoisyTube, const cool::RecordSpecification &spec)
dqutils::CoolMdt::createPayloadDataDead
coral::AttributeList createPayloadDataDead(const std::string &ChamberName, const std::string &DeadMultilayer, const std::string &DeadLayer, const std::string &DeadMezz, const std::string &DeadAsd, const std::string &DeadTube, const cool::RecordSpecification &spec)
dqutils::CoolMdt::m_until
cool::ValidityKey m_until
Definition: CoolMdt.h:83
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
dqutils::CoolMdt::coolDbFolder
void coolDbFolder(const std::string &dbStr, const std::string &folderStr)
dqutils::CoolMdt::CoolOpen
void CoolOpen(const std::string &dbStr)
dqutils::CoolMdt::m_fist_folder
bool m_fist_folder
Definition: CoolMdt.h:86
dqutils::CoolMdt::m_coolDb
cool::IDatabasePtr m_coolDb
Definition: CoolMdt.h:84
dqutils::CoolMdt::initialize
void initialize()
dqutils::CoolMdt::insertDeadFlag_withTag
void insertDeadFlag_withTag(cool::Int64 run, cool::ChannelId channelId, const std::string &ChamberName, const std::string &DeadMultilayer, const std::string &DeadLayer, const std::string &DeadMezz, const std::string &DeadAsd, const std::string &DeadTube, const std::string &cool_tag)
dqutils::CoolMdt::getCoolDb
cool::IDatabasePtr getCoolDb()
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
dqutils::CoolMdt::setSince
void setSince(cool::Int64 run, cool::Int64 lumi)
cool
Definition: CoolTagInfo.h:12
dqutils::CoolMdt::createSpecDataNoisy
cool::RecordSpecification createSpecDataNoisy()
coral
Definition: ISecondaryEventSelector.h:19
dqutils::CoolMdt::insertNoisyFlag_withTag
void insertNoisyFlag_withTag(cool::Int64 run, cool::ChannelId channelId, const std::string &ChamberName, const std::string &NoisyMultilayer, const std::string &NoisyLayer, const std::string &NoisyMezz, const std::string &NoisyAsd, const std::string &NoisyTube, const std::string &cool_tag)
CalibDbCompareRT.cool_tag
cool_tag
Definition: CalibDbCompareRT.py:12
dqutils::CoolMdt::m_coolFolder
cool::IFolderPtr m_coolFolder
Definition: CoolMdt.h:85
dqutils::CoolMdt::dumpCode
int dumpCode(const std::string &channelName)
dqutils::CoolMdt::m_since
cool::ValidityKey m_since
Definition: CoolMdt.h:82
run
Definition: run.py:1
dqutils
Definition: CoolMdt.h:76
dqutils::CoolMdt::dumpall
void dumpall()
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
dqutils::CoolMdt::setUntil
void setUntil(cool::Int64 run, cool::Int64 lumi)
dqutils::CoolMdt::coolFolderInstance
cool::IFolderPtr coolFolderInstance(const std::string &folderStr)
dqutils::CoolMdt::dumpField
std::string dumpField(cool::ChannelId channelId, std::string field)
selection
const std::string selection
Definition: fbtTestBasics.cxx:74
dqutils::CoolMdt::dump
void dump(cool::ChannelSelection selection)
dqutils::CoolMdt::setIOV
void setIOV(cool::Int64 run)
dqutils::CoolMdt::insertNoisyFlag
void insertNoisyFlag(cool::Int64 run, cool::ChannelId channelId, const std::string &ChamberName, const std::string &NoisyMultilayer, const std::string &NoisyLayer, const std::string &NoisyMezz, const std::string &NoisyAsd, const std::string &NoisyTube)
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
dqutils::CoolMdt::createSpecDataDead
cool::RecordSpecification createSpecDataDead()
dqutils::CoolMdt
Definition: CoolMdt.h:77
dqutils::CoolMdt::coolDbInstance
cool::IDatabasePtr coolDbInstance(const std::string &dbStr, bool readOnly)
dqutils::CoolMdt::getCoolFolder
cool::IFolderPtr getCoolFolder()
dqutils::CoolMdt::insertDeadFlag
void insertDeadFlag(cool::Int64 run, cool::ChannelId channelId, const std::string &ChamberName, const std::string &DeadMultilayer, const std::string &DeadLayer, const std::string &DeadMezz, const std::string &DeadAsd, const std::string &DeadTube)