File indexing completed on 2025-08-05 08:15:59
0001 #ifndef PHHEPMC_FUN4ALLHEPMCPILEUPINPUTMANAGER_H
0002 #define PHHEPMC_FUN4ALLHEPMCPILEUPINPUTMANAGER_H
0003
0004 #include "Fun4AllHepMCInputManager.h"
0005
0006 #include <phool/sphenix_constants.h>
0007
0008 #include <gsl/gsl_rng.h>
0009
0010 #include <map>
0011 #include <string>
0012
0013
0014
0015
0016 class Fun4AllHepMCPileupInputManager : public Fun4AllHepMCInputManager
0017 {
0018 public:
0019 Fun4AllHepMCPileupInputManager(const std::string &name = "DUMMY",
0020 const std::string &nodename = "DST",
0021 const std::string &topnodename = "TOP");
0022 ~Fun4AllHepMCPileupInputManager() override;
0023
0024 int run(const int nevents = 0) override { return run(nevents, false); }
0025
0026 int run(const int nevents, const bool skip);
0027 int ResetEvent() override;
0028
0029 void set_time_window(double past_nsec, double future_nsec)
0030 {
0031 _min_integration_time = past_nsec;
0032 _max_integration_time = future_nsec;
0033 }
0034
0035
0036 void set_collision_rate(double Hz) { _collision_rate = Hz; }
0037
0038 void set_time_between_crossings(double nsec) { _time_between_crossings = nsec; }
0039
0040 int SkipForThisManager(const int nevents) override;
0041 void SignalInputManager(Fun4AllHepMCInputManager *in) { m_SignalInputManager = in; }
0042 int PushBackEvents(const int i) override;
0043
0044 private:
0045 int InsertEvent(HepMC::GenEvent *evt, const double crossing_time);
0046
0047 Fun4AllHepMCInputManager *m_SignalInputManager = nullptr;
0048 gsl_rng *RandomGenerator = nullptr;
0049
0050 int m_SignalEventNumber = 0;
0051
0052
0053 double _min_integration_time = -17500.0;
0054 double _max_integration_time = 17500.0;
0055
0056
0057 double _collision_rate = 100.0e3;
0058
0059
0060 double _time_between_crossings = sphenix_constants::time_between_crossings;
0061
0062
0063 double _ave_coll_per_crossing = 1.;
0064 int _min_crossing = 0;
0065 int _max_crossing = 0;
0066
0067 bool _first_run = true;
0068
0069 std::map<int, double> m_EventNumberMap;
0070 };
0071
0072 #endif