Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:25

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 IPGLASMAWRAPPER_H
0017 #define IPGLASMAWRAPPER_H
0018 
0019 #include <memory>
0020 
0021 #include "JetScapeModuleBase.h"
0022 #include "InitialState.h"
0023 #include "JetScapeLogger.h"
0024 #include "IPGlasma.h"
0025 
0026 using namespace Jetscape;
0027 
0028 class IPGlasmaWrapper : public Jetscape::InitialState {
0029   // this is wrapper class to read external files that
0030   // stores initial number of binary collisions and corresponding
0031   // configurations
0032 public:
0033   IPGlasmaWrapper();
0034   ~IPGlasmaWrapper();
0035 
0036   /** Reads the input parameters from the XML file under the tag  <IS>. Calls InitTask(); This explicit call of InitTask() can be used for actual initialization of modules such as @a Trento if attached as a @a polymorphic class. It also initializes the tasks within the current module.
0037       @sa Read about @a polymorphism in C++.
0038    */
0039   //void Init();
0040 
0041   /** Default Exec() function. It can be overridden by other tasks.
0042    */
0043   void Exec();
0044 
0045   /** Default Clear() function. It can be overridden by other tasks.
0046    */
0047   void Clear();
0048 
0049   void InitTask();
0050 
0051   /** Default Write() function. It can be overridden by other tasks.
0052       @param w A pointer to the JetScapeWriter class.
0053    */
0054   virtual void Write(weak_ptr<JetScapeWriter> w);
0055 
0056   /** Generated number of binary collisions.
0057   */
0058   double GetNcoll() { return(static_cast<double>(ncoll_)); };
0059 
0060   //! Load saved number of binary collisions
0061   void ReadNbcList(std::string filename);
0062 
0063   void SampleABinaryCollisionPoint(double &x, double &y);
0064 
0065 private:
0066   std::unique_ptr<IPGlasma> IPGlasma_ptr_;
0067   int dim_x_, dim_y_;
0068 
0069   std::vector<double> binary_collision_x_;
0070   std::vector<double> binary_collision_y_;
0071   std::shared_ptr<std::uniform_int_distribution<int>> rand_int_ptr_;
0072 
0073   int ncoll_ = -1;
0074 
0075   // Allows the registration of the module so that it is available to be used by the Jetscape framework.
0076   static RegisterJetScapeModule<IPGlasmaWrapper> reg;
0077 };
0078 
0079 #endif  // IPGLASMAWRAPPER_H