G4QParton.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 //      ---------------- G4QParton ----------------
00033 //             by Mikhail Kossov, Oct 2006.
00034 //   class for Parton (inside a string) used by Parton String Models
00035 //   For comparison mirror member functions are taken from G4 class:
00036 //   G4Parton
00037 // ------------------------------------------------------------------------
00038 // Short description: The Quark-Gluon String consists of the partons, which
00039 // are quarks and some times gluons.
00040 // ------------------------------------------------------------------------
00041 
00042 //#define debug
00043 
00044 #include "G4QParton.hh"
00045 
00046 G4QParton::G4QParton() // By default creates only quarks (not di-quarks)
00047 {
00048   // CHIPS is working only with u, d, and s quarks (SU(3)xSU(3)) (no gluons! M.K.)
00049   // Random Flavor/Colour/Spin definition for default constructor (with .3 s-suppresion)
00050   PGGCode=(G4int)(2.3*G4UniformRand())+1; //@@ Additional parameter of s/u (M.K.)
00051   theType=1;
00052 #ifdef debug
00053   G4cout<<"....G4QParton::DefConstructer: PDG = "<<PGGCode<<", Type="<<theType<<G4endl;
00054 #endif
00055   // random colour (1,2,3)=(R,G,B) for quarks and (-1,-2,-3)=(aR,aG,aB) for anti-quarks
00056   theColour = (G4int)(3*G4UniformRand())+1;
00057   if(theColour>3) theColour = 3;                   // Should never happend
00058   theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
00059   QCont = G4QContent(0,0,0,0,0,0);  
00060   // Default definition (initialization)
00061   theX = 0.;
00062   thePosition=G4ThreeVector(0.,0.,0.);
00063   theMomentum=G4LorentzVector(0.,0.,0.,0.);
00064 }
00065 
00066 G4QParton::G4QParton(G4int PDG)
00067 {
00068   SetPDGCode(PDG);
00069   // Default definition (initialization)
00070   theX = 0.;
00071   thePosition=G4ThreeVector(0.,0.,0.);
00072   theMomentum=G4LorentzVector(0.,0.,0.,0.);
00073 }
00074 
00075 G4QParton::G4QParton(const G4QParton &right)
00076 {
00077   PGGCode     = right.PGGCode;
00078   QCont       = right.QCont;
00079   theType     = right.theType;
00080   theMomentum = right.theMomentum;
00081   thePosition = right.thePosition;
00082   theX        = right.theX;
00083   theColour   = right.theColour;
00084   theSpinZ    = right.theSpinZ;
00085 #ifdef debug
00086   G4cout<<"G4QParton::RCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
00087         <<theSpinZ<<G4endl;
00088 #endif
00089 }
00090 
00091 G4QParton::G4QParton(const G4QParton* right)
00092 {
00093   PGGCode       = right->PGGCode;
00094   QCont         = right->QCont;
00095   theType       = right->theType;
00096   theMomentum   = right->theMomentum;
00097   thePosition   = right->thePosition;
00098   theX          = right->theX;
00099   theColour     = right->theColour;
00100   theSpinZ      = right->theSpinZ;
00101 #ifdef debug
00102   G4cout<<"G4QParton::PCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
00103         <<theSpinZ<<G4endl;
00104 #endif
00105 }
00106 
00107 const G4QParton& G4QParton::operator=(const G4QParton &right)
00108 {
00109   if(this != &right)                          // Beware of self assignment
00110   {
00111     PGGCode     = right.GetPDGCode();
00112     QCont       = right.QCont;
00113     theType     = right.GetType();
00114     theMomentum = right.Get4Momentum();
00115     thePosition = right.GetPosition();
00116     theX        = right.theX;
00117     theColour   = right.theColour;
00118     theSpinZ    = right.theSpinZ; 
00119 #ifdef debug
00120     G4cout<<"G4QParton::=Constructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
00121           <<theSpinZ<<G4endl;
00122 #endif
00123   }
00124   return *this;
00125 }
00126 
00127 G4QParton::~G4QParton() {}
00128 
00129 // Redefine the parton nature without changing x, 4Mom, Pos etc.
00130 void G4QParton::SetPDGCode(G4int PDG)
00131 {
00132   PGGCode=PDG;
00133   G4int aPDG=std::abs(PDG);
00134   if(aPDG < 3304 && aPDG > 1100 && aPDG%100 < 4) // di-quark
00135   {
00136     theType=2;
00137     G4int cPDG=aPDG/100;
00138     if(PDG>0)
00139     {
00140       if     (cPDG==11) QCont=G4QContent(2,0,0,0,0,0);   // dd
00141       else if(cPDG==21) QCont=G4QContent(1,1,0,0,0,0);   // ud
00142       else if(cPDG==22) QCont=G4QContent(0,2,0,0,0,0);   // uu
00143       else if(cPDG==31) QCont=G4QContent(1,0,1,0,0,0);   // sd
00144       else if(cPDG==32) QCont=G4QContent(0,1,1,0,0,0);   // su
00145       else if(cPDG==33) QCont=G4QContent(0,0,2,0,0,0);   // ss
00146       else
00147       {
00148         G4cerr<<"***G4QParton::SetPDGCode: bad di-quark PDG="<<PDG<<G4endl;
00149         G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) DiQuark");
00150       }
00151     }
00152     else
00153     {
00154       if     (cPDG==11) QCont=G4QContent(0,0,0,2,0,0);   // anti-dd
00155       else if(cPDG==21) QCont=G4QContent(0,0,0,1,1,0);   // anti-ud
00156       else if(cPDG==22) QCont=G4QContent(0,0,0,0,2,0);   // anti-uu
00157       else if(cPDG==31) QCont=G4QContent(0,0,0,1,0,1);   // anti-sd
00158       else if(cPDG==32) QCont=G4QContent(0,0,0,0,1,1);   // anti-su
00159       else if(cPDG==33) QCont=G4QContent(0,0,0,0,0,2);   // anti-ss
00160       else
00161       {
00162         G4cerr<<"***G4QParton::SetPDGCode: bad anti-di-quark PDG="<<PDG<<G4endl;
00163         G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) AntiDiQuark");
00164       }
00165     }
00166   }
00167   else if(aPDG && aPDG<4)                        // quark
00168   {
00169     theType=1;
00170     if(PDG>0)
00171     {
00172       if     (PDG==1) QCont=G4QContent(1,0,0,0,0,0);   // d
00173       else if(PDG==2) QCont=G4QContent(0,1,0,0,0,0);   // u
00174       else if(PDG==3) QCont=G4QContent(0,0,1,0,0,0);   // s
00175       else
00176       {
00177         G4cerr<<"***G4QParton::SetPDGCode: bad quark PDG="<<PDG<<G4endl;
00178         G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Quark");
00179       }
00180     }
00181     else
00182     {
00183       if     (PDG==-1) QCont=G4QContent(0,0,0,1,0,0);  // anti-d
00184       else if(PDG==-2) QCont=G4QContent(0,0,0,0,1,0);  // anti-u
00185       else if(PDG==-3) QCont=G4QContent(0,0,0,0,0,1);  // anti-s
00186       else
00187       {
00188         G4cerr<<"***G4QParton::SetPDGCode: bad anti-quark PDG="<<PDG<<G4endl;
00189         G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Anti-Quark");
00190       }
00191     }
00192   }
00193   else if(aPDG==9 || aPDG==21)                   // gluon
00194   {
00195     theType=0;
00196     QCont=G4QContent(0,0,0,0,0,0);
00197   }
00198   else
00199   {
00200     G4cerr<<"***G4QParton::SetPDGCode: wrong gluon/quark/diquark PDG="<<PDG<<G4endl;
00201     G4Exception("G4QParton::SetPDGCode:","72",FatalException,"WrongPartonPDG");
00202   }
00203 #ifdef debug
00204   G4cout<<"....G4QParton::SetPDGCode: PDG = "<<PDG<<", Type="<<theType<<G4endl;
00205 #endif
00206   //
00207   // colour by random in (1,2,3)=(R,G,B) for quarks and 
00208   //                  in (-1,-2,-3)=(Rbar,Gbar,Bbar) for anti-quarks:
00209   G4int RGB=(G4int)(3*G4UniformRand())+1;
00210   if(theType==1)
00211   {
00212     if(PDG>0) theColour = RGB;
00213     else      theColour =-RGB;
00214   }
00215   // colour by random in (-1,-2,-3)=(Rbar,Gbar,Bbar)=(GB,RB,RG) for di-quarks and
00216   //                  in (1,2,3)=(R,G,B)=(GB,RB,RG) for anti-di-quarks:
00217   else if(theType==2)
00218   {
00219     if(PDG>0) theColour =-RGB;
00220     else      theColour = RGB;
00221   }
00222   // ColourByRandom (-11,-12,-13,-21,...,-33)=(RRbar,RGbar,RBbar,...,BBbar) for gluons
00223   else theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
00224   //
00225   // spin-z choosen at random from PDG-encoded spin:
00226   //
00227   G4double            dPDGSpin=1.;        // Quark 2S
00228   if     (theType==0) dPDGSpin=2.;        // Gluon 2S
00229   else if(theType==2) dPDGSpin=aPDG%10-1; // Di-quark 2S
00230   theSpinZ = (G4int)((dPDGSpin+1)*G4UniformRand())-dPDGSpin/2;
00231 }
00232 
00233 // QGS x+/x- logic of the Energy and Pz calculation
00234 void G4QParton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
00235 {
00236   G4LorentzVector a4Momentum = Get4Momentum();
00237   aLightConeMomentum*=theX;
00238   G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py());
00239   a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum) *
00240                                                                       (aDirection? 1: -1));
00241   a4Momentum.setE( 0.5*(aLightConeMomentum + TransverseMass2/aLightConeMomentum));
00242   Set4Momentum(a4Momentum);
00243 }  
00244 
00245 // Reduce DiQ-aDiQ to Q-aQ (true if succeeded). General function of the QPartons operations
00246 G4bool G4QParton::ReduceDiQADiQ(G4QParton* d1, G4QParton* d2)
00247 {
00248   G4bool result=false;
00249   G4int sPDG=d1->GetPDGCode();
00250   G4int nPDG=d2->GetPDGCode();
00251 #ifdef debug
00252   G4cout<<"G4QParton::ReduceDiQADiQ: **Called** LPDG="<<sPDG<<", RPDG="<<nPDG<<G4endl;
00253 #endif
00254   G4int        qPDG=sPDG;
00255   if(qPDG<-99) qPDG=(-qPDG)/100;
00256   else         qPDG/=100;
00257   G4int        dPDG=nPDG;
00258   if(dPDG<-99) dPDG=(-dPDG)/100;
00259   else         dPDG/=100;
00260   G4int L1=qPDG/10;
00261   G4int L2=qPDG%10;
00262   G4int R1=dPDG/10;
00263   G4int R2=dPDG%10;
00264   if(L1==R1 || L1==R2 || L2==R1 || L2==R2) // Annihilation condition
00265   {
00266     if     (L1==R1)
00267     {
00268       if(sPDG>0) sPDG=L2;
00269       else       sPDG=-L2;
00270       if(nPDG>0) nPDG=R2;
00271       else       nPDG=-R2;
00272 #ifdef debug
00273       G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
00274 #endif
00275     }
00276     else if(L1==R2)
00277     {
00278       if(sPDG>0) sPDG=L2;
00279       else       sPDG=-L2;
00280       if(nPDG>0) nPDG=R1;
00281       else       nPDG=-R1;
00282 #ifdef debug
00283       G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
00284 #endif
00285     }
00286     else if(L2==R1)
00287     {
00288       if(sPDG>0) sPDG=L1;
00289       else       sPDG=-L1;
00290       if(nPDG>0) nPDG=R2;
00291       else       nPDG=-R2;
00292 #ifdef debug
00293       G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
00294 #endif
00295     }
00296     else //(L2==R2)
00297     {
00298       if(sPDG>0) sPDG=L1;
00299       else       sPDG=-L1;
00300       if(nPDG>0) nPDG=R1;
00301       else       nPDG=-R1;
00302 #ifdef debug
00303       G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
00304 #endif
00305     }
00306     d1->SetPDGCode(sPDG);             // Reset the left quark
00307     d2->SetPDGCode(nPDG);            // Reset the right quark
00308     result=true;
00309 #ifdef debug
00310     G4cout<<"G4QParton::ReduceDiQADiQ:AfterReduction,L="<<sPDG<<",R="<<nPDG<<G4endl;
00311 #endif
00312   }
00313 #ifdef debug
00314   else G4cout<<"-Warning-G4QParton::ReduceDiQADiQ:DQ-aDQ reduction to Q-aQ Failed"<<G4endl;
00315 #endif
00316   return result;
00317 }

Generated on Mon May 27 17:49:38 2013 for Geant4 by  doxygen 1.4.7