Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NuclearPolarizationStore Class Reference

#include <G4NuclearPolarizationStore.hh>

Public Member Functions

 ~G4NuclearPolarizationStore ()
 
void Register (G4NuclearPolarization *ptr)
 
G4NuclearPolarizationFindOrBuild (G4int Z, G4int A, G4double Eexc)
 
void RemoveMe (G4NuclearPolarization *ptr)
 

Static Public Member Functions

static G4NuclearPolarizationStoreGetInstance ()
 

Friends

class G4ThreadLocalSingleton< G4NuclearPolarizationStore >
 

Detailed Description

Definition at line 45 of file G4NuclearPolarizationStore.hh.

Constructor & Destructor Documentation

◆ ~G4NuclearPolarizationStore()

G4NuclearPolarizationStore::~G4NuclearPolarizationStore ( )

Definition at line 51 of file G4NuclearPolarizationStore.cc.

52{
53 for(G4int i=0; i<maxNumStates; ++i) {
54 delete nuclist[i];
55 nuclist[i] = nullptr;
56 }
57}
const G4int maxNumStates
int G4int
Definition G4Types.hh:85

Member Function Documentation

◆ FindOrBuild()

G4NuclearPolarization * G4NuclearPolarizationStore::FindOrBuild ( G4int Z,
G4int A,
G4double Eexc )

Definition at line 79 of file G4NuclearPolarizationStore.cc.

80{
81 static const G4double tolerance = 10.*CLHEP::eV;
82 for(G4int i=0; i<maxNumStates; ++i) {
83 auto nucp = nuclist[i];
84 if(nucp && Z == nucp->GetZ() && A == nucp->GetA() &&
85 std::abs(Eexc - nucp->GetExcitationEnergy()) < tolerance) {
86 return nucp;
87 }
88 }
90 Register(ptr);
91 return ptr;
92}
double G4double
Definition G4Types.hh:83
const G4double A[17]
void Register(G4NuclearPolarization *ptr)

Referenced by G4PhotonEvaporation::EmittedFragment().

◆ GetInstance()

G4NuclearPolarizationStore * G4NuclearPolarizationStore::GetInstance ( )
static

Definition at line 36 of file G4NuclearPolarizationStore.cc.

37{
38 if(nullptr == instance) {
40 instance = inst.Instance();
41 }
42 return instance;
43}

Referenced by G4PhotonEvaporation::EmittedFragment().

◆ Register()

void G4NuclearPolarizationStore::Register ( G4NuclearPolarization * ptr)

Definition at line 59 of file G4NuclearPolarizationStore.cc.

60{
61 G4int idx = -1;
62 for(G4int i=0; i<maxNumStates; ++i) {
63 if(ptr == nuclist[i]) { return; }
64 if(nullptr == nuclist[i]) { idx = i; }
65 }
66 if(idx >= 0) {
67 nuclist[idx] = ptr;
68 return;
69 }
70 // delete oldest object
71 delete nuclist[oldIdx];
72 nuclist[oldIdx] = ptr;
73 // redefine oldIdx
74 ++oldIdx;
75 if(oldIdx >= maxNumStates) { oldIdx = 0; }
76}

Referenced by FindOrBuild().

◆ RemoveMe()

void G4NuclearPolarizationStore::RemoveMe ( G4NuclearPolarization * ptr)

Definition at line 94 of file G4NuclearPolarizationStore.cc.

95{
96 for(G4int i=0; i<maxNumStates; ++i) {
97 if(ptr == nuclist[i]) {
98 delete ptr;
99 nuclist[i] = nullptr;
100 // do we need redefine oldIdx?
101 if(i == oldIdx) {
102 for(G4int j=0; j<maxNumStates; ++j) {
103 if(j != i && nullptr != nuclist[j]) {
104 oldIdx = j;
105 return;
106 }
107 }
108 oldIdx = i;
109 }
110 return;
111 }
112 }
113}

Referenced by G4PhotonEvaporation::EmittedFragment().

Friends And Related Symbol Documentation

◆ G4ThreadLocalSingleton< G4NuclearPolarizationStore >

Definition at line 43 of file G4NuclearPolarizationStore.hh.


The documentation for this class was generated from the following files: