Belle II Software
release-05-02-19
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
h
i
l
m
n
p
r
s
t
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
writeROIparametersToDB.cc
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2019 - Belle II Collaboration *
4
* *
5
* Author: The Belle II Collaboration *
6
* Contributors: Simon Kurz *
7
* *
8
* This software is provided "as is" without any warranty. *
9
**************************************************************************/
10
11
#include <framework/database/DBImportObjPtr.h>
12
#include <framework/database/IntervalOfValidity.h>
13
#include <framework/database/Configuration.h>
14
#include <framework/logging/LogSystem.h>
15
#include <framework/utilities/FileSystem.h>
16
17
#include <simulation/dbobjects/ROIParameters.h>
18
19
#include <iostream>
20
21
//------------------------------------------------------------------------
22
int
main
(
int
argc,
char
** argv)
23
{
24
if
(argc < 4 or !(std::stoi(argv[1]) == 0 or std::stoi(argv[1]) == 1)) {
25
std::cout <<
26
"Please specify IOV: 0/1 {=off/on} N {=off for every Nth event; -1 if not used} experiment run [experimentEnd] [runEnd]"
<<
27
std::endl;
28
return
-1;
29
}
30
31
bool
enableROI = std::stoi(argv[1]) == 1;
32
int
disableROIforEveryNth = std::stoi(argv[2]);
33
34
if
(!enableROI) {
35
disableROIforEveryNth = -1;
36
std::cout <<
"Parameter \"N\" does not have any function if ROI finding turned off. Neglecting."
<< std::endl;
37
}
else
if
(disableROIforEveryNth == 0 or disableROIforEveryNth == 1) {
38
disableROIforEveryNth = -1;
39
std::cout <<
40
"Parameter \"N\" does not make any sense. Please use positive integer greater than 1 (or negative integer for disabling this feature)."
41
<< std::endl;
42
}
else
if
(disableROIforEveryNth < -1) {
43
disableROIforEveryNth = -1;
44
}
45
46
int
experiment = std::stoi(argv[3]);
47
int
run = std::stoi(argv[4]);
48
int
exp_end = -1;
49
int
run_end = -1;
50
if
(argc > 5) exp_end = std::stoi(argv[5]);
51
if
(argc > 6) run_end = std::stoi(argv[6]);
52
53
//------------------------------------------------------------------------
54
//..Specify database
55
auto
& conf =
Belle2::Conditions::Configuration::getInstance
();
56
conf.prependTestingPayloadLocation(
"localdb/database.txt"
);
57
58
//..set debug level
59
Belle2::LogConfig
* logging =
Belle2::LogSystem::Instance
().
getLogConfig
();
60
logging->setLogLevel(
Belle2::LogConfig::c_Debug
);
61
logging->setDebugLevel(10);
62
63
//..create ROI parameters
64
Belle2::ROIParameters
roiParameters;
65
roiParameters.
setROIfinding
(enableROI);
66
roiParameters.
setDisableROIforEveryNth
(disableROIforEveryNth);
67
68
//------------------------------------------------------------------------
69
//..Write out to localdb
70
Belle2::DBImportObjPtr<Belle2::ROIParameters>
roiParametersDBPtr;
71
roiParametersDBPtr.
construct
(roiParameters);
72
roiParametersDBPtr.
import
(
Belle2::IntervalOfValidity
(experiment, run, exp_end, run_end));
73
std::cout <<
"Successfully wrote payload ROIParameters with iov "
74
<< experiment <<
","
<< run <<
","
<< exp_end <<
","
<< run_end << std::endl;
75
}
76
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::DBImportObjPtr::construct
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Definition:
DBImportObjPtr.h:57
Belle2::DBImportBase::import
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition:
DBImportBase.cc:38
Belle2::LogSystem::getLogConfig
LogConfig * getLogConfig()
Returns global log system configuration.
Definition:
LogSystem.h:88
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:77
Belle2::Conditions::Configuration::getInstance
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
Belle2::DBImportObjPtr
Class for importing a single object to the database.
Definition:
DBImportObjPtr.h:33
Belle2::LogSystem::Instance
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition:
LogSystem.cc:33
Belle2::ROIParameters
The payload containing all PXD ROI parameters.
Definition:
ROIParameters.h:32
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition:
LogConfig.h:36
Belle2::ROIParameters::setROIfinding
void setROIfinding(bool useROIfinding)
Set whether ROI finding was used.
Definition:
ROIParameters.h:40
Belle2::LogConfig
The LogConfig class.
Definition:
LogConfig.h:32
Belle2::ROIParameters::setDisableROIforEveryNth
void setDisableROIforEveryNth(int disableROIforEveryNth)
Set if ROI finding was disabled for every Nth event (-1 if not used)
Definition:
ROIParameters.h:52
simulation
tools
writeROIparametersToDB.cc
Generated on Tue Jan 4 2022 03:02:13 for Belle II Software by
1.8.17