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 9.4.p3)


  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: not supported by cvs2svn $
 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;
301     }                                          << 260     } else {
302     else {                                     << 261       theQuarkContent[quark2-1] =1;
303       theQuarkContent[quark2 - 1] = 1;         << 262       theAntiQuarkContent[quark3-1] =1;
304       theAntiQuarkContent[quark3 - 1] = 1;     << 
305     }                                             263     }
306   }                                            << 264   } else {
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   // Allow neutron balls
422   // if (A < 2 || Z > A-LL || LL>A || Z<=0 ) { << 384   // if (A < 2 || Z > A-L || L>A || Z<=0 ) {
423   if (A < 2 || Z > A - LL || LL > A) {         << 385   if (A < 2 || Z > A-L || L>A ) {
424 #ifdef G4VERBOSE                                  386 #ifdef G4VERBOSE
425     if (verboseLevel > 0) {                    << 387     if (verboseLevel>0) {
426       G4cout << " G4PDGCodeChecker::CheckPDGCo    388       G4cout << " G4PDGCodeChecker::CheckPDGCode : ";
427       G4cout << " ???  Illegal PDG encoding fo    389       G4cout << " ???  Illegal PDG encoding for nucleus ";
428       G4cout << " PDG code=" << code << G4endl << 390       G4cout << " PDG code=" << code <<G4endl;
429     }                                             391     }
430 #endif                                            392 #endif
431     return 0;                                     393     return 0;
432   }                                               394   }
433                                                   395 
434   G4int n_up = 2 * Z + (A - Z - LL) + LL;      << 396   G4int n_up   = 2*Z +   (A-Z-L) + L;
435   G4int n_down = Z + 2 * (A - Z - LL) + LL;    << 397   G4int n_down =   Z + 2*(A-Z-L) + L;
436   G4int n_s = LL;                              << 398   G4int n_s    =   L;
437                                                   399 
438   // Fill Quark contents                          400   // Fill Quark contents
439   if (code > 0) {                              << 401   if (code>0) {
440     theQuarkContent[0] = n_up;                    402     theQuarkContent[0] = n_up;
441     theQuarkContent[1] = n_down;                  403     theQuarkContent[1] = n_down;
442     theQuarkContent[2] = n_s;                     404     theQuarkContent[2] = n_s;
443   }                                            << 405    } else {
444   else {                                       << 
445     // anti_nucleus                               406     // anti_nucleus
446     theAntiQuarkContent[0] = n_up;                407     theAntiQuarkContent[0] = n_up;
447     theAntiQuarkContent[1] = n_down;              408     theAntiQuarkContent[1] = n_down;
448     theAntiQuarkContent[2] = n_s;                 409     theAntiQuarkContent[2] = n_s;
449   }                                               410   }
450   return code;                                    411   return code;
451 }                                                 412 }
452                                                << 413  
                                                   >> 414 /////////////
453 void G4PDGCodeChecker::GetDigits(G4int PDGcode    415 void G4PDGCodeChecker::GetDigits(G4int PDGcode)
454 {                                                 416 {
455   G4int temp = std::abs(PDGcode);                 417   G4int temp = std::abs(PDGcode);
                                                   >> 418   
                                                   >> 419   higherSpin = temp/10000000;
                                                   >> 420   temp -= G4int(higherSpin*10000000);
456                                                   421 
457   higherSpin = temp / 10000000;                << 422   exotic = temp/1000000;
458   temp -= G4int(higherSpin * 10000000);        << 423   temp -= G4int(exotic*1000000);
459                                                   424 
460   exotic = temp / 1000000;                     << 425   radial = temp/100000;
461   temp -= G4int(exotic * 1000000);             << 426   temp -= G4int(radial*100000);
462                                                   427 
463   radial = temp / 100000;                      << 428   multiplet = temp/10000;
464   temp -= G4int(radial * 100000);              << 429   temp -= G4int(multiplet*10000);
465                                                   430 
466   multiplet = temp / 10000;                    << 431   quark1 = temp/1000;
467   temp -= G4int(multiplet * 10000);            << 432   temp -= G4int(quark1*1000);
468                                                   433 
469   quark1 = temp / 1000;                        << 434   quark2 = temp/100;
470   temp -= G4int(quark1 * 1000);                << 435   temp -= G4int(quark2*100);
471                                                   436 
472   quark2 = temp / 100;                         << 437   quark3 = temp/10;
473   temp -= G4int(quark2 * 100);                 << 438   temp -= G4int(quark3*10);
474                                                   439 
475   quark3 = temp / 10;                          << 440   spin= temp;
476   temp -= G4int(quark3 * 10);                  << 441   if ((spin ==0) && ( higherSpin !=0 )) {
477                                                << 442     spin =  higherSpin-1;
478   spin = temp;                                 << 443   } else {
479   if ((spin == 0) && (higherSpin != 0)) {      << 
480     spin = higherSpin - 1;                     << 
481   }                                            << 
482   else {                                       << 
483     spin -= 1;                                    444     spin -= 1;
484   }                                               445   }
485 }                                                 446 }
486                                                   447