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