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_DATA_LOADED
0021 #define LAGER_GEN_INITIAL_DATA_LOADED
0022 
0023 #include <lager/core/generator.hh>
0024 #include <lager/core/particle.hh>
0025 
0026 namespace lager {
0027 namespace initial {
0028 
0029 // VERTEX DATA
0030 using vertex = particle::XYZTVector;
0031 
0032 // PRIMARY BEAM DATA
0033 // =============================================================================
0034 // initial::beam
0035 //
0036 // primary beam data
0037 // =============================================================================
0038 class beam : public generator_data {
0039 public:
0040   beam() = default;
0041   beam(const particle& part) : part_{part} {}
0042   beam(const particle& part, const double xs)
0043       : generator_data{xs}, part_{part} {}
0044   beam(const double xs) : generator_data{xs} {}
0045 
0046   lager::particle& particle() { return part_; }
0047   const lager::particle& particle() const { return part_; }
0048 
0049 private:
0050   lager::particle part_;
0051 };
0052 
0053 // SECONDARY BEAM DATA
0054 // =============================================================================
0055 // initial::target
0056 //
0057 // secondary target beam in a primary ion beam (e.g. beam proton,
0058 // or proton in nucleon)
0059 // =============================================================================
0060 class target : public beam {
0061 public:
0062   // generalized constructor:
0063   // split a nucleon beam in a nucleon jet and a remnant
0064   //
0065   // nucl and remn are given in the ion helicity frame
0066   static target make_target(const lager::particle& ion, lager::particle nucl,
0067                             std::vector<lager::particle> remn = {},
0068                             const double xs = 1);
0069 
0070   target() = default;
0071   target(const target&) = default;
0072   target& operator=(const target&) = default;
0073 
0074   target(const double xs) : beam{xs} {}
0075 
0076   target(const particle::XYZTVector& p, const pdg_id& id)
0077       : beam{{id, p, lager::particle::status_code::SECONDARY_BEAM}} {}
0078   target(const particle::XYZTVector& p, const pdg_id& id, const double xs)
0079       : beam{{id, p, lager::particle::status_code::SECONDARY_BEAM}, xs} {}
0080 
0081   const std::vector<lager::particle>& remnant() const { return remnant_; }
0082 
0083 private:
0084   std::vector<lager::particle> remnant_; // nucleon remnant (if any)
0085 };
0086 
0087 // =============================================================================
0088 // initial::photon
0089 //
0090 // secondary photon beam (e.g. virtual photon, or bremsstrahlung photon)
0091 // =============================================================================
0092 class photon : public beam {
0093 public:
0094   // generalized constructors:
0095   // make collinear real photon event with energy E
0096   static photon make_real(const lager::particle& lepton,
0097                           const lager::particle& target, const double E,
0098                           const double xs);
0099 
0100   // generate virtual photon event with Q2 and y
0101   // also needs an azimuthal angle in the CM frame
0102   static photon make_virtual(const lager::particle& lepton,
0103                              const lager::particle& target, const double Q2,
0104                              const double y, const double xs, const double phi);
0105 
0106   photon() = default;
0107   photon(const photon&) = default;
0108   photon& operator=(const photon&) = default;
0109 
0110   photon(const double xs) : beam{xs} {}
0111 
0112   photon(const lager::particle::XYZTVector& p)
0113       : beam{{pdg_id::gamma, p, lager::particle::status_code::SECONDARY_BEAM}} {
0114   }
0115   photon(const lager::particle::XYZTVector& p, const double xs)
0116       : beam{{pdg_id::gamma, p, lager::particle::status_code::SECONDARY_BEAM},
0117              xs} {}
0118 
0119   double epsilon() const { return epsilon_; }
0120   double W() const { return sqrt(W2_); }
0121   double W2() const { return W2_; }
0122   double Q2() const { return Q2_; }
0123   double nu() const { return nu_; }
0124   double x() const { return x_; }
0125   double y() const { return y_; }
0126 
0127   lager::particle& scat() { return scat_; }
0128   const lager::particle& scat() const { return scat_; }
0129 
0130 private:
0131   double epsilon_{0.};   // gamma_L/gamma_T (xs stores just gamma_T)
0132   double W2_{0.};        // invariant mass of photon-target system
0133   double Q2_{0.};        // photon virtuality
0134   double nu_{0.};        // photon enery in target rest frame
0135   double x_{0.};         // Bjorken x
0136   double y_{0.};         // energy fraction of photon in target rest frame
0137   lager::particle scat_; // scattered lepton
0138 };
0139 } // namespace initial
0140 } // namespace lager
0141 
0142 #endif