Analysis Software
Documentation for sPHENIX simulation 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  }
61  void setDetectorActiveCrossings(const std::string &name, const int nbcross);
62 
63  void setDetectorActiveCrossings(const std::string &name, const int min, const int max);
64 
65  private:
66 
68  int runOne(const int nevents = 0);
69 
71 
72  bool m_ReadRunTTree = true;
73  int m_ievent_total = 0;
76 
79  std::map<const std::string, int> m_branchread;
80 
83 
86 
88  std::unique_ptr<PHCompositeNode> m_dstNodeInternal;
89 
91 
92  std::unique_ptr<PHCompositeNode> m_runNodeCopy;
93  std::unique_ptr<PHCompositeNode> m_runNodeSum;
95 
97 
98  std::unique_ptr<PHNodeIOManager> m_IManager;
99 
102 
104  double m_collision_rate = 5e4;
105 
107  double m_tmin = -13500;
108 
110  double m_tmax = 13500;
111 
113  class Deleter
114  {
115  public:
116  void operator() (gsl_rng* rng) const { gsl_rng_free(rng); }
117  };
118 
119  std::unique_ptr<gsl_rng, Deleter> m_rng;
120 
121  std::map<std::string,std::pair<double,double>> m_DetectorTiming;
122 
123 };
124 
125 #endif /* __Fun4AllDstPileupInputManager_H__ */