Belle II Software development
trg-cdc-tsf-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/CDCTriggerTSFConfig.h>
11
12using namespace Belle2;
13
14#define ONLINE 0
15//#define ONLINE 1
16
17void settsfconfig()
18{
19
20 const int N_config = 3;
21
22 const int run[N_config][4] = { //itnitial exp, initial run, end exp, end run
23 {0, 0, 10, 3929}, // 0
24 {10, 3930, 34, -1}, // 1 TDC cross talk filter
25 {35, 0, -1, -1} // 2 ADC
26 };
27
28 bool TDCfilter[N_config] = {
29 false, false, false
30 //false, true, true, //this is consistent with experiment. it is disabled on TSIM to reduce CPU time.
31 };
32 bool ADC[N_config] = {
33 false, false, true
34 };
35 int ADC_threshold[N_config] = {
36 -1, -1, 10
37 };
38
40 db_tsfconfig.construct();
41 if (ONLINE == 0) {
42 for (int i = 0; i < N_config; i++) {
43 IntervalOfValidity iov(run[i][0], run[i][1], run[i][2], run[i][3]);
44 db_tsfconfig->setuseTDCfilter(TDCfilter[i]);
45 db_tsfconfig->setuseADC(ADC[i]);
46 db_tsfconfig->setADC_threshold(ADC_threshold[i]);
47 db_tsfconfig.import(iov);
48 }
49 } else if (ONLINE == 1) {
50 for (int i = N_config - 1; i < N_config; i++) {
51 IntervalOfValidity iov(0, 0, -1, -1);
52 db_tsfconfig->setuseTDCfilter(TDCfilter[i]);
53 db_tsfconfig->setuseADC(ADC[i]);
54 db_tsfconfig->setADC_threshold(ADC_threshold[i]);
55 db_tsfconfig.import(iov);
56 }
57 }
58}
59
60int main()
61{
62
63 settsfconfig();
64
65}
66
67
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.