Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ElectronOccupancy.cc
Go to the documentation of this file.
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 // $Id$
28 //
29 //
30 // ----------------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // History: first implementation, based on object model of
34 // Hisaya Kurashige, 17 Aug 1999
35 // ----------------------------------------------------------------
36 // This class has information of occupation of electrons
37 // in atomic orbits
38 // ---------------------------------------------------------------
39 
40 #include "G4ElectronOccupancy.hh"
41 
43 
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 }
61 
63 {
64  theSizeOfOrbit = -1;
65 
66  delete [] theOccupancies;
67  theOccupancies =0;
68  theTotalOccupancy =0;
69 }
70 
71 
73 {
74  theSizeOfOrbit = right.theSizeOfOrbit;
75 
76  // allocate and clear the array of theOccupancies
77  theOccupancies = new G4int[theSizeOfOrbit];
78  G4int index =0;
79  for (index = 0; index < theSizeOfOrbit; index++) {
80  theOccupancies[index] = right.theOccupancies[index];
81  }
82 
83  theTotalOccupancy = right.theTotalOccupancy;
84 }
85 
87 {
88  if ( this != &right) {
89  theSizeOfOrbit = right.theSizeOfOrbit;
90 
91  // allocate and clear the array of theOccupancies
92  if ( theOccupancies != 0 ) delete [] theOccupancies;
93  theOccupancies = new G4int[theSizeOfOrbit];
94  G4int index =0;
95  for (index = 0; index < theSizeOfOrbit; index++) {
96  theOccupancies[index] = right.theOccupancies[index];
97  }
98 
99  theTotalOccupancy = right.theTotalOccupancy;
100  }
101  return *this;
102 }
103 
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 &&
111  (theOccupancies[index] == right.theOccupancies[index]) ;
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 }
120 
122 {
123  return !(*this == right);
124 }
125 
126 
128 {
129  G4cout << " -- Electron Occupancy -- " << G4endl;
130  G4int index;
131  for (index = 0; index < theSizeOfOrbit; index++) {
132  G4cout << " " << index << "-th orbit "
133  << theOccupancies[index] << G4endl;
134  }
135 }