Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions
G4ElectronOccupancy Class Reference

#include <G4ElectronOccupancy.hh>

Public Types

enum  { MaxSizeOfOrbit = 10 }
 

Public Member Functions

 G4ElectronOccupancy (G4int sizeOrbit=MaxSizeOfOrbit)
 
 G4ElectronOccupancy (const G4ElectronOccupancy &right)
 
virtual ~G4ElectronOccupancy ()
 
voidoperator new (size_t)
 
void operator delete (void *aElectronOccupancy)
 
G4ElectronOccupancyoperator= (const G4ElectronOccupancy &right)
 
G4int operator== (const G4ElectronOccupancy &right) const
 
G4int 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 62 of file G4ElectronOccupancy.hh.

Member Enumeration Documentation

anonymous enum
Enumerator
MaxSizeOfOrbit 

Definition at line 65 of file G4ElectronOccupancy.hh.

Constructor & Destructor Documentation

G4ElectronOccupancy::G4ElectronOccupancy ( G4int  sizeOrbit = MaxSizeOfOrbit)

Definition at line 44 of file G4ElectronOccupancy.cc.

References MaxSizeOfOrbit.

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

Definition at line 71 of file G4ElectronOccupancy.cc.

72 {
73  theSizeOfOrbit = right.theSizeOfOrbit;
74 
75  // allocate and clear the array of theOccupancies
76  theOccupancies = new G4int[theSizeOfOrbit];
77  G4int index =0;
78  for (index = 0; index < theSizeOfOrbit; index++) {
79  theOccupancies[index] = right.theOccupancies[index];
80  }
81 
82  theTotalOccupancy = right.theTotalOccupancy;
83 }
int G4int
Definition: G4Types.hh:78
G4ElectronOccupancy::~G4ElectronOccupancy ( )
virtual

Definition at line 62 of file G4ElectronOccupancy.cc.

63 {
64  theSizeOfOrbit = -1;
65 
66  delete [] theOccupancies;
67  theOccupancies =0;
68  theTotalOccupancy =0;
69 }

Member Function Documentation

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

Definition at line 148 of file G4ElectronOccupancy.hh.

Referenced by G4MolecularConfiguration::AddElectron(), G4MolecularConfiguration::ExciteMolecule(), and G4MoleculeDefinition::SetLevelOccupation().

149 {
150  G4int value =0;
151  if ((orbit >=0)&&(orbit<theSizeOfOrbit)){
152  theOccupancies[orbit] += number;
153  theTotalOccupancy += number;
154  value = number;
155  }
156  return value;
157 }
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
void G4ElectronOccupancy::DumpInfo ( ) const

Definition at line 125 of file G4ElectronOccupancy.cc.

References G4cout, and G4endl.

Referenced by G4DNAMolecularDissociation::DecayIt().

126 {
127  G4cout << " -- Electron Occupancy -- " << G4endl;
128  G4int index;
129  for (index = 0; index < theSizeOfOrbit; index++) {
130  G4cout << " " << index << "-th orbit "
131  << theOccupancies[index] << G4endl;
132  }
133 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int G4ElectronOccupancy::GetOccupancy ( G4int  orbit) const
inline

Definition at line 138 of file G4ElectronOccupancy.hh.

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

139 {
140  G4int value = 0;
141  if ((orbit >=0)&&(orbit<theSizeOfOrbit)){
142  value = theOccupancies[orbit];
143  }
144  return value;
145 }
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
G4int G4ElectronOccupancy::GetSizeOfOrbit ( ) const
inline

Definition at line 126 of file G4ElectronOccupancy.hh.

Referenced by eOccComp::operator()(), and comparator::operator()().

127 {
128  return theSizeOfOrbit;
129 }
G4int G4ElectronOccupancy::GetTotalOccupancy ( ) const
inline

Definition at line 132 of file G4ElectronOccupancy.hh.

Referenced by eOccComp::operator()(), and comparator::operator()().

133 {
134  return theTotalOccupancy;
135 }
void G4ElectronOccupancy::operator delete ( void aElectronOccupancy)
inline

Definition at line 120 of file G4ElectronOccupancy.hh.

References aElectronOccupancyAllocator.

121 {
122  aElectronOccupancyAllocator->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
123 }
G4PART_DLL G4ThreadLocal G4Allocator< G4ElectronOccupancy > * aElectronOccupancyAllocator
void * G4ElectronOccupancy::operator new ( size_t  )
inline

Definition at line 111 of file G4ElectronOccupancy.hh.

References aElectronOccupancyAllocator.

112 {
114  {
116  }
117  return (void *) aElectronOccupancyAllocator->MallocSingle();
118 }
G4PART_DLL G4ThreadLocal G4Allocator< G4ElectronOccupancy > * aElectronOccupancyAllocator
G4int G4ElectronOccupancy::operator!= ( const G4ElectronOccupancy right) const

Definition at line 120 of file G4ElectronOccupancy.cc.

References right.

121 {
122  return !(*this == right);
123 }
G4ElectronOccupancy & G4ElectronOccupancy::operator= ( const G4ElectronOccupancy right)

Definition at line 85 of file G4ElectronOccupancy.cc.

86 {
87  if ( this != &right) {
88  theSizeOfOrbit = right.theSizeOfOrbit;
89 
90  // allocate and clear the array of theOccupancies
91  if ( theOccupancies != 0 ) delete [] theOccupancies;
92  theOccupancies = new G4int[theSizeOfOrbit];
93  G4int index =0;
94  for (index = 0; index < theSizeOfOrbit; index++) {
95  theOccupancies[index] = right.theOccupancies[index];
96  }
97 
98  theTotalOccupancy = right.theTotalOccupancy;
99  }
100  return *this;
101 }
int G4int
Definition: G4Types.hh:78
G4int G4ElectronOccupancy::operator== ( const G4ElectronOccupancy right) const

Definition at line 103 of file G4ElectronOccupancy.cc.

References MaxSizeOfOrbit.

104 {
105  G4int index;
106  G4bool value = true;
107  for (index = 0; index < MaxSizeOfOrbit; index++) {
108  if ( (index < theSizeOfOrbit ) && ( index < right.theSizeOfOrbit) ) {
109  value = value &&
110  (theOccupancies[index] == right.theOccupancies[index]) ;
111  } else if ((index < theSizeOfOrbit ) && ( index >= right.theSizeOfOrbit)) {
112  value = value && (theOccupancies[index] == 0);
113  } else if ((index >= theSizeOfOrbit ) && ( index <right.theSizeOfOrbit)) {
114  value = value && (right.theOccupancies[index] == 0);
115  }
116  }
117  return value;
118 }
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
const XML_Char int const XML_Char * value
G4int G4ElectronOccupancy::RemoveElectron ( G4int  orbit,
G4int  number = 1 
)
inline

Definition at line 160 of file G4ElectronOccupancy.hh.

Referenced by G4MolecularConfiguration::ExciteMolecule(), G4Molecule::G4Molecule(), G4VGammaDeexcitation::GenerateGamma(), G4MolecularConfiguration::IonizeMolecule(), G4MolecularConfiguration::RemoveElectron(), and G4MoleculeDefinition::SetLevelOccupation().

161 {
162  G4int value =0;
163  if ((orbit >=0)&&(orbit<theSizeOfOrbit) ){
164  if ( theOccupancies[orbit] < number ) number = theOccupancies[orbit];
165  theOccupancies[orbit] -= number;
166  theTotalOccupancy -= number;
167  value = number;
168  }
169  return value;
170 }
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value

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