Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:19:55

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2018
0003  *
0004  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
0005  * 
0006  * For the list of contributors see AUTHORS.
0007  *
0008  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
0009  *
0010  * or via email to bugs.jetscape@gmail.com
0011  *
0012  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
0013  * See COPYING for details.
0014  ******************************************************************************/
0015 
0016 #ifndef JETENERGYLOSS_H
0017 #define JETENERGYLOSS_H
0018 
0019 #include "JetScapeModuleBase.h"
0020 #include "FluidDynamics.h"
0021 #include "FluidCellInfo.h"
0022 #include "JetClass.h"
0023 #include "JetScapeWriter.h"
0024 #include "PartonShower.h"
0025 #include "PartonPrinter.h"
0026 #include "MakeUniqueHelper.h"
0027 #include "LiquefierBase.h"
0028 #include <vector>
0029 #include <random>
0030 
0031 namespace Jetscape {
0032 
0033 class JetEnergyLoss : public JetScapeModuleBase,
0034                       public std::enable_shared_from_this<JetEnergyLoss> {
0035 
0036 public:
0037   /** Default constructor. It sets the value of qhat, deltaT and maxT to -99.99, 0.0 and 0.0, respectively. Standard signal slot flags are set to false.
0038    */
0039   JetEnergyLoss();
0040 
0041   /** A copy constructor for Jet Energy Loss Physics Task.
0042       @param j A pointer of type JetEnergyLoss class.
0043    */
0044   JetEnergyLoss(const JetEnergyLoss &j);
0045 
0046   /** Destructor
0047    */
0048   virtual ~JetEnergyLoss();
0049 
0050   /** Deep copy.
0051       @return Null pointer.
0052    */
0053   virtual shared_ptr<JetEnergyLoss> Clone() const { return nullptr; }
0054 
0055   /** It reads the input parameters from a XML file under the tag <Eloss>.
0056       Sets the Parton class @a inP and PartonShower class @a pShower to null.
0057       Also initializes the tasks attached to the JetEnergyLoss module.
0058   */
0059   virtual void Init();
0060 
0061   /** It calls DoShower() for all shower-initiating partons.
0062       To avoid abuse, this can NOT be overwritten. Eloss happens on a parton-by-parton level,
0063       Exec() should only be executed once per event.
0064    */
0065   virtual void
0066   Exec() final; // prevents eloss modules from overwrting and missusing
0067 
0068   /** Write output information for each tasks/subtasks attached to the JetEnergyLoss module using JetScapeWriter functionality.
0069       @param w A pointer of type JetScapeWriter.
0070   */
0071   virtual void WriteTask(weak_ptr<JetScapeWriter> w);
0072 
0073   /** Reset the parton shower information.
0074   */
0075   virtual void Clear();
0076 
0077   /** Default function to perform the energy loss for partons at time "time". It should be overridden by different energy loss tasks.
0078       @param deltaT Step-size.
0079       @param time Current time.
0080       @param Q2 Current virtuality of the parton.
0081       @param pIn Vector of current partons.
0082       @param pOut Vector of partons at time "time+deltaT".
0083    */
0084   virtual void DoEnergyLoss(double deltaT, double time, double Q2,
0085                             vector<Parton> &pIn, vector<Parton> &pOut){};
0086 
0087   //! Core signal to receive information from the medium
0088   sigslot::signal5<double, double, double, double,
0089                    std::unique_ptr<FluidCellInfo> &, multi_threaded_local>
0090       GetHydroCellSignal;
0091   
0092   sigslot::signal1<double &, multi_threaded_local> GetHydroTau0Signal;
0093 
0094   /** For future development. A signal to connect the JetEnergyLoss object to the function UpdateEnergyDeposit() of the FluidDynamics class.
0095    */
0096   sigslot::signal2<int, double, multi_threaded_local> jetSignal;
0097 
0098   /** For future development. A signal to connect the JetEnergyLoss object to the function GetEnergyDensity() of the FluidDynamics class. 
0099    */
0100   sigslot::signal2<int, double &, multi_threaded_local> edensitySignal;
0101 
0102   /** A signal to connect the JetEnergyLoss object to the function DoEnergyLoss() function.
0103       Send all a list of shower-initiating partons to all attached eloss modules.
0104       They in turn decide whether they are responsible or not.
0105       @TODO Rename...
0106    */
0107   sigslot::signal5<double, double, double, vector<Parton> &, vector<Parton> &,
0108                    multi_threaded_local>
0109       SentInPartons;
0110   
0111   /** Sets the value of qhat to "m_qhat". 
0112       @param m_qhat Jet quenching parameter q-hat.
0113    */
0114   void SetQhat(double m_qhat) { qhat = m_qhat; }
0115 
0116   /** @return The current value of qhat.
0117    */
0118   const double GetQhat() const { return qhat; }
0119 
0120   /** It adds a initiating parton @a p to create the parton shower in an energy loss task.
0121       @param p A pointer of type parton class.
0122    */
0123   void AddShowerInitiatingParton(shared_ptr<Parton> p) { inP = p; }
0124 
0125   /** @return The parton which initiated the parton shower.
0126    */
0127   shared_ptr<Parton> GetShowerInitiatingParton() { return inP; }
0128 
0129   void PrintShowerInitiatingParton();
0130 
0131   /** @return The time-step "deltaT" used by energy loss task. 
0132    */
0133   double GetDeltaT() { return deltaT; }
0134 
0135   /** @return The maximum time limit for parton shower.
0136    */
0137   double GetMaxT() { return maxT; }
0138 
0139   /** @return The current shower.
0140    */
0141   shared_ptr<PartonShower> GetShower() { return pShower; }
0142 
0143   // old test signals ======================
0144   //! TODO: Remove
0145   /** Set the flag m_jetSignalConnected to true, if JetEnergyLoss had sent a signal to the function UpdateEnergyDeposit() of the class FluidDynamics.
0146       @param m_jetSignalConnected A boolean flag.
0147    */
0148   void SetJetSignalConnected(bool m_jetSignalConnected) {
0149     jetSignalConnected = m_jetSignalConnected;
0150   }
0151 
0152   /**  @return A boolean flag. Its status indicates whether JetEnergyLoss had sent a signal to the function UpdateEnergyDeposit() of the class FluidDynamics. 
0153    */
0154   const bool GetJetSignalConnected() const { return jetSignalConnected; }
0155 
0156   /** Set the flag m_edensitySignalConnected to true, if JetEnergyLoss had sent a signal to the function GetEnergyDensity() of the class FluidDynamics.
0157       @param m_edensitySignalConnected A boolean flag. 
0158    */
0159   void SetEdensitySignalConnected(bool m_edensitySignalConnected) {
0160     edensitySignalConnected = m_edensitySignalConnected;
0161   }
0162 
0163   /** 
0164      @return A boolean flag. Its status indicates whether JetEnergyLoss had sent a signal to the function GetEnergyDensity() of the class FluidDynamics.
0165    */
0166   const bool GetEdensitySignalConnected() const {
0167     return edensitySignalConnected;
0168   }
0169 
0170   /** Set the flag m_GetHydroCellSignalConnected to true, if JetEnergyLoss had sent a signal to the function GetHydroCell() of the class FluidDynamics.
0171       @param m_GetHydroCellSignalConnected A boolean flag.
0172    */
0173   void SetGetHydroCellSignalConnected(bool m_GetHydroCellSignalConnected) {
0174     GetHydroCellSignalConnected = m_GetHydroCellSignalConnected;
0175   }
0176 
0177   /** 
0178      @return A boolean flag. Its status indicates whether JetEnergyLoss had sent a signal to the function GetHydroCell() of the class FluidDynamics.
0179    */
0180   const bool GetGetHydroCellSignalConnected() {
0181     return GetHydroCellSignalConnected;
0182   }
0183 
0184   void SetGetHydroTau0SignalConnected(bool m_GetHydroTau0SignalConnected) {
0185     GetHydroTau0SignalConnected = m_GetHydroTau0SignalConnected;
0186   }
0187 
0188   const bool GetGetHydroTau0SignalConnected() {
0189     return GetHydroTau0SignalConnected;
0190   }
0191 
0192   /** Set the flag m_SentInPartonsConnected to true, if JetEnergyLoss had sent a signal to the function DoEnergyLoss().
0193       @param m_SentInPartonsConnected A boolean flag.
0194    */
0195   void SetSentInPartonsConnected(bool m_SentInPartonsConnected) {
0196     SentInPartonsConnected = m_SentInPartonsConnected;
0197   }
0198 
0199   /** 
0200       @return A boolean flag. Its status indicates whether JetEnergyLoss had sent a signal to the function DoEnergyLoss().
0201    */
0202   const bool GetSentInPartonsConnected() { return SentInPartonsConnected; }
0203 
0204   void add_a_liquefier(std::shared_ptr<LiquefierBase> new_liquefier) {
0205     liquefier_ptr = new_liquefier;
0206   }
0207 
0208   std::weak_ptr<LiquefierBase> get_liquefier() { return (liquefier_ptr); }
0209 
0210   // The Slot method to send the vector of Hadronization module
0211   void SendFinalStatePartons(vector<vector<shared_ptr<Parton>>> &fPartons) {
0212     fPartons = final_Partons;
0213   }
0214 
0215   void GetFinalPartonsForEachShower(shared_ptr<PartonShower> shower);
0216 
0217 protected:
0218   std::weak_ptr<LiquefierBase> liquefier_ptr;
0219 
0220 private:
0221   double deltaT;
0222   double maxT;
0223 
0224   double qhat;
0225   shared_ptr<Parton> inP;
0226   shared_ptr<PartonShower> pShower;
0227 
0228   bool GetHydroCellSignalConnected;
0229   bool GetHydroTau0SignalConnected;
0230   bool SentInPartonsConnected;
0231 
0232   /** This function executes the shower process for the partons produced from the hard scaterring.                                                                         
0233   */
0234   void DoShower();
0235 
0236   node vStart;
0237   node vEnd;
0238 
0239   //old test signals
0240   bool jetSignalConnected;
0241   bool edensitySignalConnected;
0242 
0243   // Vector of final state partons for each shower as a vector
0244 
0245   vector<vector<shared_ptr<Parton>>> final_Partons;
0246 };
0247 
0248 } // end namespace Jetscape
0249 
0250 #endif