8#include <generators/particlegun/ParticleGun.h>
9#include <gtest/gtest.h>
38 std::vector<double>& pars);
42 std::vector<double>& pars)
46 for (
auto item : allowed) {
51 ASSERT_EQ(item.second,
pgun.setParameters(
parameters)) << name <<
": " << item.first <<
", " << item.second;
54 for (
int i = 0; i < 10; ++i) {
60 bool valid = i >= minpar;
67 ASSERT_EQ(valid,
pgun.setParameters(
parameters)) << name <<
" " << pars.size();
104 pars = {0, 1, 1, -1};
108 std::cout << std::endl;
114 std::map<int, bool> distributions = {
128 checkVariable(
"momentum", distributions, parameters.momentumDist, parameters.momentumParams);
134 std::map<int, bool> distributions = {
148 checkVariable(
"xvertex", distributions, parameters.xVertexDist, parameters.xVertexParams);
149 checkVariable(
"yvertex", distributions, parameters.yVertexDist, parameters.yVertexParams);
150 checkVariable(
"zvertex", distributions, parameters.zVertexDist, parameters.zVertexParams);
156 std::map<int, bool> distributions = {
170 checkVariable(
"theta", distributions, parameters.thetaDist, parameters.thetaParams);
171 checkVariable(
"phi", distributions, parameters.phiDist, parameters.phiParams);
The fixture for testing the Particlegun.
ParticleGun::Parameters parameters
Variable parameters.
virtual void SetUp()
Set up parameters which work for all distributions.
ParticleGun pgun
Variable of pgun.
Class to generate tracks in the particle gun and store them in a MCParticle graph.
EDistribution
enum containing all known distributions available for generation of values
@ c_polylineDistribution
Distribution given as list of (x,y) points.
@ c_normalDistribution
Normal distribution, parameters are mean and sigma.
@ c_normalCosDistribution
Normal distribution of the cosinge, parameters are mean and sigma.
@ c_uniformPtDistribution
Uniform distribution of Pt, parameters are min and max value.
@ c_polylinePtDistribution
Same as polylineDistribution but for the transverse momentum.
@ c_uniformDistribution
Uniform distribution, parameters are min and max value.
@ c_discreteSpectrum
Discrete spectrum, parameters are first the values and then the weights (non-negative) for each value...
@ c_fixedValue
Fixed value, no random generation at all, 1 parameter.
@ c_normalPtDistribution
Normal distribution of Pt, parameters are mean and sigma.
@ c_uniformCosDistribution
Uniform distribution of the cosine of the values, parameters are min and max value.
@ c_inversePtDistribution
Distribution uniform in the inverse pt distribution, that is uniform in track curvature.
@ c_polylineCosDistribution
Same as polylineDistribution but for the cosine of the angle.
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
void checkVariable(const std::string &name, const std::map< int, bool > &allowed, ParticleGun::EDistribution &dist, std::vector< double > &pars)
check one of the variables given a list of allowed and excluded distributions
Abstract base class for different kinds of events.
Struct to keep all necessary parameters for the particle gun.