Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHPythia8.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHPythia8.h
1 #ifndef PHPYTHIA8_PHPYTHIA8_H
2 #define PHPYTHIA8_PHPYTHIA8_H
3 
4 #include <fun4all/SubsysReco.h>
5 
7 
8 #include <algorithm> // for max
9 #include <cmath>
10 #include <string>
11 #include <vector>
12 
13 class PHCompositeNode;
14 class PHGenIntegral;
15 class PHPy8GenTrigger;
16 
17 namespace HepMC
18 {
19  class Pythia8ToHepMC;
20 } // namespace HepMC
21 
22 namespace Pythia8
23 {
24  class Pythia;
25 }
26 
27 class PHPythia8 : public SubsysReco, public PHHepMCGenHelper
28 {
29  public:
30  PHPythia8(const std::string &name = "PHPythia8");
31  ~PHPythia8() override;
32 
33  int Init(PHCompositeNode *topNode) override;
34  int process_event(PHCompositeNode *topNode) override;
35  int End(PHCompositeNode *topNode) override;
36 
37  void set_config_file(const std::string &cfg_file)
38  {
39  m_ConfigFileName = cfg_file;
40  }
41 
42  void print_config() const;
43 
45  void register_trigger(PHPy8GenTrigger *theTrigger);
47  {
48  m_TriggersOR = true;
49  m_TriggersAND = false;
50  } // default true
52  {
53  m_TriggersAND = true;
54  m_TriggersOR = false;
55  }
56 
58  void process_string(const std::string &s) { m_Commands.push_back(s); }
59  void beam_vertex_parameters(double beamX,
60  double beamY,
61  double beamZ,
62  double beamXsigma,
63  double beamYsigma,
64  double beamZsigma)
65  {
66  set_vertex_distribution_mean(beamX, beamY, beamZ, 0);
67  set_vertex_distribution_width(beamXsigma, beamYsigma, beamZsigma, 0);
68  }
69 
70  void save_event_weight(const bool b) { m_SaveEventWeightFlag = b; }
72 
73  private:
74  int read_config(const std::string &cfg_file);
75  int create_node_tree(PHCompositeNode *topNode) final;
76  double percent_diff(const double a, const double b) { return fabs((a - b) / a); }
78 
79  // event selection
80  std::vector<PHPy8GenTrigger *> m_RegisteredTriggers;
83 
84  // PYTHIA
85  Pythia8::Pythia *m_Pythia8;
86 
88  std::vector<std::string> m_Commands;
89 
90  // HepMC
91  HepMC::Pythia8ToHepMC *m_Pythia8ToHepMC;
92 
95 
98 
101 };
102 
103 #endif /* PHPYTHIA8_PHPYTHIA8_H */