Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/particles/management/src/G4PDGCodeChecker.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /particles/management/src/G4PDGCodeChecker.cc (Version 11.3.0) and /particles/management/src/G4PDGCodeChecker.cc (Version 11.2.2)


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