Belle II Software development
trg-cdc-2d-writedb.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <framework/database/DBImportObjPtr.h>
10#include <trg/cdc/dbobjects/CDCTrigger2DConfig.h>
11
12using namespace Belle2;
13
14#define ONLINE 0
15//#define ONLINE 1
16
17void set2dconfig()
18{
19
20 const int N_config = 2;
21
22 const int run[N_config][4] = { //itnitial exp, initial run, end exp, end run
23 {0, 0, -1, -1}, // 0
24 {9, 1400, -1, -1} // 1
25 };
26
27 int nTS[N_config] = {
28 10, 15
29 };
30
32 db_2dconfig.construct();
33 if (ONLINE == 0) {
34 for (int i = 0; i < N_config; i++) {
35 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
36 db_2dconfig->setnTS(nTS[i]);
37 db_2dconfig.import(iov);
38 }
39 } else if (ONLINE == 1) {
40 for (int i = N_config - 1; i < N_config; i++) {
41 IntervalOfValidity iov(9, 0, -1, -1);
42 db_2dconfig->setnTS(nTS[i]);
43 db_2dconfig.import(iov);
44 }
45 }
46}
47
48int main()
49{
50
51 set2dconfig();
52
53}
54
55
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
A class that describes the interval of experiments/runs for which an object in the database is valid.
Abstract base class for different kinds of events.