SQLamarr
The stand-alone ultra-fast simulation option for the LHCb experiment
SQLamarr::MCParticleSelector Class Reference

Converts GenParticles to MCParticles. More...

#include <MCParticleSelector.h>

Inheritance diagram for SQLamarr::MCParticleSelector:

Classes

class  MCParticleSelector
 Converts GenParticles into MCParticles preserving the graph structure. More...
 

Public Member Functions

 MCParticleSelector (SQLite3DB &db, const std::vector< uint64_t > retained_status_values={ LAMARR_LHCB_STABLE_IN_PRODGEN, LAMARR_LHCB_DECAYED_BY_DECAYGEN, LAMARR_LHCB_DECAYED_BY_DECAYGEN_AND_PRODUCED_BY_PRODGEN, LAMARR_LHCB_SIGNAL_IN_LAB_FRAME, LAMARR_LHCB_STABLE_IN_DECAYGEN }, const std::vector< uint64_t > retained_abspid_values={ 6, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 102, 130, 310, 311, 321, 411, 421, 413, 423, 415, 425, 431, 435, 511, 521, 513, 523, 515, 525, 531, 535, 541, 545, 441, 10441, 100441, 443, 10443, 20443, 100443, 30443, 9000443, 9010443, 9020443, 445, 10445, 551, 10551, 100551, 110551, 200551, 210551, 553, 10553, 20553, 30553, 100553, 110553, 120553, 130553, 200553, 210553, 220553, 300553, 9000553, 9010553, 555, 10555, 20555, 100555, 110555, 120555, 200555, 557, 100557, 2212, 2212, 3122, 3222, 3212, 3224, 3214, 3114, 3322, 3312, 3324, 3314, 3334, 4122, 4222, 4212, 4112, 4224, 4214, 4114, 4232, 4132, 4322, 4312, 4324, 4314, 4332, 4334, 4412, 4422, 4414, 4424, 4432, 4434, 4444, 5122, 5112, 5212, 5222, 5114, 5214, 5224, 5132, 5232, 5312, 5322, 5314, 5324, 5332, 5334, 5142, 5242, 5412, 5422, 5414, 5424, 5342, 5432, 5442, 5444, 5512, 5522, 5514, 5524, 5532, 5534, 5542, 5544, 5554 })
 Initializes and configures the algorithm. More...
 
void execute () override
 Execute the algorithm on the database (a batch of data) More...
 
- Public Member Functions inherited from SQLamarr::BaseSqlInterface
 BaseSqlInterface (SQLite3DB &db)
 Constructor, acquiring the database without ownership. More...
 
virtual ~BaseSqlInterface ()
 
void sync_database (const std::string &db_uri)
 
void invalidate_cache (void)
 Invalidate the cache of the queries. More...
 

Public Attributes

 argtypes
 
 restype
 

Protected Member Functions

bool process_particle (int genparticle_id, int prod_vtx)
 Recursive function processing a particles and its daughters (if any). More...
 
bool keep (int status, int abspid) const
 Definition of the criterion to promote a GenParticle to MCParticle. More...
 
uint64_t get_or_create_end_vertex (int genparticle_id)
 Returns the UID of the end vertex of a particle, creating it if missing. More...
 
- Protected Member Functions inherited from SQLamarr::BaseSqlInterface
sqlite3_stmt * get_statement (const std::string &name, const std::string &query)
 Creates or retrieve from cache a statement. More...
 
void begin_transaction ()
 Begin an SQL transaction stopping update to disk util end_transaction() is issued
More...
 
void end_transaction ()
 End an SQL transaction re-enabling disk updates. More...
 
int last_insert_row ()
 Return the index of the last rows inserted in any table. More...
 
void using_sql_function (const std::string &name, int argc, void(*xFunc)(sqlite3_context *, int, sqlite3_value **))
 Register a static function in DB, enabling usage from SQL. More...
 
bool exec_stmt (sqlite3_stmt *)
 Execute a statement, possibly throwing an exception on failure. More...
 

Additional Inherited Members

- Protected Attributes inherited from SQLamarr::BaseSqlInterface
SQLite3DBm_database
 Reference to the SQLite database (not owned). More...
 

Detailed Description

Converts GenParticles to MCParticles.

Most GenParticles defined in HepMC graphs by most generators are completely irrelevant to LHCb as they describe the interactions at parton-level, which is impossible to access experimentally.

Before describing the reconstruction procedure, it is worth cleaning the graph retaining those particles and relations describing experimentally-accessible features of the interaction.

The resulting graph is actually a tree, as experimentally we can only describe decays: each vertex has a unique input particle and at least two output particles.

The MCParticleSelector algorithm describe the conversion from the HepMC graph to the Monte Carlo decay tree.

The condition defining whether to retain a particle or not is defined by white lists of status and PDG ID values identifying GenParticles to be promoted to MCParticles.

Promoted particles are stored in the MCParticles table.

More advanced or branched selection criteria can be defined by inheriting from this class and overriding the keep method.

Definition at line 47 of file MCParticleSelector.h.

Constructor & Destructor Documentation

◆ MCParticleSelector()

SQLamarr::MCParticleSelector::MCParticleSelector ( SQLite3DB db,
const std::vector< uint64_t >  retained_status_values = { LAMARR_LHCB_STABLE_IN_PRODGEN, LAMARR_LHCB_DECAYED_BY_DECAYGEN, LAMARR_LHCB_DECAYED_BY_DECAYGEN_AND_PRODUCED_BY_PRODGEN, LAMARR_LHCB_SIGNAL_IN_LAB_FRAME, LAMARR_LHCB_STABLE_IN_DECAYGEN },
const std::vector< uint64_t >  retained_abspid_values = {  6, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 102,  130, 310, 311, 321,  411, 421, 413, 423, 415, 425, 431, 435,  511, 521, 513, 523, 515, 525, 531, 535, 541, 545,  441, 10441, 100441, 443, 10443, 20443, 100443, 30443, 9000443, 9010443, 9020443, 445, 10445,  551, 10551, 100551, 110551, 200551, 210551, 553, 10553, 20553, 30553, 100553, 110553, 120553, 130553, 200553, 210553, 220553, 300553, 9000553, 9010553, 555, 10555, 20555, 100555, 110555, 120555, 200555, 557, 100557,  2212, 2212,  3122, 3222, 3212, 3224, 3214, 3114, 3322, 3312, 3324, 3314, 3334,  4122, 4222, 4212, 4112, 4224, 4214, 4114, 4232, 4132, 4322, 4312, 4324, 4314, 4332, 4334, 4412, 4422, 4414, 4424, 4432, 4434, 4444,  5122, 5112, 5212, 5222, 5114, 5214, 5224, 5132, 5232, 5312, 5322, 5314, 5324, 5332, 5334, 5142, 5242, 5412, 5422, 5414, 5424, 5342, 5432, 5442, 5444, 5512, 5522, 5514, 5524, 5532, 5534, 5542, 5544, 5554 } 
)

Initializes and configures the algorithm.

Parameters
dbReference to the database (not owned)
retained_status_valuesList of the status values retained as part of the decay tree
retained_abspid_valuesList of the pid values retained as abspid values

Definition at line 21 of file MCParticleSelector.cpp.

Member Function Documentation

◆ execute()

void SQLamarr::MCParticleSelector::execute ( void  )
overridevirtual

Execute the algorithm on the database (a batch of data)

Implements SQLamarr::Transformer.

Definition at line 34 of file MCParticleSelector.cpp.

◆ get_or_create_end_vertex()

uint64_t SQLamarr::MCParticleSelector::get_or_create_end_vertex ( int  genparticle_id)
protected

Returns the UID of the end vertex of a particle, creating it if missing.

Insert vertex

Parameters
genparticle_idUID of the input GenParticle

Definition at line 179 of file MCParticleSelector.cpp.

◆ keep()

bool SQLamarr::MCParticleSelector::keep ( int  status,
int  abspid 
) const
protected

Definition of the criterion to promote a GenParticle to MCParticle.

Parameters
statusHepMC status of the GenParticle
abspidAbsolute PID of the GenParticle

Definition at line 157 of file MCParticleSelector.cpp.

◆ process_particle()

bool SQLamarr::MCParticleSelector::process_particle ( int  genparticle_id,
int  prod_vtx 
)
protected

Recursive function processing a particles and its daughters (if any).

If the particle is discarded, but any of its dauthers are kept, their production vertex is set to their parent's production vertex to preserve a tree structure.

Parameters
genparticle_idUID of the input particle
prod_vtxUID of the production vertex of the input particle.

Definition at line 62 of file MCParticleSelector.cpp.

Member Data Documentation

◆ argtypes

SQLamarr.MCParticleSelector.argtypes

Definition at line 16 of file MCParticleSelector.py.

◆ restype

SQLamarr.MCParticleSelector.restype

Definition at line 17 of file MCParticleSelector.py.


The documentation for this class was generated from the following files: