ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllDstPileupInputManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllDstPileupInputManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4MAIN_FUN4ALLDSTPILEUPINPUTMANAGER_H
4 #define G4MAIN_FUN4ALLDSTPILEUPINPUTMANAGER_H
5 
12 #include <fun4all/Fun4AllReturnCodes.h> // for SYNC_NOOBJECT, SYNC_OK
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  Fun4AllDstPileupInputManager(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  int runOne(const int nevents = 0);
65 
67 
68  bool m_ReadRunTTree = true;
69  int m_ievent_total = 0;
72 
73  std::string m_fullfilename;
74  std::string m_RunNode = "RUN";
75  std::map<const std::string, int> m_branchread;
76 
79 
82 
84  std::unique_ptr<PHCompositeNode> m_dstNodeInternal;
85 
87 
88  std::unique_ptr<PHCompositeNode> m_runNodeCopy;
89  std::unique_ptr<PHCompositeNode> m_runNodeSum;
91 
93 
94  std::unique_ptr<PHNodeIOManager> m_IManager;
95 
98 
100  double m_collision_rate = 5e4;
101 
103  double m_tmin = -13500;
104 
106  double m_tmax = 13500;
107 
109  class Deleter
110  {
111  public:
112  void operator() (gsl_rng* rng) const { gsl_rng_free(rng); }
113  };
114 
115  std::unique_ptr<gsl_rng, Deleter> m_rng;
116 
117 };
118 
119 #endif /* __Fun4AllDstPileupInputManager_H__ */