Geant4  10.02.p03
G4ElectronOccupancy Class Reference

#include <G4ElectronOccupancy.hh>

Collaboration diagram for G4ElectronOccupancy:

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

Private Attributes

G4int theSizeOfOrbit
 
G4int theTotalOccupancy
 
G4inttheOccupancies
 

Detailed Description

Definition at line 62 of file G4ElectronOccupancy.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MaxSizeOfOrbit 

Definition at line 65 of file G4ElectronOccupancy.hh.

Constructor & Destructor Documentation

◆ G4ElectronOccupancy() [1/2]

G4ElectronOccupancy::G4ElectronOccupancy ( G4int  sizeOrbit = MaxSizeOfOrbit)

Definition at line 45 of file G4ElectronOccupancy.cc.

46  : theSizeOfOrbit(sizeOrbit)
47 {
48  // check size
49  if ( (theSizeOfOrbit <1 ) || (theSizeOfOrbit > MaxSizeOfOrbit) ) {
51  }
52 
53  // allocate and clear the array of theOccupancies
55  G4int index =0;
56  for (index = 0; index < theSizeOfOrbit; index++) {
58  }
59 
61 }
Int_t index
int G4int
Definition: G4Types.hh:78

◆ G4ElectronOccupancy() [2/2]

G4ElectronOccupancy::G4ElectronOccupancy ( const G4ElectronOccupancy right)

Definition at line 72 of file G4ElectronOccupancy.cc.

73 {
75 
76  // allocate and clear the array of theOccupancies
78  G4int index =0;
79  for (index = 0; index < theSizeOfOrbit; index++) {
81  }
82 
84 }
Int_t index
int G4int
Definition: G4Types.hh:78

◆ ~G4ElectronOccupancy()

G4ElectronOccupancy::~G4ElectronOccupancy ( )
virtual

Definition at line 63 of file G4ElectronOccupancy.cc.

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

Member Function Documentation

◆ AddElectron()

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

Definition at line 136 of file G4ElectronOccupancy.cc.

137 {
138  G4int value =0;
139  if (orbit>=theSizeOfOrbit){
140  std::ostringstream smsg;
141  smsg<< "Orbit (" << orbit
142  <<") exceeds the maximum("
143  <<theSizeOfOrbit-1<<") ";
144  G4String msg = smsg.str();
145  G4Exception("G4ElectronOccupancy::AddElectron()","PART131",
146  JustWarning, msg);
147  } else if (orbit >=0) {
148  theOccupancies[orbit] += number;
149  theTotalOccupancy += number;
150  value = number;
151  }
152  return value;
153 }
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpInfo()

void G4ElectronOccupancy::DumpInfo ( ) const

Definition at line 126 of file G4ElectronOccupancy.cc.

127 {
128  G4cout << " -- Electron Occupancy -- " << G4endl;
129  G4int index;
130  for (index = 0; index < theSizeOfOrbit; index++) {
131  G4cout << " " << index << "-th orbit "
132  << theOccupancies[index] << G4endl;
133  }
134 }
Int_t index
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ GetOccupancy()

G4int G4ElectronOccupancy::GetOccupancy ( G4int  orbit) const
inline

Definition at line 138 of file G4ElectronOccupancy.hh.

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
Here is the caller graph for this function:

◆ GetSizeOfOrbit()

G4int G4ElectronOccupancy::GetSizeOfOrbit ( ) const
inline

Definition at line 126 of file G4ElectronOccupancy.hh.

127 {
128  return theSizeOfOrbit;
129 }
Here is the caller graph for this function:

◆ GetTotalOccupancy()

G4int G4ElectronOccupancy::GetTotalOccupancy ( ) const
inline

Definition at line 132 of file G4ElectronOccupancy.hh.

133 {
134  return theTotalOccupancy;
135 }
Here is the caller graph for this function:

◆ operator delete()

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

Definition at line 120 of file G4ElectronOccupancy.hh.

121 {
122  aElectronOccupancyAllocator->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
123 }
G4PART_DLL G4ThreadLocal G4Allocator< G4ElectronOccupancy > * aElectronOccupancyAllocator

◆ operator new()

void * G4ElectronOccupancy::operator new ( size_t  )
inline

Definition at line 111 of file G4ElectronOccupancy.hh.

112 {
114  {
116  }
117  return (void *) aElectronOccupancyAllocator->MallocSingle();
118 }
G4PART_DLL G4ThreadLocal G4Allocator< G4ElectronOccupancy > * aElectronOccupancyAllocator

◆ operator!=()

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

Definition at line 121 of file G4ElectronOccupancy.cc.

122 {
123  return !(*this == right);
124 }

◆ operator=()

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

Definition at line 86 of file G4ElectronOccupancy.cc.

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

◆ operator==()

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

Definition at line 104 of file G4ElectronOccupancy.cc.

105 {
106  G4int index;
107  G4bool value = true;
108  for (index = 0; index < MaxSizeOfOrbit; index++) {
109  if ( (index < theSizeOfOrbit ) && ( index < right.theSizeOfOrbit) ) {
110  value = value &&
112  } else if ((index < theSizeOfOrbit ) && ( index >= right.theSizeOfOrbit)) {
113  value = value && (theOccupancies[index] == 0);
114  } else if ((index >= theSizeOfOrbit ) && ( index <right.theSizeOfOrbit)) {
115  value = value && (right.theOccupancies[index] == 0);
116  }
117  }
118  return value;
119 }
Int_t index
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79

◆ RemoveElectron()

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

Definition at line 155 of file G4ElectronOccupancy.cc.

156 {
157  G4int value =0;
158  if (orbit>=theSizeOfOrbit){
159  std::ostringstream smsg;
160  smsg<< "Orbit (" << orbit
161  <<") exceeds the maximum("
162  <<theSizeOfOrbit-1 <<") ";
163  G4String msg = smsg.str();
164  G4Exception("G4ElectronOccupancy::RemoveElectron()","PART131",
165  JustWarning, msg);
166  } else if (orbit >=0) {
167  if ( theOccupancies[orbit] < number ) number = theOccupancies[orbit];
168  theOccupancies[orbit] -= number;
169  theTotalOccupancy -= number;
170  value = number;
171  }
172  return value;
173 }
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ theOccupancies

G4int* G4ElectronOccupancy::theOccupancies
private

Definition at line 101 of file G4ElectronOccupancy.hh.

◆ theSizeOfOrbit

G4int G4ElectronOccupancy::theSizeOfOrbit
private

Definition at line 99 of file G4ElectronOccupancy.hh.

◆ theTotalOccupancy

G4int G4ElectronOccupancy::theTotalOccupancy
private

Definition at line 100 of file G4ElectronOccupancy.hh.


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