Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4Ions << 27 // 26 // 28 // Class Description: << 27 // $Id: G4Ions.hh 103892 2017-05-03 08:11:00Z gcosmo $ 29 // 28 // 30 // This is the base class for all nuclei inclu << 29 // 31 // light nuclei such as deuteron, alpha, and p << 30 // ------------------------------------------------------------ 32 // All nuclei/ions created on the fly are obje << 31 // GEANT 4 class header file 33 // Atomic number and atomic mass are valid onl << 32 // 34 // from this class. This class has Excitation << 33 // History: first implementation, based on object model of 35 // the normal particle properties. << 34 // Hisaya Kurashige, 27 June 1998 36 << 35 // ---------------------------------------------------------------- 37 // Authors: G.Cosmo, 4 April 1996 - Design bas << 36 // Add excitation energy 17 Aug. 1999 H.Kurashige 38 // H.Kurashige, 27 June 1998 - First << 37 // Add isomer level 30 Apr. H.Kurashige 39 // ------------------------------------------- << 38 40 #ifndef G4Ions_hh << 39 41 #define G4Ions_hh 1 << 40 #ifndef G4Ions_h >> 41 #define G4Ions_h 1 42 42 43 #include "G4ParticleDefinition.hh" << 44 #include "G4ios.hh" << 45 #include "globals.hh" 43 #include "globals.hh" >> 44 #include "G4ios.hh" >> 45 #include "G4ParticleDefinition.hh" >> 46 >> 47 // ###################################################################### >> 48 // ### Ions ### >> 49 // ###################################################################### 46 50 47 class G4Ions : public G4ParticleDefinition 51 class G4Ions : public G4ParticleDefinition 48 { 52 { 49 public: << 53 // Class Description 50 // clang-format off << 54 // This is the base class for all nuclei including pre-defined 51 G4Ions( << 55 // light nuclei such as deuteron, alpha, and proton (Hydrogen) >> 56 // All nuclei/ions created on the fly are objects of this class >> 57 // Atomic number and atomic mass are vaild only for particles derived >> 58 // from this class. This class has Excitation Energy in addition to >> 59 // the normal particle properties. >> 60 >> 61 protected: >> 62 G4Ions(){}; >> 63 >> 64 >> 65 public: //With Description >> 66 G4Ions( 52 const G4String& aName, G4dou 67 const G4String& aName, G4double mass, 53 G4double width, G4dou 68 G4double width, G4double charge, 54 G4int iSpin, G4int 69 G4int iSpin, G4int iParity, 55 G4int iConjugation, G4int 70 G4int iConjugation, G4int iIsospin, 56 G4int iIsospin3, G4int 71 G4int iIsospin3, G4int gParity, 57 const G4String& pType, G4int 72 const G4String& pType, G4int lepton, 58 G4int baryon, G4int 73 G4int baryon, G4int encoding, 59 G4bool stable, G4dou 74 G4bool stable, G4double lifetime, 60 G4DecayTable* decaytable, G4boo << 75 G4DecayTable *decaytable, G4bool shortlived, 61 const G4String& subType ="", 76 const G4String& subType ="", 62 G4int anti_encoding =0, 77 G4int anti_encoding =0, 63 G4double excitation = 0.0, 78 G4double excitation = 0.0, 64 G4int isomer = 0 79 G4int isomer = 0 65 ); << 80 ); 66 // clang-format on << 67 << 68 ~G4Ions() override = default; << 69 81 70 inline G4Ions* IonsDefinition(); << 82 public: 71 inline G4Ions* Ions(); << 83 virtual ~G4Ions(); >> 84 G4Ions* IonsDefinition(); >> 85 G4Ions* Ions(); >> 86 >> 87 public: //With Description >> 88 // Get excitation energy of nucleus >> 89 G4double GetExcitationEnergy() const ; >> 90 >> 91 // Get Isomer level (=0 for ground state) >> 92 G4int GetIsomerLevel() const; >> 93 >> 94 // enumerator for floating level base >> 95 enum class G4FloatLevelBase >> 96 { no_Float=0, >> 97 plus_X, plus_Y, plus_Z, plus_U, plus_V, plus_W, >> 98 plus_R, plus_S, plus_T, plus_A, plus_B, plus_C, plus_D, plus_E >> 99 }; >> 100 static G4Ions::G4FloatLevelBase FloatLevelBase(char flbChar); >> 101 static G4Ions::G4FloatLevelBase FloatLevelBase(G4int flbIdx); >> 102 static char FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb); >> 103 >> 104 // set/get methods for floating level base >> 105 G4Ions::G4FloatLevelBase GetFloatLevelBase() const; >> 106 G4int GetFloatLevelBaseIndex() const; >> 107 void SetFloatLevelBase(G4Ions::G4FloatLevelBase flb); >> 108 void SetFloatLevelBase(char flbChar); >> 109 void SetFloatLevelBase(G4int flbIdx); >> 110 >> 111 private: >> 112 G4double theExcitationEnergy; >> 113 G4int theIsomerLevel; >> 114 G4FloatLevelBase floatLevelBase; 72 115 73 // Get excitation energy of nucleus << 74 inline G4double GetExcitationEnergy() cons << 75 << 76 // Get Isomer level (=0 for ground state) << 77 inline G4int GetIsomerLevel() const; << 78 << 79 enum class G4FloatLevelBase // enumerator << 80 { << 81 no_Float = 0, << 82 plus_X, << 83 plus_Y, << 84 plus_Z, << 85 plus_U, << 86 plus_V, << 87 plus_W, << 88 plus_R, << 89 plus_S, << 90 plus_T, << 91 plus_A, << 92 plus_B, << 93 plus_C, << 94 plus_D, << 95 plus_E << 96 }; << 97 << 98 static G4Ions::G4FloatLevelBase FloatLevel << 99 static G4Ions::G4FloatLevelBase FloatLevel << 100 static char FloatLevelBaseChar(G4Ions::G4F << 101 << 102 // Set/Get methods for floating level base << 103 // << 104 inline G4Ions::G4FloatLevelBase GetFloatLe << 105 inline G4int GetFloatLevelBaseIndex() cons << 106 inline void SetFloatLevelBase(G4Ions::G4Fl << 107 inline void SetFloatLevelBase(char flbChar << 108 inline void SetFloatLevelBase(G4int flbIdx << 109 << 110 protected: << 111 G4Ions() = default; << 112 << 113 private: << 114 G4double theExcitationEnergy = 0.0; << 115 G4int theIsomerLevel = 0; << 116 G4FloatLevelBase floatLevelBase = G4FloatL << 117 }; 116 }; 118 117 119 #define noFloat G4Ions::G4FloatLevelBase::no_F 118 #define noFloat G4Ions::G4FloatLevelBase::no_Float 120 #define plusU G4Ions::G4FloatLevelBase::plus_U << 119 #define plusU G4Ions::G4FloatLevelBase::plus_U 121 #define plusV G4Ions::G4FloatLevelBase::plus_V << 120 #define plusV G4Ions::G4FloatLevelBase::plus_V 122 #define plusW G4Ions::G4FloatLevelBase::plus_W << 121 #define plusW G4Ions::G4FloatLevelBase::plus_W 123 #define plusX G4Ions::G4FloatLevelBase::plus_X 122 #define plusX G4Ions::G4FloatLevelBase::plus_X 124 #define plusY G4Ions::G4FloatLevelBase::plus_Y << 123 #define plusY G4Ions::G4FloatLevelBase::plus_Y 125 #define plusZ G4Ions::G4FloatLevelBase::plus_Z << 124 #define plusZ G4Ions::G4FloatLevelBase::plus_Z 126 #define plusR G4Ions::G4FloatLevelBase::plus_R << 125 #define plusR G4Ions::G4FloatLevelBase::plus_R 127 #define plusS G4Ions::G4FloatLevelBase::plus_S << 126 #define plusS G4Ions::G4FloatLevelBase::plus_S 128 #define plusT G4Ions::G4FloatLevelBase::plus_T << 127 #define plusT G4Ions::G4FloatLevelBase::plus_T 129 #define plusA G4Ions::G4FloatLevelBase::plus_A 128 #define plusA G4Ions::G4FloatLevelBase::plus_A 130 #define plusB G4Ions::G4FloatLevelBase::plus_B << 129 #define plusB G4Ions::G4FloatLevelBase::plus_B 131 #define plusC G4Ions::G4FloatLevelBase::plus_C << 130 #define plusC G4Ions::G4FloatLevelBase::plus_C 132 #define plusD G4Ions::G4FloatLevelBase::plus_D << 131 #define plusD G4Ions::G4FloatLevelBase::plus_D 133 #define plusE G4Ions::G4FloatLevelBase::plus_E << 132 #define plusE G4Ions::G4FloatLevelBase::plus_E 134 << 135 // ------------------------ << 136 // Inline methods << 137 // ------------------------ << 138 133 139 inline G4Ions* G4Ions::IonsDefinition() << 134 inline >> 135 G4Ions* G4Ions::IonsDefinition() 140 { 136 { 141 return this; 137 return this; 142 } 138 } 143 139 144 inline G4Ions* G4Ions::Ions() << 140 inline >> 141 G4Ions* G4Ions::Ions() 145 { 142 { 146 return this; 143 return this; 147 } 144 } 148 145 149 inline G4double G4Ions::GetExcitationEnergy() << 146 inline >> 147 G4double G4Ions::GetExcitationEnergy() const 150 { 148 { 151 return theExcitationEnergy; 149 return theExcitationEnergy; 152 } 150 } 153 151 154 inline G4int G4Ions::GetIsomerLevel() const << 152 inline >> 153 G4int G4Ions::GetIsomerLevel() const 155 { 154 { 156 return theIsomerLevel; 155 return theIsomerLevel; 157 } 156 } 158 << 157 159 inline G4Ions::G4FloatLevelBase G4Ions::GetFlo << 158 inline >> 159 G4Ions::G4FloatLevelBase G4Ions::GetFloatLevelBase() const 160 { 160 { 161 return floatLevelBase; 161 return floatLevelBase; 162 } 162 } 163 163 164 inline G4int G4Ions::GetFloatLevelBaseIndex() << 164 inline >> 165 G4int G4Ions::GetFloatLevelBaseIndex() const 165 { 166 { 166 return static_cast<G4int>(floatLevelBase); 167 return static_cast<G4int>(floatLevelBase); 167 } 168 } 168 169 169 inline void G4Ions::SetFloatLevelBase(G4Ions:: << 170 inline >> 171 void G4Ions::SetFloatLevelBase(G4Ions::G4FloatLevelBase flb) 170 { 172 { 171 floatLevelBase = flb; 173 floatLevelBase = flb; 172 } 174 } 173 175 174 inline void G4Ions::SetFloatLevelBase(char flb << 176 inline >> 177 void G4Ions::SetFloatLevelBase(char flbChar) 175 { 178 { 176 floatLevelBase = FloatLevelBase(flbChar); 179 floatLevelBase = FloatLevelBase(flbChar); 177 } 180 } 178 181 179 inline void G4Ions::SetFloatLevelBase(G4int fl << 182 inline >> 183 void G4Ions::SetFloatLevelBase(G4int flbIdx) 180 { 184 { 181 floatLevelBase = FloatLevelBase(flbIdx); 185 floatLevelBase = FloatLevelBase(flbIdx); 182 } 186 } 183 187 >> 188 inline >> 189 G4Ions::G4FloatLevelBase G4Ions::FloatLevelBase(char flbChar) >> 190 { >> 191 G4Ions::G4FloatLevelBase flb = noFloat; >> 192 switch(flbChar) >> 193 { >> 194 case 'x': case 'X': >> 195 flb = plusX; >> 196 break; >> 197 case 'y': case 'Y': >> 198 flb = plusY; >> 199 break; >> 200 case 'z': case 'Z': >> 201 flb = plusZ; >> 202 break; >> 203 case 'u': case 'U': >> 204 flb = plusU; >> 205 break; >> 206 case 'v': case 'V': >> 207 flb = plusV; >> 208 break; >> 209 case 'w': case 'W': >> 210 flb = plusW; >> 211 break; >> 212 case 'r': case 'R': >> 213 flb = plusR; >> 214 break; >> 215 case 's': case 'S': >> 216 flb = plusS; >> 217 break; >> 218 case 't': case 'T': >> 219 flb = plusT; >> 220 break; >> 221 case 'a': case 'A': >> 222 flb = plusA; >> 223 break; >> 224 case 'b': case 'B': >> 225 flb = plusB; >> 226 break; >> 227 case 'c': case 'C': >> 228 flb = plusC; >> 229 break; >> 230 case 'd': case 'D': >> 231 flb = plusD; >> 232 break; >> 233 case 'e': case 'E': >> 234 flb = plusE; >> 235 break; >> 236 case '\0': default: >> 237 break; >> 238 } >> 239 return flb; >> 240 } >> 241 >> 242 inline >> 243 G4Ions::G4FloatLevelBase G4Ions::FloatLevelBase(G4int flbIdx) >> 244 { >> 245 static G4Ions::G4FloatLevelBase flb[] = >> 246 { noFloat, >> 247 plusX, plusY, plusZ, plusU, plusV, plusW, >> 248 plusR, plusS, plusT, plusA, plusB, plusC, plusD, plusE }; >> 249 return flb[flbIdx]; >> 250 } >> 251 >> 252 inline >> 253 char G4Ions::FloatLevelBaseChar(G4Ions::G4FloatLevelBase flb) >> 254 { >> 255 static char flbChar[] = {'\0','X','Y','Z','U','V','W', >> 256 'R','S','T','A','B','C','D','E'}; >> 257 return flbChar[static_cast<G4int>(flb)]; >> 258 } >> 259 184 #endif 260 #endif >> 261 >> 262 >> 263 >> 264 >> 265 >> 266 >> 267 >> 268 185 269