Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllSingleDstPileupInputManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllSingleDstPileupInputManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_FUN4ALLSINGLEDSTPILEUPINPUTMANAGER_H
4 #define G4MAIN_FUN4ALLSINGLEDSTPILEUPINPUTMANAGER_H
5 
13 
14 #include <phool/PHCompositeNode.h> // for PHCompositeNode
15 #include <phool/PHNodeIOManager.h> // for PHNodeIOManager
16 
17 #include <gsl/gsl_rng.h>
18 
19 #include <map>
20 #include <memory>
21 #include <string>
22 
23 class SyncObject;
24 
30 {
31  public:
32  Fun4AllSingleDstPileupInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
33  int fileopen(const std::string &filenam) override;
34  int fileclose() override;
35  int run(const int nevents = 0) override;
36  int BranchSelect(const std::string &branch, const int iflag) override;
37  int setBranches() override;
38  void Print(const std::string &what = "ALL") const override;
39  int PushBackEvents(const int i) override;
40 
41  // Effectivly turn off the synchronization checking (copy from Fun4AllNoSyncDstInputManager)
42  int SyncIt(const SyncObject* /*mastersync*/) override { return Fun4AllReturnCodes::SYNC_OK; }
43  int GetSyncObject(SyncObject** /*mastersync*/) override { return Fun4AllReturnCodes::SYNC_NOOBJECT; }
44  int NoSyncPushBackEvents(const int nevt) override { return PushBackEvents(nevt); }
45 
47  void setCollisionRate(double Hz)
48  { m_collision_rate = Hz; }
49 
51  void setTimeBetweenCrossings(double nsec)
52  { m_time_between_crossings = nsec; }
53 
55  void setPileupTimeWindow(double tmin, double tmax)
56  {
57  m_tmin = tmin;
58  m_tmax = tmax;
59  }
60 
61  private:
62 
64 
65  bool m_ReadRunTTree = true;
66  int m_ievent_total = 0;
69 
72  std::map<const std::string, int> m_branchread;
73 
76 
79 
81  std::unique_ptr<PHCompositeNode> m_dstNodeInternal;
82 
84 
85  std::unique_ptr<PHCompositeNode> m_runNodeCopy;
86  std::unique_ptr<PHCompositeNode> m_runNodeSum;
88 
90 
91  std::unique_ptr<PHNodeIOManager> m_IManager;
92 
94 
95  std::unique_ptr<PHNodeIOManager> m_IManager_background;
96 
99 
101  double m_collision_rate = 5e4;
102 
104  double m_tmin = -13500;
105 
107  double m_tmax = 13500;
108 
110  class Deleter
111  {
112  public:
113  void operator() (gsl_rng* rng) const { gsl_rng_free(rng); }
114  };
115 
116  std::unique_ptr<gsl_rng, Deleter> m_rng;
117 
118 };
119 
120 #endif /* __Fun4AllSingleDstPileupInputManager_H__ */