00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "G4QParton.hh"
00045
00046 G4QParton::G4QParton()
00047 {
00048
00049
00050 PGGCode=(G4int)(2.3*G4UniformRand())+1;
00051 theType=1;
00052 #ifdef debug
00053 G4cout<<"....G4QParton::DefConstructer: PDG = "<<PGGCode<<", Type="<<theType<<G4endl;
00054 #endif
00055
00056 theColour = (G4int)(3*G4UniformRand())+1;
00057 if(theColour>3) theColour = 3;
00058 theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
00059 QCont = G4QContent(0,0,0,0,0,0);
00060
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
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)
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
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)
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);
00141 else if(cPDG==21) QCont=G4QContent(1,1,0,0,0,0);
00142 else if(cPDG==22) QCont=G4QContent(0,2,0,0,0,0);
00143 else if(cPDG==31) QCont=G4QContent(1,0,1,0,0,0);
00144 else if(cPDG==32) QCont=G4QContent(0,1,1,0,0,0);
00145 else if(cPDG==33) QCont=G4QContent(0,0,2,0,0,0);
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);
00155 else if(cPDG==21) QCont=G4QContent(0,0,0,1,1,0);
00156 else if(cPDG==22) QCont=G4QContent(0,0,0,0,2,0);
00157 else if(cPDG==31) QCont=G4QContent(0,0,0,1,0,1);
00158 else if(cPDG==32) QCont=G4QContent(0,0,0,0,1,1);
00159 else if(cPDG==33) QCont=G4QContent(0,0,0,0,0,2);
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)
00168 {
00169 theType=1;
00170 if(PDG>0)
00171 {
00172 if (PDG==1) QCont=G4QContent(1,0,0,0,0,0);
00173 else if(PDG==2) QCont=G4QContent(0,1,0,0,0,0);
00174 else if(PDG==3) QCont=G4QContent(0,0,1,0,0,0);
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);
00184 else if(PDG==-2) QCont=G4QContent(0,0,0,0,1,0);
00185 else if(PDG==-3) QCont=G4QContent(0,0,0,0,0,1);
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)
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
00208
00209 G4int RGB=(G4int)(3*G4UniformRand())+1;
00210 if(theType==1)
00211 {
00212 if(PDG>0) theColour = RGB;
00213 else theColour =-RGB;
00214 }
00215
00216
00217 else if(theType==2)
00218 {
00219 if(PDG>0) theColour =-RGB;
00220 else theColour = RGB;
00221 }
00222
00223 else theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
00224
00225
00226
00227 G4double dPDGSpin=1.;
00228 if (theType==0) dPDGSpin=2.;
00229 else if(theType==2) dPDGSpin=aPDG%10-1;
00230 theSpinZ = (G4int)((dPDGSpin+1)*G4UniformRand())-dPDGSpin/2;
00231 }
00232
00233
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
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)
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
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);
00307 d2->SetPDGCode(nPDG);
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 }