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 = 4;
21
22 const int run[N_config][4] = { //itnitial exp, initial run, end exp, end run
23 {0, 0, 9, 1399}, // 0
24 {9, 1400, 29, -1}, // 1 15 TS
25 {30, 0, 34, -1}, // 2 full hit 2D
26 {35, 0, -1, -1}, // 3 ADC
27 };
28
29 int nTS[N_config] = {
30 10, 15, 15, 15
31 };
32 bool fullhit[N_config] = {
33 false, false, true, true
34 };
35 int hitthreshold[N_config] = {
36 4, 4, 16, 16
37 };
38 bool ADC[N_config] = {
39 false, false, false, true
40 };
41
43 db_2dconfig.construct();
44 if (ONLINE == 0) {
45 for (int i = 0; i < N_config; i++) {
46 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
47 db_2dconfig->setnTS(nTS[i]);
48 db_2dconfig->setfullhit(fullhit[i]);
49 db_2dconfig->sethitthreshold(hitthreshold[i]);
50 db_2dconfig->setADC(ADC[i]);
51 db_2dconfig.import(iov);
52 }
53 } else if (ONLINE == 1) {
54 for (int i = N_config - 1; i < N_config; i++) {
55 IntervalOfValidity iov(0, 0, -1, -1);
56 db_2dconfig->setnTS(nTS[i]);
57 db_2dconfig->setfullhit(fullhit[i]);
58 db_2dconfig->sethitthreshold(hitthreshold[i]);
59 db_2dconfig->setADC(ADC[i]);
60 db_2dconfig.import(iov);
61 }
62 }
63}
64
65int main()
66{
67
68 set2dconfig();
69
70}
71
72
bool import(const IntervalOfValidity &iov)
Import the object to database.
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.