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 // G4PDGCodeChecker << 27 // 26 // 28 // Author: Hisaya Kurashige, 17 August 1999 << 27 // $Id: G4PDGCodeChecker.cc,v 1.16 2010/12/15 07:39:05 gunter Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-09-04 $ 30 << 29 // 31 #include "G4PDGCodeChecker.hh" << 30 // 32 << 31 // ---------------------------------------------------------------------- 33 #include "G4PhysicalConstants.hh" << 32 // GEANT 4 class implementation file 34 #include "G4SystemOfUnits.hh" << 33 // >> 34 // History: first implementation, based on object model of >> 35 // 17 Aug 1999 H.Kurashige >> 36 // ********************************************************************** 35 37 36 #include <fstream> 38 #include <fstream> 37 #include <iomanip> 39 #include <iomanip> 38 40 39 G4PDGCodeChecker::G4PDGCodeChecker() : verbose << 41 #include "G4PDGCodeChecker.hh" >> 42 >> 43 ///////////// >> 44 G4PDGCodeChecker::G4PDGCodeChecker() >> 45 :code(0),theParticleType(""), >> 46 thePDGiSpin(0),higherSpin(0), >> 47 exotic(0),radial(0),multiplet(0), >> 48 quark1(0),quark2(0),quark3(0),spin(0) 40 { 49 { >> 50 verboseLevel = 1; 41 // clear QuarkContents 51 // clear QuarkContents 42 for (G4int flavor = 0; flavor < NumberOfQuar << 52 G4int flavor; 43 theQuarkContent[flavor] = 0; << 53 for (flavor=0; flavor<NumberOfQuarkFlavor; flavor++){ 44 theAntiQuarkContent[flavor] = 0; << 54 theQuarkContent[flavor] =0; >> 55 theAntiQuarkContent[flavor] =0; 45 } 56 } 46 } 57 } 47 58 48 G4int G4PDGCodeChecker::CheckPDGCode(G4int PDG << 59 ///////////// >> 60 G4int G4PDGCodeChecker::CheckPDGCode( G4int PDGcode, >> 61 G4String particleType) 49 { 62 { 50 code = PDGcode; 63 code = PDGcode; 51 theParticleType = particleType; 64 theParticleType = particleType; 52 65 53 // clear QuarkContents 66 // clear QuarkContents 54 for (G4int flavor = 0; flavor < NumberOfQuar << 67 G4int flavor; 55 theQuarkContent[flavor] = 0; << 68 for (flavor=0; flavor<NumberOfQuarkFlavor; flavor++){ 56 theAntiQuarkContent[flavor] = 0; << 69 theQuarkContent[flavor] =0; >> 70 theAntiQuarkContent[flavor] =0; 57 } 71 } 58 72 59 // check code for nuclei 73 // check code for nuclei 60 if ((theParticleType == "nucleus") || (thePa << 74 if ((theParticleType == "nucleus")||(theParticleType == "anti_nucleus")) { 61 return CheckForNuclei(); 75 return CheckForNuclei(); 62 } 76 } 63 77 64 // get each digit number 78 // get each digit number 65 GetDigits(code); 79 GetDigits(code); 66 80 67 // check code 81 // check code 68 if (theParticleType == "quarks") { << 82 if (theParticleType =="quarks") { 69 return CheckForQuarks(); 83 return CheckForQuarks(); 70 } << 84 71 if (theParticleType == "diquarks") { << 85 } else if (theParticleType =="diquarks") { 72 return CheckForDiQuarks(); 86 return CheckForDiQuarks(); 73 } << 87 74 if (theParticleType == "gluons") { << 88 } else if (theParticleType =="gluons") { 75 return code; // gluons, do not care about << 89 // gluons 76 } << 90 // do not care about 77 if (theParticleType == "meson") { << 91 return code; >> 92 >> 93 } else if (theParticleType == "meson") { 78 return CheckForMesons(); 94 return CheckForMesons(); 79 } << 95 80 if (theParticleType == "baryon") { << 96 } else if (theParticleType == "baryon"){ 81 return CheckForBaryons(); 97 return CheckForBaryons(); >> 98 >> 99 82 } 100 } 83 // No check 101 // No check 84 return code; 102 return code; 85 } 103 } 86 << 104 >> 105 ///////////// 87 G4int G4PDGCodeChecker::CheckForBaryons() 106 G4int G4PDGCodeChecker::CheckForBaryons() 88 { 107 { 89 G4int tempPDGcode = code; << 108 G4int tempPDGcode = code; 90 109 91 if ((quark1 == 0) || (quark2 == 0) || (quark << 110 if ((quark1==0)||(quark2==0)||(quark3==0)){ 92 #ifdef G4VERBOSE 111 #ifdef G4VERBOSE 93 if (verboseLevel > 0) { << 112 if (verboseLevel>0) { 94 G4cout << " G4PDGCodeChecker::CheckPDGCo 113 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 95 G4cout << " meson has three quark "; 114 G4cout << " meson has three quark "; 96 G4cout << " PDG code=" << code << G4endl << 115 G4cout << " PDG code=" << code <<G4endl; 97 } 116 } 98 #endif 117 #endif 99 return 0; 118 return 0; 100 } 119 } 101 << 120 102 // exceptions << 121 //exceptions 103 if (std::abs(tempPDGcode) % 10000 == 3122) { << 122 if (std::abs(tempPDGcode)%10000 == 3122) { 104 // Lambda 123 // Lambda 105 quark2 = 2; << 124 quark2=2; quark3 = 1; spin = 1; 106 quark3 = 1; << 125 } else if (std::abs(tempPDGcode)%10000 == 3124) { 107 spin = 1; << 108 } << 109 else if (std::abs(tempPDGcode) % 10000 == 31 << 110 // Lambda* 126 // Lambda* 111 quark2 = 2; << 127 quark2=2; quark3 = 1; spin = 3; 112 quark3 = 1; << 128 } else if (std::abs(tempPDGcode)%10000 == 3126) { 113 spin = 3; << 114 } << 115 else if (std::abs(tempPDGcode) % 10000 == 31 << 116 // Lambda* 129 // Lambda* 117 quark2 = 2; << 130 quark2=2; quark3 = 1; spin = 5; 118 quark3 = 1; << 131 } else if (std::abs(tempPDGcode)%10000 == 3128) { 119 spin = 5; << 120 } << 121 else if (std::abs(tempPDGcode) % 10000 == 31 << 122 // Lambda* 132 // Lambda* 123 quark2 = 2; << 133 quark2=2; quark3 = 1; spin = 7; 124 quark3 = 1; << 134 } else if (std::abs(tempPDGcode)%10000 == 4122) { 125 spin = 7; << 126 } << 127 else if (std::abs(tempPDGcode) % 10000 == 41 << 128 // Lambda_c 135 // Lambda_c 129 quark2 = 2; << 136 quark2=2; quark3 = 1; spin = 1; 130 quark3 = 1; << 137 } else if (std::abs(tempPDGcode)%10000 == 4132) { 131 spin = 1; << 132 } << 133 else if (std::abs(tempPDGcode) % 10000 == 51 << 134 // Lambda_b << 135 quark2 = 2; << 136 quark3 = 1; << 137 spin = 1; << 138 } << 139 else if (std::abs(tempPDGcode) % 10000 == 41 << 140 // Xi_c0 138 // Xi_c0 141 quark2 = 3; << 139 quark2=3; quark3 = 1; spin = 1; 142 quark3 = 1; << 140 } else if (std::abs(tempPDGcode)%10000 == 4232) { 143 spin = 1; << 144 } << 145 else if (std::abs(tempPDGcode) % 10000 == 42 << 146 // Xi_c+ 141 // Xi_c+ 147 quark2 = 3; << 142 quark2=3; quark3 = 2; spin = 1; 148 quark3 = 2; << 143 } else if (std::abs(tempPDGcode)%10000 == 2122) { 149 spin = 1; << 144 // Delta+ (spin 1/2) 150 } << 145 quark2=2; quark3 = 1; spin = 1; 151 else if (std::abs(tempPDGcode) % 10000 == 51 << 146 } else if (std::abs(tempPDGcode)%10000 == 1212) { 152 // Xi_b0 << 147 // Delta0 (spin 1/2) 153 quark2 = 3; << 148 quark1=2; quark2 = 1; spin = 1; 154 quark3 = 1; << 149 } else if (std::abs(tempPDGcode)%10000 == 2126) { 155 spin = 1; << 150 // Delta+ (spin 5/2) 156 } << 151 quark2=2; quark3 = 1; spin = 5; 157 else if (std::abs(tempPDGcode) % 10000 == 52 << 152 } else if (std::abs(tempPDGcode)%10000 == 1216) { 158 // Xi_b+ << 153 // Delta0 (spin 5/2) 159 quark2 = 3; << 154 quark1=2; quark2 = 1; spin = 5; 160 quark3 = 2; << 155 } else if (std::abs(tempPDGcode)%10000 == 2128) { 161 spin = 1; << 156 // Delta+ (spin 7/2) 162 } << 157 quark2=2; quark3 = 1; spin = 7; 163 else if (std::abs(tempPDGcode) % 10000 == 21 << 158 } else if (std::abs(tempPDGcode)%10000 == 1218) { 164 // Delta+ (spin 1/2) << 159 // Delta0 (spin 7/2) 165 quark2 = 2; << 160 quark1=2; quark2 = 1; spin = 7; 166 quark3 = 1; << 161 } else if (std::abs(tempPDGcode)%10000 == 2124) { 167 spin = 1; << 162 // N*+ (spin 3/2) 168 } << 163 quark2=2; quark3 = 1; spin = 3; 169 else if (std::abs(tempPDGcode) % 10000 == 12 << 164 } else if (std::abs(tempPDGcode)%10000 == 1214) { 170 // Delta0 (spin 1/2) << 165 // N*0 (spin 3/2) 171 quark1 = 2; << 166 quark1=2; quark2 = 1; spin = 3; 172 quark2 = 1; << 167 } 173 spin = 1; << 174 } << 175 else if (std::abs(tempPDGcode) % 10000 == 21 << 176 // Delta+ (spin 5/2) << 177 quark2 = 2; << 178 quark3 = 1; << 179 spin = 5; << 180 } << 181 else if (std::abs(tempPDGcode) % 10000 == 12 << 182 // Delta0 (spin 5/2) << 183 quark1 = 2; << 184 quark2 = 1; << 185 spin = 5; << 186 } << 187 else if (std::abs(tempPDGcode) % 10000 == 21 << 188 // Delta+ (spin 7/2) << 189 quark2 = 2; << 190 quark3 = 1; << 191 spin = 7; << 192 } << 193 else if (std::abs(tempPDGcode) % 10000 == 12 << 194 // Delta0 (spin 7/2) << 195 quark1 = 2; << 196 quark2 = 1; << 197 spin = 7; << 198 } << 199 else if (std::abs(tempPDGcode) % 10000 == 21 << 200 // N*+ (spin 3/2) << 201 quark2 = 2; << 202 quark3 = 1; << 203 spin = 3; << 204 } << 205 else if (std::abs(tempPDGcode) % 10000 == 12 << 206 // N*0 (spin 3/2) << 207 quark1 = 2; << 208 quark2 = 1; << 209 spin = 3; << 210 } << 211 168 212 // check quark flavor << 169 // check quark flavor 213 if ((quark1 < quark2) || (quark2 < quark3) | << 170 if ((quark1<quark2)||(quark2<quark3)||(quark1<quark3)) { 214 #ifdef G4VERBOSE 171 #ifdef G4VERBOSE 215 if (verboseLevel > 0) { << 172 if (verboseLevel>0) { 216 G4cout << " G4PDGCodeChecker::CheckPDGCo 173 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 217 G4cout << " illegal code for baryon "; 174 G4cout << " illegal code for baryon "; 218 G4cout << " PDG code=" << code << G4endl << 175 G4cout << " PDG code=" << code <<G4endl; 219 } 176 } 220 #endif 177 #endif 221 return 0; 178 return 0; 222 } 179 } 223 if (quark1 > NumberOfQuarkFlavor) { << 180 if (quark1> NumberOfQuarkFlavor) { 224 #ifdef G4VERBOSE 181 #ifdef G4VERBOSE 225 if (verboseLevel > 0) { << 182 if (verboseLevel>0) { 226 G4cout << " G4PDGCodeChecker::CheckPDGCo 183 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 227 G4cout << " ??? unknown quark "; 184 G4cout << " ??? unknown quark "; 228 G4cout << " PDG code=" << code << G4endl << 185 G4cout << " PDG code=" << code <<G4endl; 229 } 186 } 230 #endif 187 #endif 231 return 0; 188 return 0; 232 } 189 } >> 190 233 191 234 // Fill Quark contents 192 // Fill Quark contents 235 if (tempPDGcode > 0) { << 193 if (tempPDGcode >0) { 236 theQuarkContent[quark1 - 1]++; << 194 theQuarkContent[quark1-1] ++; 237 theQuarkContent[quark2 - 1]++; << 195 theQuarkContent[quark2-1] ++; 238 theQuarkContent[quark3 - 1]++; << 196 theQuarkContent[quark3-1] ++; 239 } << 197 } else { 240 else { << 198 theAntiQuarkContent[quark1-1] ++; 241 theAntiQuarkContent[quark1 - 1]++; << 199 theAntiQuarkContent[quark2-1] ++; 242 theAntiQuarkContent[quark2 - 1]++; << 200 theAntiQuarkContent[quark3-1] ++; 243 theAntiQuarkContent[quark3 - 1]++; << 244 } 201 } 245 202 246 return code; 203 return code; 247 } 204 } 248 << 205 >> 206 ///////////// 249 G4int G4PDGCodeChecker::CheckForMesons() 207 G4int G4PDGCodeChecker::CheckForMesons() 250 { 208 { 251 G4int tempPDGcode = code; << 209 G4int tempPDGcode = code; 252 210 253 // -- exceptions -- << 211 // -- exceptions -- 254 if (tempPDGcode == 310) spin = 0; // K0s << 212 if (tempPDGcode == 310) spin = 0; //K0s 255 if (tempPDGcode == 130) // K0l << 213 if (tempPDGcode == 130) { //K0l 256 { << 214 spin = 0; 257 spin = 0; << 258 quark2 = 3; 215 quark2 = 3; 259 quark3 = 1; 216 quark3 = 1; 260 } 217 } 261 << 218 262 if ((quark1 != 0) || (quark2 == 0) || (quark << 219 // >> 220 if ((quark1 !=0)||(quark2==0)||(quark3==0)){ 263 #ifdef G4VERBOSE 221 #ifdef G4VERBOSE 264 if (verboseLevel > 0) { << 222 if (verboseLevel>0) { 265 G4cout << " G4PDGCodeChecker::CheckPDGCo 223 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 266 G4cout << " meson has only quark and ant 224 G4cout << " meson has only quark and anti-quark pair"; 267 G4cout << " PDG code=" << code << G4endl << 225 G4cout << " PDG code=" << code <<G4endl; 268 } 226 } 269 #endif 227 #endif 270 return 0; 228 return 0; 271 } << 229 } 272 if (quark2 < quark3) { << 230 if (quark2<quark3) { 273 #ifdef G4VERBOSE 231 #ifdef G4VERBOSE 274 if (verboseLevel > 0) { << 232 if (verboseLevel>0) { 275 G4cout << " G4PDGCodeChecker::CheckPDGCo 233 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 276 G4cout << " illegal code for meson "; 234 G4cout << " illegal code for meson "; 277 G4cout << " PDG code=" << code << G4endl << 235 G4cout << " PDG code=" << code <<G4endl; 278 } 236 } 279 #endif 237 #endif 280 return 0; 238 return 0; 281 } 239 } 282 240 283 // check quark flavor 241 // check quark flavor 284 if (quark2 > NumberOfQuarkFlavor) { << 242 if (quark2> NumberOfQuarkFlavor){ 285 #ifdef G4VERBOSE 243 #ifdef G4VERBOSE 286 if (verboseLevel > 0) { << 244 if (verboseLevel>0) { 287 G4cout << " G4PDGCodeChecker::CheckPDGCo 245 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 288 G4cout << " ??? unknown quark "; 246 G4cout << " ??? unknown quark "; 289 G4cout << " PDG code=" << code << G4endl << 247 G4cout << " PDG code=" << code <<G4endl; 290 } 248 } 291 #endif 249 #endif 292 return 0; 250 return 0; 293 } 251 } 294 252 >> 253 295 // check heavier quark type 254 // check heavier quark type 296 if ((quark2 & 1) != 0) { << 255 if (quark2 & 1) { 297 // down type qurak 256 // down type qurak 298 if (tempPDGcode > 0) { << 257 if (tempPDGcode >0) { 299 theQuarkContent[quark3 - 1] = 1; << 258 theQuarkContent[quark3-1] =1; 300 theAntiQuarkContent[quark2 - 1] = 1; << 259 theAntiQuarkContent[quark2-1] =1; >> 260 } else { >> 261 theQuarkContent[quark2-1] =1; >> 262 theAntiQuarkContent[quark3-1] =1; 301 } 263 } 302 else { << 264 } else { 303 theQuarkContent[quark2 - 1] = 1; << 304 theAntiQuarkContent[quark3 - 1] = 1; << 305 } << 306 } << 307 else { << 308 // up type quark 265 // up type quark 309 if (tempPDGcode > 0) { << 266 if (tempPDGcode >0) { 310 theQuarkContent[quark2 - 1] = 1; << 267 theQuarkContent[quark2-1] =1; 311 theAntiQuarkContent[quark3 - 1] = 1; << 268 theAntiQuarkContent[quark3-1] =1; 312 } << 269 } else { 313 else { << 270 theQuarkContent[quark3-1] =1; 314 theQuarkContent[quark3 - 1] = 1; << 271 theAntiQuarkContent[quark2-1] =1; 315 theAntiQuarkContent[quark2 - 1] = 1; << 316 } 272 } 317 } 273 } 318 return code; 274 return code; 319 } 275 } 320 276 >> 277 >> 278 >> 279 ///////////// 321 G4int G4PDGCodeChecker::CheckForDiQuarks() 280 G4int G4PDGCodeChecker::CheckForDiQuarks() 322 { 281 { 323 if ((quark1 == 0) || (quark2 == 0) || (quark << 282 if ((quark1 ==0) || (quark2 ==0) || (quark3 !=0)) { 324 // quark3 should be 0 283 // quark3 should be 0 325 // --- code is wrong << 284 // --- code is wrong 326 return 0; 285 return 0; 327 } << 286 328 if (quark1 < quark2) { << 287 } else if (quark1 < quark2) { 329 // --- code is wrong << 288 // --- code is wrong 330 return 0; 289 return 0; 331 } << 290 332 if (quark2 > NumberOfQuarkFlavor) { << 291 } else if (quark2>NumberOfQuarkFlavor){ 333 #ifdef G4VERBOSE 292 #ifdef G4VERBOSE 334 if (verboseLevel > 0) { << 293 if (verboseLevel>0) { 335 G4cout << " G4PDGCodeChecker::CheckPDGCo 294 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 336 G4cout << " ??? unknown quark "; 295 G4cout << " ??? unknown quark "; 337 G4cout << " PDG code=" << code << G4endl << 296 G4cout << " PDG code=" << code <<G4endl; 338 } 297 } 339 #endif 298 #endif 340 return 0; 299 return 0; >> 300 341 } 301 } 342 302 343 // Fill Quark Contents 303 // Fill Quark Contents 344 if (code > 0) { << 304 if (code>0){ 345 theQuarkContent[quark1 - 1] += 1; << 305 theQuarkContent[quark1-1] +=1; 346 theQuarkContent[quark2 - 1] += 1; << 306 theQuarkContent[quark2-1] +=1; 347 } << 307 } else { 348 else { << 308 theAntiQuarkContent[quark1-1] +=1; 349 theAntiQuarkContent[quark1 - 1] += 1; << 309 theAntiQuarkContent[quark2-1] +=1; 350 theAntiQuarkContent[quark2 - 1] += 1; << 351 } 310 } 352 311 353 return code; 312 return code; 354 } 313 } 355 << 314 >> 315 ///////////// 356 G4int G4PDGCodeChecker::CheckForQuarks() 316 G4int G4PDGCodeChecker::CheckForQuarks() 357 { 317 { 358 quark1 = std::abs(code); << 318 if ( std::abs(quark1)>NumberOfQuarkFlavor ) { 359 << 360 if (std::abs(quark1) > NumberOfQuarkFlavor) << 361 #ifdef G4VERBOSE 319 #ifdef G4VERBOSE 362 if (verboseLevel > 0) { << 320 if (verboseLevel>0) { 363 G4cout << " G4PDGCodeChecker::CheckPDGCo 321 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 364 G4cout << " ??? unknown quark "; 322 G4cout << " ??? unknown quark "; 365 G4cout << " PDG code=" << code << G4endl << 323 G4cout << " PDG code=" << code <<G4endl; 366 } 324 } 367 #endif 325 #endif 368 // --- code is wrong << 326 // --- code is wrong 369 return 0; 327 return 0; 370 } << 328 >> 329 } >> 330 >> 331 quark1 = std::abs(code); 371 332 372 // Fill Quark Contents 333 // Fill Quark Contents 373 if (code > 0) { << 334 if (code>0){ 374 theQuarkContent[quark1 - 1] = 1; << 335 theQuarkContent[quark1-1] =1; 375 } << 336 } else { 376 else { << 337 theAntiQuarkContent[quark1-1] =1; 377 theAntiQuarkContent[quark1 - 1] = 1; << 378 } 338 } 379 return code; 339 return code; 380 } 340 } 381 341 >> 342 ///////////// 382 G4bool G4PDGCodeChecker::CheckCharge(G4double 343 G4bool G4PDGCodeChecker::CheckCharge(G4double thePDGCharge) const 383 { 344 { 384 // check charge 345 // check charge 385 G4double totalCharge = 0.0; 346 G4double totalCharge = 0.0; 386 for (G4int flavor = 0; flavor < NumberOfQuar << 347 for (G4int flavor= 0; flavor<NumberOfQuarkFlavor-1; flavor+=2){ 387 totalCharge += (-1. / 3.) * eplus * theQua << 348 totalCharge += (-1./3.)*eplus*theQuarkContent[flavor]; 388 totalCharge += 1. / 3. * eplus * theAntiQu << 349 totalCharge += 1./3.*eplus*theAntiQuarkContent[flavor]; 389 totalCharge += 2. / 3. * eplus * theQuarkC << 350 totalCharge += 2./3.*eplus*theQuarkContent[flavor+1]; 390 totalCharge += (-2. / 3.) * eplus * theAnt << 351 totalCharge += (-2./3.)*eplus*theAntiQuarkContent[flavor+1]; 391 } 352 } 392 353 393 if (std::fabs(totalCharge - thePDGCharge) > << 354 if (std::fabs(totalCharge-thePDGCharge)>0.1*eplus) { 394 #ifdef G4VERBOSE 355 #ifdef G4VERBOSE 395 if (verboseLevel > 0) { << 356 if (verboseLevel>0) { 396 G4cout << " G4PDGCodeChecker::CheckCharg 357 G4cout << " G4PDGCodeChecker::CheckCharge : "; 397 G4cout << " illegal electric charge " << << 358 G4cout << " illegal electric charge " << thePDGCharge/eplus; 398 G4cout << " PDG code=" << code << G4endl << 359 G4cout << " PDG code=" << code <<G4endl; 399 } 360 } 400 #endif 361 #endif 401 return false; 362 return false; 402 } 363 } 403 return true; 364 return true; 404 } 365 } 405 366 >> 367 ///////////// 406 G4int G4PDGCodeChecker::CheckForNuclei() 368 G4int G4PDGCodeChecker::CheckForNuclei() 407 { 369 { 408 G4int pcode = std::abs(code); 370 G4int pcode = std::abs(code); 409 if (pcode < 1000000000) { 371 if (pcode < 1000000000) { 410 // non-nuclei << 372 // non-nuclei 411 return 0; 373 return 0; 412 } 374 } 413 375 414 pcode -= 1000000000; 376 pcode -= 1000000000; 415 G4int LL = pcode / 10000000; << 377 G4int L = pcode/10000000; 416 pcode -= 10000000 * LL; << 378 pcode -= 10000000*L; 417 G4int Z = pcode / 10000; << 379 G4int Z = pcode/10000; 418 pcode -= 10000 * Z; << 380 pcode -= 10000*Z; 419 G4int A = pcode / 10; << 381 G4int A = pcode/10; 420 << 382 421 // Allow neutron balls << 383 if (A < 2 || Z > A-L || L>A || Z<=0 ) { 422 // if (A < 2 || Z > A-LL || LL>A || Z<=0 ) { << 423 if (A < 2 || Z > A - LL || LL > A) { << 424 #ifdef G4VERBOSE 384 #ifdef G4VERBOSE 425 if (verboseLevel > 0) { << 385 if (verboseLevel>0) { 426 G4cout << " G4PDGCodeChecker::CheckPDGCo 386 G4cout << " G4PDGCodeChecker::CheckPDGCode : "; 427 G4cout << " ??? Illegal PDG encoding fo 387 G4cout << " ??? Illegal PDG encoding for nucleus "; 428 G4cout << " PDG code=" << code << G4endl << 388 G4cout << " PDG code=" << code <<G4endl; 429 } 389 } 430 #endif 390 #endif 431 return 0; 391 return 0; 432 } 392 } 433 393 434 G4int n_up = 2 * Z + (A - Z - LL) + LL; << 394 G4int n_up = 2*Z + (A-Z-L) + L; 435 G4int n_down = Z + 2 * (A - Z - LL) + LL; << 395 G4int n_down = Z + 2*(A-Z-L) + L; 436 G4int n_s = LL; << 396 G4int n_s = L; 437 397 438 // Fill Quark contents 398 // Fill Quark contents 439 if (code > 0) { << 399 if (code>0) { 440 theQuarkContent[0] = n_up; 400 theQuarkContent[0] = n_up; 441 theQuarkContent[1] = n_down; 401 theQuarkContent[1] = n_down; 442 theQuarkContent[2] = n_s; 402 theQuarkContent[2] = n_s; 443 } << 403 } else { 444 else { << 445 // anti_nucleus 404 // anti_nucleus 446 theAntiQuarkContent[0] = n_up; 405 theAntiQuarkContent[0] = n_up; 447 theAntiQuarkContent[1] = n_down; 406 theAntiQuarkContent[1] = n_down; 448 theAntiQuarkContent[2] = n_s; 407 theAntiQuarkContent[2] = n_s; 449 } 408 } 450 return code; 409 return code; 451 } 410 } 452 << 411 >> 412 ///////////// 453 void G4PDGCodeChecker::GetDigits(G4int PDGcode 413 void G4PDGCodeChecker::GetDigits(G4int PDGcode) 454 { 414 { 455 G4int temp = std::abs(PDGcode); 415 G4int temp = std::abs(PDGcode); >> 416 >> 417 higherSpin = temp/10000000; >> 418 temp -= G4int(higherSpin*10000000); 456 419 457 higherSpin = temp / 10000000; << 420 exotic = temp/1000000; 458 temp -= G4int(higherSpin * 10000000); << 421 temp -= G4int(exotic*1000000); 459 422 460 exotic = temp / 1000000; << 423 radial = temp/100000; 461 temp -= G4int(exotic * 1000000); << 424 temp -= G4int(radial*100000); 462 425 463 radial = temp / 100000; << 426 multiplet = temp/10000; 464 temp -= G4int(radial * 100000); << 427 temp -= G4int(multiplet*10000); 465 428 466 multiplet = temp / 10000; << 429 quark1 = temp/1000; 467 temp -= G4int(multiplet * 10000); << 430 temp -= G4int(quark1*1000); 468 431 469 quark1 = temp / 1000; << 432 quark2 = temp/100; 470 temp -= G4int(quark1 * 1000); << 433 temp -= G4int(quark2*100); 471 434 472 quark2 = temp / 100; << 435 quark3 = temp/10; 473 temp -= G4int(quark2 * 100); << 436 temp -= G4int(quark3*10); 474 437 475 quark3 = temp / 10; << 438 spin= temp; 476 temp -= G4int(quark3 * 10); << 439 if ((spin ==0) && ( higherSpin !=0 )) { 477 << 440 spin = higherSpin-1; 478 spin = temp; << 441 } else { 479 if ((spin == 0) && (higherSpin != 0)) { << 480 spin = higherSpin - 1; << 481 } << 482 else { << 483 spin -= 1; 442 spin -= 1; 484 } 443 } 485 } 444 } 486 445