Belle II Software
release-05-01-25
variablesOnTTree.cc
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2013 - Belle II Collaboration *
4
* *
5
* Author: The Belle II Collaboration *
6
* Contributors: Eugenio Paoloni *
7
* *
8
* This software is provided "as is" without any warranty. *
9
**************************************************************************/
10
11
#include <gtest/gtest.h>
12
#include <tracking/trackFindingVXD/filterMap/filterFramework/Shortcuts.h>
13
#include <tracking/trackFindingVXD/filterMap/filterFramework/SelectionVariable.h>
14
#include <tracking/trackFindingVXD/filterMap/filterFramework/Filter.h>
15
16
#include <tracking/trackFindingVXD/filterMap/training/VariablesTTree.h>
17
#include <TTree.h>
18
19
20
namespace
Belle2
{
26
SELECTION_VARIABLE
(Difference, 2,
double
,
28
static
double
value(
const
double
& t1,
29
const
double
& t2)
30
{
return
t1 - t2; };
31
);
32
34
SELECTION_VARIABLE
(Sum, 2,
double
,
35
static
double
value(
const
double
& t1,
36
const
double
& t2)
37
{
return
t1 + t2; };
38
);
39
41
class
VariablesOnTTree:
public
::testing::Test {
42
protected
:
43
44
public
:
45
TTree*
tree1
;
46
TTree*
tree2
;
47
VariablesOnTTree() :
tree1
(nullptr),
tree2
(nullptr)
48
{
49
tree1
=
new
TTree(
"t1"
,
"t1"
);
50
tree2
=
new
TTree(
"t2"
,
"t2"
);
51
52
}
53
54
~
VariablesOnTTree
()
55
{
56
delete
tree1
;
57
delete
tree2
;
58
}
59
};
60
62
TEST_F
(VariablesOnTTree, basic_test)
63
{
64
auto
filter1 = 0 < Difference() < 1 && 0 < Sum() < 1;
65
auto
variables1 =
VariablesTTree<>::build
(filter1 , tree1);
66
67
auto
filter2 = 0 < Difference() < 1 && 0 < Sum() < 1;
68
auto
variables2 =
VariablesTTree<>::build
(filter2 , tree2);
69
70
double
a(0.), b(1.0);
71
variables1.evaluateOn(a, b);
72
tree1->Fill();
73
74
double
c(1.), d(0.0);
75
variables2.evaluateOn(c, d);
76
tree2->Fill();
77
78
tree1->Scan();
79
tree2->Scan();
80
}
82
}
Belle2::VariablesOnTTree::tree1
TTree * tree1
a TTree
Definition:
variablesOnTTree.cc:53
Belle2::SELECTION_VARIABLE
SELECTION_VARIABLE(Difference, 2, double, static double value(const double &t1, const double &t2) { return t1 - t2;};)
Quick definition of a selection variable implementing the difference of 2 doubles.
Belle2::VariablesTTree<>::build
static auto build(const Filter &, TTree *tree) -> VariablesTTree< Filter >
Handy function.
Definition:
VariablesTTree.h:51
Belle2::VariablesOnTTree::tree2
TTree * tree2
another TTree
Definition:
variablesOnTTree.cc:54
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::VariablesOnTTree
Test for VariablesTTree.
Definition:
variablesOnTTree.cc:49
Belle2::TEST_F
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Definition:
globalLabel.cc:65
tracking
trackFindingVXD
filterMap
training
tests
variablesOnTTree.cc
Generated on Fri Nov 5 2021 04:04:37 for Belle II Software by
1.8.17