Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:10

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4PILEUPGENERATOR_H
0004 #define G4MAIN_PHG4PILEUPGENERATOR_H
0005 
0006 #include "PHG4ParticleGeneratorBase.h"
0007 
0008 #include <phool/sphenix_constants.h>
0009 
0010 #include <string>  // for string
0011 
0012 class PHCompositeNode;
0013 
0014 class PHG4PileupGenerator : public PHG4ParticleGeneratorBase
0015 {
0016  public:
0017   PHG4PileupGenerator(const std::string &name = "PILEUPGENERATOR");
0018   ~PHG4PileupGenerator() override;
0019 
0020   int Init(PHCompositeNode *topNode) override;
0021   int InitRun(PHCompositeNode *topNode) override;
0022   int process_event(PHCompositeNode *topNode) override;
0023   int Reset(PHCompositeNode *topNode) override;
0024   int ResetEvent(PHCompositeNode *topNode) override;
0025   int EndRun(const int runnumber) override;
0026   int End(PHCompositeNode *topNode) override;
0027 
0028   void set_generator(PHG4ParticleGeneratorBase *generator) { _generator = generator; }
0029 
0030   /// past times are negative, future times are positive
0031   void set_time_window(double past_nsec, double future_nsec)
0032   {
0033     _min_integration_time = past_nsec;
0034     _max_integration_time = future_nsec;
0035   }
0036   void set_collision_rate(double kHz) { _collision_rate = kHz; }
0037   void set_time_between_crossings(double nsec) { _time_between_crossings = nsec; }
0038 
0039  private:
0040   PHG4ParticleGeneratorBase *_generator = nullptr;
0041 
0042   double _min_integration_time = -1000.;
0043   double _max_integration_time = 1000.;
0044   double _collision_rate = 100.;  // kHz
0045   double _time_between_crossings = sphenix_constants::time_between_crossings; // ns
0046 
0047   double _ave_coll_per_crossing = 1.;  // recalculated
0048   int _min_crossing = 0;               // recalculated
0049   int _max_crossing = 0;               // recalculated
0050 };
0051 
0052 #endif