File indexing completed on 2025-08-05 08:18:07
0001
0002
0003 #ifndef G4MAIN_FUN4ALLSINGLEDSTPILEUPINPUTMANAGER_H
0004 #define G4MAIN_FUN4ALLSINGLEDSTPILEUPINPUTMANAGER_H
0005
0006
0007
0008
0009
0010
0011 #include <fun4all/Fun4AllInputManager.h>
0012 #include <fun4all/Fun4AllReturnCodes.h>
0013
0014 #include <phool/PHCompositeNode.h> // for PHCompositeNode
0015 #include <phool/PHNodeIOManager.h> // for PHNodeIOManager
0016 #include <phool/sphenix_constants.h>
0017
0018 #include <gsl/gsl_rng.h>
0019
0020 #include <map>
0021 #include <memory>
0022 #include <string>
0023
0024 class SyncObject;
0025
0026
0027
0028
0029
0030 class Fun4AllSingleDstPileupInputManager : public Fun4AllInputManager
0031 {
0032 public:
0033 Fun4AllSingleDstPileupInputManager(const std::string &name = "DUMMY", const std::string &nodename = "DST", const std::string &topnodename = "TOP");
0034 int fileopen(const std::string &filenam) override;
0035 int fileclose() override;
0036 int run(const int nevents = 0) override;
0037 int BranchSelect(const std::string &branch, const int iflag) override;
0038 int setBranches() override;
0039 void Print(const std::string &what = "ALL") const override;
0040 int PushBackEvents(const int i) override;
0041
0042
0043 int SyncIt(const SyncObject * ) override { return Fun4AllReturnCodes::SYNC_OK; }
0044 int GetSyncObject(SyncObject ** ) override { return Fun4AllReturnCodes::SYNC_NOOBJECT; }
0045 int NoSyncPushBackEvents(const int nevt) override { return PushBackEvents(nevt); }
0046
0047
0048 void setCollisionRate(double Hz)
0049 {
0050 m_collision_rate = Hz;
0051 }
0052
0053
0054 void setTimeBetweenCrossings(double nsec)
0055 {
0056 m_time_between_crossings = nsec;
0057 }
0058
0059
0060 void setPileupTimeWindow(double tmin, double tmax)
0061 {
0062 m_tmin = tmin;
0063 m_tmax = tmax;
0064 }
0065
0066 private:
0067
0068
0069 bool m_ReadRunTTree = true;
0070 int m_ievent_total = 0;
0071 int m_ievent_thisfile = 0;
0072
0073
0074 std::string m_fullfilename;
0075 std::string m_RunNode = "RUN";
0076 std::map<const std::string, int> m_branchread;
0077
0078
0079 PHCompositeNode *m_dstNode = nullptr;
0080
0081
0082 PHCompositeNode *m_runNode = nullptr;
0083
0084
0085 std::unique_ptr<PHCompositeNode> m_dstNodeInternal;
0086
0087
0088
0089 std::unique_ptr<PHCompositeNode> m_runNodeCopy;
0090 std::unique_ptr<PHCompositeNode> m_runNodeSum;
0091
0092
0093
0094
0095 std::unique_ptr<PHNodeIOManager> m_IManager;
0096
0097
0098
0099 std::unique_ptr<PHNodeIOManager> m_IManager_background;
0100
0101
0102 double m_time_between_crossings = sphenix_constants::time_between_crossings;
0103
0104
0105 double m_collision_rate = 5e4;
0106
0107
0108 double m_tmin = -13500;
0109
0110
0111 double m_tmax = 13500;
0112
0113
0114 class Deleter
0115 {
0116 public:
0117 void operator()(gsl_rng *rng) const { gsl_rng_free(rng); }
0118 };
0119
0120 std::unique_ptr<gsl_rng, Deleter> m_rng;
0121 };
0122
0123 #endif