Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // TRENTO: Reduced Thickness Event-by-event Nuclear Topology
0002 // Copyright 2015 Jonah E. Bernhard, J. Scott Moreland
0003 // TRENTO3D: Three-dimensional extension of TRENTO by Weiyao Ke
0004 // MIT License
0005 
0006 #ifndef COLLIDER_H
0007 #define COLLIDER_H
0008 
0009 #include <memory>
0010 
0011 #include "fwd_decl.h"
0012 #include "event.h"
0013 #include "nucleon.h"
0014 #include "output.h"
0015 
0016 namespace trento {
0017 
0018 /// \rst
0019 /// Orchestrates event generation and output.  Owns instances of several other
0020 /// TRENTO classes and knows how they work together.  Responsible for sampling
0021 /// impact parameters.  After instantiation, call ``run_events()`` to do
0022 /// everything.
0023 ///
0024 /// Example::
0025 ///
0026 ///   Collider collider{var_map};
0027 ///   collider.run_events();
0028 ///
0029 /// \endrst
0030 
0031 struct records {
0032     int i;
0033     double b;
0034     double npart;
0035     double mult;
0036 };
0037 
0038 class Collider {
0039  public:
0040   /// Instantiate from the configuration.
0041   explicit Collider(const VarMap& var_map);
0042 
0043   /// Declare a destructor to properly handle the std::unique_ptr<Nucleus>
0044   /// members.  At this point in the code, Nucleus is an incomplete type so the
0045   /// compiler does not know how to delete it.  Therefore the destructor is
0046   /// defined (as default) in the implementation file, at which point Nucleus is
0047   /// fully defined.  See e.g. Item 22 of Effective Modern C++ by Scott Meyers
0048   /// and this stackoverflow answer: http://stackoverflow.com/a/6089065.
0049   ~Collider();
0050 
0051   /// Run events and output.
0052   void run_events();
0053   const std::vector<records> & all_records() const{
0054     return all_records_;
0055   }
0056   const Event & expose_event() const{
0057     return event_;
0058   }
0059 
0060  private:
0061   // Most of these are pretty self-explanatory...
0062 
0063   /// Sample a min-bias impact parameter within the set range.
0064   double sample_impact_param();
0065   /// Pair of nucleus projectiles.
0066   std::unique_ptr<Nucleus> nucleusA_, nucleusB_;
0067 
0068   /// The nucleon profile instance.
0069   NucleonProfile nucleon_profile_;
0070 
0071   /// Number of events to run.
0072   const int nevents_;
0073 
0074   /// Number of trys.
0075   int ntrys_;
0076 
0077   /// Minimum and maximum impact parameter.
0078   const double bmin_, bmax_;
0079 
0080   /// WK: Minimum and maximum Npart.
0081   const int npartmin_, npartmax_;
0082 
0083   /// WK: Minimum and maximum total entropy (at midrapitiy).
0084   const double stotmin_, stotmax_;
0085 
0086   /// Parameterizes the degree of asymmetry between the two projectiles.  Used
0087   /// to apportion the total impact parameter to each projectile so that the
0088   /// resulting overlap is approximately centered.  Given the two nuclear radii
0089   /// rA and rB (see Nucleus::radius()), the parameter is
0090   ///
0091   ///   asymmetry = rA / (rA + rB)
0092   ///
0093   /// and the impact parameter b is apportioned
0094   ///
0095   ///   offset_A = asymmetry * b
0096   ///   offset_B = (asymmetry-1) * b
0097   ///
0098   /// So for example, two identical projectiles would have asymmetry = 0.5, and
0099   /// each would be offset by half the impact parameter.  A proton-lead system
0100   /// would have asymmetry = 1, meaning the lead nucleus would be offset by the
0101   /// entire impact parameter and the proton would not be offset at all.
0102   const double asymmetry_;
0103 
0104   /// The event instance.
0105   Event event_;
0106 
0107   /// The output instance.
0108   Output output_;
0109 
0110   /// Whether calculate Ncoll and nulear binary collision density
0111   bool with_ncoll_;
0112 
0113   // take down id, b, npart, ncoll, mult for each event.
0114   std::vector<records> all_records_;
0115 };
0116 
0117 }  // namespace trento
0118 
0119 #endif  // COLLIDER_H