Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/parton_string/hadronization/src/G4HadronBuilder.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 /processes/hadronic/models/parton_string/hadronization/src/G4HadronBuilder.cc (Version 11.3.0) and /processes/hadronic/models/parton_string/hadronization/src/G4HadronBuilder.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 //                                                 23 //
                                                   >>  24 // $Id: G4HadronBuilder.cc,v 1.4 2005/06/04 13:47:01 jwellisc Exp $
                                                   >>  25 // GEANT4 tag $Name: geant4-08-00-patch-01 $
 27 //                                                 26 //
 28 // -------------------------------------------     27 // -----------------------------------------------------------------------------
 29 //      GEANT 4 class implementation file          28 //      GEANT 4 class implementation file
 30 //                                                 29 //
 31 //      History:                                   30 //      History: 
 32 //             Gunter Folger, August/September     31 //             Gunter Folger, August/September 2001
 33 //               Create class; algorithm previ     32 //               Create class; algorithm previously in G4VLongitudinalStringDecay.
 34 // -------------------------------------------     33 // -----------------------------------------------------------------------------
 35                                                    34 
 36 #include "G4HadronBuilder.hh"                      35 #include "G4HadronBuilder.hh"
 37 #include "G4SystemOfUnits.hh"                  << 
 38 #include "Randomize.hh"                        << 
 39 #include "G4HadronicException.hh"                  36 #include "G4HadronicException.hh"
                                                   >>  37 #include "Randomize.hh"
 40 #include "G4ParticleTable.hh"                      38 #include "G4ParticleTable.hh"
 41                                                    39 
 42 //#define debug_Hbuilder                       <<  40 G4HadronBuilder::G4HadronBuilder(G4double mesonMix, G4double barionMix,
 43 //#define debug_heavyHadrons                   <<  41          std::vector<double> scalarMesonMix,
 44                                                <<  42          std::vector<double> vectorMesonMix)
 45 G4HadronBuilder::G4HadronBuilder(const std::ve << 
 46                      const std::vector<G4doubl << 
 47                      const std::vector<G4doubl << 
 48                                  const G4doubl << 
 49 {                                                  43 {
 50   mesonSpinMix       = mesonMix;               <<  44   mesonSpinMix=mesonMix;       
 51   barionSpinMix      = barionMix;              <<  45   barionSpinMix=barionMix;
 52   scalarMesonMixings = scalarMesonMix;         <<  46   scalarMesonMixings=scalarMesonMix;
 53   vectorMesonMixings = vectorMesonMix;         <<  47   vectorMesonMixings=vectorMesonMix;
 54         ProbEta_c          = Eta_cProb;        << 
 55         ProbEta_b          = Eta_bProb;        << 
 56 }                                                  48 }
 57                                                    49 
 58 //-------------------------------------------- << 
 59                                                << 
 60 G4ParticleDefinition * G4HadronBuilder::Build(     50 G4ParticleDefinition * G4HadronBuilder::Build(G4ParticleDefinition * black, G4ParticleDefinition * white)
 61 {                                                  51 {
                                                   >>  52 
 62   if (black->GetParticleSubType()== "di_quark"     53   if (black->GetParticleSubType()== "di_quark" || white->GetParticleSubType()== "di_quark" ) {
 63            // Barion                           <<  54 
                                                   >>  55 //    Barion
 64      Spin spin = (G4UniformRand() < barionSpin     56      Spin spin = (G4UniformRand() < barionSpinMix) ? SpinHalf : SpinThreeHalf;
 65      return Barion(black,white,spin);              57      return Barion(black,white,spin);
 66   } else {                                     <<  58 
 67            // Meson                            <<  59   } else {  
 68      G4int StrangeQ = 0;                       <<  60 
 69      if( std::abs(black->GetPDGEncoding()) >=  <<  61 //    Meson
 70      if( std::abs(white->GetPDGEncoding()) >=  <<  62      Spin spin = (G4UniformRand() < mesonSpinMix) ? SpinZero : SpinOne;
 71            Spin spin = (G4UniformRand() < meso << 
 72      return Meson(black,white,spin);               63      return Meson(black,white,spin);
                                                   >>  64 
 73   }                                                65   }
 74 }                                                  66 }
 75                                                    67 
 76 //--------------------------------------------     68 //-------------------------------------------------------------------------
 77                                                    69 
 78 G4ParticleDefinition * G4HadronBuilder::BuildL     70 G4ParticleDefinition * G4HadronBuilder::BuildLowSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
 79 {                                                  71 {
 80   if ( black->GetParticleSubType()== "quark" &     72   if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
 81     return Meson(black,white, SpinZero);           73     return Meson(black,white, SpinZero);
 82   } else {                                         74   } else {
 83                 // will return a SpinThreeHalf <<  75 //          will return a SpinThreeHalf Barion if all quarks the same
 84     return Barion(black,white, SpinHalf);          76     return Barion(black,white, SpinHalf); 
 85   }                                                77   } 
 86 }                                                  78 }
 87                                                    79 
 88 //--------------------------------------------     80 //-------------------------------------------------------------------------
 89                                                    81 
 90 G4ParticleDefinition * G4HadronBuilder::BuildH     82 G4ParticleDefinition * G4HadronBuilder::BuildHighSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
 91 {                                                  83 {
 92   if ( black->GetParticleSubType()== "quark" &     84   if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
 93     return Meson(black,white, SpinOne);            85     return Meson(black,white, SpinOne);
 94   } else {                                         86   } else {
 95     return Barion(black,white,SpinThreeHalf);      87     return Barion(black,white,SpinThreeHalf);
 96   }                                                88   }
 97 }                                                  89 }
 98                                                    90 
 99 //--------------------------------------------     91 //-------------------------------------------------------------------------
100                                                    92 
101 G4ParticleDefinition * G4HadronBuilder::Meson(     93 G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black, 
102                 G4ParticleDefinition * white,      94                 G4ParticleDefinition * white, Spin theSpin)
103 {                                                  95 {
104        #ifdef debug_Hbuilder                   <<  96 #ifdef G4VERBOSE
105        // Verify Input Charge                  <<  97 //  Verify Input Charge
106        G4double charge =  black->GetPDGCharge( <<  98    
107        if (std::abs(charge) > 2 || std::abs(3. <<  99    G4double charge =  black->GetPDGCharge() 
108        {                                       << 100                     + white->GetPDGCharge();   
                                                   >> 101    if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge)) > perCent )
                                                   >> 102     {
109       G4cerr << " G4HadronBuilder::Build()" <<    103       G4cerr << " G4HadronBuilder::Build()" << G4endl;
110       G4cerr << "    Invalid total charge foun    104       G4cerr << "    Invalid total charge found for on input: " 
111       << charge<< G4endl;                         105       << charge<< G4endl;
112       G4cerr << "    PGDcode input quark1/quar    106       G4cerr << "    PGDcode input quark1/quark2 : " <<
113       black->GetPDGEncoding() << " / "<<          107       black->GetPDGEncoding() << " / "<< 
114       white->GetPDGEncoding() << G4endl;          108       white->GetPDGEncoding() << G4endl;
115       G4cerr << G4endl;                           109       G4cerr << G4endl;
116   }                                               110   } 
117         #endif                                 << 111 #endif  
118                                                << 112   
119         G4int id1 = black->GetPDGEncoding();   << 113   G4int id1= black->GetPDGEncoding();
120   G4int id2 = white->GetPDGEncoding();         << 114   G4int id2= white->GetPDGEncoding();
121                                                << 115 //  G4int ifl1= std::max(std::abs(id1), std::abs(id2));
122         // G4int ifl1= std::max(std::abs(id1), << 
123   if ( std::abs(id1) < std::abs(id2) )            116   if ( std::abs(id1) < std::abs(id2) )
124   {                                            << 117      {
125      G4int xchg = id1;                            118      G4int xchg = id1; 
126      id1 = id2;                                   119      id1 = id2;  
127      id2 = xchg;                                  120      id2 = xchg;
128   }                                            << 121      }
129                                                << 
130         G4int abs_id1 = std::abs(id1);         << 
131                                                   122   
132   if ( abs_id1 > 5 )                           << 123   if (std::abs(id1) > 3 ) 
133      throw G4HadronicException(__FILE__, __LIN    124      throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
134                                                   125   
135         G4int PDGEncoding=0;                      126         G4int PDGEncoding=0;
136                                                   127 
137   if (id1 + id2 == 0) {                           128   if (id1 + id2 == 0) {     
138            if ( abs_id1 < 4) {  // light quark << 129      G4double rmix = G4UniformRand();
139         G4double rmix = G4UniformRand();       << 130      G4int    imix = 2*std::abs(id1) - 1;
140         G4int    imix = 2*std::abs(id1) - 1;   << 131      if(theSpin == SpinZero) {
141         if (theSpin == SpinZero) {             << 132         PDGEncoding = 110*(1 + (G4int)(rmix + scalarMesonMixings[imix - 1])
142            PDGEncoding = 110*(1 + (G4int)(rmix << 133                              + (G4int)(rmix + scalarMesonMixings[imix])
143                                 + (G4int)(rmix << 134         ) +  theSpin;
144                   ) +  theSpin;                << 135      } else {
145         } else {                               << 136         PDGEncoding = 110*(1 + (G4int)(rmix + vectorMesonMixings[imix - 1])
146            PDGEncoding = 110*(1 + (G4int)(rmix << 137            + (G4int)(rmix + vectorMesonMixings[imix])
147                     + (G4int)(rmix + vectorMes << 138         ) +  theSpin;
148             ) +  theSpin;                      << 139      }
149         }                                      << 
150            } else {  // for c and b quarks     << 
151                                                << 
152               PDGEncoding = abs_id1*100 + abs_ << 
153                                                << 
154               if (PDGEncoding == 440) {        << 
155                 if ( G4UniformRand() < ProbEta << 
156                   PDGEncoding +=1;             << 
157                 } else {                       << 
158                   PDGEncoding +=3;             << 
159                 }                              << 
160               }                                << 
161               if (PDGEncoding == 550) {        << 
162                 if ( G4UniformRand() < ProbEta << 
163                   PDGEncoding +=1;             << 
164                 } else {                       << 
165                   PDGEncoding +=3;             << 
166                 }                              << 
167               }                                << 
168            }                                   << 
169   } else {                                        140   } else {
170      PDGEncoding = 100 * std::abs(id1) + 10 *     141      PDGEncoding = 100 * std::abs(id1) + 10 * std::abs(id2) +  theSpin;  
171      G4bool IsUp = (std::abs(id1)&1) == 0;  //    142      G4bool IsUp = (std::abs(id1)&1) == 0;  // quark 1 up type quark (u or c)
172      G4bool IsAnti = id1 < 0;             // q << 143      G4bool IsAnti = id1 < 0;     // quark 1 is antiquark?
173      if ( (IsUp && IsAnti ) || (!IsUp && !IsAn << 144      if( (IsUp && IsAnti ) || (!IsUp && !IsAnti ) ) 
174   }                                            << 145         PDGEncoding = - PDGEncoding;
175                                                << 
176         // ----------------------------------- << 
177         // Special treatment for charmed and b << 
178   // no excited charmed or bottom mesons, ther << 
179   // into existing charmed and bottom mesons i << 
180   // we use the corresponding ground state mes << 
181   // else, we prefer to conserve the electric  << 
182         #ifdef debug_heavyHadrons              << 
183   G4int initialPDGEncoding = PDGEncoding;      << 
184   #endif                                       << 
185         if      ( std::abs( PDGEncoding ) == 1 << 
186     ( PDGEncoding > 0 ? PDGEncoding = 411 : PD << 
187         else if ( std::abs( PDGEncoding ) == 1 << 
188     ( PDGEncoding > 0 ? PDGEncoding = 421 : PD << 
189         else if ( std::abs( PDGEncoding ) == 4 << 
190     ( PDGEncoding > 0 ? PDGEncoding = 411 : PD << 
191         else if ( std::abs( PDGEncoding ) == 4 << 
192     ( PDGEncoding > 0 ? PDGEncoding = 421 : PD << 
193         else if ( std::abs( PDGEncoding ) == 1 << 
194     ( PDGEncoding > 0 ? PDGEncoding = 411 : PD << 
195         else if ( std::abs( PDGEncoding ) == 1 << 
196     ( PDGEncoding > 0 ? PDGEncoding = 421 : PD << 
197         else if ( std::abs( PDGEncoding ) == 2 << 
198     ( PDGEncoding > 0 ? PDGEncoding = 411 : PD << 
199         else if ( std::abs( PDGEncoding ) == 2 << 
200     ( PDGEncoding > 0 ? PDGEncoding = 421 : PD << 
201         else if ( std::abs( PDGEncoding ) == 4 << 
202     ( PDGEncoding > 0 ? PDGEncoding = 411 : PD << 
203         else if ( std::abs( PDGEncoding ) == 4 << 
204     ( PDGEncoding > 0 ? PDGEncoding = 421 : PD << 
205         else if ( std::abs( PDGEncoding ) == 1 << 
206     ( PDGEncoding > 0 ? PDGEncoding = 431 : PD << 
207         else if ( std::abs( PDGEncoding ) == 4 << 
208     ( PDGEncoding > 0 ? PDGEncoding = 431 : PD << 
209         else if ( std::abs( PDGEncoding ) == 1 << 
210     ( PDGEncoding > 0 ? PDGEncoding = 431 : PD << 
211         else if ( std::abs( PDGEncoding ) == 2 << 
212     ( PDGEncoding > 0 ? PDGEncoding = 431 : PD << 
213         else if ( std::abs( PDGEncoding ) == 4 << 
214     ( PDGEncoding > 0 ? PDGEncoding = 431 : PD << 
215         else if ( std::abs( PDGEncoding ) ==   << 
216         else if ( std::abs( PDGEncoding ) ==   << 
217         else if ( std::abs( PDGEncoding ) ==   << 
218         else if ( std::abs( PDGEncoding ) ==   << 
219         else if ( std::abs( PDGEncoding ) ==   << 
220         else if ( std::abs( PDGEncoding ) ==   << 
221         else if ( std::abs( PDGEncoding ) == 9 << 
222         else if ( std::abs( PDGEncoding ) == 9 << 
223         else if ( std::abs( PDGEncoding ) == 9 << 
224         else if ( std::abs( PDGEncoding ) ==   << 
225         else if ( std::abs( PDGEncoding ) ==   << 
226         // Bottom mesons                       << 
227         else if ( std::abs( PDGEncoding ) == 1 << 
228     ( PDGEncoding > 0 ? PDGEncoding = 511 : PD << 
229         else if ( std::abs( PDGEncoding ) == 1 << 
230     ( PDGEncoding > 0 ? PDGEncoding = 521 : PD << 
231         else if ( std::abs( PDGEncoding ) == 5 << 
232     ( PDGEncoding > 0 ? PDGEncoding = 511 : PD << 
233         else if ( std::abs( PDGEncoding ) == 5 << 
234     ( PDGEncoding > 0 ? PDGEncoding = 521 : PD << 
235         else if ( std::abs( PDGEncoding ) == 1 << 
236     ( PDGEncoding > 0 ? PDGEncoding = 511 : PD << 
237         else if ( std::abs( PDGEncoding ) == 1 << 
238     ( PDGEncoding > 0 ? PDGEncoding = 521 : PD << 
239         else if ( std::abs( PDGEncoding ) == 2 << 
240     ( PDGEncoding > 0 ? PDGEncoding = 511 : PD << 
241         else if ( std::abs( PDGEncoding ) == 2 << 
242     ( PDGEncoding > 0 ? PDGEncoding = 521 : PD << 
243         else if ( std::abs( PDGEncoding ) == 5 << 
244     ( PDGEncoding > 0 ? PDGEncoding = 511 : PD << 
245         else if ( std::abs( PDGEncoding ) == 5 << 
246     ( PDGEncoding > 0 ? PDGEncoding = 521 : PD << 
247         else if ( std::abs( PDGEncoding ) == 1 << 
248     ( PDGEncoding > 0 ? PDGEncoding = 531 : PD << 
249         else if ( std::abs( PDGEncoding ) == 5 << 
250     ( PDGEncoding > 0 ? PDGEncoding = 531 : PD << 
251         else if ( std::abs( PDGEncoding ) == 1 << 
252     ( PDGEncoding > 0 ? PDGEncoding = 531 : PD << 
253         else if ( std::abs( PDGEncoding ) == 2 << 
254     ( PDGEncoding > 0 ? PDGEncoding = 531 : PD << 
255         else if ( std::abs( PDGEncoding ) == 5 << 
256     ( PDGEncoding > 0 ? PDGEncoding = 531 : PD << 
257         else if ( std::abs( PDGEncoding ) == 1 << 
258     ( PDGEncoding > 0 ? PDGEncoding = 541 : PD << 
259         else if ( std::abs( PDGEncoding ) == 5 << 
260     ( PDGEncoding > 0 ? PDGEncoding = 541 : PD << 
261         else if ( std::abs( PDGEncoding ) == 1 << 
262     ( PDGEncoding > 0 ? PDGEncoding = 541 : PD << 
263   else if ( std::abs( PDGEncoding ) == 20543 ) << 
264     ( PDGEncoding > 0 ? PDGEncoding = 541 : PD << 
265         else if ( std::abs( PDGEncoding ) == 5 << 
266     ( PDGEncoding > 0 ? PDGEncoding = 541 : PD << 
267         else if ( std::abs( PDGEncoding ) ==   << 
268         else if ( std::abs( PDGEncoding ) ==   << 
269         else if ( std::abs( PDGEncoding ) ==   << 
270         else if ( std::abs( PDGEncoding ) ==   << 
271         else if ( std::abs( PDGEncoding ) ==   << 
272         else if ( std::abs( PDGEncoding ) ==   << 
273         else if ( std::abs( PDGEncoding ) ==   << 
274         else if ( std::abs( PDGEncoding ) ==   << 
275         else if ( std::abs( PDGEncoding ) ==   << 
276         else if ( std::abs( PDGEncoding ) ==   << 
277         else if ( std::abs( PDGEncoding ) ==   << 
278         else if ( std::abs( PDGEncoding ) ==   << 
279         else if ( std::abs( PDGEncoding ) ==   << 
280         else if ( std::abs( PDGEncoding ) ==   << 
281         else if ( std::abs( PDGEncoding ) ==   << 
282         else if ( std::abs( PDGEncoding ) ==   << 
283         else if ( std::abs( PDGEncoding ) ==   << 
284         else if ( std::abs( PDGEncoding ) == 9 << 
285         else if ( std::abs( PDGEncoding ) == 9 << 
286         else if ( std::abs( PDGEncoding ) ==   << 
287         else if ( std::abs( PDGEncoding ) ==   << 
288         else if ( std::abs( PDGEncoding ) ==   << 
289         else if ( std::abs( PDGEncoding ) ==   << 
290         else if ( std::abs( PDGEncoding ) ==   << 
291         else if ( std::abs( PDGEncoding ) ==   << 
292         else if ( std::abs( PDGEncoding ) ==   << 
293         else if ( std::abs( PDGEncoding ) ==   << 
294         else if ( std::abs( PDGEncoding ) ==   << 
295         #ifdef debug_heavyHadrons              << 
296   if ( initialPDGEncoding != PDGEncoding ) {   << 
297     G4cout << "G4HadronBuilder::Meson : forcin << 
298      << initialPDGEncoding << " into pdgCode=" << 
299   }                                               146   }
300   #endif                                       << 147      
301         // ----------------------------------- << 148      
302                                                << 
303   G4ParticleDefinition * MesonDef=                149   G4ParticleDefinition * MesonDef=
304     G4ParticleTable::GetParticleTable()->FindP    150     G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
305                                                << 151 #ifdef G4VERBOSE
306         #ifdef debug_Hbuilder                  << 
307   if (MesonDef == 0 ) {                           152   if (MesonDef == 0 ) {
308     G4cerr << " G4HadronBuilder - Warning: No     153     G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
309            << PDGEncoding << G4endl;              154            << PDGEncoding << G4endl;
310   } else if  ( (  black->GetPDGCharge() + whit << 155   }
311             - MesonDef->GetPDGCharge() ) > per << 156   if  ( (  black->GetPDGCharge() 
                                                   >> 157                + white->GetPDGCharge()
                                                   >> 158          - MesonDef->GetPDGCharge() ) > perCent   ) {
312           G4cerr << " G4HadronBuilder - Warnin    159           G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
313       << " Quark1/2 = "                           160       << " Quark1/2 = " 
314       << black->GetParticleName() << " / "        161       << black->GetParticleName() << " / "
315       << white->GetParticleName()                 162       << white->GetParticleName() 
316       << " resulting Hadron " << MesonDef->Get    163       << " resulting Hadron " << MesonDef->GetParticleName() 
317       << G4endl;                                  164       << G4endl;
318   }                                               165   }
319         #endif                                 << 166 #endif
320                                                   167 
321   return MesonDef;                                168   return MesonDef;
322 }                                                 169 }
323                                                   170 
324 //-------------------------------------------- << 
325                                                   171 
326 G4ParticleDefinition * G4HadronBuilder::Barion    172 G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black, 
327                  G4ParticleDefinition * white, << 173                 G4ParticleDefinition * white,Spin theSpin)
328 {                                                 174 {
329         #ifdef debug_Hbuilder                  << 175 
330         // Verify Input Charge                 << 176 #ifdef G4VERBOSE
331         G4double charge =  black->GetPDGCharge << 177 //  Verify Input Charge
332         if (std::abs(charge) > 2 || std::abs(3 << 178    G4double charge =  black->GetPDGCharge() 
                                                   >> 179                     + white->GetPDGCharge();   
                                                   >> 180    if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge)) > perCent )
333     {                                             181     {
334       G4cerr << " G4HadronBuilder::Build()" <<    182       G4cerr << " G4HadronBuilder::Build()" << G4endl;
335       G4cerr << "    Invalid total charge foun    183       G4cerr << "    Invalid total charge found for on input: " 
336       << charge<< G4endl;                         184       << charge<< G4endl;
337       G4cerr << "    PGDcode input quark1/quar    185       G4cerr << "    PGDcode input quark1/quark2 : " <<
338       black->GetPDGEncoding() << " / "<<          186       black->GetPDGEncoding() << " / "<< 
339       white->GetPDGEncoding() << G4endl;          187       white->GetPDGEncoding() << G4endl;
340       G4cerr << G4endl;                           188       G4cerr << G4endl;
341   }                                               189   } 
342         #endif                                 << 190 #endif  
343                                                << 191   G4int id1= black->GetPDGEncoding();
344         G4int id1 = black->GetPDGEncoding();   << 192   G4int id2= white->GetPDGEncoding();
345   G4int id2 = white->GetPDGEncoding();         << 
346                                                << 
347   if ( std::abs(id1) < std::abs(id2) )            193   if ( std::abs(id1) < std::abs(id2) )
348   {                                            << 194      {
349      G4int xchg = id1;                            195      G4int xchg = id1; 
350      id1 = id2;                                   196      id1 = id2;  
351      id2 = xchg;                                  197      id2 = xchg;
352   }                                            << 198      }
353                                                   199 
354   if (std::abs(id1) < 1000 || std::abs(id2) >  << 200   if (std::abs(id1) < 1000 || std::abs(id2) > 3 ) 
355      throw G4HadronicException(__FILE__, __LIN    201      throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Barion: Illegal quark content as input");   
356                                                   202 
357   G4int ifl1= std::abs(id1)/1000;                 203   G4int ifl1= std::abs(id1)/1000;
358   G4int ifl2 = (std::abs(id1) - ifl1 * 1000)/1    204   G4int ifl2 = (std::abs(id1) - ifl1 * 1000)/100;
359   G4int diquarkSpin = std::abs(id1)%10;           205   G4int diquarkSpin = std::abs(id1)%10; 
360   G4int ifl3 = id2;                               206   G4int ifl3 = id2;
361   if (id1 < 0)                                    207   if (id1 < 0)
362   {                                            << 208      {
363      ifl1 = - ifl1;                               209      ifl1 = - ifl1;
364      ifl2 = - ifl2;                               210      ifl2 = - ifl2;
365   }                                            << 211      }
366   //... Construct barion, distinguish Lambda a    212   //... Construct barion, distinguish Lambda and Sigma barions.
367   G4int kfla = std::abs(ifl1);                    213   G4int kfla = std::abs(ifl1);
368   G4int kflb = std::abs(ifl2);                    214   G4int kflb = std::abs(ifl2);
369   G4int kflc = std::abs(ifl3);                    215   G4int kflc = std::abs(ifl3);
370                                                   216 
371   G4int kfld = std::max(kfla,kflb);               217   G4int kfld = std::max(kfla,kflb);
372         kfld = std::max(kfld,kflc);               218         kfld = std::max(kfld,kflc);
373   G4int kflf = std::min(kfla,kflb);               219   G4int kflf = std::min(kfla,kflb);
374         kflf = std::min(kflf,kflc);               220         kflf = std::min(kflf,kflc);
375                                                   221 
376   G4int kfle = kfla + kflb + kflc - kfld - kfl    222   G4int kfle = kfla + kflb + kflc - kfld - kflf;
377                                                   223 
378   //... barion with content uuu or ddd or sss     224   //... barion with content uuu or ddd or sss has always spin = 3/2
379   theSpin = (kfla == kflb && kflb == kflc)? Sp    225   theSpin = (kfla == kflb && kflb == kflc)? SpinThreeHalf : theSpin;   
380                                                   226 
381   G4int kfll = 0;                                 227   G4int kfll = 0;
382         if (kfld < 6) {                        << 228   if(theSpin == SpinHalf && kfld > kfle && kfle > kflf) { 
383      if (theSpin == SpinHalf && kfld > kfle && << 229 // Spin J=1/2 and all three quarks different
384               // Spin J=1/2 and all three quar << 230 // Two states exist: (uds -> lambda or sigma0)
385               // Two states exist: (uds -> lam << 231 //   -  lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
386               //   -  lambda: s(ud)0 s : 3122; << 232 //   -  sigma0: s(ud)1 s : 3212
387               //   -  sigma0: s(ud)1 s : 3212  << 233      if(diquarkSpin == 1 ) {
388         if (diquarkSpin == 1 ) {               << 234         if ( kfla == kfld) {   // heaviest quark in diquark
389            if ( kfla == kfld) {   // heaviest  << 235            kfll = 1;
390               kfll = 1;                        << 236         } else {
391            } else {                            << 237            kfll = (G4int)(0.25 + G4UniformRand());
392               kfll = (G4int)(0.25 + G4UniformR << 238         }
393            }                                   << 239      }   
394         }                                      << 240      if(diquarkSpin == 3 && kfla != kfld)
395         if (diquarkSpin == 3 && kfla != kfld)  << 241          kfll = (G4int)(0.75 + G4UniformRand());
396             kfll = (G4int)(0.75 + G4UniformRan << 242   }
397      }                                         << 
398         }                                      << 
399                                                   243   
400   G4int PDGEncoding;                              244   G4int PDGEncoding;
401   if (kfll == 1)                                  245   if (kfll == 1)
402      PDGEncoding = 1000 * kfld + 100 * kflf +     246      PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
403   else                                            247   else    
404      PDGEncoding = 1000 * kfld + 100 * kfle +     248      PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
405                                                   249 
406   if (id1 < 0)                                    250   if (id1 < 0)
407      PDGEncoding = -PDGEncoding;                  251      PDGEncoding = -PDGEncoding;
408                                                   252 
409         // ----------------------------------- << 253 
410         // Special treatment for charmed and b << 
411   // neither excited charmed or bottom baryons << 
412   // heavy (c, b) constitutent quarks:         << 
413   //   Sigma_c* , Xi_c' , Xi_c* , Omega_c* ,   << 
414   //   Xi_cc , Xi_cc* , Omega_cc , Omega_cc* , << 
415   //   Sigma_b* , Xi_b' , Xi_b* , Omega_b*,    << 
416   //   Xi_bc , Xi_bc' , Xi_bc* , Omega_bc , Om << 
417   //   Omega_bcc , Omega_bcc* , Xi_bb, Xi_bb*  << 
418   //   Omega_bbc , Omega_bbc* , Omega_bbb      << 
419   // therefore we need to transform these into << 
420   // baryons in Geant4. Whenever possible, we  << 
421   // baryons with the same quantum numbers; el << 
422   // electric charge rather than other flavor  << 
423         #ifdef debug_heavyHadrons              << 
424   G4int charmViolation = 0, bottomViolation =  << 
425   G4int initialPDGEncoding = PDGEncoding;      << 
426   #endif                                       << 
427         if      ( std::abs( PDGEncoding ) == 4 << 
428     ( PDGEncoding > 0 ? PDGEncoding = 4222 : P << 
429   } else if ( std::abs( PDGEncoding ) == 4214  << 
430     ( PDGEncoding > 0 ? PDGEncoding = 4212 : P << 
431   } else if ( std::abs( PDGEncoding ) == 4114  << 
432     ( PDGEncoding > 0 ? PDGEncoding = 4112 : P << 
433   } else if ( std::abs( PDGEncoding ) == 4322  << 
434     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
435   } else if ( std::abs( PDGEncoding ) == 4312  << 
436     ( PDGEncoding > 0 ? PDGEncoding = 4132 : P << 
437   } else if ( std::abs( PDGEncoding ) == 4324  << 
438     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
439   } else if ( std::abs( PDGEncoding ) == 4314  << 
440     ( PDGEncoding > 0 ? PDGEncoding = 4132 : P << 
441   } else if ( std::abs( PDGEncoding ) == 4334  << 
442     ( PDGEncoding > 0 ? PDGEncoding = 4332 : P << 
443   } else if ( std::abs( PDGEncoding ) == 4412  << 
444     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
445           #ifdef debug_heavyHadrons            << 
446     charmViolation = 1;                        << 
447     #endif                                     << 
448         } else if ( std::abs( PDGEncoding ) == << 
449     ( PDGEncoding > 0 ? PDGEncoding = 4222 : P << 
450           #ifdef debug_heavyHadrons            << 
451     charmViolation = 1;                        << 
452     #endif                                     << 
453   } else if ( std::abs( PDGEncoding ) == 4414  << 
454     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
455           #ifdef debug_heavyHadrons            << 
456     charmViolation = 1;                        << 
457     #endif                                     << 
458         } else if ( std::abs( PDGEncoding ) == << 
459     ( PDGEncoding > 0 ? PDGEncoding = 4222 : P << 
460           #ifdef debug_heavyHadrons            << 
461     charmViolation = 1;                        << 
462     #endif                                     << 
463   } else if ( std::abs( PDGEncoding ) == 4432  << 
464     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
465           #ifdef debug_heavyHadrons            << 
466     charmViolation = 1;                        << 
467     #endif                                     << 
468   } else if ( std::abs( PDGEncoding ) == 4434  << 
469     ( PDGEncoding > 0 ? PDGEncoding = 4232 : P << 
470           #ifdef debug_heavyHadrons            << 
471     charmViolation = 1;                        << 
472     #endif                                     << 
473         } else if ( std::abs( PDGEncoding ) == << 
474     ( PDGEncoding > 0 ? PDGEncoding = 4222 : P << 
475           #ifdef debug_heavyHadrons            << 
476     charmViolation = 2;                        << 
477     #endif                                     << 
478         // Bottom baryons                      << 
479         } else if ( std::abs( PDGEncoding ) == << 
480     ( PDGEncoding > 0 ? PDGEncoding = 5112 : P << 
481         } else if ( std::abs( PDGEncoding ) == << 
482     ( PDGEncoding > 0 ? PDGEncoding = 5212 : P << 
483         } else if ( std::abs( PDGEncoding ) == << 
484     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
485         } else if ( std::abs( PDGEncoding ) == << 
486     ( PDGEncoding > 0 ? PDGEncoding = 5132 : P << 
487         } else if ( std::abs( PDGEncoding ) == << 
488     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
489         } else if ( std::abs( PDGEncoding ) == << 
490     ( PDGEncoding > 0 ? PDGEncoding = 5132 : P << 
491         } else if ( std::abs( PDGEncoding ) == << 
492     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
493         } else if ( std::abs( PDGEncoding ) == << 
494     ( PDGEncoding > 0 ? PDGEncoding = 5332 : P << 
495         } else if ( std::abs( PDGEncoding ) == << 
496     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
497           #ifdef debug_heavyHadrons            << 
498     charmViolation = 1;                        << 
499     #endif                                     << 
500         } else if ( std::abs( PDGEncoding ) == << 
501     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
502           #ifdef debug_heavyHadrons            << 
503     charmViolation = 1;                        << 
504     #endif                                     << 
505         } else if ( std::abs( PDGEncoding ) == << 
506     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
507           #ifdef debug_heavyHadrons            << 
508     charmViolation = 1;                        << 
509     #endif                                     << 
510         } else if ( std::abs( PDGEncoding ) == << 
511     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
512           #ifdef debug_heavyHadrons            << 
513     charmViolation = 1;                        << 
514     #endif                                     << 
515         } else if ( std::abs( PDGEncoding ) == << 
516     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
517           #ifdef debug_heavyHadrons            << 
518     charmViolation = 1;                        << 
519     #endif                                     << 
520         } else if ( std::abs( PDGEncoding ) == << 
521     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
522           #ifdef debug_heavyHadrons            << 
523     charmViolation = 1;                        << 
524     #endif                                     << 
525         } else if ( std::abs( PDGEncoding ) == << 
526     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
527           #ifdef debug_heavyHadrons            << 
528     charmViolation = 1;                        << 
529     #endif                                     << 
530         } else if ( std::abs( PDGEncoding ) == << 
531     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
532           #ifdef debug_heavyHadrons            << 
533     charmViolation = 1;                        << 
534     #endif                                     << 
535         } else if ( std::abs( PDGEncoding ) == << 
536     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
537           #ifdef debug_heavyHadrons            << 
538     charmViolation = 1;                        << 
539     #endif                                     << 
540         } else if ( std::abs( PDGEncoding ) == << 
541     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
542           #ifdef debug_heavyHadrons            << 
543     charmViolation = 2;                        << 
544     #endif                                     << 
545         } else if ( std::abs( PDGEncoding ) == << 
546     ( PDGEncoding > 0 ? PDGEncoding = 5222 : P << 
547           #ifdef debug_heavyHadrons            << 
548     charmViolation = 2;                        << 
549     #endif                                     << 
550         } else if ( std::abs( PDGEncoding ) == << 
551     ( PDGEncoding > 0 ? PDGEncoding = 5132 : P << 
552           #ifdef debug_heavyHadrons            << 
553     bottomViolation = 1;                       << 
554     #endif                                     << 
555         } else if ( std::abs( PDGEncoding ) == << 
556     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
557           #ifdef debug_heavyHadrons            << 
558     bottomViolation = 1;                       << 
559     #endif                                     << 
560         } else if ( std::abs( PDGEncoding ) == << 
561     ( PDGEncoding > 0 ? PDGEncoding = 5132 : P << 
562           #ifdef debug_heavyHadrons            << 
563     bottomViolation = 1;                       << 
564     #endif                                     << 
565         } else if ( std::abs( PDGEncoding ) == << 
566     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
567           #ifdef debug_heavyHadrons            << 
568     bottomViolation = 1;                       << 
569     #endif                                     << 
570         } else if ( std::abs( PDGEncoding ) == << 
571     ( PDGEncoding > 0 ? PDGEncoding = 5332 : P << 
572           #ifdef debug_heavyHadrons            << 
573     bottomViolation = 1;                       << 
574     #endif                                     << 
575         } else if ( std::abs( PDGEncoding ) == << 
576     ( PDGEncoding > 0 ? PDGEncoding = 5332 : P << 
577           #ifdef debug_heavyHadrons            << 
578     bottomViolation = 1;                       << 
579     #endif                                     << 
580         } else if ( std::abs( PDGEncoding ) == << 
581     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
582           #ifdef debug_heavyHadrons            << 
583     charmViolation = 1; bottomViolation = 1;   << 
584     #endif                                     << 
585         } else if ( std::abs( PDGEncoding ) == << 
586     ( PDGEncoding > 0 ? PDGEncoding = 5232 : P << 
587           #ifdef debug_heavyHadrons            << 
588     charmViolation = 1; bottomViolation = 1;   << 
589     #endif                                     << 
590         } else if ( std::abs( PDGEncoding ) == << 
591     ( PDGEncoding > 0 ? PDGEncoding = 5332 : P << 
592           #ifdef debug_heavyHadrons            << 
593     bottomViolation = 2;                       << 
594     #endif                                     << 
595   }                                            << 
596         #ifdef debug_heavyHadrons              << 
597   if ( initialPDGEncoding != PDGEncoding ) {   << 
598     G4cout << "G4HadronBuilder::Barion : forci << 
599      << initialPDGEncoding << " into pdgCode=" << 
600     if ( charmViolation != 0  ||  bottomViolat << 
601       G4cout << "\t --> VIOLATION of " << ( ch << 
602              << ( charmViolation != 0  &&  bot << 
603              << ( bottomViolation != 0 ? " BOT << 
604     }                                          << 
605   }                                            << 
606   #endif                                       << 
607         // ----------------------------------- << 
608                                                << 
609   G4ParticleDefinition * BarionDef=               254   G4ParticleDefinition * BarionDef=
610     G4ParticleTable::GetParticleTable()->FindP    255     G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
611                                                << 256 #ifdef G4VERBOSE
612         #ifdef debug_Hbuilder                  << 
613   if (BarionDef == 0 ) {                          257   if (BarionDef == 0 ) {
614     G4cerr << " G4HadronBuilder - Warning: No     258     G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
615            << PDGEncoding << G4endl;              259            << PDGEncoding << G4endl;
616   } else if  ( (  black->GetPDGCharge() + whit << 260   }
617             - BarionDef->GetPDGCharge() ) > pe << 261   if  ( (  black->GetPDGCharge() 
                                                   >> 262                + white->GetPDGCharge()
                                                   >> 263          - BarionDef->GetPDGCharge() ) > perCent   ) {
618           G4cerr << " G4HadronBuilder - Warnin    264           G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
619       << " DiQuark/Quark = "                      265       << " DiQuark/Quark = " 
620       << black->GetParticleName() << " / "        266       << black->GetParticleName() << " / "
621       << white->GetParticleName()                 267       << white->GetParticleName() 
622       << " resulting Hadron " << BarionDef->Ge    268       << " resulting Hadron " << BarionDef->GetParticleName() 
623       << G4endl;                                  269       << G4endl;
624   }                                               270   }
625         #endif                                 << 271 #endif
626                                                   272 
627   return BarionDef;                               273   return BarionDef;
628 }                                                 274 }
629                                                   275