Geant4-11
Public Types | Public Member Functions | Private Attributes
G4ElectronOccupancy Class Reference

#include <G4ElectronOccupancy.hh>

Public Types

enum  { MaxSizeOfOrbit = 20 }
 

Public Member Functions

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

Private Attributes

G4inttheOccupancies = nullptr
 
G4int theSizeOfOrbit = 0
 
G4int theTotalOccupancy = 0
 

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
45 {
47 }
48
49 // allocate and clear the array of theOccupancies
51 for (G4int index = 0; index < theSizeOfOrbit; ++index)
52 {
53 theOccupancies[index] = 0;
54 }
55
57}
int G4int
Definition: G4Types.hh:85

References MaxSizeOfOrbit, theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

◆ G4ElectronOccupancy() [2/2]

G4ElectronOccupancy::G4ElectronOccupancy ( const G4ElectronOccupancy right)

Definition at line 68 of file G4ElectronOccupancy.cc.

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

References theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

◆ ~G4ElectronOccupancy()

G4ElectronOccupancy::~G4ElectronOccupancy ( )
virtual

Definition at line 59 of file G4ElectronOccupancy.cc.

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

References theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

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:35

References G4Exception(), JustWarning, theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

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

References G4cout, G4endl, theOccupancies, and theSizeOfOrbit.

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}

References theOccupancies, and theSizeOfOrbit.

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

◆ GetSizeOfOrbit()

G4int G4ElectronOccupancy::GetSizeOfOrbit ( ) const
inline

◆ 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()

References 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}

References aElectronOccupancyAllocator().

◆ 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 {
88
89 // allocate and clear the array of theOccupancies
90 if ( theOccupancies != nullptr ) delete [] theOccupancies;
92 for (G4int index = 0; index < theSizeOfOrbit; ++index)
93 {
94 theOccupancies[index] = right.theOccupancies[index];
95 }
96
98 }
99 return *this;
100}

References theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

◆ 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

References MaxSizeOfOrbit, theOccupancies, and theSizeOfOrbit.

◆ 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}

References G4Exception(), JustWarning, theOccupancies, theSizeOfOrbit, and theTotalOccupancy.

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().

Field Documentation

◆ theOccupancies

G4int* G4ElectronOccupancy::theOccupancies = nullptr
private

◆ theSizeOfOrbit

G4int G4ElectronOccupancy::theSizeOfOrbit = 0
private

◆ theTotalOccupancy

G4int G4ElectronOccupancy::theTotalOccupancy = 0
private

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