Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Pythia8Options.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Pythia8Options.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
17 
18 #include <vector>
19 
20 #include <boost/program_options.hpp>
21 
23  using boost::program_options::bool_switch;
25 
26  auto opt = desc.add_options();
27  opt("gen-nhard", value<size_t>()->default_value(1u),
28  "Number of hard interactions, zero to disable");
29  opt("gen-npileup", value<double>()->default_value(200.0),
30  "Mean number of pile-up interactions, zero to disable");
31  opt("gen-vertex-xy-std-mm", value<double>()->default_value(0.0125),
32  "Transverse vertex standard deviation in mm");
33  opt("gen-vertex-z-std-mm", value<double>()->default_value(55.5),
34  "Longitudinal vertex standard deviation in mm");
35  opt("gen-vertex-t-std-ns", value<double>()->default_value(5.0),
36  "Temporal vertex standard deviation in ns");
37  opt("gen-cms-energy-gev", value<double>()->default_value(14000.0),
38  "Center-of-mass energy collision in GeV");
39  opt("gen-pdg-beam0",
40  value<int32_t>()->default_value(Acts::PdgParticle::eProton),
41  "PDG number of the first beam particle");
42  opt("gen-pdg-beam1",
43  value<int32_t>()->default_value(Acts::PdgParticle::eProton),
44  "PDG number of the second beam particle");
45  opt("gen-hard-process",
46  value<std::vector<std::string>>()->default_value({"HardQCD:all = on"},
47  "HardQCD:all = on"),
48  "Pythia8 process string for the hard interactions. Can be given multiple "
49  "times.");
50  opt("gen-pileup-process",
51  value<std::vector<std::string>>()->default_value({"SoftQCD:all = on"},
52  "SoftQCD:all = on"),
53  "Pythi8 process string for the pile-up interactions. Can be given "
54  "multiple times.");
55 }
56 
58  const Variables& vars, Acts::Logging::Level lvl) {
59  using namespace Acts::UnitLiterals;
60 
61  const auto nhard = vars["gen-nhard"].as<size_t>();
62  const auto npileup = vars["gen-npileup"].as<double>();
63  const auto pdgBeam0 = static_cast<Acts::PdgParticle>(
64  vars["gen-pdg-beam0"].template as<int32_t>());
65  const auto pdgBeam1 = static_cast<Acts::PdgParticle>(
66  vars["gen-pdg-beam1"].template as<int32_t>());
67  const auto cmsEnergy = vars["gen-cms-energy-gev"].as<double>() * 1_GeV;
68 
69  auto vertexGen = std::make_shared<GaussianVertexGenerator>();
70  vertexGen->stddev[Acts::ePos0] =
71  vars["gen-vertex-xy-std-mm"].as<double>() * 1_mm;
72  vertexGen->stddev[Acts::ePos1] =
73  vars["gen-vertex-xy-std-mm"].as<double>() * 1_mm;
74  vertexGen->stddev[Acts::ePos2] =
75  vars["gen-vertex-z-std-mm"].as<double>() * 1_mm;
76  vertexGen->stddev[Acts::eTime] =
77  vars["gen-vertex-t-std-ns"].as<double>() * 1_ns;
78 
80  if (0u < nhard) {
82  hard.pdgBeam0 = pdgBeam0;
83  hard.pdgBeam1 = pdgBeam1;
84  hard.cmsEnergy = cmsEnergy;
85  hard.settings = vars["gen-hard-process"].as<std::vector<std::string>>();
86 
87  cfg.generators.push_back(
88  {std::make_shared<FixedMultiplicityGenerator>(nhard), vertexGen,
89  std::make_shared<Pythia8Generator>(hard, lvl)});
90  }
91  if (0.0 < npileup) {
93  pileup.pdgBeam0 = pdgBeam0;
94  pileup.pdgBeam1 = pdgBeam1;
95  pileup.cmsEnergy = cmsEnergy;
96  pileup.settings = vars["gen-pileup-process"].as<std::vector<std::string>>();
97 
98  cfg.generators.push_back(
99  {std::make_shared<PoissonMultiplicityGenerator>(npileup), vertexGen,
100  std::make_shared<Pythia8Generator>(pileup, lvl)});
101  }
102 
103  return cfg;
104 }