Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // ------------------------------------------- 28 // GEANT 4 class implementation file 29 // 30 // 21 Oct 2009 first implementation by A. 31 // Based on prototype of A.Ma 32 // ******************************************* 33 34 #include "G4MoleculeDefinition.hh" 35 #include "G4MolecularConfiguration.hh" 36 #include "G4MoleculeTable.hh" 37 #include "G4Serialize.hh" 38 39 using namespace std; 40 41 // ------------------------------------------- 42 // ### MoleculeDefini 43 // ------------------------------------------- 44 45 G4MoleculeDefinition::G4MoleculeDefinition(con 46 G4d 47 G4d 48 G4i 49 G4i 50 G4d 51 G4i 52 G4d 53 con 54 G4F 55 G4ParticleDefinition(name, mass, 0., charg 56 0, 0, ID, false, life 57 fDiffusionCoefficient(diffCoeff), 58 fAtomsNb(atomsNumber), 59 fVanDerVaalsRadius(radius) 60 61 { 62 fCharge = charge; 63 if(electronicLevels != 0) 64 { 65 fElectronOccupancy = new G4ElectronOccupan 66 } 67 else 68 { 69 fElectronOccupancy = nullptr; 70 } 71 fDecayTable = nullptr; 72 G4MoleculeTable::Instance()->Insert(this); 73 } 74 75 G4MoleculeDefinition* G4MoleculeDefinition::Lo 76 { 77 G4String name; 78 G4double mass; 79 G4double diffCoeff; 80 G4int charge; 81 G4int electronicLevels; 82 G4double radius; 83 G4int atomsNumber; 84 G4double lifetime; 85 G4String aType; 86 87 READ(in,name); 88 READ(in,mass); 89 READ(in,diffCoeff); 90 READ(in,charge); 91 READ(in,electronicLevels); 92 READ(in,radius); 93 READ(in,atomsNumber); 94 READ(in,lifetime); 95 READ(in,aType); 96 97 return new G4MoleculeDefinition(name, 98 mass, 99 diffCoeff, 100 charge, 101 electronicLe 102 radius, 103 atomsNumber, 104 lifetime, 105 aType); 106 } 107 108 void G4MoleculeDefinition::Serialize(std::ostr 109 { 110 WRITE(out,this->G4ParticleDefinition::GetPar 111 WRITE(out,this->G4ParticleDefinition::GetPDG 112 WRITE(out,this->G4ParticleDefinition::GetPDG 113 WRITE(out,this->G4ParticleDefinition::GetPar 114 WRITE(out,fDiffusionCoefficient); 115 WRITE(out,fCharge); 116 if(fElectronOccupancy != nullptr) 117 { 118 WRITE(out,fElectronOccupancy->GetSizeOfOrb 119 } 120 else 121 { 122 WRITE(out,(G4int) 0); 123 } 124 WRITE(out,fVanDerVaalsRadius); 125 WRITE(out,fAtomsNb); 126 } 127 128 //____________________________________________ 129 130 G4MoleculeDefinition::~G4MoleculeDefinition() 131 { 132 if (fElectronOccupancy != nullptr) 133 { 134 delete fElectronOccupancy; 135 fElectronOccupancy = nullptr; 136 } 137 if (fDecayTable != nullptr) 138 { 139 delete fDecayTable; 140 fDecayTable = nullptr; 141 } 142 } 143 144 //____________________________________________ 145 146 G4MolecularConfiguration* 147 G4MoleculeDefinition::NewConfiguration(const 148 { 149 bool alreadyExist(false); 150 return G4MolecularConfiguration::CreateMolec 151 152 153 154 155 } 156 157 //____________________________________________ 158 159 G4MolecularConfiguration* 160 G4MoleculeDefinition::GetConfigurationWithLabe 161 { 162 return G4MolecularConfiguration::GetMolecula 163 164 } 165 166 //____________________________________________ 167 168 G4MolecularConfiguration* 169 G4MoleculeDefinition:: 170 NewConfigurationWithElectronOccupancy(const 171 const 172 G4doub 173 { 174 G4bool alreadyExist(false); 175 G4MolecularConfiguration* conf = 176 G4MolecularConfiguration::CreateMolecula 177 178 179 180 181 182 183 conf->SetDecayTime(decayTime); 184 185 return conf; 186 } 187 188 //____________________________________________ 189 190 void G4MoleculeDefinition::SetLevelOccupation( 191 { 192 if(fElectronOccupancy != nullptr) 193 { 194 G4int levelOccupancy = fElectronOccupancy- 195 196 if(levelOccupancy != 0) 197 { 198 199 fElectronOccupancy->RemoveElectron(shell 200 } 201 202 fElectronOccupancy->AddElectron(shell, eNb 203 } 204 } 205 206 //____________________________________________ 207 208 void G4MoleculeDefinition::AddDecayChannel(con 209 con 210 { 211 if(fDecayTable == nullptr) 212 { 213 fDecayTable = new G4MolecularDissociationT 214 } 215 216 fDecayTable->AddChannel(G4MolecularConfigura 217 218 channel); 219 } 220 221 //____________________________________________ 222 223 void G4MoleculeDefinition::AddDecayChannel(con 224 con 225 { 226 if (fDecayTable == nullptr) 227 { 228 fDecayTable = new G4MolecularDissociationT 229 } 230 fDecayTable->AddChannel(molConf, channel); 231 } 232 233 //____________________________________________ 234 235 const vector<const G4MolecularDissociationChan 236 G4MoleculeDefinition::GetDecayChannels(const G 237 { 238 if (fDecayTable != nullptr) 239 { 240 const vector<const G4MolecularDissociation 241 fDecayTable->GetDecayChannels(ExState) 242 return output; 243 } 244 245 G4ExceptionDescription errMsg; 246 errMsg << ": no Excited States and Decays f 247 << GetName() 248 << " are defined."; 249 G4Exception("G4MoleculeDefinition::GetDecayC 250 FatalErrorInArgument, errMsg); 251 return nullptr; 252 } 253 254 //____________________________________________ 255 256 const vector<const G4MolecularDissociationChan 257 G4MoleculeDefinition::GetDecayChannels(const G 258 const 259 { 260 if(fDecayTable != nullptr) 261 { 262 const vector<const G4MolecularDissociation 263 fDecayTable->GetDecayChannels(conf); 264 return output; 265 } 266 // else 267 // { 268 // G4ExceptionDescription errMsg; 269 // errMsg << ": no Excited States and Decay 270 // << GetName() 271 // << " are defined."; 272 // G4Exception("G4MoleculeDefinition::GetDe 273 // "", 274 // FatalErrorInArgument, 275 // errMsg); 276 // } 277 return nullptr; 278 } 279 280 //____________________________________________ 281 282 void G4MoleculeDefinition::Finalize() 283 { 284 G4MoleculeTable::Instance()->Finalize(this); 285 } 286 287 //____________________________________________ 288 289 290