G4HadronBuilder.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 //
00029 // -----------------------------------------------------------------------------
00030 //      GEANT 4 class implementation file
00031 //
00032 //      History: 
00033 //             Gunter Folger, August/September 2001
00034 //               Create class; algorithm previously in G4VLongitudinalStringDecay.
00035 // -----------------------------------------------------------------------------
00036 
00037 #include "G4HadronBuilder.hh"
00038 #include "G4SystemOfUnits.hh"
00039 #include "Randomize.hh"
00040 #include "G4HadronicException.hh"
00041 #include "G4ParticleTable.hh"
00042 
00043 G4HadronBuilder::G4HadronBuilder(G4double mesonMix, G4double barionMix,
00044                      std::vector<double> scalarMesonMix,
00045                      std::vector<double> vectorMesonMix)
00046 {
00047         mesonSpinMix=mesonMix;       
00048         barionSpinMix=barionMix;
00049         scalarMesonMixings=scalarMesonMix;
00050         vectorMesonMixings=vectorMesonMix;
00051 }
00052 
00053 G4ParticleDefinition * G4HadronBuilder::Build(G4ParticleDefinition * black, G4ParticleDefinition * white)
00054 {
00055 
00056         if (black->GetParticleSubType()== "di_quark" || white->GetParticleSubType()== "di_quark" ) {
00057 
00058 //    Barion
00059            Spin spin = (G4UniformRand() < barionSpinMix) ? SpinHalf : SpinThreeHalf;
00060            return Barion(black,white,spin);
00061 
00062         } else {        
00063 
00064 //    Meson
00065            Spin spin = (G4UniformRand() < mesonSpinMix) ? SpinZero : SpinOne;
00066            return Meson(black,white,spin);
00067 
00068         }
00069 }
00070 
00071 //-------------------------------------------------------------------------
00072 
00073 G4ParticleDefinition * G4HadronBuilder::BuildLowSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
00074 {
00075         if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
00076                 return Meson(black,white, SpinZero);
00077         } else {
00078 //                    will return a SpinThreeHalf Barion if all quarks the same
00079                 return Barion(black,white, SpinHalf); 
00080         }       
00081 }
00082 
00083 //-------------------------------------------------------------------------
00084 
00085 G4ParticleDefinition * G4HadronBuilder::BuildHighSpin(G4ParticleDefinition * black, G4ParticleDefinition * white)
00086 {
00087         if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
00088                 return Meson(black,white, SpinOne);
00089         } else {
00090                 return Barion(black,white,SpinThreeHalf);
00091         }
00092 }
00093 
00094 //-------------------------------------------------------------------------
00095 
00096 G4ParticleDefinition * G4HadronBuilder::Meson(G4ParticleDefinition * black, 
00097                                               G4ParticleDefinition * white, Spin theSpin)
00098 {
00099 #ifdef G4VERBOSE
00100 //  Verify Input Charge
00101    
00102    G4double charge =  black->GetPDGCharge() 
00103                     + white->GetPDGCharge();     
00104    if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent )   // 1.001 to avoid int(.9999) -> 0
00105         {
00106             G4cerr << " G4HadronBuilder::Build()" << G4endl;
00107             G4cerr << "    Invalid total charge found for on input: " 
00108                         << charge<< G4endl;
00109             G4cerr << "    PGDcode input quark1/quark2 : " <<
00110                         black->GetPDGEncoding() << " / "<< 
00111                         white->GetPDGEncoding() << G4endl;
00112             G4cerr << G4endl;
00113         } 
00114 #endif  
00115         
00116         G4int id1= black->GetPDGEncoding();
00117         G4int id2= white->GetPDGEncoding();
00118 //      G4int ifl1= std::max(std::abs(id1), std::abs(id2));
00119         if ( std::abs(id1) < std::abs(id2) )
00120            {
00121            G4int xchg = id1; 
00122            id1 = id2;  
00123            id2 = xchg;
00124            }
00125         
00126         if (std::abs(id1) > 3 ) 
00127            throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
00128         
00129         G4int PDGEncoding=0;
00130 
00131         if (id1 + id2 == 0) {     
00132            G4double rmix = G4UniformRand();
00133            G4int    imix = 2*std::abs(id1) - 1;
00134            if(theSpin == SpinZero) {
00135               PDGEncoding = 110*(1 + (G4int)(rmix + scalarMesonMixings[imix - 1])
00136                                    + (G4int)(rmix + scalarMesonMixings[imix])
00137                                 ) +  theSpin;
00138            } else {
00139               PDGEncoding = 110*(1 + (G4int)(rmix + vectorMesonMixings[imix - 1])
00140                                    + (G4int)(rmix + vectorMesonMixings[imix])
00141                                 ) +  theSpin;
00142            }
00143         } else {
00144            PDGEncoding = 100 * std::abs(id1) + 10 * std::abs(id2) +  theSpin;  
00145            G4bool IsUp = (std::abs(id1)&1) == 0;        // quark 1 up type quark (u or c)
00146            G4bool IsAnti = id1 < 0;             // quark 1 is antiquark?
00147            if( (IsUp && IsAnti ) || (!IsUp && !IsAnti ) ) 
00148               PDGEncoding = - PDGEncoding;
00149         }
00150            
00151            
00152         G4ParticleDefinition * MesonDef=
00153                 G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
00154 #ifdef G4VERBOSE
00155         if (MesonDef == 0 ) {
00156                 G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
00157                        << PDGEncoding << G4endl;
00158         } else if  ( (  black->GetPDGCharge() + white->GetPDGCharge()
00159                         - MesonDef->GetPDGCharge() ) > perCent   ) {
00160                 G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
00161                         << " Quark1/2 = " 
00162                         << black->GetParticleName() << " / "
00163                         << white->GetParticleName() 
00164                         << " resulting Hadron " << MesonDef->GetParticleName() 
00165                         << G4endl;
00166         }
00167 #endif
00168 
00169         return MesonDef;
00170 }
00171 
00172 
00173 G4ParticleDefinition * G4HadronBuilder::Barion(G4ParticleDefinition * black, 
00174                                               G4ParticleDefinition * white,Spin theSpin)
00175 {
00176 
00177 #ifdef G4VERBOSE
00178 //  Verify Input Charge
00179    G4double charge =  black->GetPDGCharge() 
00180                     + white->GetPDGCharge();     
00181    if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent )
00182         {
00183             G4cerr << " G4HadronBuilder::Build()" << G4endl;
00184             G4cerr << "    Invalid total charge found for on input: " 
00185                         << charge<< G4endl;
00186             G4cerr << "    PGDcode input quark1/quark2 : " <<
00187                         black->GetPDGEncoding() << " / "<< 
00188                         white->GetPDGEncoding() << G4endl;
00189             G4cerr << G4endl;
00190         } 
00191 #endif  
00192         G4int id1= black->GetPDGEncoding();
00193         G4int id2= white->GetPDGEncoding();
00194         if ( std::abs(id1) < std::abs(id2) )
00195            {
00196            G4int xchg = id1; 
00197            id1 = id2;  
00198            id2 = xchg;
00199            }
00200 
00201         if (std::abs(id1) < 1000 || std::abs(id2) > 3 ) 
00202            throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Barion: Illegal quark content as input");   
00203 
00204         G4int ifl1= std::abs(id1)/1000;
00205         G4int ifl2 = (std::abs(id1) - ifl1 * 1000)/100;
00206         G4int diquarkSpin = std::abs(id1)%10; 
00207         G4int ifl3 = id2;
00208         if (id1 < 0)
00209            {
00210            ifl1 = - ifl1;
00211            ifl2 = - ifl2;
00212            }
00213         //... Construct barion, distinguish Lambda and Sigma barions.
00214         G4int kfla = std::abs(ifl1);
00215         G4int kflb = std::abs(ifl2);
00216         G4int kflc = std::abs(ifl3);
00217 
00218         G4int kfld = std::max(kfla,kflb);
00219               kfld = std::max(kfld,kflc);
00220         G4int kflf = std::min(kfla,kflb);
00221               kflf = std::min(kflf,kflc);
00222 
00223         G4int kfle = kfla + kflb + kflc - kfld - kflf;
00224 
00225         //... barion with content uuu or ddd or sss has always spin = 3/2
00226         theSpin = (kfla == kflb && kflb == kflc)? SpinThreeHalf : theSpin;   
00227 
00228         G4int kfll = 0;
00229         if(theSpin == SpinHalf && kfld > kfle && kfle > kflf) { 
00230 // Spin J=1/2 and all three quarks different
00231 // Two states exist: (uds -> lambda or sigma0)
00232 //   -  lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
00233 //   -  sigma0: s(ud)1 s : 3212
00234            if(diquarkSpin == 1 ) {
00235               if ( kfla == kfld) {   // heaviest quark in diquark
00236                  kfll = 1;
00237               } else {
00238                  kfll = (G4int)(0.25 + G4UniformRand());
00239               }
00240            }   
00241            if(diquarkSpin == 3 && kfla != kfld)
00242                kfll = (G4int)(0.75 + G4UniformRand());
00243         }
00244         
00245         G4int PDGEncoding;
00246         if (kfll == 1)
00247            PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
00248         else    
00249            PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
00250 
00251         if (id1 < 0)
00252            PDGEncoding = -PDGEncoding;
00253 
00254 
00255         G4ParticleDefinition * BarionDef=
00256                 G4ParticleTable::GetParticleTable()->FindParticle(PDGEncoding);
00257 #ifdef G4VERBOSE
00258         if (BarionDef == 0 ) {
00259                 G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
00260                        << PDGEncoding << G4endl;
00261         } else if  ( (  black->GetPDGCharge() + white->GetPDGCharge()
00262                         - BarionDef->GetPDGCharge() ) > perCent   ) {
00263                 G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
00264                         << " DiQuark/Quark = " 
00265                         << black->GetParticleName() << " / "
00266                         << white->GetParticleName() 
00267                         << " resulting Hadron " << BarionDef->GetParticleName() 
00268                         << G4endl;
00269         }
00270 #endif
00271 
00272         return BarionDef;
00273 }

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