Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:19:10

0001 #ifndef FLOWAFTERBURNER_FLOWAFTERBURNER_H
0002 #define FLOWAFTERBURNER_FLOWAFTERBURNER_H
0003 
0004 #include <string>
0005 #include <array>
0006 
0007 #include "AfterburnerAlgo.h"
0008 
0009 namespace CLHEP
0010 {
0011   class HepRandomEngine;
0012 }
0013 namespace HepMC
0014 {
0015   class GenEvent;
0016   class GenParticle;
0017 }
0018 
0019 class Afterburner
0020 {
0021 
0022  public:
0023 
0024   explicit  Afterburner( const std::string &algorithmName = "MINBIAS",
0025               CLHEP::HepRandomEngine *engine = nullptr,
0026               float mineta = -5.0f, float maxeta = 5.0f,
0027               float minpt = 0.0f, float maxpt = 100.0f );
0028 
0029   ~Afterburner();
0030   
0031   Afterburner(const Afterburner&) = delete;
0032   Afterburner& operator=(const Afterburner&) = delete;
0033   Afterburner(Afterburner&&) noexcept;
0034   Afterburner& operator=(Afterburner&&) noexcept;
0035 
0036 
0037   // overloaded algo setter (legacy)
0038   void setAlgo(AfterburnerAlgo::flowAfterburnerAlgorithm algo_type);
0039   void setAlgo(const std::string &name);
0040   void setAlgo(AfterburnerAlgo * algo);
0041   
0042   AfterburnerAlgo * getAlgo() { return m_algo; }
0043   
0044   void setEngine(CLHEP::HepRandomEngine *engine);
0045   CLHEP::HepRandomEngine * getEngine() { return m_engine; }
0046 
0047   void setEtaRange(float mineta, float maxeta);
0048   void setPtRange(float minpt, float maxpt);
0049 
0050   float getPsiN(unsigned int n) const;
0051  
0052   static double vn_func(double x, void *params);
0053   void throw_psi_n(HepMC::GenEvent *event);
0054 
0055   void AddFlowToParentAndMoveDescendants(HepMC::GenEvent *event, HepMC::GenParticle *parent);
0056 
0057   // add all the extra arguments for legacy flowAfterburner function
0058   int flowAfterburner(HepMC::GenEvent *event, 
0059                       CLHEP::HepRandomEngine *engine = nullptr,
0060                       const std::string &algorithmName = "",
0061                       float mineta = -5.0f, float maxeta = 5.0f,
0062                       float minpt = 0.0f, float maxpt = 100.0f);
0063 
0064  private:
0065     
0066   AfterburnerAlgo * m_algo = nullptr;
0067   CLHEP::HepRandomEngine * m_engine = nullptr;
0068   bool m_ownAlgo = false;
0069   bool m_ownEngine = false;
0070   float m_mineta = -5.0f;
0071   float m_maxeta = 5.0f;
0072   float m_minpt = 0.0f;
0073   float m_maxpt = 100.0f;
0074   double m_phishift = 0.0; // shift of the reaction plane angle in phi, used to align with the impact parameter
0075 
0076   void setPsiN(unsigned int n, float psi);
0077   float m_psi_n[6] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; // reaction plane angles
0078 
0079   // Legacy arguments
0080   void readLegacyArguments(
0081       CLHEP::HepRandomEngine *engine,
0082       const std::string &algorithmName,
0083       float mineta, float maxeta,
0084       float minpt, float maxpt);  
0085 };
0086 
0087 // legacy function, use the Afterburner class instead
0088 int flowAfterburner(HepMC::GenEvent *inEvent,
0089                     CLHEP::HepRandomEngine *engine,
0090                     const std::string &algorithmName,
0091                     float mineta, float maxeta,
0092                     float minpt, float maxpt);
0093 
0094 #endif