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 // Generic fixed target implementation, to be used for photon generators
0021 // that need to be aware of the %RL traversed.
0022 
0023 #include <lager/core/configuration.hh>
0024 #include <lager/core/interval.hh>
0025 #include <lager/core/logger.hh>
0026 
0027 namespace lager::initial {
0028 class realistic_target {
0029 public:
0030   realistic_target(const configuration& cf, const string_path& path);
0031   // Get the total RL based on the vertex position
0032   double total_rl(const double vz) const {
0033     double rl = rl_pre_;
0034     if (target_range_.includes(vz)) {
0035       rl += rl_per_cm_ * (vz - target_range_.min);
0036     } else if (vz >= target_range_.max) {
0037       rl += rl_per_cm_ * target_range_.width();
0038     }
0039     LOG_JUNK2("realistic_target", "Calculated RL for z-vertex position at " +
0040                                       std::to_string(vz) +
0041                                       " cm [%]: " + std::to_string(rl * 100.));
0042     return rl;
0043   }
0044   double front() const { return target_range_.min; }
0045   double back() const { return target_range_.max; }
0046   double length() const { return target_range_.width(); }
0047 
0048 private:
0049   double calc_rl_pre(const configuration& cf, const string_path& path) const;
0050 
0051   const double rl_pre_;                 // radiator+window preceeding the target
0052   const double rl_per_cm_;              // rl/cm for the target
0053   const interval<double> target_range_; // target range in cm
0054 };
0055 } // namespace lager::initial