SQLamarr
The stand-alone ultra-fast simulation option for the LHCb experiment
MCParticleSelector.h
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 
11 #pragma once
12 #include <vector>
13 
14 #include "SQLamarr/db_functions.h"
15 #include "SQLamarr/BaseSqlInterface.h"
16 #include "SQLamarr/preprocessor_symbols.h"
17 #include "SQLamarr/Transformer.h"
18 
19 namespace SQLamarr
20 {
48  {
49  public:
53  SQLite3DB& db,
54 
56  const std::vector<uint64_t> retained_status_values = {
57  LAMARR_LHCB_STABLE_IN_PRODGEN,
58  LAMARR_LHCB_DECAYED_BY_DECAYGEN,
59  LAMARR_LHCB_DECAYED_BY_DECAYGEN_AND_PRODUCED_BY_PRODGEN,
60  LAMARR_LHCB_SIGNAL_IN_LAB_FRAME,
61  LAMARR_LHCB_STABLE_IN_DECAYGEN
62  },
63 
65  const std::vector<uint64_t> retained_abspid_values = {
66  /* Standard model particles */
67  6, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 102,
68  /* Strange Mesons: */
69  130, 310, 311, 321,
70  /* Charm Mesons: */
71  411, 421, 413, 423, 415, 425, 431, 435,
72  /* Beauty Mesons: */
73  511, 521, 513, 523, 515, 525, 531, 535, 541, 545,
74  /* Charmonium states: */
75  441, 10441, 100441, 443, 10443, 20443, 100443, 30443, 9000443, 9010443,
76  9020443, 445, 10445,
77  /* Bottomonium states: */
78  551, 10551, 100551, 110551, 200551, 210551, 553, 10553, 20553, 30553,
79  100553, 110553, 120553, 130553, 200553, 210553, 220553, 300553,
80  9000553, 9010553, 555, 10555, 20555, 100555, 110555, 120555, 200555,
81  557, 100557,
82  /* Light baryons: */
83  2212, 2212,
84  /* Strange baryons: */
85  3122, 3222, 3212, 3224, 3214, 3114, 3322, 3312, 3324, 3314, 3334,
86  /* Charm baryons: */
87  4122, 4222, 4212, 4112, 4224, 4214, 4114, 4232, 4132, 4322, 4312, 4324,
88  4314, 4332, 4334, 4412, 4422, 4414, 4424, 4432, 4434, 4444,
89  /* Beauty baryons: */
90  5122, 5112, 5212, 5222, 5114, 5214, 5224, 5132, 5232, 5312, 5322,
91  5314, 5324, 5332, 5334, 5142, 5242, 5412, 5422, 5414, 5424, 5342, 5432,
92  5442, 5444, 5512, 5522, 5514, 5524, 5532, 5534, 5542, 5544, 5554
93  }
94  );
95 
97  void execute () override;
98 
99  protected:
104  bool process_particle (
105  int genparticle_id,
106  int prod_vtx
108  );
109 
111  bool keep (
112  int status,
113  int abspid
114  ) const;
115 
118  uint64_t get_or_create_end_vertex (
119  int genparticle_id
120  );
121 
122 
123  private:
124  const std::vector<uint64_t> m_retained_status_values;
125  const std::vector<uint64_t> m_retained_abspid_values;
126  };
127 }
Abstract interface with helper functions to access an SQLite DB.
Converts GenParticles into MCParticles preserving the graph structure.
bool process_particle(int genparticle_id, int prod_vtx)
Recursive function processing a particles and its daughters (if any).
void execute() override
Execute the algorithm on the database (a batch of data)
uint64_t get_or_create_end_vertex(int genparticle_id)
Returns the UID of the end vertex of a particle, creating it if missing.
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.
bool keep(int status, int abspid) const
Definition of the criterion to promote a GenParticle to MCParticle.
Interface to an executable class used for polymorphism.
Definition: Transformer.h:17
A database connection handler easying sharing the DB between C++ and Python.
Definition: db_functions.py:24