ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ElectronOccupancy.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ElectronOccupancy.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // History: first implementation, based on object model of
33 // Hisaya Kurashige, 17 Aug 1999
34 // ----------------------------------------------------------------
35 // Class Description
36 // This class has information of occupation of electrons
37 // in atomic orbits
38 // -
39 // GetOccupancy(N) gives the number of electron
40 // in N-th orbit
41 // For example : Carbon atom should be
42 // GetOccupancy(0) --> 2
43 // GetOccupancy(1) --> 4
44 // GetOccupancy(2..7) --> 0
45 // -
46 // GetTotalOccupancy() gives the total number of electrons
47 //
48 // ---------------------------------------------------------------
49 
50 
51 
52 #ifndef G4ElectronOccupancy_h
53 #define G4ElectronOccupancy_h 1
54 
55 #include "globals.hh"
56 #include "G4Allocator.hh"
57 #include "G4ios.hh"
58 
59 #include "pwdefs.hh"
60 
62 {
63  public:
64  enum { MaxSizeOfOrbit = 20};
65 
66  public: // With Description
69 
70  public:
71  virtual ~G4ElectronOccupancy();
72 
73  // new/delete operators are oberloded to use G4Allocator
74  inline void *operator new(size_t);
75  inline void operator delete(void *aElectronOccupancy);
76 
77 
78  //- operators
82 
83  public: // With Description
84  // The following methods returns
85  // 0: if the orbit(atom) is vacant
86  // >0: number of electrons in orbit
87  G4int GetTotalOccupancy() const;
88  G4int GetOccupancy(G4int orbit) const;
89 
90  //
91  G4int AddElectron(G4int orbit, G4int number = 1);
92  G4int RemoveElectron(G4int orbit, G4int number = 1);
93 
94  G4int GetSizeOfOrbit() const;
95  void DumpInfo() const;
96 
97  private:
101 
102 };
103 
105 
106 // ------------------------
107 // Inlined operators
108 // ------------------------
109 
110 inline void * G4ElectronOccupancy::operator new(size_t)
111 {
113  {
115  }
116  return (void *) aElectronOccupancyAllocator()->MallocSingle();
117 }
118 
119 inline void G4ElectronOccupancy::operator delete(void * aElectronOccupancy)
120 {
121  aElectronOccupancyAllocator()->FreeSingle((G4ElectronOccupancy *) aElectronOccupancy);
122 }
123 
124 inline
126 {
127  return theSizeOfOrbit;
128 }
129 
130 inline
132 {
133  return theTotalOccupancy;
134 }
135 
136 inline
138 {
139  G4int value = 0;
140  if ((orbit >=0)&&(orbit<theSizeOfOrbit)){
141  value = theOccupancies[orbit];
142  }
143  return value;
144 }
145 
146 
147 #endif