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.3)


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