G4LundStringFragmentation.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 // GEANT4 tag $Name:  $ 1.8
00029 //
00030 // -----------------------------------------------------------------------------
00031 //      GEANT 4 class implementation file
00032 //
00033 //      History: first implementation, Maxim Komogorov, 10-Jul-1998
00034 // -----------------------------------------------------------------------------
00035 #include "G4LundStringFragmentation.hh"
00036 #include "G4PhysicalConstants.hh"
00037 #include "G4SystemOfUnits.hh"
00038 #include "Randomize.hh"
00039 #include "G4FragmentingString.hh"
00040 #include "G4DiQuarks.hh"
00041 #include "G4Quarks.hh"
00042 
00043 // Class G4LundStringFragmentation 
00044 //*************************************************************************************
00045 
00046 G4LundStringFragmentation::G4LundStringFragmentation()
00047 {
00048 // ------ For estimation of a minimal string mass ---------------
00049     Mass_of_light_quark    =140.*MeV;
00050     Mass_of_heavy_quark    =500.*MeV;
00051     Mass_of_string_junction=720.*MeV;
00052 // ------ An estimated minimal string mass ----------------------
00053     MinimalStringMass  = 0.;              
00054     MinimalStringMass2 = 0.;              
00055 // ------ Minimal invariant mass used at a string fragmentation -
00056     WminLUND = 0.45*GeV; //0.23*GeV;                   // Uzhi 0.7 -> 0.23 3.8.10 //0.8 1.5
00057 // ------ Smooth parameter used at a string fragmentation for ---
00058 // ------ smearinr sharp mass cut-off ---------------------------
00059     SmoothParam  = 0.2;                   
00060 
00061 //    SetStringTensionParameter(0.25);                           
00062     SetStringTensionParameter(1.);                         
00063     SetDiquarkSuppression(0.087);                 // Uzhi 18.05.2012
00064     SetDiquarkBreakProbability(0.05); 
00065     SetStrangenessSuppression(0.47);              // Uzhi 18.05.2012
00066 
00067 // For treating of small string decays
00068    for(G4int i=0; i<3; i++)
00069    {  for(G4int j=0; j<3; j++)
00070       {  for(G4int k=0; k<6; k++)
00071          {  Meson[i][j][k]=0; MesonWeight[i][j][k]=0.;
00072          }
00073       }
00074    }
00075 //--------------------------
00076          Meson[0][0][0]=111;                       // dbar-d Pi0
00077    MesonWeight[0][0][0]=(1.-pspin_meson)*(1.-scalarMesonMix[0]);
00078 
00079          Meson[0][0][1]=221;                       // dbar-d Eta
00080    MesonWeight[0][0][1]=(1.-pspin_meson)*(scalarMesonMix[0]-scalarMesonMix[1]);
00081 
00082          Meson[0][0][2]=331;                       // dbar-d EtaPrime
00083    MesonWeight[0][0][2]=(1.-pspin_meson)*(scalarMesonMix[1]);
00084 
00085          Meson[0][0][3]=113;                       // dbar-d Rho0
00086    MesonWeight[0][0][3]=pspin_meson*(1.-vectorMesonMix[0]);
00087 
00088          Meson[0][0][4]=223;                       // dbar-d Omega
00089    MesonWeight[0][0][4]=pspin_meson*(vectorMesonMix[0]);
00090 //--------------------------
00091 
00092          Meson[0][1][0]=211;                       // dbar-u Pi+
00093    MesonWeight[0][1][0]=(1.-pspin_meson);
00094 
00095          Meson[0][1][1]=213;                       // dbar-u Rho+
00096    MesonWeight[0][1][1]=pspin_meson;
00097 //--------------------------
00098 
00099          Meson[0][2][0]=311;                      // dbar-s K0bar
00100    MesonWeight[0][2][0]=(1.-pspin_meson);
00101 
00102          Meson[0][2][1]=313;                       // dbar-s K*0bar
00103    MesonWeight[0][2][1]=pspin_meson;
00104 //--------------------------
00105 //--------------------------
00106          Meson[1][0][0]=211;                       // ubar-d Pi-
00107    MesonWeight[1][0][0]=(1.-pspin_meson);
00108 
00109          Meson[1][0][1]=213;                       // ubar-d Rho-
00110    MesonWeight[1][0][1]=pspin_meson;
00111 //--------------------------
00112 
00113          Meson[1][1][0]=111;                       // ubar-u Pi0
00114    MesonWeight[1][1][0]=(1.-pspin_meson)*(1.-scalarMesonMix[0]);
00115 
00116          Meson[1][1][1]=221;                       // ubar-u Eta
00117    MesonWeight[1][1][1]=(1.-pspin_meson)*(scalarMesonMix[0]-scalarMesonMix[1]);
00118 
00119          Meson[1][1][2]=331;                       // ubar-u EtaPrime
00120    MesonWeight[1][1][2]=(1.-pspin_meson)*(scalarMesonMix[1]);
00121 
00122          Meson[1][1][3]=113;                       // ubar-u Rho0
00123    MesonWeight[1][1][3]=pspin_meson*(1.-vectorMesonMix[0]);
00124 
00125          Meson[1][1][4]=223;                       // ubar-u Omega
00126    MesonWeight[1][1][4]=pspin_meson*(scalarMesonMix[0]);
00127 //--------------------------
00128 
00129          Meson[1][2][0]=321;                      // ubar-s K-
00130    MesonWeight[1][2][0]=(1.-pspin_meson);
00131 
00132          Meson[1][2][1]=323;                      // ubar-s K*-bar -
00133    MesonWeight[1][2][1]=pspin_meson;
00134 //--------------------------
00135 //--------------------------
00136 
00137          Meson[2][0][0]=311;                       // sbar-d K0
00138    MesonWeight[2][0][0]=(1.-pspin_meson);
00139 
00140          Meson[2][0][1]=313;                       // sbar-d K*0
00141    MesonWeight[2][0][1]=pspin_meson;
00142 //--------------------------
00143 
00144          Meson[2][1][0]=321;                        // sbar-u K+
00145    MesonWeight[2][1][0]=(1.-pspin_meson);
00146 
00147          Meson[2][1][1]=323;                       // sbar-u K*+
00148    MesonWeight[2][1][1]=pspin_meson;
00149 //--------------------------
00150 
00151          Meson[2][2][0]=221;                       // sbar-s Eta
00152    MesonWeight[2][2][0]=(1.-pspin_meson)*(1.-scalarMesonMix[5]);
00153 
00154          Meson[2][2][1]=331;                       // sbar-s EtaPrime
00155    MesonWeight[2][2][1]=(1.-pspin_meson)*(1.-scalarMesonMix[5]);
00156 
00157          Meson[2][2][3]=333;                       // sbar-s EtaPrime
00158    MesonWeight[2][2][3]=pspin_meson*(vectorMesonMix[5]);
00159 //--------------------------
00160 
00161    for(G4int i=0; i<3; i++)
00162    {  for(G4int j=0; j<3; j++)
00163       {  for(G4int k=0; k<3; k++)
00164          {  for(G4int l=0; l<4; l++)
00165             { Baryon[i][j][k][l]=0; BaryonWeight[i][j][k][l]=0.;}
00166          }
00167       }
00168    }
00169 
00170    G4double pspin_barion_in=pspin_barion;
00171    //pspin_barion=0.75;
00172 //---------------------------------------
00173          Baryon[0][0][0][0]=1114;         // Delta-
00174    BaryonWeight[0][0][0][0]=1.;
00175 
00176 //---------------------------------------
00177          Baryon[0][0][1][0]=2112;         // neutron
00178    BaryonWeight[0][0][1][0]=1.-pspin_barion;
00179 
00180          Baryon[0][0][1][1]=2114;         // Delta0
00181    BaryonWeight[0][0][1][1]=pspin_barion;
00182 
00183 //---------------------------------------
00184          Baryon[0][0][2][0]=3112;         // Sigma-
00185    BaryonWeight[0][0][2][0]=1.-pspin_barion;
00186 
00187          Baryon[0][0][2][1]=3114;         // Sigma*-
00188    BaryonWeight[0][0][2][1]=pspin_barion;
00189 
00190 //---------------------------------------
00191          Baryon[0][1][0][0]=2112;         // neutron
00192    BaryonWeight[0][1][0][0]=1.-pspin_barion;
00193 
00194          Baryon[0][1][0][1]=2114;         // Delta0
00195    BaryonWeight[0][1][0][1]=pspin_barion;
00196 
00197 //---------------------------------------
00198          Baryon[0][1][1][0]=2212;         // proton
00199    BaryonWeight[0][1][1][0]=1.-pspin_barion;
00200 
00201          Baryon[0][1][1][1]=2214;         // Delta+
00202    BaryonWeight[0][1][1][1]=pspin_barion;
00203 
00204 //---------------------------------------
00205          Baryon[0][1][2][0]=3122;         // Lambda
00206    BaryonWeight[0][1][2][0]=(1.-pspin_barion)*0.5;
00207 
00208          Baryon[0][1][2][1]=3212;         // Sigma0
00209    BaryonWeight[0][1][2][2]=(1.-pspin_barion)*0.5;
00210 
00211          Baryon[0][1][2][2]=3214;         // Sigma*0
00212    BaryonWeight[0][1][2][2]=pspin_barion;
00213 
00214 //---------------------------------------
00215          Baryon[0][2][0][0]=3112;         // Sigma-
00216    BaryonWeight[0][2][0][0]=1.-pspin_barion;
00217 
00218          Baryon[0][2][0][1]=3114;         // Sigma*-
00219    BaryonWeight[0][2][0][1]=pspin_barion;
00220 
00221 //---------------------------------------
00222          Baryon[0][2][1][0]=3122;         // Lambda
00223    BaryonWeight[0][2][1][0]=(1.-pspin_barion)*0.5;
00224 
00225          Baryon[0][2][1][1]=3212;         // Sigma0
00226    BaryonWeight[0][2][1][1]=(1.-pspin_barion)*0.5;
00227 
00228          Baryon[0][2][1][2]=3214;         // Sigma*0
00229    BaryonWeight[0][2][1][2]=pspin_barion;
00230 
00231 //---------------------------------------
00232          Baryon[0][2][2][0]=3312;         // Theta-
00233    BaryonWeight[0][2][2][0]=1.-pspin_barion;
00234 
00235          Baryon[0][2][2][1]=3314;         // Theta*-
00236    BaryonWeight[0][2][2][1]=pspin_barion;
00237 
00238 //---------------------------------------
00239 //---------------------------------------
00240          Baryon[1][0][0][0]=2112;         // neutron
00241    BaryonWeight[1][0][0][0]=1.-pspin_barion;
00242 
00243          Baryon[1][0][0][1]=2114;         // Delta0
00244    BaryonWeight[1][0][0][1]=pspin_barion;
00245 
00246 //---------------------------------------
00247          Baryon[1][0][1][0]=2212;         // proton
00248    BaryonWeight[1][0][1][0]=1.-pspin_barion;          
00249 
00250          Baryon[1][0][1][1]=2214;         // Delta+
00251    BaryonWeight[1][0][1][1]=pspin_barion;
00252 
00253 //---------------------------------------
00254          Baryon[1][0][2][0]=3122;         // Lambda
00255    BaryonWeight[1][0][2][0]=(1.-pspin_barion)*0.5;
00256 
00257          Baryon[1][0][2][1]=3212;         // Sigma0
00258    BaryonWeight[1][0][2][1]=(1.-pspin_barion)*0.5;
00259 
00260          Baryon[1][0][2][2]=3214;         // Sigma*0
00261    BaryonWeight[1][0][2][2]=pspin_barion;
00262 
00263 //---------------------------------------
00264          Baryon[1][1][0][0]=2212;         // proton
00265    BaryonWeight[1][1][0][0]=1.-pspin_barion;
00266 
00267          Baryon[1][1][0][1]=2214;         // Delta+
00268    BaryonWeight[1][1][0][1]=pspin_barion;
00269 
00270 //---------------------------------------
00271          Baryon[1][1][1][0]=2224;         // Delta++
00272    BaryonWeight[1][1][1][0]=1.;
00273 
00274 //---------------------------------------
00275          Baryon[1][1][2][0]=3222;         // Sigma+
00276    BaryonWeight[1][1][2][0]=1.-pspin_barion;
00277 
00278          Baryon[1][1][2][1]=3224;         // Sigma*+
00279    BaryonWeight[1][1][2][1]=pspin_barion;
00280 
00281 //---------------------------------------
00282          Baryon[1][2][0][0]=3122;         // Lambda
00283    BaryonWeight[1][2][0][0]=(1.-pspin_barion)*0.5;
00284 
00285          Baryon[1][2][0][1]=3212;         // Sigma0
00286    BaryonWeight[1][2][0][1]=(1.-pspin_barion)*0.5;
00287 
00288          Baryon[1][2][0][2]=3214;         // Sigma*0
00289    BaryonWeight[1][2][0][2]=pspin_barion;
00290 
00291 //---------------------------------------
00292          Baryon[1][2][1][0]=3222;         // Sigma+
00293    BaryonWeight[1][2][1][0]=1.-pspin_barion;
00294 
00295          Baryon[1][2][1][1]=3224;         // Sigma*+
00296    BaryonWeight[1][2][1][1]=pspin_barion;
00297 
00298 //---------------------------------------
00299          Baryon[1][2][2][0]=3322;         // Theta0
00300    BaryonWeight[1][2][2][0]=1.-pspin_barion;
00301 
00302          Baryon[1][2][2][1]=3324;         // Theta*0
00303    BaryonWeight[1][2][2][1]=pspin_barion;
00304 
00305 //---------------------------------------
00306 //---------------------------------------
00307          Baryon[2][0][0][0]=3112;         // Sigma-
00308    BaryonWeight[2][0][0][0]=1.-pspin_barion;
00309 
00310          Baryon[2][0][0][1]=3114;         // Sigma*-
00311    BaryonWeight[2][0][0][1]=pspin_barion;
00312 
00313 //---------------------------------------
00314          Baryon[2][0][1][0]=3122;         // Lambda
00315    BaryonWeight[2][0][1][0]=(1.-pspin_barion)*0.5;          
00316 
00317          Baryon[2][0][1][1]=3212;         // Sigma0
00318    BaryonWeight[2][0][1][1]=(1.-pspin_barion)*0.5; 
00319 
00320          Baryon[2][0][1][2]=3214;         // Sigma*0
00321    BaryonWeight[2][0][1][2]=pspin_barion;
00322 
00323 //---------------------------------------
00324          Baryon[2][0][2][0]=3312;         // Sigma-
00325    BaryonWeight[2][0][2][0]=1.-pspin_barion;
00326 
00327          Baryon[2][0][2][1]=3314;         // Sigma*-
00328    BaryonWeight[2][0][2][1]=pspin_barion;
00329 
00330 //---------------------------------------
00331          Baryon[2][1][0][0]=3122;         // Lambda
00332    BaryonWeight[2][1][0][0]=(1.-pspin_barion)*0.5;
00333 
00334          Baryon[2][1][0][1]=3212;         // Sigma0
00335    BaryonWeight[2][1][0][1]=(1.-pspin_barion)*0.5;
00336 
00337          Baryon[2][1][0][2]=3214;         // Sigma*0
00338    BaryonWeight[2][1][0][2]=pspin_barion;
00339 
00340 //---------------------------------------
00341          Baryon[2][1][1][0]=3222;         // Sigma+
00342    BaryonWeight[2][1][1][0]=1.-pspin_barion;
00343 
00344          Baryon[2][1][1][1]=3224;         // Sigma*+
00345    BaryonWeight[2][1][1][1]=pspin_barion;
00346 
00347 //---------------------------------------
00348          Baryon[2][1][2][0]=3322;         // Theta0
00349    BaryonWeight[2][1][2][0]=1.-pspin_barion;
00350 
00351          Baryon[2][1][2][1]=3324;         // Theta*0
00352    BaryonWeight[2][1][2][2]=pspin_barion;
00353 
00354 //---------------------------------------
00355          Baryon[2][2][0][0]=3312;         // Theta-
00356    BaryonWeight[2][2][0][0]=1.-pspin_barion;
00357 
00358          Baryon[2][2][0][1]=3314;         // Theta*-
00359    BaryonWeight[2][2][0][1]=pspin_barion;
00360 
00361 //---------------------------------------
00362          Baryon[2][2][1][0]=3322;         // Theta0
00363    BaryonWeight[2][2][1][0]=1.-pspin_barion;
00364 
00365          Baryon[2][2][1][1]=3324;         // Theta*0
00366    BaryonWeight[2][2][1][1]=pspin_barion;
00367 
00368 //---------------------------------------
00369          Baryon[2][2][2][0]=3334;         // Omega
00370    BaryonWeight[2][2][2][0]=1.;
00371 
00372 //---------------------------------------
00373    pspin_barion=pspin_barion_in;
00374    /*
00375            for(G4int i=0; i<3; i++)
00376            {  for(G4int j=0; j<3; j++)
00377                   {  for(G4int k=0; k<3; k++)
00378                          {  for(G4int l=0; l<4; l++)
00379                                 { G4cout<<i<<" "<<j<<" "<<k<<" "<<l<<" "<<Baryon[i][j][k][l]<<G4endl;}
00380                          }
00381                   }
00382            }
00383                 G4int Uzhi;
00384                 G4cin>>Uzhi;
00385     */
00386    //StrangeSuppress=0.38;
00387    Prob_QQbar[0]=StrangeSuppress;         // Probability of ddbar production
00388    Prob_QQbar[1]=StrangeSuppress;         // Probability of uubar production
00389    Prob_QQbar[2]=StrangeSuppress/(2.+StrangeSuppress);//(1.-2.*StrangeSuppress); // Probability of ssbar production
00390 
00391    //A.R. 25-Jul-2012 : Coverity fix.
00392    for ( G4int i=0 ; i<35 ; i++ ) { 
00393      FS_LeftHadron[i] = 0;
00394      FS_RightHadron[i] = 0;
00395      FS_Weight[i] = 0.0; 
00396    }
00397    NumberOf_FS = 0;
00398 
00399 }
00400 
00401 // --------------------------------------------------------------
00402 G4LundStringFragmentation::~G4LundStringFragmentation()
00403 {}
00404 
00405 
00406 //--------------------------------------------------------------------------------------
00407 void G4LundStringFragmentation::SetMinimalStringMass(const G4FragmentingString  * const string)  
00408 {
00409         G4double EstimatedMass=0.;
00410         G4int Number_of_quarks=0;
00411 
00412         G4double StringM=string->Get4Momentum().mag();
00413 
00414         G4int Qleft =std::abs(string->GetLeftParton()->GetPDGEncoding());
00415 
00416         //G4cout<<"Min mass Qleft -------------------"<<G4endl;
00417         //G4cout<<"String mass"<<string->Get4Momentum().mag()<<G4endl;
00418         if( Qleft > 1000)
00419         {
00420                 Number_of_quarks+=2;
00421                 G4int q1=Qleft/1000;
00422                 if( q1 < 3) {EstimatedMass +=Mass_of_light_quark;}
00423                 if( q1 > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00424 
00425                 G4int q2=(Qleft/100)%10;
00426                 if( q2 < 3) {EstimatedMass +=Mass_of_light_quark;}
00427                 if( q2 > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00428                 EstimatedMass +=Mass_of_string_junction;
00429         }
00430         else
00431         {
00432                 Number_of_quarks++;
00433                 if( Qleft < 3) {EstimatedMass +=Mass_of_light_quark;}
00434                 if( Qleft > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00435         }
00436 
00437         //G4cout<<"Min mass Qleft "<<Qleft<<" "<<EstimatedMass<<G4endl;
00438 
00439         G4int Qright=std::abs(string->GetRightParton()->GetPDGEncoding());
00440 
00441         if( Qright > 1000)
00442         {
00443                 Number_of_quarks+=2;
00444                 G4int q1=Qright/1000;
00445                 if( q1 < 3) {EstimatedMass +=Mass_of_light_quark;}
00446                 if( q1 > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00447 
00448                 G4int q2=(Qright/100)%10;
00449                 if( q2 < 3) {EstimatedMass +=Mass_of_light_quark;}
00450                 if( q2 > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00451                 EstimatedMass +=Mass_of_string_junction;
00452         }
00453         else
00454         {
00455                 Number_of_quarks++;
00456                 if( Qright < 3) {EstimatedMass +=Mass_of_light_quark;}
00457                 if( Qright > 2) {EstimatedMass +=Mass_of_heavy_quark;}
00458         }
00459 
00460         //G4cout<<"Min mass Qright "<<Qright<<" "<<EstimatedMass<<G4endl;
00461 
00462         if(Number_of_quarks==2){EstimatedMass +=100.*MeV;}
00463         if(Number_of_quarks==3){EstimatedMass += 20.*MeV;}
00464         if(Number_of_quarks==4)
00465         {
00466                 if((StringM > 1880.) && ( EstimatedMass < 2100))     {EstimatedMass = 2020.;}//1880.;}
00467                 //   if((StringM > 1880.) && ( EstimatedMass < 2100))     {EstimatedMass = 2051.;}
00468                 else if((StringM > 2232.) && ( EstimatedMass < 2730)){EstimatedMass = 2570.;}
00469                 else if((StringM > 5130.) && ( EstimatedMass < 3450)){EstimatedMass = 5130.;}
00470                 else
00471                 {
00472                         EstimatedMass -=2.*Mass_of_string_junction;
00473                         if(EstimatedMass <= 1600.*MeV){EstimatedMass-=200.*MeV;}
00474                         else                          {EstimatedMass+=100.*MeV;}
00475                 }
00476         }
00477 
00478         //G4cout<<"EstimatedMass  "<<EstimatedMass <<G4endl;
00479         //G4int Uzhi; G4cin>>Uzhi;
00480         MinimalStringMass=EstimatedMass;
00481         SetMinimalStringMass2(EstimatedMass);
00482 }
00483 
00484 //--------------------------------------------------------------------------------------
00485 void G4LundStringFragmentation::SetMinimalStringMass2(
00486                 const G4double aValue)
00487 {
00488         MinimalStringMass2=aValue * aValue;
00489 }
00490 
00491 //--------------------------------------------------------------------------------------
00492 G4KineticTrackVector* G4LundStringFragmentation::FragmentString(
00493                 const G4ExcitedString& theString)
00494 {
00495         // Can no longer modify Parameters for Fragmentation.
00496         PastInitPhase=true;
00497 
00498         SetMassCut(160.*MeV); // For LightFragmentationTest it is required
00499                               // that no one pi-meson can be produced.
00500 
00501         G4FragmentingString  aString(theString);
00502         SetMinimalStringMass(&aString);
00503 
00504         G4KineticTrackVector * LeftVector(0);
00505 
00506         if(!IsFragmentable(&aString)) // produce 1 hadron
00507         {
00508                 //G4cout<<"Non fragmentable"<<G4endl;
00509                 SetMassCut(1000.*MeV);
00510                 LeftVector=LightFragmentationTest(&theString);
00511                 SetMassCut(160.*MeV);
00512         }  // end of if(!IsFragmentable(&aString))
00513 
00514         if ( LeftVector != 0 ) {
00515                 // Uzhi insert 6.05.08 start
00516                 LeftVector->operator[](0)->SetFormationTime(theString.GetTimeOfCreation());
00517                 LeftVector->operator[](0)->SetPosition(theString.GetPosition());
00518                 if(LeftVector->size() > 1)
00519                 {
00520                         // 2 hadrons created from qq-qqbar are stored
00521                         LeftVector->operator[](1)->SetFormationTime(theString.GetTimeOfCreation());
00522                         LeftVector->operator[](1)->SetPosition(theString.GetPosition());
00523                 }
00524                 return LeftVector;
00525         }
00526 
00527         // The string can fragment. At least two particles can be produced.
00528         LeftVector =new G4KineticTrackVector;
00529         G4KineticTrackVector * RightVector=new G4KineticTrackVector;
00530 
00531         G4ExcitedString *theStringInCMS=CPExcited(theString);
00532         G4LorentzRotation toCms=theStringInCMS->TransformToAlignedCms();
00533 
00534         G4bool success = Loop_toFragmentString(theStringInCMS, LeftVector, RightVector);
00535 
00536         delete theStringInCMS;
00537 
00538         if ( ! success )
00539         {
00540                 std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
00541                 LeftVector->clear();
00542                 std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
00543                 delete RightVector;
00544                 return LeftVector;
00545         }
00546 
00547         // Join Left- and RightVector into LeftVector in correct order.
00548         while(!RightVector->empty())
00549         {
00550                 LeftVector->push_back(RightVector->back());
00551                 RightVector->erase(RightVector->end()-1);
00552         }
00553         delete RightVector;
00554 
00555         CalculateHadronTimePosition(theString.Get4Momentum().mag(), LeftVector);
00556 
00557         G4LorentzRotation toObserverFrame(toCms.inverse());
00558 
00559         G4double TimeOftheStringCreation=theString.GetTimeOfCreation();
00560         G4ThreeVector PositionOftheStringCreation(theString.GetPosition());
00561 
00562         //G4cout<<"# prod hadrons "<<LeftVector->size()<<G4endl;
00563         for(size_t C1 = 0; C1 < LeftVector->size(); C1++)
00564         {
00565                 G4KineticTrack* Hadron = LeftVector->operator[](C1);
00566                 G4LorentzVector Momentum = Hadron->Get4Momentum();
00567                 //G4cout<<"Hadron "<<Hadron->GetDefinition()->GetParticleName()<<" "<<Momentum<<G4endl;
00568                 Momentum = toObserverFrame*Momentum;
00569                 Hadron->Set4Momentum(Momentum);
00570 
00571                 G4LorentzVector Coordinate(Hadron->GetPosition(), Hadron->GetFormationTime());
00572                 Momentum = toObserverFrame*Coordinate;
00573                 Hadron->SetFormationTime(TimeOftheStringCreation + Momentum.e() - fermi/c_light);
00574                 G4ThreeVector aPosition(Momentum.vect());
00575                 Hadron->SetPosition(PositionOftheStringCreation+aPosition);
00576         };
00577 
00578         return LeftVector;
00579 }
00580 
00581 //----------------------------------------------------------------------------------
00582 G4bool G4LundStringFragmentation::IsFragmentable(const G4FragmentingString * const string)
00583 {
00584         SetMinimalStringMass(string);
00585         //  return sqr(MinimalStringMass + WminLUND) < string->Get4Momentum().mag2();
00586         return MinimalStringMass < string->Get4Momentum().mag(); // 21.07.2010
00587 }
00588 
00589 //----------------------------------------------------------------------------------------
00590 G4bool G4LundStringFragmentation::StopFragmenting(const G4FragmentingString * const string)
00591 {
00592         SetMinimalStringMass(string);
00593 
00594         if (string->FourQuarkString())
00595         {
00596                 return G4UniformRand() < std::exp(-0.0005*(string->Mass() - MinimalStringMass));
00597         } else {
00598                 return G4UniformRand() < std::exp(-0.88e-6*(string->Mass()*string->Mass() -
00599                                                             MinimalStringMass*MinimalStringMass));
00600         }
00601 }
00602 
00603 //----------------------------------------------------------------------------------------------------------
00604 G4bool G4LundStringFragmentation::SplitLast(G4FragmentingString * string,
00605                 G4KineticTrackVector * LeftVector,
00606                 G4KineticTrackVector * RightVector)
00607 {
00608         //... perform last cluster decay
00609         //G4cout<<"Split last-----------------------------------------"<<G4endl;
00610         G4LorentzVector Str4Mom=string->Get4Momentum();
00611         G4ThreeVector ClusterVel=string->Get4Momentum().boostVector();
00612         G4double StringMass=string->Mass();
00613 
00614         G4ParticleDefinition * LeftHadron(0), * RightHadron(0);
00615 
00616         NumberOf_FS=0;
00617         for(G4int i=0; i<35; i++) {FS_Weight[i]=0.;}
00618 
00619         //G4cout<<"StrMass "<<StringMass<<" q "<<string->GetLeftParton()->GetParticleName()<<" "<<string->GetRightParton()->GetParticleName()<<" StringMassSqr "<<StringMassSqr<<G4endl;
00620 
00621         string->SetLeftPartonStable(); // to query quark contents..
00622 
00623         if (string->FourQuarkString() )
00624         {
00625                 // The string is qq-qqbar type. Diquarks are on the string ends
00626                 //G4cout<<"The string is qq-qqbar type. Diquarks are on the string ends"<<G4endl;
00627 
00628                 if(StringMass-MinimalStringMass < 0.)
00629                 {
00630                         if (! Diquark_AntiDiquark_belowThreshold_lastSplitting(string, LeftHadron, RightHadron) ) 
00631                         {
00632                                 return false;
00633                         }
00634                 } else
00635                 {
00636                         Diquark_AntiDiquark_aboveThreshold_lastSplitting(string, LeftHadron, RightHadron);
00637 
00638                         if(NumberOf_FS == 0) return false;
00639                         //G4cout<<"NumberOf_FS "<<NumberOf_FS<<G4endl;
00640                         G4int sampledState = SampleState();
00641                         //SampledState=16;
00642                         if(string->GetLeftParton()->GetPDGEncoding() < 0)
00643                         {
00644                                 LeftHadron =FS_LeftHadron[sampledState];
00645                                 RightHadron=FS_RightHadron[sampledState];
00646                         } else
00647                         {
00648                                 LeftHadron =FS_RightHadron[sampledState];
00649                                 RightHadron=FS_LeftHadron[sampledState];
00650                         }
00651                         //G4cout<<"Selected "<<SampledState<<" "<<LeftHadron->GetParticleName()<<" "<<RightHadron->GetParticleName()<<G4endl;
00652                 }
00653         } else
00654         {
00655                 if (string->DecayIsQuark() && string->StableIsQuark() )
00656                 {       //... there are quarks on cluster ends
00657                         //G4cout<<"Q Q string"<<G4endl;
00658                         Quark_AntiQuark_lastSplitting(string, LeftHadron, RightHadron);
00659                 } else 
00660                 {       //... there is a Diquark on one of the cluster ends
00661                         //G4cout<<"DiQ Q string"<<G4endl;
00662                         Quark_Diquark_lastSplitting(string, LeftHadron, RightHadron);
00663                 }
00664                 
00665                 if(NumberOf_FS == 0) return false;
00666                 //G4cout<<"NumberOf_FS "<<NumberOf_FS<<G4endl;
00667                 G4int sampledState = SampleState();
00668                 //sampledState=17;
00669                 LeftHadron =FS_LeftHadron[sampledState];
00670                 RightHadron=FS_RightHadron[sampledState];
00671                 //G4cout<<"Selected "<<sampledState<<" "<<LeftHadron->GetParticleName()<<" "<<RightHadron->GetParticleName()<<G4endl;
00672                 //G4int Uzhi; G4cin>>Uzhi;
00673 
00674         }  // End of if(!string->FourQuarkString())
00675 
00676         G4LorentzVector  LeftMom, RightMom;
00677         G4ThreeVector    Pos;
00678 
00679         Sample4Momentum(&LeftMom,  LeftHadron->GetPDGMass(),
00680                         &RightMom, RightHadron->GetPDGMass(),
00681                         StringMass);
00682 
00683         LeftMom.boost(ClusterVel);
00684         RightMom.boost(ClusterVel);
00685 
00686         LeftVector->push_back(new G4KineticTrack(LeftHadron, 0, Pos, LeftMom));
00687         RightVector->push_back(new G4KineticTrack(RightHadron, 0, Pos, RightMom));
00688 
00689         return true;
00690 
00691 }
00692 
00693 //----------------------------------------------------------------------------------------------------------
00694 void G4LundStringFragmentation::Sample4Momentum(G4LorentzVector* Mom, G4double Mass, G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass) 
00695 {
00696         // ------ Sampling of momenta of 2 last produced hadrons --------------------
00697         G4ThreeVector Pt;
00698         G4double MassMt2, AntiMassMt2;
00699         G4double AvailablePz, AvailablePz2;
00700 
00701         //G4cout<<"Masses "<<InitialMass<<" "<<Mass<<" "<<AntiMass<<G4endl;
00702         //
00703 
00704         if((Mass > 930. || AntiMass > 930.)) //If there is a baryon
00705         {
00706                 // ----------------- Isotropic decay ------------------------------------
00707                 G4double r_val = sqr(InitialMass*InitialMass - Mass*Mass - AntiMass*AntiMass) -
00708                                 sqr(2.*Mass*AntiMass);
00709                 G4double Pabs = (r_val > 0.)? std::sqrt(r_val)/(2.*InitialMass) : 0;
00710                 //G4cout<<"P for isotr decay "<<Pabs<<G4endl;
00711 
00712                 //... sample unit vector
00713                 G4double pz =1. - 2.*G4UniformRand();
00714                 G4double st     = std::sqrt(1. - pz * pz)*Pabs;
00715                 G4double phi    = 2.*pi*G4UniformRand();
00716                 G4double px = st*std::cos(phi);
00717                 G4double py = st*std::sin(phi);
00718                 pz *= Pabs;
00719 
00720                 Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
00721                 Mom->setE(std::sqrt(Pabs*Pabs + Mass*Mass));
00722 
00723                 AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
00724                 AntiMom->setE (std::sqrt(Pabs*Pabs + AntiMass*AntiMass));
00725                 //G4int Uzhi; G4cin>>Uzhi;
00726         }
00727         else
00728                 //
00729         {
00730                 do
00731                 {
00732                         // GF 22-May-09, limit sampled pt to allowed range
00733 
00734                         G4double termD = InitialMass*InitialMass -Mass*Mass - AntiMass*AntiMass;
00735                         G4double termab = 4*sqr(Mass*AntiMass);
00736                         G4double termN = 2*termD + 4*Mass*Mass + 4*AntiMass*AntiMass;
00737                         G4double pt2max=(termD*termD - termab )/ termN ;
00738                         //G4cout<<"Anis "<<pt2max<<" "<<(termD*termD-termab)/(4.*InitialMass*InitialMass)<<G4endl;
00739 
00740                         Pt=SampleQuarkPt(std::sqrt(pt2max)); Pt.setZ(0); G4double Pt2=Pt.mag2();
00741                         //G4cout<<"Sampl pt2 "<<Pt2<<G4endl;
00742                         MassMt2    =     Mass *     Mass + Pt2;
00743                         AntiMassMt2= AntiMass * AntiMass + Pt2;
00744 
00745                         AvailablePz2= sqr(InitialMass*InitialMass - MassMt2 - AntiMassMt2) -
00746                                         4.*MassMt2*AntiMassMt2;
00747                 }
00748                 while(AvailablePz2 < 0.);     // GF will occur only for numerical precision problem with limit in sampled pt
00749 
00750                 AvailablePz2 /=(4.*InitialMass*InitialMass);
00751                 AvailablePz = std::sqrt(AvailablePz2);
00752 
00753                 G4double Px=Pt.getX();
00754                 G4double Py=Pt.getY();
00755 
00756                 Mom->setPx(Px); Mom->setPy(Py); Mom->setPz(AvailablePz);
00757                 Mom->setE(std::sqrt(MassMt2+AvailablePz2));
00758 
00759                 AntiMom->setPx(-Px); AntiMom->setPy(-Py); AntiMom->setPz(-AvailablePz);
00760                 AntiMom->setE (std::sqrt(AntiMassMt2+AvailablePz2));
00761         }
00762 }
00763 
00764 //-----------------------------------------------------------------------------
00765 G4LorentzVector * G4LundStringFragmentation::SplitEandP(G4ParticleDefinition * pHadron,
00766                 G4FragmentingString * string, G4FragmentingString * newString)
00767 { 
00768         //G4cout<<"Start SplitEandP "<<G4endl;
00769         G4LorentzVector String4Momentum=string->Get4Momentum();
00770         G4double StringMT2=string->Get4Momentum().mt2();
00771 
00772         G4double HadronMass = pHadron->GetPDGMass();
00773 
00774         SetMinimalStringMass(newString);
00775         //G4cout<<"HadM MinimalStringMassLeft StringM "<<HadronMass<<" "<<MinimalStringMass<<" "<<String4Momentum.mag()<<G4endl;
00776 
00777         if(HadronMass + MinimalStringMass > String4Momentum.mag()) {return 0;}// have to start all over!
00778         String4Momentum.setPz(0.);
00779         G4ThreeVector StringPt=String4Momentum.vect();
00780 
00781         // calculate and assign hadron transverse momentum component HadronPx and HadronPy
00782         G4ThreeVector thePt;
00783         thePt=SampleQuarkPt();
00784 
00785         G4ThreeVector HadronPt = thePt +string->DecayPt();
00786         HadronPt.setZ(0);
00787 
00788         G4ThreeVector RemSysPt = StringPt - HadronPt;
00789 
00790         //...  sample z to define hadron longitudinal momentum and energy
00791         //... but first check the available phase space
00792 
00793         G4double HadronMassT2 = sqr(HadronMass) + HadronPt.mag2();
00794         G4double ResidualMassT2=sqr(MinimalStringMass) + RemSysPt.mag2();
00795 
00796         G4double Pz2 = (sqr(StringMT2 - HadronMassT2 - ResidualMassT2) -
00797                         4*HadronMassT2 * ResidualMassT2)/4./StringMT2;
00798         //G4cout<<"Pz2 "<<Pz2<<G4endl;
00799         if(Pz2 < 0 ) {return 0;}          // have to start all over!
00800 
00801         //... then compute allowed z region  z_min <= z <= z_max
00802 
00803         G4double Pz = std::sqrt(Pz2);
00804         G4double zMin = (std::sqrt(HadronMassT2+Pz2) - Pz)/std::sqrt(StringMT2);
00805         G4double zMax = (std::sqrt(HadronMassT2+Pz2) + Pz)/std::sqrt(StringMT2);
00806 
00807         //G4cout<<"if (zMin >= zMax) return 0 "<<zMin<<" "<<zMax<<G4endl;
00808         if (zMin >= zMax) return 0;             // have to start all over!
00809 
00810         G4double z = GetLightConeZ(zMin, zMax,
00811                         string->GetDecayParton()->GetPDGEncoding(), pHadron,
00812                         HadronPt.x(), HadronPt.y());
00813         //G4cout<<"z "<<z<<G4endl;
00814         //... now compute hadron longitudinal momentum and energy
00815         // longitudinal hadron momentum component HadronPz
00816 
00817         HadronPt.setZ(0.5* string->GetDecayDirection() *
00818                         (z * string->LightConeDecay() - 
00819                                         HadronMassT2/(z * string->LightConeDecay())));
00820 
00821         G4double HadronE  = 0.5* (z * string->LightConeDecay() +
00822                         HadronMassT2/(z * string->LightConeDecay()));
00823 
00824         G4LorentzVector * a4Momentum= new G4LorentzVector(HadronPt,HadronE);
00825         //G4cout<<"Out SplitEandP "<<G4endl;
00826         return a4Momentum;
00827 }
00828 
00829 //-----------------------------------------------------------------------------------------
00830 G4double G4LundStringFragmentation::GetLightConeZ(G4double zmin, G4double zmax, 
00831                 G4int PDGEncodingOfDecayParton,
00832                 G4ParticleDefinition* pHadron,
00833                 G4double Px, G4double Py)
00834 {
00835 
00836         //    If blund get restored, you MUST adapt the calculation of zOfMaxyf.
00837         //    const G4double  blund = 1;
00838 
00839         G4double Mass = pHadron->GetPDGMass();
00840         //  G4int HadronEncoding=pHadron->GetPDGEncoding();
00841 
00842         G4double Mt2 = Px*Px + Py*Py + Mass*Mass;
00843 
00844         G4double  alund;
00845         if(std::abs(PDGEncodingOfDecayParton) < 1000)
00846         {    // ---------------- Quark fragmentation ----------------------
00847                 alund=0.35/GeV/GeV; // Instead of 0.7 because kinks are not considered
00848         }
00849         else
00850         {    // ---------------- Di-quark fragmentation ----------------------
00851                 alund=0.7/GeV/GeV;    // 0.7 2.0
00852         }
00853         G4double zOfMaxyf=alund*Mt2/(alund*Mt2 + 1.);
00854         G4double maxYf=(1-zOfMaxyf)/zOfMaxyf * std::exp(-alund*Mt2/zOfMaxyf);
00855         G4double z, yf;
00856         do
00857         {
00858                 z = zmin + G4UniformRand()*(zmax-zmin);
00859                 //        yf = std::pow(1. - z, blund)/z*std::exp(-alund*Mt2/z);
00860                 yf = (1-z)/z * std::exp(-alund*Mt2/z);
00861         }
00862         while (G4UniformRand()*maxYf > yf);
00863 
00864 
00865         return z;
00866 }
00867 
00868 //------------------------------------------------------------------------
00869 G4double G4LundStringFragmentation::lambda(G4double S, G4double m1_Sqr, G4double m2_Sqr)
00870 { 
00871         G4double lam = sqr(S - m1_Sqr - m2_Sqr) - 4.*m1_Sqr*m2_Sqr;
00872         return lam;
00873 }
00874 
00875 
00876 //------------------------------------------------------------------------
00877 //------------------------------------------------------------------------
00878 // Internal methods introduced to improve the code structure (AR Nov 2011)
00879 //------------------------------------------------------------------------
00880 //------------------------------------------------------------------------
00881 
00882 //----------------------------------------------------------------------------------------
00883 G4bool G4LundStringFragmentation::Loop_toFragmentString(G4ExcitedString * & theStringInCMS, 
00884                                                         G4KineticTrackVector * & LeftVector, 
00885                                                         G4KineticTrackVector * & RightVector)
00886 {
00887         G4bool final_success=false;
00888         G4bool inner_success=true;
00889         G4int attempt=0;
00890         while ( ! final_success && attempt++ < StringLoopInterrupt )
00891         {       // If the string fragmentation do not be happend, repeat the fragmentation.
00892                 G4FragmentingString *currentString=new G4FragmentingString(*theStringInCMS);
00893                 //G4cout<<"Main loop start whilecounter "<<attempt<<G4endl;
00894                 // Cleaning up the previously produced hadrons
00895                 std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
00896                 LeftVector->clear();
00897                 std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
00898                 RightVector->clear();
00899 
00900                 // Main fragmentation loop until the string will not be able to fragment
00901                 inner_success=true;  // set false on failure.
00902                 while (! StopFragmenting(currentString) )
00903                 {       // Split current string into hadron + new string
00904                         G4FragmentingString *newString=0;  // used as output from SplitUp.
00905                         G4KineticTrack * Hadron=Splitup(currentString,newString);
00906                         if ( Hadron != 0 )  // Store the hadron                               
00907                         {
00908                                 //G4cout<<"Hadron prod at fragm. "<<Hadron->GetDefinition()->GetParticleName()<<G4endl;
00909                                 if ( currentString->GetDecayDirection() > 0 )
00910                                 {
00911                                         LeftVector->push_back(Hadron);
00912                                 } else
00913                                 {
00914                                         RightVector->push_back(Hadron);
00915                                 }
00916                                 delete currentString;
00917                                 currentString=newString;
00918                         }
00919                 }; 
00920                 // Split remaining string into 2 final hadrons.
00921                 if ( inner_success && SplitLast(currentString, LeftVector, RightVector) )
00922                 {
00923                         final_success=true;
00924                 }
00925                 delete currentString;
00926         }  // End of the loop where we try to fragment the string.
00927         return final_success;
00928 }
00929 
00930 //----------------------------------------------------------------------------------------
00931 G4bool G4LundStringFragmentation::
00932 Diquark_AntiDiquark_belowThreshold_lastSplitting(G4FragmentingString * & string,
00933                                                  G4ParticleDefinition * & LeftHadron,
00934                                                  G4ParticleDefinition * & RightHadron)
00935 {
00936         G4double StringMass   = string->Mass();
00937         G4int cClusterInterrupt = 0;
00938         do
00939         {
00940                 //G4cout<<"cClusterInterrupt "<<cClusterInterrupt<<G4endl;
00941                 if (cClusterInterrupt++ >= ClusterLoopInterrupt)
00942                 {
00943                         return false;
00944                 }
00945 
00946                 G4int LeftQuark1= string->GetLeftParton()->GetPDGEncoding()/1000;
00947                 G4int LeftQuark2=(string->GetLeftParton()->GetPDGEncoding()/100)%10;
00948 
00949                 G4int RightQuark1= string->GetRightParton()->GetPDGEncoding()/1000;
00950                 G4int RightQuark2=(string->GetRightParton()->GetPDGEncoding()/100)%10;
00951 
00952                 if(G4UniformRand()<0.5)
00953                 {
00954                         LeftHadron =hadronizer->Build(FindParticle( LeftQuark1),
00955                                                       FindParticle(RightQuark1));
00956                         RightHadron=hadronizer->Build(FindParticle( LeftQuark2),
00957                                                       FindParticle(RightQuark2));
00958                 } else
00959                 {
00960                         LeftHadron =hadronizer->Build(FindParticle( LeftQuark1),
00961                                                       FindParticle(RightQuark2));
00962                         RightHadron=hadronizer->Build(FindParticle( LeftQuark2),
00963                                                       FindParticle(RightQuark1));
00964                 }
00965 
00966                 //... repeat procedure, if mass of cluster is too low to produce hadrons
00967                 //... ClusterMassCut = 0.15*GeV model parameter
00968         }
00969         while ((StringMass <= LeftHadron->GetPDGMass() + RightHadron->GetPDGMass()));
00970 
00971         return true;
00972 }
00973 
00974 //----------------------------------------------------------------------------------------
00975 G4bool G4LundStringFragmentation::
00976 Diquark_AntiDiquark_aboveThreshold_lastSplitting(G4FragmentingString * & string,
00977                                                  G4ParticleDefinition * & LeftHadron,
00978                                                  G4ParticleDefinition * & RightHadron)
00979 {
00980         // StringMass-MinimalStringMass > 0. Creation of 2 baryons is possible ----
00981 
00982         //G4cout<<"DiQ Anti-DiQ string"<<G4endl;
00983         //G4cout<<string->GetLeftParton()->GetPDGEncoding()<<" "<<string->GetRightParton()->GetPDGEncoding()<<G4endl;
00984 
00985         G4double StringMass   = string->Mass();
00986         G4double StringMassSqr= sqr(StringMass); 
00987         G4ParticleDefinition * Di_Quark;
00988         G4ParticleDefinition * Anti_Di_Quark;
00989 
00990         if(string->GetLeftParton()->GetPDGEncoding() < 0)
00991         {
00992                 Anti_Di_Quark   =string->GetLeftParton();
00993                 Di_Quark=string->GetRightParton();
00994         } else
00995         {
00996                 Anti_Di_Quark   =string->GetRightParton();
00997                 Di_Quark=string->GetLeftParton();
00998         }
00999 
01000         G4int IDAnti_di_quark    =Anti_Di_Quark->GetPDGEncoding();
01001         G4int AbsIDAnti_di_quark =std::abs(IDAnti_di_quark);
01002         G4int IDdi_quark         =Di_Quark->GetPDGEncoding();
01003         G4int AbsIDdi_quark      =std::abs(IDdi_quark);
01004 
01005         G4int ADi_q1=AbsIDAnti_di_quark/1000;
01006         G4int ADi_q2=(AbsIDAnti_di_quark-ADi_q1*1000)/100;
01007 
01008         G4int Di_q1=AbsIDdi_quark/1000;
01009         G4int Di_q2=(AbsIDdi_quark-Di_q1*1000)/100;
01010 
01011         //G4cout<<"IDs Anti "<<ADi_q1<<" "<<ADi_q2<<G4endl;
01012         //G4cout<<"IDs      "<< Di_q1<<" "<< Di_q2<<G4endl;
01013 
01014         NumberOf_FS=0;
01015         for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01016         {
01017                 //G4cout<<"Insert QQbar "<<ProdQ<<G4endl;
01018 
01019                 G4int StateADiQ=0;
01020                 do  // while(Meson[AbsIDquark-1][ProdQ-1][StateQ]<>0);
01021                 {
01022                         //G4cout<<G4endl<<"AbsIDquark ProdQ StateQ "<<MesonWeight[AbsIDquark-1][ProdQ-1][StateQ]<<" "<<AbsIDquark<<" "<<ProdQ<<" "<<StateQ<<G4endl;
01023                         //G4cout<<G4endl<<"AbsIDquark ProdQ StateQ "<<SignQ*Meson[AbsIDquark-1][ProdQ-1][StateQ]<<" "<<AbsIDquark<<" "<<ProdQ<<" "<<StateQ<<G4endl;
01024                         LeftHadron=G4ParticleTable::GetParticleTable()->FindParticle(
01025                                                         -Baryon[ADi_q1-1][ADi_q2-1][ProdQ-1][StateADiQ]);
01026                         G4double LeftHadronMass=LeftHadron->GetPDGMass();
01027 
01028                         //G4cout<<"Anti Bar "<<LeftHadron->GetParticleName()<<G4endl;
01029 
01030                         G4int StateDiQ=0;
01031                         do // while(Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<>0);
01032                         {
01033                                 //G4cout<<G4endl<<"Di_q1 Di_q2 ProdQ StateDiQ "<<BaryonWeight[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<<" "<<Di_q1-1<<" "<<Di_q2-1<<" "<<ProdQ-1<<" "<<StateDiQ<<G4endl;
01034                                 RightHadron=G4ParticleTable::GetParticleTable()->FindParticle(
01035                                                                 +Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]);
01036                                 G4double RightHadronMass=RightHadron->GetPDGMass();
01037 
01038                                 //G4cout<<"Baryon "<<RightHadron->GetParticleName()<<G4endl;
01039 
01040                                 //G4cout<<"StringMass LeftHadronMass RightHadronMass "<<StringMass<<" "<<LeftHadronMass<<" "<< RightHadronMass<<G4endl;
01041 
01042                                 if(StringMass >= LeftHadronMass + RightHadronMass)
01043                                 {
01044                                         G4double FS_Psqr=lambda(StringMassSqr,sqr(LeftHadronMass),
01045                                                                 sqr(RightHadronMass));
01046                                         //FS_Psqr=1.;
01047                                         FS_Weight[NumberOf_FS]=std::sqrt(FS_Psqr)*FS_Psqr*
01048                                                                BaryonWeight[ADi_q1-1][ADi_q2-1][ProdQ-1][StateADiQ]*
01049                                                                BaryonWeight[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]*
01050                                                                Prob_QQbar[ProdQ-1];
01051 
01052                                         FS_LeftHadron[NumberOf_FS] = LeftHadron;
01053                                         FS_RightHadron[NumberOf_FS]= RightHadron;
01054 
01055                                         //G4cout<<"State "<<NumberOf_FS<<" "<<BaryonWeight[ADi_q1-1][ADi_q2-1][ProdQ-1][StateADiQ]*BaryonWeight[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<<G4endl;
01056                                         //G4cout<<"State "<<NumberOf_FS<<" "<<std::sqrt(FS_Psqr/4./StringMassSqr)<<" "<<std::sqrt(FS_Psqr)<<" "<<FS_Weight[NumberOf_FS]<<G4endl;
01057                                         NumberOf_FS++;
01058 
01059                                         if(NumberOf_FS > 34)
01060                                         {G4int Uzhi; G4cout<<"QQ_QQbar string #_FS "<<NumberOf_FS<<G4endl; G4cin>>Uzhi;}
01061                                 } // End of if(StringMass >= LeftHadronMass + RightHadronMass)
01062 
01063                                 StateDiQ++;
01064                                 //G4cout<<Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<<" "<<Di_q1-1<<" "<<Di_q2-1<<" "<<ProdQ-1<<" "<<StateDiQ<<G4endl;
01065                         } while(Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]!=0);
01066 
01067                         StateADiQ++;
01068                 } while(Baryon[ADi_q1-1][ADi_q2-1][ProdQ-1][StateADiQ]!=0);
01069         } // End of for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01070 
01071         return true;
01072 }
01073 
01074 //----------------------------------------------------------------------------------------
01075 G4bool G4LundStringFragmentation::
01076 Quark_Diquark_lastSplitting(G4FragmentingString * & string,
01077                             G4ParticleDefinition * & LeftHadron,
01078                             G4ParticleDefinition * & RightHadron)
01079 {
01080         G4double StringMass   = string->Mass();
01081         G4double StringMassSqr= sqr(StringMass);
01082 
01083         G4ParticleDefinition * Di_Quark;
01084         G4ParticleDefinition * Quark;
01085 
01086         if(string->GetLeftParton()->GetParticleSubType()== "quark")
01087         {
01088                 Quark   =string->GetLeftParton();
01089                 Di_Quark=string->GetRightParton();
01090         } else
01091         {
01092                 Quark   =string->GetRightParton();
01093                 Di_Quark=string->GetLeftParton();
01094         }
01095 
01096         G4int IDquark        =Quark->GetPDGEncoding();
01097         G4int AbsIDquark     =std::abs(IDquark);
01098         G4int IDdi_quark   =Di_Quark->GetPDGEncoding();
01099         G4int AbsIDdi_quark=std::abs(IDdi_quark);
01100         G4int Di_q1=AbsIDdi_quark/1000;
01101         G4int Di_q2=(AbsIDdi_quark-Di_q1*1000)/100;
01102         //G4cout<<"IDs "<<IDdi_quark<<" "<<IDquark<<G4endl;
01103 
01104         G4int              SignDiQ= 1;
01105         if(IDdi_quark < 0) SignDiQ=-1;
01106 
01107         NumberOf_FS=0;
01108         for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01109         {
01110                 G4int SignQ;
01111                 if(IDquark > 0)
01112                 {                                   SignQ=-1;
01113                         if(IDquark == 2)                   SignQ= 1;
01114                         if((IDquark == 1) && (ProdQ == 3)) SignQ= 1; // K0
01115                         if((IDquark == 3) && (ProdQ == 1)) SignQ=-1; // K0bar
01116                 } else
01117                 {
01118                         SignQ= 1;
01119                         if(IDquark == -2)                  SignQ=-1;
01120                         if((IDquark ==-1) && (ProdQ == 3)) SignQ=-1; // K0bar
01121                         if((IDquark ==-3) && (ProdQ == 1)) SignQ= 1; // K0
01122                 }
01123 
01124                 if(AbsIDquark == ProdQ)            SignQ= 1;
01125 
01126                 //G4cout<<G4endl;
01127                 //G4cout<<"Insert QQbar "<<ProdQ<<" Sign "<<SignQ<<G4endl;
01128 
01129                 G4int StateQ=0;
01130                 do  // while(Meson[AbsIDquark-1][ProdQ-1][StateQ]<>0);
01131                 {
01132                         //G4cout<<G4endl<<"AbsIDquark ProdQ StateQ "<<MesonWeight[AbsIDquark-1][ProdQ-1][StateQ]<<" "<<AbsIDquark<<" "<<ProdQ<<" "<<StateQ<<G4endl;
01133                         //G4cout<<G4endl<<"AbsIDquark ProdQ StateQ "<<SignQ*Meson[AbsIDquark-1][ProdQ-1][StateQ]<<" "<<AbsIDquark<<" "<<ProdQ<<" "<<StateQ<<G4endl;
01134                         LeftHadron=G4ParticleTable::GetParticleTable()->FindParticle(SignQ*
01135                                                         Meson[AbsIDquark-1][ProdQ-1][StateQ]);
01136                         G4double LeftHadronMass=LeftHadron->GetPDGMass();
01137 
01138                         //G4cout<<"Meson "<<LeftHadron->GetParticleName()<<G4endl;
01139 
01140                         G4int StateDiQ=0;
01141                         do // while(Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<>0);
01142                         {
01143                                 //G4cout<<G4endl<<"Di_q1 Di_q2 ProdQ StateDiQ "<<BaryonWeight[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<<" "<<Di_q1-1<<" "<<Di_q2-1<<" "<<ProdQ-1<<" "<<StateDiQ<<G4endl;
01144                                 RightHadron=G4ParticleTable::GetParticleTable()->FindParticle(SignDiQ*
01145                                                                 Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]);
01146                                 G4double RightHadronMass=RightHadron->GetPDGMass();
01147 
01148                                 //G4cout<<"Baryon "<<RightHadron->GetParticleName()<<G4endl;
01149 
01150                                 //G4cout<<"StringMass LeftHadronMass RightHadronMass "<<StringMass<<" "<<LeftHadronMass<<" "<< RightHadronMass<<G4endl;
01151 
01152                                 if(StringMass >= LeftHadronMass + RightHadronMass)
01153                                 {
01154                                         G4double FS_Psqr=lambda(StringMassSqr,sqr(LeftHadronMass),
01155                                                                 sqr(RightHadronMass));
01156                                         FS_Weight[NumberOf_FS]=std::sqrt(FS_Psqr)*
01157                                                                MesonWeight[AbsIDquark-1][ProdQ-1][StateQ]*
01158                                                                BaryonWeight[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]*
01159                                                                Prob_QQbar[ProdQ-1];
01160 
01161                                         FS_LeftHadron[NumberOf_FS] = LeftHadron;
01162                                         FS_RightHadron[NumberOf_FS]= RightHadron;
01163 
01164                                         //G4cout<<"State "<<NumberOf_FS<<" "<<std::sqrt(FS_Psqr/4./StringMassSqr)<<" "<<std::sqrt(FS_Psqr)<<" "<<FS_Weight[NumberOf_FS]<<G4endl;
01165                                         //G4cout<<"++++++++++++++++++++++++++++++++"<<G4endl;
01166                                         NumberOf_FS++;
01167 
01168                                         if(NumberOf_FS > 34)
01169                                         {G4int Uzhi; G4cout<<"QQbar string #_FS "<<NumberOf_FS<<G4endl; G4cin>>Uzhi;}
01170                                 } // End of if(StringMass >= LeftHadronMass + RightHadronMass)
01171 
01172                                 StateDiQ++;
01173                                 //G4cout<<Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]<<" "<<Di_q1-1<<" "<<Di_q2-1<<" "<<ProdQ-1<<" "<<StateDiQ<<G4endl;
01174                         } while(Baryon[Di_q1-1][Di_q2-1][ProdQ-1][StateDiQ]!=0);
01175 
01176                         StateQ++;
01177                 } while(Meson[AbsIDquark-1][ProdQ-1][StateQ]!=0);
01178         } // End of for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01179 
01180         return true;
01181 }
01182 
01183 //----------------------------------------------------------------------------------------
01184 G4bool G4LundStringFragmentation::
01185 Quark_AntiQuark_lastSplitting(G4FragmentingString * & string,
01186                               G4ParticleDefinition * & LeftHadron,
01187                               G4ParticleDefinition * & RightHadron)
01188 {
01189         G4double StringMass   = string->Mass();
01190         G4double StringMassSqr= sqr(StringMass);
01191 
01192         G4ParticleDefinition * Quark;
01193         G4ParticleDefinition * Anti_Quark;
01194 
01195         if(string->GetLeftParton()->GetPDGEncoding()>0)
01196         {
01197                 Quark     =string->GetLeftParton();
01198                 Anti_Quark=string->GetRightParton();
01199         } else
01200         {
01201                 Quark     =string->GetRightParton();
01202                 Anti_Quark=string->GetLeftParton();
01203         }
01204 
01205         //G4cout<<" Quarks "<<Quark->GetParticleName()<<" "<<Anti_Quark->GetParticleName()<<G4endl;
01206         G4int IDquark        =Quark->GetPDGEncoding();
01207         G4int AbsIDquark     =std::abs(IDquark);
01208         G4int IDanti_quark   =Anti_Quark->GetPDGEncoding();
01209         G4int AbsIDanti_quark=std::abs(IDanti_quark);
01210 
01211         NumberOf_FS=0;
01212         for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01213         {
01214                 //G4cout<<"ProdQ "<<ProdQ<<G4endl;
01215                 G4int                              SignQ=-1;
01216                 if(IDquark == 2)                   SignQ= 1;
01217                 if((IDquark == 1) && (ProdQ == 3)) SignQ= 1; // K0
01218                 if((IDquark == 3) && (ProdQ == 1)) SignQ=-1; // K0bar
01219                 if(IDquark == ProdQ)               SignQ= 1;
01220 
01221                 G4int                                   SignAQ= 1;
01222                 if(IDanti_quark == -2)                  SignAQ=-1;
01223                 if((IDanti_quark ==-1) && (ProdQ == 3)) SignAQ=-1; // K0bar
01224                 if((IDanti_quark ==-3) && (ProdQ == 1)) SignAQ= 1; // K0
01225                 if(AbsIDanti_quark == ProdQ)            SignAQ= 1;
01226 
01227                 G4int StateQ=0;
01228                 do  // while(Meson[AbsIDquark-1][ProdQ-1][StateQ]<>0);
01229                 {
01230                         LeftHadron=G4ParticleTable::GetParticleTable()->FindParticle(SignQ*
01231                                                        Meson[AbsIDquark-1][ProdQ-1][StateQ]);
01232                         G4double LeftHadronMass=LeftHadron->GetPDGMass();
01233                         StateQ++;
01234 
01235                         G4int StateAQ=0;
01236                         do // while(Meson[AbsIDanti_quark-1][ProdQ-1][StateAQ]<>0);
01237                         {
01238                                 RightHadron=G4ParticleTable::GetParticleTable()->FindParticle(SignAQ*
01239                                                                 Meson[AbsIDanti_quark-1][ProdQ-1][StateAQ]);
01240                                 G4double RightHadronMass=RightHadron->GetPDGMass();
01241                                 StateAQ++;
01242 
01243                                 if(StringMass >= LeftHadronMass + RightHadronMass)
01244                                 {
01245                                         G4double FS_Psqr=lambda(StringMassSqr,sqr(LeftHadronMass),
01246                                                                 sqr(RightHadronMass));
01247                                         //FS_Psqr=1.;
01248                                         FS_Weight[NumberOf_FS]=std::sqrt(FS_Psqr)*
01249                                                                MesonWeight[AbsIDquark-1][ProdQ-1][StateQ]*
01250                                                                MesonWeight[AbsIDanti_quark-1][ProdQ-1][StateAQ]*
01251                                                                Prob_QQbar[ProdQ-1];
01252 
01253                                         if(string->GetLeftParton()->GetPDGEncoding()>0)
01254                                         {
01255                                                 FS_LeftHadron[NumberOf_FS] = RightHadron;
01256                                                 FS_RightHadron[NumberOf_FS]= LeftHadron;
01257                                         } else
01258                                         {
01259                                                 FS_LeftHadron[NumberOf_FS] = LeftHadron;
01260                                                 FS_RightHadron[NumberOf_FS]= RightHadron;
01261                                         }
01262                                         NumberOf_FS++;
01263                                         //G4cout<<LeftHadron->GetParticleName()<<" "<<RightHadron->GetParticleName()<<" ";
01264                                         //G4cout<<"Masses "<<StringMass<<" "<<LeftHadronMass<<" "<<RightHadronMass<<" "<<NumberOf_FS-1<<G4endl; //FS_Psqr<<G4endl;
01265 
01266                                         if(NumberOf_FS > 34)
01267                                         {G4int Uzhi; G4cout<<"QQbar string #_FS "<<NumberOf_FS<<G4endl; G4cin>>Uzhi;}
01268                                 } // End of if(StringMass >= LeftHadronMass + RightHadronMass)
01269                         } while(Meson[AbsIDanti_quark-1][ProdQ-1][StateAQ]!=0);
01270                 } while(Meson[AbsIDquark-1][ProdQ-1][StateQ]!=0);
01271         } // End of for(G4int ProdQ=1; ProdQ < 4; ProdQ++)
01272 
01273         return true;
01274 }
01275 
01276 //----------------------------------------------------------------------------------------------------------
01277 G4int G4LundStringFragmentation::SampleState(void) 
01278 {
01279         G4double SumWeights=0.;
01280         for(G4int i=0; i<NumberOf_FS; i++) {SumWeights+=FS_Weight[i];}
01281 
01282         G4double ksi=G4UniformRand();
01283         G4double Sum=0.;
01284         G4int indexPosition = 0;
01285 
01286         for(G4int i=0; i<NumberOf_FS; i++)
01287         {
01288                 Sum+=(FS_Weight[i]/SumWeights);
01289                 indexPosition=i;
01290                 if(Sum >= ksi) break;
01291         }
01292         return indexPosition;
01293 }
01294 

Generated on Mon May 27 17:48:50 2013 for Geant4 by  doxygen 1.4.7