Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHSartre.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHSartre.h
1 #ifndef PHSARTRE_PHSARTRE_H
2 #define PHSARTRE_PHSARTRE_H
3 
4 #include <fun4all/SubsysReco.h>
6 
7 #include <cmath>
8 #include <string>
9 #include <vector>
10 
11 class PHCompositeNode;
12 
13 class Sartre;
14 class Event;
15 class EventGeneratorSettings;
16 class PHSartreGenTrigger;
17 class TGenPhaseSpace;
18 
19 class PHSartre : public SubsysReco, public PHHepMCGenHelper
20 {
21  public:
22  PHSartre(const std::string &name = "PHSartre");
23  virtual ~PHSartre();
24 
25  int Init(PHCompositeNode *topNode);
26  int process_event(PHCompositeNode *topNode);
27  int ResetEvent(PHCompositeNode *topNode);
28  int End(PHCompositeNode *topNode);
29 
30  void set_config_file(const std::string &cfg_file)
31  {
32  _configFile = cfg_file;
33  }
34 
35  void print_config() const;
36 
38  void register_trigger(PHSartreGenTrigger *theTrigger);
40  {
41  _triggersOR = true;
42  _triggersAND = false;
43  } // default true
45  {
46  _triggersAND = true;
47  _triggersOR = false;
48  }
49 
51  void process_string(std::string s) { _commands.push_back(s); }
52 
53  void beam_vertex_parameters(double beamX,
54  double beamY,
55  double beamZ,
56  double beamXsigma,
57  double beamYsigma,
58  double beamZsigma)
59  {
60  set_vertex_distribution_mean(beamX, beamY, beamZ, 0);
61  set_vertex_distribution_width(beamXsigma, beamYsigma, beamZsigma, 0);
62  }
63 
64  private:
65  double percent_diff(const double a, const double b) { return fabs((a - b) / a); }
66  void randomlyReverseBeams(Event *myEvent);
67  void ReverseBeams(Event *myEvent);
68 
69  int _eventcount = 0;
70  int _gencount = 0;
71 
72  // event selection
73  std::vector<PHSartreGenTrigger *> _registeredTriggers;
74  bool _triggersOR = true;
75  bool _triggersAND = false;
76 
78  std::vector<std::string> _commands;
79 
80  // Sartre
81  Sartre *_sartre = nullptr;
82  EventGeneratorSettings *settings = nullptr;
83  TGenPhaseSpace *decay = nullptr;
84  int daughterID = -1;
85  double daughterMasses[2] = {};
86  bool doPerformDecay = false;
87 };
88 
89 #endif /* __PHSARTRE_H__ */