Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:14:58

0001 // lAger: General Purpose l/A-event Generator
0002 // Copyright (C) 2016-2021 Sylvester Joosten <sjoosten@anl.gov>
0003 //
0004 // This file is part of lAger.
0005 //
0006 // lAger is free software: you can redistribute it and/or modify
0007 // it under the terms of the GNU General Public License as published by
0008 // the Free Shoftware Foundation, either version 3 of the License, or
0009 // (at your option) any later version.
0010 //
0011 // lAger is distributed in the hope that it will be useful,
0012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 // GNU General Public License for more details.
0015 //
0016 // You should have received a copy of the GNU General Public License
0017 // along with lAger.  If not, see <https://www.gnu.org/licenses/>.
0018 //
0019 
0020 #ifndef LAGER_GEN_INITIAL_TARGET_GEN_LOADED
0021 #define LAGER_GEN_INITIAL_TARGET_GEN_LOADED
0022 
0023 #include <TRandom.h>
0024 #include <lager/core/generator.hh>
0025 #include <lager/core/particle.hh>
0026 #include <lager/gen/initial/data.hh>
0027 #include <lager/gen/initial/generator.hh>
0028 #include <memory>
0029 
0030 namespace lager {
0031 namespace initial {
0032 
0033 // estimated target info from config file to be used by lA generators to
0034 // estimate phase-space and cross section ranges
0035 particle estimated_target(const configuration& cf);
0036 
0037 // simple target identical to the ion beam
0038 class primary_target : public target_generator {
0039 public:
0040   primary_target(const configuration& cf, const string_path& path,
0041                  std::shared_ptr<TRandom> r);
0042 
0043   virtual target generate(const beam& ion);
0044   // no contribution to the cross section and phase space
0045   virtual double max_cross_section() const { return 1; }
0046   virtual double phase_space() const { return 1; }
0047 
0048 private:
0049   const particle target_;
0050 };
0051 
0052 // Fermi distribution using old fortran routines from J.S O'Connell and J.W.
0053 // Lightbody Jr. See physics/fermi.hh for more info
0054 // Note that this routine is very generic, and we do not treat remnant particles
0055 // here
0056 class fermi87 : public target_generator {
0057 public:
0058   fermi87(const configuration& cf, const string_path& path,
0059           std::shared_ptr<TRandom> r);
0060 
0061   virtual target generate(const beam& ion);
0062   // We treat the nucleon selection as orthogonal to the main generation
0063   // process, so we first select a nucleon according to the fermi-distribution.
0064   // Because of this we do not have to cary the cross section and phase-space
0065   // information into the main accept-reject procedure.
0066   // I expect this to be more computationally efficient in most cases (although
0067   // I did not
0068   // test the difference).
0069   virtual double max_cross_section() const { return 1; }
0070   virtual double phase_space() const { return 1; }
0071 
0072 private:
0073   // calculate the normalization to the fermi-distribution function
0074   double calc_norm() const;
0075   // calculate the maximum fermi-distribution PDF
0076   double calc_max() const;
0077   // Actual p.d.f implementation
0078   double pdf(const double P) const;
0079 
0080   const int A_;            // nucleus A
0081   const particle nucleon_; // nucleon-of-interest
0082   const double k_max_;     // max fermi momentum
0083   const double norm_;      // internal normalization factor
0084   const double xs_max_;    // maximum value of the PDF
0085 };
0086 
0087 } // namespace initial
0088 } // namespace lager
0089 
0090 #endif