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
TagUniqueSignalModule.cc
1
#include <analysis/modules/TagUniqueSignal/TagUniqueSignalModule.h>
2
3
#include <analysis/dataobjects/Particle.h>
4
#include <mdst/dataobjects/MCParticle.h>
5
#include <analysis/dataobjects/ParticleList.h>
6
7
#include <framework/datastore/StoreObjPtr.h>
8
#include <framework/logging/Logger.h>
9
10
#include <set>
11
12
using namespace
std;
13
using namespace
Belle2
;
14
15
16
//-----------------------------------------------------------------
17
// Register module
18
//-----------------------------------------------------------------
19
20
REG_MODULE
(TagUniqueSignal)
21
22
TagUniqueSignalModule
::
TagUniqueSignalModule
() :
Module
(), m_targetVar(
nullptr
)
23
{
24
setDescription(
"Mark true (target=1) candidates from input list via extra-info field. Only the first true candidate associated with an MCParticle is marked."
);
25
setPropertyFlags(c_ParallelProcessingCertified);
26
27
// Add parameters
28
addParam(
"particleList"
, m_particleList,
"Input ParticleList name"
);
29
addParam(
"target"
, m_targetVariable,
"Variable which defines signal and background."
, std::string(
"isSignal"
));
30
addParam(
"extraInfoName"
, m_extraInfoName,
31
"Extra-info field added to all particles in the input list. 1 for unique signal, 0 for background or duplicates."
,
32
string
(
"uniqueSignal"
));
33
}
34
35
void
TagUniqueSignalModule::initialize()
36
{
37
StoreObjPtr<ParticleList>
().isRequired(m_particleList);
38
39
Variable::Manager
& manager = Variable::Manager::Instance();
40
41
m_targetVar = manager.getVariable(m_targetVariable);
42
if
(m_targetVar ==
nullptr
) {
43
B2ERROR(
"TagUniqueSignal: Variable::Manager doesn't have variable"
<< m_targetVariable);
44
}
45
}
46
47
void
TagUniqueSignalModule::event()
48
{
49
const
StoreObjPtr<ParticleList>
inPList(m_particleList);
50
if
(!inPList)
51
return
;
52
53
54
const
int
size = inPList->getListSize();
55
std::set<const MCParticle*> foundMCParticles;
56
for
(
int
i = 0; i < size; i++) {
57
Particle
* part = inPList->getParticle(i);
58
const
MCParticle
* mcp = part->getRelated<
MCParticle
>();
59
float
extraInfoValue = 0.0;
60
if
(mcp and m_targetVar->function(part)) {
61
const
bool
was_inserted = foundMCParticles.insert(mcp).second;
62
if
(was_inserted)
63
extraInfoValue = 1.0;
64
}
65
if
(part->hasExtraInfo(m_extraInfoName)) {
66
B2WARNING(
"Extra Info with given name is already set! This module can only be used once per particle."
);
67
}
else
{
68
part->addExtraInfo(m_extraInfoName, extraInfoValue);
69
}
70
}
71
}
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition:
Module.h:652
Belle2::Module
Base class for Modules.
Definition:
Module.h:74
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::TagUniqueSignalModule
Loops through the particle list finds a unique signal candidate for each event.
Definition:
TagUniqueSignalModule.h:37
Belle2::Particle
Class to store reconstructed particles.
Definition:
Particle.h:77
Belle2::MCParticle
A Class to store the Monte Carlo particle information.
Definition:
MCParticle.h:43
Belle2::Variable::Manager
Global list of available variables.
Definition:
Manager.h:108
analysis
modules
TagUniqueSignal
src
TagUniqueSignalModule.cc
Generated on Tue Jan 4 2022 02:50:11 for Belle II Software by
1.8.17