Belle II Software  release-05-01-25
ParticleGun.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Susanne Koblitz, Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <mdst/dataobjects/MCParticleGraph.h>
14 
15 #include <vector>
16 
17 namespace Belle2 {
28  class ParticleGun {
29  public:
31  enum EDistribution {
64  };
65 
67  struct Parameters {
83  double nTracks;
85  std::vector<int> pdgCodes = {};
87  std::vector<double> momentumParams = {0};
89  std::vector<double> phiParams = {0};
91  std::vector<double> thetaParams = {0};
93  std::vector<double> xVertexParams = {0};
95  std::vector<double> yVertexParams = {0};
97  std::vector<double> zVertexParams = {0};
99  std::vector<double> timeParams = {0};
100 
104  bool independentVertices = false;
107  bool varyNumberOfTracks = true;
111  bool fixedMomentumPerEvent = false;
112 
113  };
114 
116  ParticleGun(): m_params() {}
117 
120 
125  bool generateEvent(MCParticleGraph& graph);
126 
128  bool setParameters(const Parameters& parameters);
129 
130  protected:
132  double generateValue(EDistribution dist, const std::vector<double>& params);
133 
136  };
137 
139 } //end namespace Belle2
140 
Belle2::ParticleGun::c_inversePtDistribution
@ c_inversePtDistribution
Distribution uniform in the inverse pt distribution, that is uniform in track curvature.
Definition: ParticleGun.h:63
Belle2::ParticleGun::c_uniformCosDistribution
@ c_uniformCosDistribution
Uniform distribution of the cosine of the values, parameters are min and max value.
Definition: ParticleGun.h:47
Belle2::ParticleGun::c_fixedValue
@ c_fixedValue
Fixed value, no random generation at all, 1 parameter.
Definition: ParticleGun.h:41
Belle2::ParticleGun::c_normalCosDistribution
@ c_normalCosDistribution
Normal distribution of the cosinge, parameters are mean and sigma.
Definition: ParticleGun.h:57
Belle2::ParticleGun::Parameters::phiDist
EDistribution phiDist
Distribution to use for azimuth angle generation.
Definition: ParticleGun.h:79
Belle2::ParticleGun::Parameters::thetaDist
EDistribution thetaDist
Distribution to use for polar angle generation.
Definition: ParticleGun.h:81
Belle2::ParticleGun::Parameters::zVertexParams
std::vector< double > zVertexParams
Parameters for the z vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:105
Belle2::MCParticleGraph
Class to build, validate and sort a particle decay chain.
Definition: MCParticleGraph.h:48
Belle2::ParticleGun::Parameters::momentumParams
std::vector< double > momentumParams
Parameters for the momentum generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:95
Belle2::ParticleGun::setParameters
bool setParameters(const Parameters &parameters)
Set the parameters for generating the Particles.
Definition: ParticleGun.cc:207
Belle2::ParticleGun::Parameters::independentVertices
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:112
Belle2::ParticleGun::Parameters::pdgCodes
std::vector< int > pdgCodes
List of PDG particle codes to pick from when generating particles.
Definition: ParticleGun.h:93
Belle2::ParticleGun::Parameters
Struct to keep all necessary parameters for the particle gun.
Definition: ParticleGun.h:75
Belle2::ParticleGun::c_uniformLogDistribution
@ c_uniformLogDistribution
Uniform distribution of the logarithm of the values, parameters are min and max value.
Definition: ParticleGun.h:49
Belle2::ParticleGun::Parameters::varyNumberOfTracks
bool varyNumberOfTracks
If true, the number of tracks per event will fluctuate according to Poisson distribution.
Definition: ParticleGun.h:115
Belle2::ParticleGun::c_uniformLogPtDistribution
@ c_uniformLogPtDistribution
Uniform distribution of the logarithm of the Pt, parameters are min and max value.
Definition: ParticleGun.h:51
Belle2::ParticleGun::c_discretePtSpectrum
@ c_discretePtSpectrum
Discrete pt spectrum, parameters are first the values and then the weights (non-negative) for each va...
Definition: ParticleGun.h:61
Belle2::ParticleGun::c_normalPtDistribution
@ c_normalPtDistribution
Normal distribution of Pt, parameters are mean and sigma.
Definition: ParticleGun.h:55
Belle2::ParticleGun::Parameters::xVertexDist
EDistribution xVertexDist
Distribution to use for x vertex generation.
Definition: ParticleGun.h:83
Belle2::ParticleGun::Parameters::thetaParams
std::vector< double > thetaParams
Parameters for the polar angle generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:99
Belle2::ParticleGun::c_polylinePtDistribution
@ c_polylinePtDistribution
Same as polylineDistribution but for the transverse momentum.
Definition: ParticleGun.h:69
Belle2::ParticleGun::c_polylineDistribution
@ c_polylineDistribution
Distribution given as list of (x,y) points.
Definition: ParticleGun.h:67
Belle2::ParticleGun::Parameters::yVertexParams
std::vector< double > yVertexParams
Parameters for the y vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:103
Belle2::ParticleGun::Parameters::timeDist
EDistribution timeDist
Distribution to use for time generation.
Definition: ParticleGun.h:89
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ParticleGun::Parameters::nTracks
double nTracks
Number of tracks to generate per event.
Definition: ParticleGun.h:91
Belle2::ParticleGun::Parameters::xVertexParams
std::vector< double > xVertexParams
Parameters for the x vertex generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:101
Belle2::ParticleGun::Parameters::zVertexDist
EDistribution zVertexDist
Distribution to use for z vertex generation.
Definition: ParticleGun.h:87
Belle2::ParticleGun::c_discreteSpectrum
@ c_discreteSpectrum
Discrete spectrum, parameters are first the values and then the weights (non-negative) for each value...
Definition: ParticleGun.h:59
Belle2::ParticleGun::c_polylineCosDistribution
@ c_polylineCosDistribution
Same as polylineDistribution but for the cosine of the angle.
Definition: ParticleGun.h:71
Belle2::ParticleGun::Parameters::yVertexDist
EDistribution yVertexDist
Distribution to use for y vertex generation.
Definition: ParticleGun.h:85
Belle2::ParticleGun::ParticleGun
ParticleGun()
Default constructor.
Definition: ParticleGun.h:124
Belle2::ParticleGun::~ParticleGun
~ParticleGun()
Default destructor.
Definition: ParticleGun.h:127
Belle2::ParticleGun::m_params
Parameters m_params
All relevant parameters.
Definition: ParticleGun.h:143
Belle2::ParticleGun::generateEvent
bool generateEvent(MCParticleGraph &graph)
Generate the next event and store the result in the given MCParticle graph.
Definition: ParticleGun.cc:121
Belle2::ParticleGun::Parameters::phiParams
std::vector< double > phiParams
Parameters for the azimuth angle generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:97
Belle2::ParticleGun::EDistribution
EDistribution
enum containing all known distributions available for generation of values
Definition: ParticleGun.h:39
Belle2::ParticleGun::c_normalDistribution
@ c_normalDistribution
Normal distribution, parameters are mean and sigma.
Definition: ParticleGun.h:53
Belle2::ParticleGun::generateValue
double generateValue(EDistribution dist, const std::vector< double > &params)
Generate a value according to the given distribution with the given parameters.
Definition: ParticleGun.cc:75
Belle2::ParticleGun::Parameters::timeParams
std::vector< double > timeParams
Parameters for the time generation, meaning depends on chosen distribution.
Definition: ParticleGun.h:107
Belle2::ParticleGun::c_uniformDistribution
@ c_uniformDistribution
Uniform distribution, parameters are min and max value.
Definition: ParticleGun.h:43
Belle2::ParticleGun::Parameters::fixedMomentumPerEvent
bool fixedMomentumPerEvent
generates particle momentum according to the specified distribution and assigns this momentum to all ...
Definition: ParticleGun.h:119
Belle2::ParticleGun::Parameters::momentumDist
EDistribution momentumDist
Distribution to use for momentum generation.
Definition: ParticleGun.h:77
Belle2::ParticleGun::c_uniformPtDistribution
@ c_uniformPtDistribution
Uniform distribution of Pt, parameters are min and max value.
Definition: ParticleGun.h:45