Belle II Software development
ParticleGun.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <mdst/dataobjects/MCParticleGraph.h>
12
13#include <vector>
14
15namespace Belle2 {
27 public:
62 };
63
65 struct Parameters {
81 double nTracks;
83 std::vector<int> pdgCodes = {};
85 std::vector<double> momentumParams = {0};
87 std::vector<double> phiParams = {0};
89 std::vector<double> thetaParams = {0};
91 std::vector<double> xVertexParams = {0};
93 std::vector<double> yVertexParams = {0};
95 std::vector<double> zVertexParams = {0};
97 std::vector<double> timeParams = {0};
98
110
111 };
112
115
118
124
126 bool setParameters(const Parameters& parameters);
127
128 protected:
130 double generateValue(EDistribution dist, const std::vector<double>& params);
131
134 };
135
137} //end namespace Belle2
138
Class to build, validate and sort a particle decay chain.
Class to generate tracks in the particle gun and store them in a MCParticle graph.
Definition: ParticleGun.h:26
EDistribution
enum containing all known distributions available for generation of values
Definition: ParticleGun.h:29
@ c_polylineDistribution
Distribution given as list of (x,y) points.
Definition: ParticleGun.h:57
@ c_uniformLogPtDistribution
Uniform distribution of the logarithm of the Pt, parameters are min and max value.
Definition: ParticleGun.h:41
@ c_normalDistribution
Normal distribution, parameters are mean and sigma.
Definition: ParticleGun.h:43
@ c_normalCosDistribution
Normal distribution of the cosinge, parameters are mean and sigma.
Definition: ParticleGun.h:47
@ c_uniformPtDistribution
Uniform distribution of Pt, parameters are min and max value.
Definition: ParticleGun.h:35
@ c_polylinePtDistribution
Same as polylineDistribution but for the transverse momentum.
Definition: ParticleGun.h:59
@ c_discretePtSpectrum
Discrete pt spectrum, parameters are first the values and then the weights (non-negative) for each va...
Definition: ParticleGun.h:51
@ c_uniformDistribution
Uniform distribution, parameters are min and max value.
Definition: ParticleGun.h:33
@ c_discreteSpectrum
Discrete spectrum, parameters are first the values and then the weights (non-negative) for each value...
Definition: ParticleGun.h:49
@ c_fixedValue
Fixed value, no random generation at all, 1 parameter.
Definition: ParticleGun.h:31
@ c_normalPtDistribution
Normal distribution of Pt, parameters are mean and sigma.
Definition: ParticleGun.h:45
@ c_uniformCosDistribution
Uniform distribution of the cosine of the values, parameters are min and max value.
Definition: ParticleGun.h:37
@ c_inversePtDistribution
Distribution uniform in the inverse pt distribution, that is uniform in track curvature.
Definition: ParticleGun.h:53
@ c_polylineCosDistribution
Same as polylineDistribution but for the cosine of the angle.
Definition: ParticleGun.h:61
@ c_uniformLogDistribution
Uniform distribution of the logarithm of the values, parameters are min and max value.
Definition: ParticleGun.h:39
Parameters m_params
All relevant parameters.
Definition: ParticleGun.h:133
~ParticleGun()
Default destructor.
Definition: ParticleGun.h:117
bool generateEvent(MCParticleGraph &graph)
Generate the next event and store the result in the given MCParticle graph.
ParticleGun()
Default constructor.
Definition: ParticleGun.h:114
bool setParameters(const Parameters &parameters)
Set the parameters for generating the Particles.
double generateValue(EDistribution dist, const std::vector< double > &params)
Generate a value according to the given distribution with the given parameters.
Abstract base class for different kinds of events.
Struct to keep all necessary parameters for the particle gun.
Definition: ParticleGun.h:65
std::vector< int > pdgCodes
List of PDG particle codes to pick from when generating particles.
Definition: ParticleGun.h:83
EDistribution xVertexDist
Distribution to use for x vertex generation.
Definition: ParticleGun.h:73
std::vector< double > thetaParams
Parameters for the polar angle generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:89
std::vector< double > momentumParams
Parameters for the momentum generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:85
EDistribution yVertexDist
Distribution to use for y vertex generation.
Definition: ParticleGun.h:75
std::vector< double > xVertexParams
Parameters for the x vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:91
EDistribution thetaDist
Distribution to use for polar angle generation.
Definition: ParticleGun.h:71
EDistribution zVertexDist
Distribution to use for z vertex generation.
Definition: ParticleGun.h:77
EDistribution timeDist
Distribution to use for time generation.
Definition: ParticleGun.h:79
EDistribution momentumDist
Distribution to use for momentum generation.
Definition: ParticleGun.h:67
EDistribution phiDist
Distribution to use for azimuth angle generation.
Definition: ParticleGun.h:69
double nTracks
Number of tracks to generate per event.
Definition: ParticleGun.h:81
bool independentVertices
If false, all particles of one event will have the same vertex, if true the vertex of each particle w...
Definition: ParticleGun.h:102
std::vector< double > zVertexParams
Parameters for the z vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:95
std::vector< double > phiParams
Parameters for the azimuth angle generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:87
bool varyNumberOfTracks
If true, the number of tracks per event will fluctuate according to Poisson distribution.
Definition: ParticleGun.h:105
std::vector< double > timeParams
Parameters for the time generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:97
bool fixedMomentumPerEvent
generates particle momentum according to the specified distribution and assigns this momentum to all ...
Definition: ParticleGun.h:109
std::vector< double > yVertexParams
Parameters for the y vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:93