SQLamarr
The stand-alone ultra-fast simulation option for the LHCb experiment
MCParticleSelector.py
1
# (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration.
2
#
3
# This software is distributed under the terms of the GNU General Public
4
# Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE".
5
#
6
# In applying this licence, CERN does not waive the privileges and immunities
7
# granted to it by virtue of its status as an Intergovernmental Organization
8
# or submit itself to any jurisdiction.
9
10
import
ctypes
11
from
ctypes
import
POINTER
12
from
SQLamarr
import
clib, c_TransformerPtr
13
14
from
SQLamarr.db_functions
import
SQLite3DB
15
16
clib.new_MCParticleSelector.argtypes = (ctypes.c_void_p,)
17
clib.new_MCParticleSelector.restype = c_TransformerPtr
18
19
class
MCParticleSelector
:
20
"""
21
Converts GenParticles into MCParticles preserving the graph structure.
22
23
The event described with GenParticles and GenVertices is described with much
24
more detail than what is needed to match reconstructed particles to their
25
MC-true couterparts. `MCParticleSelector` is a Transformer copying the
26
GenParticles table into an MCParticle table, "skipping" particles irrelevant
27
for MC matching while preserving the tree structure of the decay
28
representation.
29
30
Note that the `GenParticles` graph is a DAG, but not a tree, with vertices
31
(graph nodes) defining multiple inputs (describing interactions) while the
32
`MCParticle` graph is a tree, with each vertex (node) accepting a single input
33
particle (decay vertex).
34
"""
35
def
__init__
(self, db: SQLite3DB):
36
"""Acquires the reference to an open connection to the DB"""
37
self.
_self
_self = clib.new_MCParticleSelector(db.get())
38
39
def
__del__(self):
40
"""@private: Release the bound class instance"""
41
clib.del_Transformer(self.
_self
_self)
42
43
@property
44
def
raw_pointer(self):
45
"""@private: Return the raw pointer to the algorithm."""
46
return
self.
_self
_self
47
SQLamarr::MCParticleSelector.MCParticleSelector
Converts GenParticles into MCParticles preserving the graph structure.
Definition:
MCParticleSelector.py:19
SQLamarr::MCParticleSelector.MCParticleSelector.__init__
def __init__(self, SQLite3DB db)
Acquires the reference to an open connection to the DB.
Definition:
MCParticleSelector.py:35
SQLamarr::MCParticleSelector.MCParticleSelector._self
_self
Definition:
MCParticleSelector.py:37
SQLamarr.db_functions
Definition:
db_functions.py:1
python
SQLamarr
MCParticleSelector.py
Generated by
1.9.1