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 JETSCAPE_H
0017 #define JETSCAPE_H
0018 
0019 #include "JetScapeLogger.h"
0020 #include "JetScapeTaskSupport.h"
0021 #include "JetScapeModuleBase.h"
0022 #include "CausalLiquefier.h"
0023 
0024 namespace Jetscape {
0025 
0026 class JetScape : public JetScapeModuleBase {
0027 
0028 public:
0029   /** Default constructor to create the main task of the JetScape framework.
0030   */
0031   JetScape();
0032 
0033   /** This is a destructor for a JetScape.
0034    */
0035   virtual ~JetScape();
0036 
0037   /** This function initializes the main task of the JetScape framework. It calls JetScapeTask::InitTaks() function to initialize the modules/tasks of a JetScapeTask.
0038   */
0039   void Init();
0040 
0041   /** This function execute the modules/tasks of a JetScapeTask for all the events. It also calls "GetPartons()" function to print parton shower, and  "WriteTasks()" function to store the data in the XML file.  
0042   */
0043   void Exec();
0044 
0045   void Finish();
0046 
0047   /** This function sets the total number of events to "m_n_events".
0048    */
0049   void SetNumberOfEvents(int m_n_events) { n_events = m_n_events; }
0050 
0051   /** This function returns the total number of events.
0052    */
0053   int GetNumberOfEvents() { return n_events; }
0054 
0055   /** Controls whether to reuse a hydro event (for speedup).
0056       The number of times is controled by SetNReuseHydro
0057    */
0058   inline void SetReuseHydro(const bool reuse_hydro) {
0059     reuse_hydro_ = reuse_hydro;
0060   }
0061   /** Returns whether hydro events are reused.
0062    */
0063   inline bool GetReuseHydro() const { return reuse_hydro_; }
0064 
0065   /** Controls number of times a hydro event gets reused.
0066       Reusal has to be explicitly turned on by SetReuseHydro.
0067       Turn it on first to avoid a warning.
0068    */
0069   inline void SetNReuseHydro(const unsigned int n_reuse_hydro) {
0070     if (!GetReuseHydro()) {
0071       JSWARN << "Number of hydro reusals set, but reusal not turned on.";
0072       JSWARN << "Try jetscape->SetReuseHydro (true);";
0073     }
0074     n_reuse_hydro_ = n_reuse_hydro;
0075   }
0076   inline unsigned int GetNReuseHydro() const { return n_reuse_hydro_; }
0077 
0078 protected:
0079   void CompareElementsFromXML();
0080   void recurseToBuild(std::vector<std::string> &elems, tinyxml2::XMLElement *mElement);
0081   void recurseToSearch(std::vector<std::string> &elems, tinyxml2::XMLElement *uElement);
0082   void ReadGeneralParametersFromXML();
0083   void DetermineTaskListFromXML();
0084   void DetermineWritersFromXML();
0085   void CheckForWriterFromXML(const char *writerName,
0086                              std::string outputFilename);
0087   void SetModuleId(tinyxml2::XMLElement *moduleElement,
0088                    shared_ptr<JetScapeModuleBase> module);
0089 
0090   void SetPointers();
0091 
0092   void Show();
0093   int n_events;
0094   int n_events_printout;
0095 
0096   bool reuse_hydro_;
0097   unsigned int n_reuse_hydro_;
0098 
0099   std::shared_ptr<CausalLiquefier> liquefier;
0100 
0101   bool
0102       fEnableAutomaticTaskListDetermination; // Option to automatically determine the task list from the XML file,
0103       // rather than manually calling JetScapeTask::Add() in the run macro.
0104 };
0105 
0106 } // end namespace Jetscape
0107 
0108 #endif