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 8.0.p1)


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