Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FermiNucleiProperties.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 FermiBreakUp model
28// by A. Novikov (January 2025)
29//
30
31#ifndef G4FERMINUCLEIPROPERTIES_HH
32#define G4FERMINUCLEIPROPERTIES_HH
33
34#include "G4FermiDataTypes.hh"
35#include "globals.hh"
36#include <vector>
37
38// Caches values from larger G4NucleiProperties(x5-10 speed boost)
39class G4FermiNucleiProperties
40{
41 public:
42 void Initialize() { *this = G4FermiNucleiProperties(); }
43
44 template<typename DataSource>
45 void Initialize(const DataSource& dataSource)
46 {
47 Initialize(dataSource.begin(), dataSource.end());
48 }
49
50 template<typename Iter>
51 void Initialize(Iter begin, Iter end)
52 {
53 nucleiMasses_.clear();
54 static_assert(
55 std::is_same_v<typename Iter::value_type, std::pair<const G4FermiNucleiData, G4double>>,
56 "invalid iterator");
57 for (auto it = begin; it != end; ++it) {
58 InsertNuclei(it->first.atomicMass, it->first.chargeNumber, it->second);
59 }
60 }
61
63 {
64 return Instance().GetNuclearMassImpl(atomicMass, chargeNumber);
65 }
66
67 static G4bool IsStable(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber)
68 {
69 return Instance().IsStableImpl(atomicMass, chargeNumber);
70 }
71
72 void InsertNuclei(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber, G4double mass,
73 G4bool isStable = true);
74
75 static G4FermiNucleiProperties& Instance()
76 {
77 static G4FermiNucleiProperties properties;
78 return properties;
79 }
80
81 private:
83
84 G4double GetNuclearMassImpl(G4FermiAtomicMass atomicMass,
85 G4FermiChargeNumber chargeNumber) const;
86
87 G4bool IsStableImpl(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber) const;
88
89 struct G4FermiMassData
90 {
91 G4double mass;
92
93 G4bool isStable = false; // is nuclei stable
94
95 G4bool isCached = false; // value has been inserted earlier
96 };
97
98 mutable std::vector<G4FermiMassData> nucleiMasses_;
99};
100
101#endif // G4FERMINUCLEIPROPERTIES_HH
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
void Initialize(Iter begin, Iter end)
void Initialize(const DataSource &dataSource)
static G4bool IsStable(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber)
void InsertNuclei(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber, G4double mass, G4bool isStable=true)
static G4double GetNuclearMass(G4FermiAtomicMass atomicMass, G4FermiChargeNumber chargeNumber)
static G4FermiNucleiProperties & Instance()