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
test_main.cc
Go to the documentation of this file.
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2016 - Belle II Collaboration *
4
* *
5
* Author: The Belle II Collaboration *
6
* Contributors: Martin Ritter *
7
* *
8
* This software is provided "as is" without any warranty. *
9
**************************************************************************/
10
19
#include "gtest/gtest.h"
20
#include "framework/core/RandomNumbers.h"
21
#include <framework/logging/LogSystem.h>
22
#include <framework/logging/LogConfig.h>
23
#include <framework/dbobjects/MagneticField.h>
24
#include <framework/dbobjects/MagneticFieldComponentConstant.h>
25
#include <mdst/dbobjects/CollisionInvariantMass.h>
26
#include <mdst/dbobjects/CollisionBoostVector.h>
27
#include <mdst/dbobjects/BeamSpot.h>
28
#include <framework/database/DBStore.h>
29
30
namespace
{
35
class
TestEventListener:
public
::testing::EmptyTestEventListener {
36
public
:
38
TestEventListener(
bool
debug): ::testing::EmptyTestEventListener(), m_enableDebug{debug} {}
39
private
:
43
virtual
void
OnTestStart(const ::testing::TestInfo& test)
final
override
44
{
45
if
(m_enableDebug) {
46
Belle2::LogSystem::Instance
().
getLogConfig
()->
setDebugLevel
(10000);
47
Belle2::LogSystem::Instance
().
getLogConfig
()->
setLogLevel
(
Belle2::LogConfig::c_Debug
);
48
}
49
std::string name = test.test_case_name();
50
name +=
"/"
;
51
name += test.name();
52
Belle2::RandomNumbers::initialize
(name);
53
Belle2::MagneticField
* field =
new
Belle2::MagneticField
();
54
field->addComponent(
new
Belle2::MagneticFieldComponentConstant
({0, 0, 1.5 *
Belle2::Unit::T
}));
55
Belle2::DBStore::Instance
().
addConstantOverride
(
"MagneticField"
, field,
false
);
56
auto
* collisionInvariantMass =
new
Belle2::CollisionInvariantMass
();
57
collisionInvariantMass->setMass(10.5738932579, 0, 0);
58
Belle2::DBStore::Instance
().
addConstantOverride
(
"CollisionInvariantMass"
, collisionInvariantMass);
59
auto
* collisionBoostVector =
new
Belle2::CollisionBoostVector
();
60
collisionBoostVector->setBoost(TVector3(0.0414880886031, 0, 0.272492455429), TMatrixDSym(3));
61
Belle2::DBStore::Instance
().
addConstantOverride
(
"CollisionBoostVector"
, collisionBoostVector);
62
auto
* beamSpot =
new
Belle2::BeamSpot
();
63
Belle2::DBStore::Instance
().
addConstantOverride
(
"BeamSpot"
, beamSpot);
64
}
66
virtual
void
OnTestEnd(const ::testing::TestInfo&)
final
override
67
{
68
Belle2::LogSystem::Instance
().
resetLogging
();
69
}
70
72
bool
m_enableDebug;
73
};
74
}
75
77
int
main
(
int
argc,
char
** argv)
78
{
79
::testing::InitGoogleTest(&argc, argv);
80
::testing::UnitTest& unit_test = *::testing::UnitTest::GetInstance();
81
bool
debug{
false
};
82
for
(
int
i = 1; i < argc; ++i) {
83
if
(std::string(argv[i]) ==
"--debug"
) debug =
true
;
84
}
85
unit_test.listeners().Append(
new
TestEventListener(debug));
86
return
RUN_ALL_TESTS();
87
}
Belle2::DBStore::addConstantOverride
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition:
DBStore.cc:204
Belle2::LogSystem::resetLogging
void resetLogging()
Reset logging system to defaults: empty all log messages and reset connections to the default.
Definition:
LogSystem.cc:184
Belle2::LogConfig::setLogLevel
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition:
LogConfig.cc:27
Belle2::BeamSpot
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition:
BeamSpot.h:32
Belle2::Unit::T
static const double T
[tesla]
Definition:
Unit.h:130
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::RandomNumbers::initialize
static void initialize()
Initialize the random number generator with a unique random seed;.
Definition:
RandomNumbers.cc:34
Belle2::DBStore::Instance
static DBStore & Instance()
Instance of a singleton DBStore.
Definition:
DBStore.cc:36
Belle2::CollisionInvariantMass
This class contains the measured average center-of-mass energy, which is equal to the invariant mass ...
Definition:
CollisionInvariantMass.h:31
Belle2::MagneticField
Magnetic field map.
Definition:
MagneticField.h:43
Belle2::LogSystem::Instance
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition:
LogSystem.cc:33
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition:
LogConfig.h:36
Belle2::MagneticFieldComponentConstant
Describe one component of the Geometry.
Definition:
MagneticFieldComponentConstant.h:29
Belle2::CollisionBoostVector
This class contains the measured average boost vector vec(beta) = (beta_x, beta_y,...
Definition:
CollisionBoostVector.h:33
Belle2::LogConfig::setDebugLevel
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition:
LogConfig.h:94
site_scons
test_main.cc
Generated on Tue Jan 4 2022 03:02:15 for Belle II Software by
1.8.17