Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FermiFragmentPoolAN.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// G4FermiBreakUpAN alternative de-excitation model
28// by A. Novikov (January 2025)
29//
30
31#ifndef G4FERMIFRAGMENTPOOLAN_HH
32#define G4FERMIFRAGMENTPOOLAN_HH
33
34#include "G4FermiDataTypes.hh"
35#include "G4VFermiFragmentAN.hh"
36#include "globals.hh"
37
38class G4FermiFragmentPoolAN
39{
40 private:
41 using Container = std::vector<const G4VFermiFragmentAN*>;
42
43 public:
44 class DefaultPoolANSource : private std::vector<G4VFermiFragmentAN*>
45 {
46 private:
47 using PoolANContainer = std::vector<G4VFermiFragmentAN*>;
48
49 public:
51
52 void Initialize();
53
54 using PoolANContainer::begin;
55 using PoolANContainer::cbegin;
56 using PoolANContainer::cend;
57 using PoolANContainer::end;
58 };
59
61 {
62 public:
63 using const_iterator = Container::const_iterator;
64
66
67 const_iterator begin() const { return begin_; }
68 const_iterator end() const { return end_; }
69
70 private:
71 const_iterator begin_;
72 const_iterator end_;
73 };
74
75 std::size_t Count(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const;
76
77 std::size_t Count(G4FermiNucleiData nuclei) const
78 {
79 return Count(nuclei.atomicMass, nuclei.chargeNumber);
80 }
81
82 IteratorRange GetFragments(G4FermiAtomicMass atomicMass,
83 G4FermiChargeNumber chargeNumber) const;
84
86 {
87 return GetFragments(nuclei.atomicMass, nuclei.chargeNumber);
88 }
89
90 template<typename DataSource>
91 void Initialize(const DataSource& dataSource)
92 {
93 Initialize(dataSource.begin(), dataSource.end());
94 }
95
96 template<typename Iter>
97 void Initialize(Iter begin, Iter end)
98 {
99 fragments_.clear();
100 static_assert(
101 std::is_same_v<std::remove_const_t<typename Iter::value_type>, G4VFermiFragmentAN*>,
102 "invalid iterator");
103 for (auto it = begin; it != end; ++it) {
104 AddFragment(**it);
105 }
106 }
107
108 void AddFragment(const G4VFermiFragmentAN& fragment);
109
110 static G4FermiFragmentPoolAN& Instance()
111 {
112 static G4FermiFragmentPoolAN pool;
113 return pool;
114 }
115
116 private:
118
119 static inline const Container EmptyContainer_ = {};
120
121 std::vector<Container> fragments_;
122};
123
124#endif // G4FERMIFRAGMENTPOOL_HH
IteratorRange(const_iterator begin, const_iterator end)
IteratorRange GetFragments(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const
IteratorRange GetFragments(G4FermiNucleiData nuclei) const
std::size_t Count(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const
void Initialize(Iter begin, Iter end)
void Initialize(const DataSource &dataSource)
static G4FermiFragmentPoolAN & Instance()
void AddFragment(const G4VFermiFragmentAN &fragment)
std::size_t Count(G4FermiNucleiData nuclei) const