Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4FermiFragmentPoolAN.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // G4FermiBreakUpAN alternative de-excitation model
0028 // by A. Novikov (January 2025)
0029 //
0030 
0031 #ifndef G4FERMIFRAGMENTPOOLAN_HH
0032 #define G4FERMIFRAGMENTPOOLAN_HH
0033 
0034 #include "G4FermiDataTypes.hh"
0035 #include "G4VFermiFragmentAN.hh"
0036 #include "globals.hh"
0037 
0038 class G4FermiFragmentPoolAN
0039 {
0040   private:
0041     using Container = std::vector<const G4VFermiFragmentAN*>;
0042 
0043   public:
0044     class DefaultPoolANSource : private std::vector<G4VFermiFragmentAN*>
0045     {
0046       private:
0047         using PoolANContainer = std::vector<G4VFermiFragmentAN*>;
0048 
0049       public:
0050         DefaultPoolANSource();
0051 
0052         void Initialize();
0053 
0054         using PoolANContainer::begin;
0055         using PoolANContainer::cbegin;
0056         using PoolANContainer::cend;
0057         using PoolANContainer::end;
0058     };
0059 
0060     class IteratorRange
0061     {
0062       public:
0063         using const_iterator = Container::const_iterator;
0064 
0065         IteratorRange(const_iterator begin, const_iterator end) : begin_(begin), end_(end) {}
0066 
0067         const_iterator begin() const { return begin_; }
0068         const_iterator end() const { return end_; }
0069 
0070       private:
0071         const_iterator begin_;
0072         const_iterator end_;
0073     };
0074 
0075     std::size_t Count(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const;
0076 
0077     std::size_t Count(G4FermiNucleiData nuclei) const
0078     {
0079       return Count(nuclei.atomicMass, nuclei.chargeNumber);
0080     }
0081 
0082     IteratorRange GetFragments(G4FermiAtomicMass atomicMass,
0083                                G4FermiChargeNumber chargeNumber) const;
0084 
0085     IteratorRange GetFragments(G4FermiNucleiData nuclei) const
0086     {
0087       return GetFragments(nuclei.atomicMass, nuclei.chargeNumber);
0088     }
0089 
0090     template<typename DataSource>
0091     void Initialize(const DataSource& dataSource)
0092     {
0093       Initialize(dataSource.begin(), dataSource.end());
0094     }
0095 
0096     template<typename Iter>
0097     void Initialize(Iter begin, Iter end)
0098     {
0099       fragments_.clear();
0100       static_assert(
0101         std::is_same_v<std::remove_const_t<typename Iter::value_type>, G4VFermiFragmentAN*>,
0102         "invalid iterator");
0103       for (auto it = begin; it != end; ++it) {
0104         AddFragment(**it);
0105       }
0106     }
0107 
0108     void AddFragment(const G4VFermiFragmentAN& fragment);
0109 
0110     static G4FermiFragmentPoolAN& Instance()
0111     {
0112       static G4FermiFragmentPoolAN pool;
0113       return pool;
0114     }
0115 
0116   private:
0117     G4FermiFragmentPoolAN();
0118   
0119     static inline const Container EmptyContainer_ = {};
0120 
0121     std::vector<Container> fragments_;
0122 };
0123 
0124 #endif  // G4FERMIFRAGMENTPOOL_HH