Back to home page

sPhenix code displayed by LXR

 
 

    


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

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 HARDPROCESS_H
0017 #define HARDPROCESS_H
0018 
0019 #include "InitialState.h"
0020 #include "JetScapeModuleBase.h"
0021 #include "JetClass.h"
0022 #include <vector>
0023 
0024 namespace Jetscape {
0025 
0026 /**
0027      @class 
0028      Interface for the hard process. 
0029    */
0030 class HardProcess : public JetScapeModuleBase {
0031 
0032 public:
0033   /** Default constructor to create a Hard Process Physics task. Sets the task ID as "HardProcess".
0034   */
0035   HardProcess();
0036 
0037   /** Destructor for the Hard Process Physics task.
0038    */
0039   virtual ~HardProcess();
0040 
0041   /** It reads the input parameters relevant to the hard scattering from the XML file under the name tag <Hard>. Uses JetScapeSingnalManager Instance to retrieve the Initial State Physics information. Calls InitTask(); This explicit call can be used for actual initialization of modules such as @a PythiaGun if attached as a @a polymorphic class. It also initializes the tasks within the current module.
0042     @sa Read about @a polymorphism in C++.
0043   */
0044   virtual void Init();
0045 
0046   /** Calls JetScapeTask::ExecuteTasks() for recursive execution of tasks attached to HardProcess module. It can be overridden by the attached module.
0047    */
0048   virtual void Exec();
0049 
0050   /** Erases the hard partons stored in the vector @a hp_list of the hard process module. It can be overridden by the attached module.
0051   */
0052   virtual void Clear();
0053 
0054   /** It writes the output information obtained from the HardProcess Task into a file.
0055       @param w is a pointer of type JetScapeWrite class.
0056   */
0057   virtual void WriteTask(weak_ptr<JetScapeWriter> w);
0058 
0059   /** Collect header information for writer modules
0060       @param w is a pointer of type JetScapeWrite class.
0061   */
0062   virtual void CollectHeader(weak_ptr<JetScapeWriter> w);
0063 
0064   // connect the InitialState module with hard process
0065   /** A pointer of type InitialState class. 
0066    */
0067   std::shared_ptr<InitialState> ini;
0068 
0069   /** 
0070       @return The number of hard partons.
0071    */
0072   int GetNHardPartons() { return hp_list.size(); }
0073 
0074   /** @return A pointer to the Parton class for ith hard parton.
0075       @param i Index of a vector of the hard parton.
0076    */
0077   shared_ptr<Parton> GetPartonAt(int i) { return hp_list[i]; }
0078 
0079   /** @return A vector of the Parton class. These parton classes correspond to the hard partons.
0080    */
0081   vector<shared_ptr<Parton>> &GetPartonList() { return hp_list; }
0082 
0083   /** It adds a parton class pointer p into an existing vector of hard Parton class, and increases the vector size by 1.
0084       @param p Parton class pointer for a hard parton.
0085    */
0086   void AddParton(shared_ptr<Parton> p) { hp_list.push_back(p); }
0087 
0088   // Slots ...
0089   /** This function stores the vector of hard partons into a vector plist.
0090       @param plist A output vector of Parton class.
0091    */
0092   void GetHardPartonList(vector<shared_ptr<Parton>> &plist) { plist = hp_list; }
0093 
0094   /** Generated cross section.
0095       To be overwritten by implementations that have such information.
0096   */
0097   virtual double GetSigmaGen() { return 1; };
0098   /** Generated cross section error.
0099       To be overwritten by implementations that have such information.
0100   */
0101   virtual double GetSigmaErr() { return 0; };
0102 
0103   /** Generated pt-hat
0104       To be overwritten by implementations that have such information.
0105   */
0106   virtual double GetPtHat() { return 0; };
0107 
0108   /** Generated weight.
0109       This is in addition to sigmaGen, e.g. coming from dynamic oversampling.
0110       To be overwritten by implementations that have such information.
0111   */
0112   virtual double GetEventWeight() { return 1; };
0113 
0114   /** It adds a Hadron class pointer h into an existing vector of Hadron class, and increases the vector size by 1.
0115       @param h Hadron class pointer for a hadron.
0116    */
0117   void AddHadron(shared_ptr<Hadron> h) { hd_list.push_back(h); }
0118 
0119   // Slots ...
0120   /** This function stores the vector of hadrons into a vector hlist.
0121       @param hlist an output vector of Hadron class.
0122    */
0123   void GetHadronList(vector<shared_ptr<Hadron>> &hlist) { hlist = hd_list; }
0124 
0125   /** @return A vector of the Hadron class.
0126    */
0127   vector<shared_ptr<Hadron>> &GetHadronList() { return hd_list; }
0128 
0129   /**
0130       @return The number of hadrons.
0131   */
0132   int GetNHadrons() { return hd_list.size(); }
0133 
0134     std::string printer;
0135     
0136 private:
0137   // Think of always using unique_ptr for any vector in jetscape framework !???
0138   // To be discussed ...
0139   vector<shared_ptr<Parton>> hp_list;
0140 
0141   // A vector of Hadrons generated by Pythia
0142   vector<shared_ptr<Hadron>> hd_list;
0143     
0144 
0145 };
0146 
0147 } // end namespace Jetscape
0148 
0149 #endif