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 #include "G4SPBaryon.hh"
00027 #include "Randomize.hh"
00028 #include "G4ParticleTable.hh"
00029
00030
00031
00032 G4int G4SPBaryon::FindQuark(G4int diQuark) const
00033 {
00034 G4double sum = GetProbability(diQuark);
00035 G4double random = G4UniformRand();
00036 G4double running = 0;
00037 G4int Quark(0);
00038 typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
00039 iter i;
00040 for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
00041 {
00042 if (std::abs((*i)->GetDiQuark()) == std::abs(diQuark))
00043 {
00044 running += (*i)->GetProbability();
00045 if (running/sum >= random)
00046 {
00047 Quark = (*i)->GetQuark();
00048 break;
00049 }
00050 }
00051 }
00052 return Quark;
00053 }
00054
00055 G4double G4SPBaryon::GetProbability(G4int diQuark) const
00056 {
00057 G4double sum = 0;
00058 typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
00059 iter i;
00060 for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
00061 {
00062 if (std::abs((*i)->GetDiQuark()) == std::abs(diQuark))
00063 {
00064 sum += (*i)->GetProbability();
00065 }
00066 }
00067 return sum;
00068 }
00069
00070 G4int G4SPBaryon::
00071 MatchDiQuarkAndGetQuark(const G4SPBaryon & aBaryon, G4int & aDiQuark) const
00072 {
00073 G4int result=0;
00074 typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
00075 iter i;
00076 G4double running = 0;
00077 G4double total = 0;
00078 for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
00079 {
00080 total += aBaryon.GetProbability((*i)->GetDiQuark());
00081 }
00082 G4double random = G4UniformRand()*total;
00083 for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
00084 {
00085 running += aBaryon.GetProbability((*i)->GetDiQuark());
00086 if(random/total<running)
00087 {
00088 result = (*i)->GetQuark();
00089 aDiQuark = (*i)->GetDiQuark();
00090 break;
00091 }
00092 }
00093 return result;
00094 }
00095
00096 void G4SPBaryon::
00097 SampleQuarkAndDiquark(G4int & quark, G4int & diQuark) const
00098 {
00099 typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
00100 G4double random = G4UniformRand();
00101 G4double sum = 0;
00102 iter i;
00103 for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
00104 {
00105 sum += (*i)->GetProbability();
00106 if (sum > random)
00107 {
00108 if (theDefinition->GetPDGEncoding() < 0)
00109 {
00110 quark = (*i)->GetDiQuark();
00111 diQuark = (*i)->GetQuark();
00112 }
00113 else
00114 {
00115 quark = (*i)->GetQuark();
00116 diQuark = (*i)->GetDiQuark();
00117 }
00118 break;
00119 }
00120 }
00121 }
00122
00123 void G4SPBaryon::
00124 FindDiquark(G4int quark, G4int & diQuark) const
00125 {
00126 typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
00127 G4double sum = 0;
00128 iter i;
00129 for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
00130 {
00131 if (std::abs((*i)->GetQuark()) == std::abs(quark))
00132 {
00133 sum += (*i)->GetProbability();
00134 }
00135 }
00136 G4double random = G4UniformRand();
00137 G4double running = 0;
00138 for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
00139 {
00140 if (std::abs((*i)->GetQuark()) == std::abs(quark))
00141 {
00142 running += (*i)->GetProbability();
00143 if (running/sum >= random)
00144 {
00145 diQuark = (*i)->GetDiQuark();
00146 break;
00147 }
00148 }
00149 }
00150 }
00151
00152
00153 G4SPBaryon::
00154 G4SPBaryon(G4Proton * aProton)
00155 {
00156 theDefinition = aProton;
00157 thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3.));
00158 thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./6.));
00159 thePartonInfo.push_back(new G4SPPartonInfo(2101, 2, 1./2.));
00160 }
00161
00162 G4SPBaryon::
00163 G4SPBaryon(G4AntiProton * aAntiProton)
00164 {
00165 theDefinition = aAntiProton;
00166 thePartonInfo.push_back(new G4SPPartonInfo(-2203, -1, 1./3.));
00167 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 1./6.));
00168 thePartonInfo.push_back(new G4SPPartonInfo(-2101, -2, 1./2.));
00169 }
00170
00171 G4SPBaryon::
00172 G4SPBaryon(G4Neutron * aNeutron)
00173 {
00174 theDefinition = aNeutron;
00175 thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 1./6.));
00176 thePartonInfo.push_back(new G4SPPartonInfo(2101, 1, 1./2.));
00177 thePartonInfo.push_back(new G4SPPartonInfo(1103, 2, 1./3.));
00178 }
00179
00180 G4SPBaryon::
00181 G4SPBaryon(G4AntiNeutron * aAntiNeutron)
00182 {
00183 theDefinition = aAntiNeutron;
00184 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -1, 1./6.));
00185 thePartonInfo.push_back(new G4SPPartonInfo(-2101, -1, 1./2.));
00186 thePartonInfo.push_back(new G4SPPartonInfo(-1103, -2, 1./3.));
00187 }
00188
00189 G4SPBaryon::
00190 G4SPBaryon(G4Lambda * aLambda)
00191 {
00192 theDefinition = aLambda;
00193 thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.));
00194 thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./4.));
00195 thePartonInfo.push_back(new G4SPPartonInfo(3201, 1, 1./12.));
00196 thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./4.));
00197 thePartonInfo.push_back(new G4SPPartonInfo(3101, 2, 1./12.));
00198 }
00199
00200 G4SPBaryon::
00201 G4SPBaryon(G4AntiLambda * aAntiLambda)
00202 {
00203 theDefinition = aAntiLambda;
00204 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
00205 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./4.));
00206 thePartonInfo.push_back(new G4SPPartonInfo(-3201, -1, 1./12.));
00207 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./4.));
00208 thePartonInfo.push_back(new G4SPPartonInfo(-3101, -2, 1./12.));
00209 }
00210
00211 G4SPBaryon::
00212 G4SPBaryon(G4SigmaPlus * aSigmaPlus)
00213 {
00214 theDefinition = aSigmaPlus;
00215 thePartonInfo.push_back(new G4SPPartonInfo(2203, 3, 1./3.));
00216 thePartonInfo.push_back(new G4SPPartonInfo(3203, 2, 1./6.));
00217 thePartonInfo.push_back(new G4SPPartonInfo(3201, 2, 1./2.));
00218 }
00219
00220 G4SPBaryon::
00221 G4SPBaryon(G4AntiSigmaPlus * aAntiSigmaPlus)
00222 {
00223 theDefinition = aAntiSigmaPlus;
00224 thePartonInfo.push_back(new G4SPPartonInfo(-2203, -3, 1./3.));
00225 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -2, 1./6.));
00226 thePartonInfo.push_back(new G4SPPartonInfo(-3201, -2, 1./2.));
00227 }
00228
00229 G4SPBaryon::
00230 G4SPBaryon(G4SigmaZero * aSigmaZero)
00231 {
00232 theDefinition = aSigmaZero;
00233 thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.));
00234 thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./12.));
00235 thePartonInfo.push_back(new G4SPPartonInfo(3201, 1, 1./4.));
00236 thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./12.));
00237 thePartonInfo.push_back(new G4SPPartonInfo(3101, 2, 1./4.));
00238 }
00239
00240 G4SPBaryon::
00241 G4SPBaryon(G4AntiSigmaZero * aAntiSigmaZero)
00242 {
00243 theDefinition = aAntiSigmaZero;
00244 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
00245 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./12.));
00246 thePartonInfo.push_back(new G4SPPartonInfo(-3201, -1, 1./4.));
00247 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./12.));
00248 thePartonInfo.push_back(new G4SPPartonInfo(-3101, -2, 1./4.));
00249 }
00250
00251 G4SPBaryon::
00252 G4SPBaryon(G4SigmaMinus * aSigmaMinus)
00253 {
00254 theDefinition = aSigmaMinus;
00255 thePartonInfo.push_back(new G4SPPartonInfo(1103, 3, 1./3.));
00256 thePartonInfo.push_back(new G4SPPartonInfo(3103, 1, 1./6.));
00257 thePartonInfo.push_back(new G4SPPartonInfo(3101, 1, 1./2.));
00258 }
00259
00260 G4SPBaryon::
00261 G4SPBaryon(G4AntiSigmaMinus * aAntiSigmaMinus)
00262 {
00263 theDefinition = aAntiSigmaMinus;
00264 thePartonInfo.push_back(new G4SPPartonInfo(-1103, -3, 1./3.));
00265 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -1, 1./6.));
00266 thePartonInfo.push_back(new G4SPPartonInfo(-3101, -1, 1./2.));
00267 }
00268
00269 G4SPBaryon::
00270 G4SPBaryon(G4XiMinus * aXiMinus)
00271 {
00272 theDefinition = aXiMinus;
00273 thePartonInfo.push_back(new G4SPPartonInfo(3103, 3, 1./6.));
00274 thePartonInfo.push_back(new G4SPPartonInfo(3101, 3, 1./2.));
00275 thePartonInfo.push_back(new G4SPPartonInfo(3303, 1, 1./3.));
00276 }
00277
00278 G4SPBaryon::
00279 G4SPBaryon(G4AntiXiMinus * aAntiXiMinus)
00280 {
00281 theDefinition = aAntiXiMinus;
00282 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -3, 1./6.));
00283 thePartonInfo.push_back(new G4SPPartonInfo(-3101, -3, 1./2.));
00284 thePartonInfo.push_back(new G4SPPartonInfo(-3303, -1, 1./3.));
00285 }
00286
00287 G4SPBaryon::
00288 G4SPBaryon(G4XiZero * aXiZero)
00289 {
00290 theDefinition = aXiZero;
00291 thePartonInfo.push_back(new G4SPPartonInfo(3203, 3, 1./6.));
00292 thePartonInfo.push_back(new G4SPPartonInfo(3201, 3, 1./2.));
00293 thePartonInfo.push_back(new G4SPPartonInfo(3303, 2, 1./3.));
00294 }
00295
00296 G4SPBaryon::
00297 G4SPBaryon(G4AntiXiZero * aAntiXiZero)
00298 {
00299 theDefinition = aAntiXiZero;
00300 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -3, 1./6.));
00301 thePartonInfo.push_back(new G4SPPartonInfo(-3201, -3, 1./2.));
00302 thePartonInfo.push_back(new G4SPPartonInfo(-3303, -2, 1./3.));
00303 }
00304
00305 G4SPBaryon::
00306 G4SPBaryon(G4OmegaMinus * anOmegaMinus)
00307 {
00308 theDefinition = anOmegaMinus;
00309 thePartonInfo.push_back(new G4SPPartonInfo(3303, 3, 1.));
00310 }
00311
00312
00313 G4SPBaryon::
00314 G4SPBaryon(G4AntiOmegaMinus * anAntiOmegaMinus)
00315 {
00316 theDefinition = anAntiOmegaMinus;
00317 thePartonInfo.push_back(new G4SPPartonInfo(-3303, -3, 1.));
00318 }
00319
00320
00321 G4SPBaryon::
00322 G4SPBaryon(G4ParticleDefinition * aDefinition)
00323 {
00324 theDefinition = aDefinition;
00325 if(theDefinition ==
00326 G4ParticleTable::GetParticleTable()->FindParticle(2224))
00327 {
00328 thePartonInfo.push_back(new G4SPPartonInfo(2203, 2, 1.));
00329 }
00330 else if(theDefinition ==
00331 G4ParticleTable::GetParticleTable()->FindParticle(-2224))
00332 {
00333 thePartonInfo.push_back(new G4SPPartonInfo(-2203, -2, 1.));
00334 }
00335 else if(theDefinition ==
00336 G4ParticleTable::GetParticleTable()->FindParticle(2214))
00337 {
00338 thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3.));
00339 thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 2./3.));
00340 }
00341 else if(theDefinition ==
00342 G4ParticleTable::GetParticleTable()->FindParticle(-2214))
00343 {
00344 thePartonInfo.push_back(new G4SPPartonInfo(-2203, -1, 1./3.));
00345 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 2./3.));
00346 }
00347 else if(theDefinition ==
00348 G4ParticleTable::GetParticleTable()->FindParticle(2114))
00349 {
00350 thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 2./3.));
00351 thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./3.));
00352 }
00353 else if(theDefinition ==
00354 G4ParticleTable::GetParticleTable()->FindParticle(-2114))
00355 {
00356 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -1, 2./3.));
00357 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 1./3.));
00358 }
00359 else if(theDefinition ==
00360 G4ParticleTable::GetParticleTable()->FindParticle(1114))
00361 {
00362 thePartonInfo.push_back(new G4SPPartonInfo(1103, 1, 1.));
00363 }
00364 else if(theDefinition ==
00365 G4ParticleTable::GetParticleTable()->FindParticle(-1114))
00366 {
00367 thePartonInfo.push_back(new G4SPPartonInfo(-1103, -1, 1.));
00368 }
00369 else if(theDefinition ==
00370 G4ParticleTable::GetParticleTable()->FindParticle(3224))
00371 {
00372 thePartonInfo.push_back(new G4SPPartonInfo(2203, 3, 1./3.));
00373 thePartonInfo.push_back(new G4SPPartonInfo(3203, 2, 2./3.));
00374 }
00375 else if(theDefinition ==
00376 G4ParticleTable::GetParticleTable()->FindParticle(-3224))
00377 {
00378 thePartonInfo.push_back(new G4SPPartonInfo(-2203, -3, 1./3.));
00379 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -2, 2./3.));
00380 }
00381 else if(theDefinition ==
00382 G4ParticleTable::GetParticleTable()->FindParticle(3214))
00383 {
00384 thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.));
00385 thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./3.));
00386 thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./3.));
00387 }
00388 else if(theDefinition ==
00389 G4ParticleTable::GetParticleTable()->FindParticle(-3214))
00390 {
00391 thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
00392 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./3.));
00393 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./3.));
00394 }
00395 else if(theDefinition ==
00396 G4ParticleTable::GetParticleTable()->FindParticle(3114))
00397 {
00398 thePartonInfo.push_back(new G4SPPartonInfo(1103, 3, 1./3.));
00399 thePartonInfo.push_back(new G4SPPartonInfo(3103, 1, 2./3.));
00400 }
00401 else if(theDefinition ==
00402 G4ParticleTable::GetParticleTable()->FindParticle(-3224))
00403 {
00404 thePartonInfo.push_back(new G4SPPartonInfo(-1103, -3, 1./3.));
00405 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -1, 2./3.));
00406 }
00407 else if(theDefinition ==
00408 G4ParticleTable::GetParticleTable()->FindParticle(3324))
00409 {
00410 thePartonInfo.push_back(new G4SPPartonInfo(3203, 3, 1./3.));
00411 thePartonInfo.push_back(new G4SPPartonInfo(3303, 2, 2./3.));
00412 }
00413 else if(theDefinition ==
00414 G4ParticleTable::GetParticleTable()->FindParticle(-3324))
00415 {
00416 thePartonInfo.push_back(new G4SPPartonInfo(-3203, -3, 1./3.));
00417 thePartonInfo.push_back(new G4SPPartonInfo(-3303, -2, 2./3.));
00418 }
00419 else if(theDefinition ==
00420 G4ParticleTable::GetParticleTable()->FindParticle(3314))
00421 {
00422 thePartonInfo.push_back(new G4SPPartonInfo(3103, 3, 2./3.));
00423 thePartonInfo.push_back(new G4SPPartonInfo(3303, 1, 1./3.));
00424 }
00425 else if(theDefinition ==
00426 G4ParticleTable::GetParticleTable()->FindParticle(-3314))
00427 {
00428 thePartonInfo.push_back(new G4SPPartonInfo(-3103, -3, 2./3.));
00429 thePartonInfo.push_back(new G4SPPartonInfo(-3303, -1, 1./3.));
00430 }
00431 }
00432
00433 G4SPBaryon::~G4SPBaryon()
00434 {
00435 for(unsigned int i=0;i<thePartonInfo.size(); i++) delete thePartonInfo[i];
00436 }