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
SignalSideVariablesToExtraInfoModule.cc
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2013 - Belle II Collaboration *
4
* *
5
* Author: The Belle II Collaboration *
6
* Contributors: Anze Zupanc *
7
* *
8
* This software is provided "as is" without any warranty. *
9
**************************************************************************/
10
11
#include <analysis/modules/SignalSideVariablesToExtraInfo/SignalSideVariablesToExtraInfoModule.h>
12
#include <framework/core/ModuleParam.templateDetails.h>
13
#include <framework/datastore/StoreArray.h>
14
15
#include <analysis/dataobjects/Particle.h>
16
#include <analysis/dataobjects/RestOfEvent.h>
17
18
using namespace
Belle2
;
19
20
//-----------------------------------------------------------------
21
// Register the Module
22
//-----------------------------------------------------------------
23
REG_MODULE
(SignalSideVariablesToExtraInfo)
24
25
//-----------------------------------------------------------------
26
// Implementation
27
//-----------------------------------------------------------------
28
29
SignalSideVariablesToExtraInfoModule
::
SignalSideVariablesToExtraInfoModule
() :
Module
()
30
{
31
// Set module properties
32
setDescription(
"The module writes property (value of specified variable) of single particle\n"
33
"found in the input ParticleList as an ExtraInfo to the Particle related to\n"
34
"the current ROE. This module is intended to be executed only in for_each ROE\n"
35
"path."
);
36
37
// Parameter definitions
38
std::map<std::string, std::string> emptymap;
39
addParam(
"particleListName"
, m_particleListName,
"The input particleList name. This list should contain at most 1 particle"
,
40
std::string(
""
));
41
addParam(
"variableToExtraInfo"
, m_variableToExtraInfo,
42
"Dictionary of variables and extraInfo names to save in the extra-info field."
,
43
emptymap);
44
}
45
46
void
SignalSideVariablesToExtraInfoModule::initialize
()
47
{
48
StoreArray<Particle>
().isRequired();
49
m_inputList
.isRequired(
m_particleListName
);
50
51
for
(
const
auto
& pair :
m_variableToExtraInfo
) {
52
const
Variable::Manager::Var
* var =
Variable::Manager::Instance
().
getVariable
(pair.first);
53
if
(!var) {
54
B2ERROR(
"Variable '"
<< pair.first <<
"' is not available in Variable::Manager!"
);
55
}
else
{
56
m_functions
.push_back(var->function);
57
m_extraInfoNames
.push_back(pair.second);
58
}
59
}
60
}
61
62
void
SignalSideVariablesToExtraInfoModule::event
()
63
{
64
StoreObjPtr<ParticleList>
plist(
m_particleListName
);
65
unsigned
int
n = plist->getListSize();
66
67
if
(n == 0)
68
return
;
69
70
if
(n > 1)
71
B2WARNING(
"Input ParticleList "
<<
m_particleListName
<<
" contains more than 1 particle. plist.size = "
<< n);
72
73
StoreObjPtr<RestOfEvent>
roe(
"RestOfEvent"
);
74
if
(roe.
isValid
()) {
75
auto
* signalSide = roe->getRelated<
Particle
>();
76
77
const
unsigned
int
nVars =
m_functions
.size();
78
for
(
unsigned
int
iVar = 0; iVar < nVars; iVar++) {
79
if
(signalSide->hasExtraInfo(
m_extraInfoNames
[iVar])) {
80
B2WARNING(
"Extra info with given name "
<<
m_extraInfoNames
[iVar] <<
" already set, I won't set it again."
);
81
}
else
{
82
signalSide->addExtraInfo(
m_extraInfoNames
[iVar],
m_functions
[iVar](plist->getParticle(0)));
83
}
84
}
85
}
86
}
Belle2::Variable::Manager::Var
A variable returning a floating-point value for a given Particle.
Definition:
Manager.h:137
Belle2::Variable::Manager::getVariable
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
Definition:
Manager.cc:33
Belle2::SignalSideVariablesToExtraInfoModule::m_variableToExtraInfo
std::map< std::string, std::string > m_variableToExtraInfo
Map of variable and extraInfo name to save in the extra-info field.
Definition:
SignalSideVariablesToExtraInfoModule.h:67
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition:
Module.h:652
Belle2::SignalSideVariablesToExtraInfoModule
The module writes property of single particle found in the input ParticleList as an ExtraInfo to the ...
Definition:
SignalSideVariablesToExtraInfoModule.h:45
Belle2::SignalSideVariablesToExtraInfoModule::m_functions
std::vector< Variable::Manager::FunctionPtr > m_functions
Vector of function pointers corresponding to given variables.
Definition:
SignalSideVariablesToExtraInfoModule.h:70
Belle2::Module
Base class for Modules.
Definition:
Module.h:74
Belle2::SignalSideVariablesToExtraInfoModule::m_extraInfoNames
std::vector< std::string > m_extraInfoNames
Vector of extra info names.
Definition:
SignalSideVariablesToExtraInfoModule.h:72
Belle2::SignalSideVariablesToExtraInfoModule::m_particleListName
std::string m_particleListName
The input particleList name.
Definition:
SignalSideVariablesToExtraInfoModule.h:59
Belle2::SignalSideVariablesToExtraInfoModule::m_inputList
StoreObjPtr< ParticleList > m_inputList
input particle list
Definition:
SignalSideVariablesToExtraInfoModule.h:60
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition:
ParticleList.h:33
Belle2::Particle
Class to store reconstructed particles.
Definition:
Particle.h:77
Belle2::SignalSideVariablesToExtraInfoModule::initialize
virtual void initialize() override
Register input and output data.
Definition:
SignalSideVariablesToExtraInfoModule.cc:46
Belle2::StoreArray< Particle >
Belle2::SignalSideVariablesToExtraInfoModule::event
virtual void event() override
process event
Definition:
SignalSideVariablesToExtraInfoModule.cc:62
Belle2::StoreObjPtr::isValid
bool isValid() const
Check whether the object was created.
Definition:
StoreObjPtr.h:120
Belle2::Variable::Manager::Instance
static Manager & Instance()
get singleton instance.
Definition:
Manager.cc:27
analysis
modules
SignalSideVariablesToExtraInfo
src
SignalSideVariablesToExtraInfoModule.cc
Generated on Tue Jan 4 2022 02:50:10 for Belle II Software by
1.8.17