Belle II Software  release-05-02-19
ECLDBTool.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * ECLDBTool *
6  * *
7  * Utility designed to read / write object from / to database. *
8  * *
9  * Author: The Belle II Collaboration *
10  * Contributors: Sergei Gribanov (S.S.Gribanov@inp.nsk.su) (BINP) *
11  * *
12  * This software is provided "as is" without any warranty. *
13  **************************************************************************/
14 #pragma once
15 
16 // FRAMEWORK
17 #include <framework/database/IntervalOfValidity.h>
18 #include <framework/dataobjects/EventMetaData.h>
19 namespace Belle2 {
29  class ECLDBTool {
30  public:
39  ECLDBTool(bool isLocal,
40  const char* dbName,
41  const char* payloadName);
45  ~ECLDBTool();
49  void connect() const;
56  void write(TObject* const obj,
57  const IntervalOfValidity& iov) const;
65  void read(TObject** obj,
66  IntervalOfValidity** iov,
67  const EventMetaData& event) const;
73  void read(IntervalOfValidity** iov,
74  const EventMetaData& event) const;
82  void changeIoV(const EventMetaData& event,
83  const IntervalOfValidity& iov) const;
84  private:
91  bool m_isLocal;
96  std::string m_dbName;
100  std::string m_payloadName;
101  };
103 }
104 
Belle2::IntervalOfValidity
A class that describes the interval of experiments/runs for which an object in the database is valid.
Definition: IntervalOfValidity.h:35
Belle2::ECLDBTool::read
void read(TObject **obj, IntervalOfValidity **iov, const EventMetaData &event) const
Read object and validity interval from a database.
Definition: ECLDBTool.cc:51
Belle2::ECLDBTool::connect
void connect() const
Connect to a database.
Definition: ECLDBTool.cc:34
Belle2::ECLDBTool::m_payloadName
std::string m_payloadName
Name of payload.
Definition: ECLDBTool.h:112
Belle2::ECLDBTool::write
void write(TObject *const obj, const IntervalOfValidity &iov) const
Write object and validity interval to a database.
Definition: ECLDBTool.cc:44
Belle2::ECLDBTool::changeIoV
void changeIoV(const EventMetaData &event, const IntervalOfValidity &iov) const
Change interval of validity (Make a copy of the current payload with other validity interval).
Definition: ECLDBTool.cc:72
Belle2::ECLDBTool::~ECLDBTool
~ECLDBTool()
Destructor.
Definition: ECLDBTool.cc:30
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLDBTool::ECLDBTool
ECLDBTool(bool isLocal, const char *dbName, const char *payloadName)
Constructor.
Definition: ECLDBTool.cc:21
Belle2::ECLDBTool::m_dbName
std::string m_dbName
Tag in the central database or path to a local database.
Definition: ECLDBTool.h:108
Belle2::EventMetaData
Store event, run, and experiment numbers.
Definition: EventMetaData.h:43
Belle2::ECLDBTool::m_isLocal
bool m_isLocal
If m_isLocal is true, local database is used.
Definition: ECLDBTool.h:103