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
ParticleCopierModule.cc
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2010 - 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
// Own include
12
#include <analysis/modules/ParticleCopier/ParticleCopierModule.h>
13
14
15
// framework - DataStore
16
#include <framework/datastore/StoreArray.h>
17
#include <framework/datastore/StoreObjPtr.h>
18
19
// framework aux
20
#include <framework/logging/Logger.h>
21
22
// dataobjects
23
#include <analysis/dataobjects/Particle.h>
24
#include <analysis/dataobjects/ParticleList.h>
25
26
// utilities
27
#include <analysis/utility/ParticleCopy.h>
28
29
using namespace
std;
30
31
namespace
Belle2
{
37
//-----------------------------------------------------------------
38
// Register module
39
//-----------------------------------------------------------------
40
41
REG_MODULE
(ParticleCopier)
42
43
//-----------------------------------------------------------------
44
// Implementation
45
//-----------------------------------------------------------------
46
47
ParticleCopierModule
::
ParticleCopierModule
() :
Module
()
48
{
49
setDescription(
"Replaces each Particle in the ParticleList with its copy.\n"
50
"Particle's (grand)^n-daughter Particles are copied as well.\n"
51
"The existing relations of the original Particle (or it's (grand-)^n-daughters)\n"
52
"are copied as well."
);
53
setPropertyFlags(c_ParallelProcessingCertified);
54
55
// Add parameters
56
vector<string> defaultList;
57
addParam(
"inputListNames"
, m_inputListNames,
58
"list of input ParticleList names"
, defaultList);
59
}
60
61
void
ParticleCopierModule::initialize()
62
{
63
// Input lists
64
for
(
const
std::string& listName : m_inputListNames) {
65
StoreObjPtr<ParticleList>
().isRequired(listName);
66
}
67
}
68
69
void
ParticleCopierModule::event()
70
{
71
const
StoreArray<Particle>
particles;
72
73
// copy all particles from input lists that pass selection criteria into plist
74
for
(
const
auto
& inputListName : m_inputListNames) {
75
const
StoreObjPtr<ParticleList>
plist(inputListName);
76
77
const
unsigned
int
origSize = plist->getListSize();
78
std::vector<Particle*> copies(origSize);
79
80
for
(
unsigned
i = 0; i < origSize; i++) {
81
const
Particle
* origP = plist->getParticle(i);
82
83
// copy the particle
84
Particle
* copyP = ParticleCopy::copyParticle(origP);
85
copies.at(i) = copyP;
86
}
87
88
// clear the original list and fill it with copies
89
plist->clear();
90
for
(
unsigned
i = 0; i < origSize; i++)
91
plist->addParticle(copies[i]);
92
93
unsigned
int
copySize = plist->getListSize();
94
95
if
(copySize != origSize)
96
B2FATAL(
"Size of the ParticleList "
<< inputListName
97
<<
" has changed while copying the Particles! original size = "
98
<< origSize <<
" vs. new size = "
<< copySize);
99
100
}
101
}
103
}
// end Belle2 namespace
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition:
Module.h:652
Belle2::ParticleCopierModule
Module for creating copies of Particles.
Definition:
ParticleCopierModule.h:46
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::Particle
Class to store reconstructed particles.
Definition:
Particle.h:77
Belle2::StoreArray< Particle >
analysis
modules
ParticleCopier
src
ParticleCopierModule.cc
Generated on Tue Jan 4 2022 02:50:03 for Belle II Software by
1.8.17