ATLAS Offline Software
Loading...
Searching...
No Matches
ReadLumiBlock.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIG_ReadLumiBlock_H
6#define TRIG_ReadLumiBlock_H
7
8//
9// Connect to COOL and get LB lengths for a run
10//
11
12// COOL
13#include "CoolApplication/Application.h"
14#include "CoolKernel/DatabaseId.h"
15#include "CoolKernel/Exception.h"
16#include "CoolKernel/IDatabaseSvc.h"
17#include "CoolKernel/IDatabase.h"
18
19#include "GaudiKernel/MsgStream.h"
20
21// C/C++
22#include <map>
23#include <string>
24
28class ReadLumiBlock : public cool::Application {
29public:
30
36
37 bool updateLumiBlocks(uint32_t run, MsgStream& msg);
38 float getLumiBlockLength(uint32_t lb, MsgStream& msg) const;
39
40 void setConnectionCOOL(const std::string &id) { m_cool_id = id; }
41 bool getTriedSetup() { return m_triedSetup; }
42
43 cool::DatabaseId& cool_id() { return m_cool_id; }
44 cool::IDatabasePtr& cool_ptr() { return m_cool_ptr; }
45
46 const std::string& cool_source() const { return m_cool_source; }
47
48 uint32_t getRun() const { return m_run; }
49
50private:
51
52 bool dbIsOpen();
53 void closeDb(MsgStream& msg);
54 bool openDb(bool readOnly, MsgStream& msg);
55
56private:
57
58 std::map<uint32_t, uint64_t> m_lbLength; // Hold the runs LB lengths
59
60 cool::DatabaseId m_cool_id; // COOL connection id
61 cool::DatabaseId m_cool_id_run1; // COOL connection id for run 1 data
62 cool::DatabaseId m_cool_id_run2; // COOL connection id for run 2 data
63 cool::IDatabasePtr m_cool_ptr; // COOL database pointer
64
65 std::string m_cool_source; // COOL configuration source
66 uint32_t m_run; // Run number
67 bool m_triedSetup; // If we have tried to get a DB connection
68};
69
70#endif
bool updateLumiBlocks(uint32_t run, MsgStream &msg)
Load information for.
cool::IDatabasePtr m_cool_ptr
cool::IDatabasePtr & cool_ptr()
Get reference to COOL database ptr.
bool getTriedSetup()
True when a connection attempt has been made.
std::map< uint32_t, uint64_t > m_lbLength
float getLumiBlockLength(uint32_t lb, MsgStream &msg) const
cool::DatabaseId m_cool_id_run1
bool dbIsOpen()
Check if DB connection is open.
void closeDb(MsgStream &msg)
Close DB connection.
cool::DatabaseId m_cool_id
void setConnectionCOOL(const std::string &id)
Set which COOL instance to connect to (run1, run2)
cool::DatabaseId & cool_id()
Get reference to COOL database ID.
ReadLumiBlock()
Construct helper class for reading in lumi block length from COOL.
bool openDb(bool readOnly, MsgStream &msg)
Open a DB connection.
const std::string & cool_source() const
Get name of COOL data source.
std::string m_cool_source
cool::DatabaseId m_cool_id_run2
uint32_t getRun() const
Get run number.
int lb
Definition globals.cxx:23
Definition run.py:1
MsgStream & msg
Definition testRead.cxx:32