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

#include <G4ElectronOccupancy.hh>

Public Types

enum  { MaxSizeOfOrbit = 20 }
 

Public Member Functions

 G4ElectronOccupancy (G4int sizeOrbit=MaxSizeOfOrbit)
 
 G4ElectronOccupancy (const G4ElectronOccupancy &right)
 
virtual ~G4ElectronOccupancy ()
 
void * operator new (size_t)
 
void operator delete (void *aElectronOccupancy)
 
G4ElectronOccupancyoperator= (const G4ElectronOccupancy &right)
 
G4bool operator== (const G4ElectronOccupancy &right) const
 
G4bool operator!= (const G4ElectronOccupancy &right) const
 
G4int GetTotalOccupancy () const
 
G4int GetOccupancy (G4int orbit) const
 
G4int AddElectron (G4int orbit, G4int number=1)
 
G4int RemoveElectron (G4int orbit, G4int number=1)
 
G4int GetSizeOfOrbit () const
 
void DumpInfo () const
 

Detailed Description

Definition at line 50 of file G4ElectronOccupancy.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MaxSizeOfOrbit 

Definition at line 54 of file G4ElectronOccupancy.hh.

Constructor & Destructor Documentation

◆ G4ElectronOccupancy() [1/2]

G4ElectronOccupancy::G4ElectronOccupancy ( G4int  sizeOrbit = MaxSizeOfOrbit)

Definition at line 40 of file G4ElectronOccupancy.cc.

41 : theSizeOfOrbit(sizeOrbit)
42{
43 // check size
44 if ( (theSizeOfOrbit < 1 ) || (theSizeOfOrbit > MaxSizeOfOrbit) )
45 {
46 theSizeOfOrbit = MaxSizeOfOrbit;
47 }
48
49 // allocate and clear the array of theOccupancies
50 theOccupancies = new G4int[theSizeOfOrbit];
51 for (G4int index = 0; index < theSizeOfOrbit; ++index)
52 {
53 theOccupancies[index] = 0;
54 }
55
56 theTotalOccupancy = 0;
57}
int G4int
Definition: G4Types.hh:85

◆ G4ElectronOccupancy() [2/2]

G4ElectronOccupancy::G4ElectronOccupancy ( const G4ElectronOccupancy right)

Definition at line 68 of file G4ElectronOccupancy.cc.

69{
70 theSizeOfOrbit = right.theSizeOfOrbit;
71
72 // allocate and clear the array of theOccupancies
73 theOccupancies = new G4int[theSizeOfOrbit];
74 for (G4int index = 0; index < theSizeOfOrbit; ++index)
75 {
76 theOccupancies[index] = right.theOccupancies[index];
77 }
78
79 theTotalOccupancy = right.theTotalOccupancy;
80}

◆ ~G4ElectronOccupancy()

G4ElectronOccupancy::~G4ElectronOccupancy ( )
virtual

Definition at line 59 of file G4ElectronOccupancy.cc.

60{
61 theSizeOfOrbit = -1;
62
63 delete [] theOccupancies;
64 theOccupancies = nullptr;
65 theTotalOccupancy = 0;
66}

Member Function Documentation

◆ AddElectron()

G4int G4ElectronOccupancy::AddElectron ( G4int  orbit,
G4int  number = 1 
)

Definition at line 139 of file G4ElectronOccupancy.cc.

140{
141 G4int value =0;
142 if (orbit>=theSizeOfOrbit)
143 {
144 std::ostringstream smsg;
145 smsg<< "Orbit (" << orbit
146 <<") exceeds the maximum("
147 <<theSizeOfOrbit-1<<") ";
148 G4String msg = smsg.str();
149 G4Exception("G4ElectronOccupancy::AddElectron()","PART131",
150 JustWarning, msg);
151 }
152 else if (orbit >=0)
153 {
154 theOccupancies[orbit] += number;
155 theTotalOccupancy += number;
156 value = number;
157 }
158 return value;
159}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

Referenced by G4MolecularConfiguration::AddElectron(), G4EmDNAChemistry::ConstructDissociationChannels(), G4EmDNAChemistry_option1::ConstructDissociationChannels(), G4EmDNAChemistry_option3::ConstructDissociationChannels(), G4EmDNAChemistry_option2::ConstructDissociationChannels(), G4MolecularConfiguration::ExciteMolecule(), G4Molecule::G4Molecule(), G4MolecularConfiguration::MoveOneElectron(), and G4MoleculeDefinition::SetLevelOccupation().

◆ DumpInfo()

void G4ElectronOccupancy::DumpInfo ( ) const

Definition at line 129 of file G4ElectronOccupancy.cc.

130{
131 G4cout << " -- Electron Occupancy -- " << G4endl;
132 for (G4int index = 0; index < theSizeOfOrbit; ++index)
133 {
134 G4cout << " " << index << "-th orbit "
135 << theOccupancies[index] << G4endl;
136 }
137}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

Referenced by G4MolecularConfiguration::PrintState().

◆ GetOccupancy()

G4int G4ElectronOccupancy::GetOccupancy ( G4int  orbit) const
inline

Definition at line 126 of file G4ElectronOccupancy.hh.

127{
128 G4int value = 0;
129 if ((orbit >=0)&&(orbit<theSizeOfOrbit))
130 {
131 value = theOccupancies[orbit];
132 }
133 return value;
134}

Referenced by G4MolecularConfiguration::IonizeMolecule(), G4MolecularConfiguration::MoveOneElectron(), comparator::operator()(), G4MolecularConfiguration::RemoveElectron(), and G4MoleculeDefinition::SetLevelOccupation().

◆ GetSizeOfOrbit()

G4int G4ElectronOccupancy::GetSizeOfOrbit ( ) const
inline

Definition at line 114 of file G4ElectronOccupancy.hh.

115{
116 return theSizeOfOrbit;
117}

Referenced by G4MoleculeDefinition::GetNbMolecularShells(), comparator::operator()(), and G4MoleculeDefinition::Serialize().

◆ GetTotalOccupancy()

G4int G4ElectronOccupancy::GetTotalOccupancy ( ) const
inline

◆ operator delete()

void G4ElectronOccupancy::operator delete ( void *  aElectronOccupancy)
inline

Definition at line 107 of file G4ElectronOccupancy.hh.

108{
110 ->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
111}
G4PART_DLL G4Allocator< G4ElectronOccupancy > *& aElectronOccupancyAllocator()

◆ operator new()

void * G4ElectronOccupancy::operator new ( size_t  )
inline

Definition at line 97 of file G4ElectronOccupancy.hh.

98{
99 if (aElectronOccupancyAllocator() == nullptr)
100 {
102 }
103 return (void*) aElectronOccupancyAllocator()->MallocSingle();
104}

◆ operator!=()

G4bool G4ElectronOccupancy::operator!= ( const G4ElectronOccupancy right) const

Definition at line 124 of file G4ElectronOccupancy.cc.

125{
126 return !(*this == right);
127}

◆ operator=()

G4ElectronOccupancy & G4ElectronOccupancy::operator= ( const G4ElectronOccupancy right)

Definition at line 83 of file G4ElectronOccupancy.cc.

84{
85 if ( this != &right)
86 {
87 theSizeOfOrbit = right.theSizeOfOrbit;
88
89 // allocate and clear the array of theOccupancies
90 if ( theOccupancies != nullptr ) delete [] theOccupancies;
91 theOccupancies = new G4int[theSizeOfOrbit];
92 for (G4int index = 0; index < theSizeOfOrbit; ++index)
93 {
94 theOccupancies[index] = right.theOccupancies[index];
95 }
96
97 theTotalOccupancy = right.theTotalOccupancy;
98 }
99 return *this;
100}

◆ operator==()

G4bool G4ElectronOccupancy::operator== ( const G4ElectronOccupancy right) const

Definition at line 102 of file G4ElectronOccupancy.cc.

103{
104 G4bool value = true;
105 for (G4int index = 0; index < MaxSizeOfOrbit; ++index)
106 {
107 if ( (index < theSizeOfOrbit ) && ( index < right.theSizeOfOrbit) )
108 {
109 value = value &&
110 (theOccupancies[index] == right.theOccupancies[index]) ;
111 }
112 else if ((index < theSizeOfOrbit ) && ( index >= right.theSizeOfOrbit))
113 {
114 value = value && (theOccupancies[index] == false);
115 }
116 else if ((index >= theSizeOfOrbit ) && ( index <right.theSizeOfOrbit))
117 {
118 value = value && (right.theOccupancies[index] == false);
119 }
120 }
121 return value;
122}
bool G4bool
Definition: G4Types.hh:86

◆ RemoveElectron()

G4int G4ElectronOccupancy::RemoveElectron ( G4int  orbit,
G4int  number = 1 
)

Definition at line 161 of file G4ElectronOccupancy.cc.

162{
163 G4int value =0;
164 if (orbit>=theSizeOfOrbit)
165 {
166 std::ostringstream smsg;
167 smsg<< "Orbit (" << orbit
168 <<") exceeds the maximum("
169 <<theSizeOfOrbit-1 <<") ";
170 G4String msg = smsg.str();
171 G4Exception("G4ElectronOccupancy::RemoveElectron()","PART131",
172 JustWarning, msg);
173 }
174 else if (orbit >=0)
175 {
176 if ( theOccupancies[orbit] < number ) number = theOccupancies[orbit];
177 theOccupancies[orbit] -= number;
178 theTotalOccupancy -= number;
179 value = number;
180 }
181 return value;
182}

Referenced by G4EmDNAChemistry::ConstructDissociationChannels(), G4EmDNAChemistry_option1::ConstructDissociationChannels(), G4EmDNAChemistry_option3::ConstructDissociationChannels(), G4EmDNAChemistry_option2::ConstructDissociationChannels(), G4MolecularConfiguration::ExciteMolecule(), G4Molecule::G4Molecule(), G4MolecularConfiguration::IonizeMolecule(), G4MolecularConfiguration::MoveOneElectron(), G4MolecularConfiguration::RemoveElectron(), and G4MoleculeDefinition::SetLevelOccupation().


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