Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4SPBaryon.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 #include "G4SPBaryon.hh"
27 #include "Randomize.hh"
28 #include "G4ParticleTable.hh"
29 
30 // correcting numbers, HPW Dec 1999
31 
33 {
34  G4double sum = GetProbability(diQuark);
35  G4double random = G4UniformRand();
36  G4double running = 0;
37  G4int Quark(0);
38  typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
39  iter i;
40  for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
41  {
42  if (std::abs((*i)->GetDiQuark()) == std::abs(diQuark))
43  {
44  running += (*i)->GetProbability();
45  if (running/sum >= random)
46  {
47  Quark = (*i)->GetQuark();
48  break;
49  }
50  }
51  }
52  return Quark;
53 }
54 
56 {
57  G4double sum = 0;
58  typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
59  iter i;
60  for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
61  {
62  if (std::abs((*i)->GetDiQuark()) == std::abs(diQuark))
63  {
64  sum += (*i)->GetProbability();
65  }
66  }
67  return sum;
68 }
69 
70 G4int G4SPBaryon::MatchDiQuarkAndGetQuark(const G4SPBaryon & aBaryon, G4int & aDiQuark) const
71 {
72  G4int result=0;
73  typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
74  iter i;
75  G4double running = 0;
76  G4double total = 0;
77  for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
78  {
79  total += aBaryon.GetProbability((*i)->GetDiQuark());
80  }
81  G4double random = G4UniformRand()*total;
82  for(i = thePartonInfo.begin(); i!=thePartonInfo.end(); i++)
83  {
84  running += aBaryon.GetProbability((*i)->GetDiQuark());
85  if(random/total<running)
86  {
87  result = (*i)->GetQuark(); // (diquark annihilated)
88  aDiQuark = (*i)->GetDiQuark();
89  break;
90  }
91  }
92  return result;
93 }
94 
95 void G4SPBaryon::SampleQuarkAndDiquark(G4int & quark, G4int & diQuark) const
96 {
97  typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
98  G4double random = G4UniformRand();
99  G4double sum = 0;
100  iter i;
101  for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
102  {
103  sum += (*i)->GetProbability();
104  if (sum > random)
105  {
106  if (theDefinition->GetPDGEncoding() < 0)
107  {
108  quark = (*i)->GetDiQuark();
109  diQuark = (*i)->GetQuark();
110  } else {
111  quark = (*i)->GetQuark();
112  diQuark = (*i)->GetDiQuark();
113  }
114  break;
115  }
116  }
117 }
118 
119 void G4SPBaryon::FindDiquark(G4int quark, G4int & diQuark) const
120 {
121  typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
122  G4double sum = 0;
123  iter i;
124  for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
125  {
126  if (std::abs((*i)->GetQuark()) == std::abs(quark))
127  {
128  sum += (*i)->GetProbability();
129  }
130  }
131  G4double random = G4UniformRand();
132  G4double running = 0;
133  for(i=thePartonInfo.begin() ; i!=thePartonInfo.end(); i++)
134  {
135  if (std::abs((*i)->GetQuark()) == std::abs(quark))
136  {
137  running += (*i)->GetProbability();
138  if (running/sum >= random)
139  {
140  diQuark = (*i)->GetDiQuark();
141  break;
142  }
143  }
144  }
145 }
146 
147 
149 {
150  theDefinition = aProton;
151  thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3.)); // uu_1, d
152  thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./6.)); // ud_1, u
153  thePartonInfo.push_back(new G4SPPartonInfo(2101, 2, 1./2.)); // ud_0, u
154 }
155 
157 {
158  theDefinition = aAntiProton;
159  thePartonInfo.push_back(new G4SPPartonInfo(-2203, -1, 1./3.));
160  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 1./6.));
161  thePartonInfo.push_back(new G4SPPartonInfo(-2101, -2, 1./2.));
162 }
163 
165 {
166  theDefinition = aNeutron;
167  thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 1./6.)); // ud_1, d
168  thePartonInfo.push_back(new G4SPPartonInfo(2101, 1, 1./2.)); // ud_0, d
169  thePartonInfo.push_back(new G4SPPartonInfo(1103, 2, 1./3.)); // dd_1, u
170 }
171 
173 {
174  theDefinition = aAntiNeutron;
175  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -1, 1./6.));
176  thePartonInfo.push_back(new G4SPPartonInfo(-2101, -1, 1./2.));
177  thePartonInfo.push_back(new G4SPPartonInfo(-1103, -2, 1./3.));
178 }
179 
181 {
182  theDefinition = aLambda;
183  thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.)); // ud_1, s
184  thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./4.)); // su_1, d
185  thePartonInfo.push_back(new G4SPPartonInfo(3201, 1, 1./12.)); // su_0, d
186  thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./4.)); // sd_1, u
187  thePartonInfo.push_back(new G4SPPartonInfo(3101, 2, 1./12.)); // sd_0, u
188 }
189 
191 {
192  theDefinition = aAntiLambda;
193  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
194  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./4.));
195  thePartonInfo.push_back(new G4SPPartonInfo(-3201, -1, 1./12.));
196  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./4.));
197  thePartonInfo.push_back(new G4SPPartonInfo(-3101, -2, 1./12.));
198 }
199 
201 {
202  theDefinition = aSigmaPlus;
203  thePartonInfo.push_back(new G4SPPartonInfo(2203, 3, 1./3.));
204  thePartonInfo.push_back(new G4SPPartonInfo(3203, 2, 1./6.));
205  thePartonInfo.push_back(new G4SPPartonInfo(3201, 2, 1./2.));
206 }
207 
209 {
210  theDefinition = aAntiSigmaPlus;
211  thePartonInfo.push_back(new G4SPPartonInfo(-2203, -3, 1./3.));
212  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -2, 1./6.));
213  thePartonInfo.push_back(new G4SPPartonInfo(-3201, -2, 1./2.));
214 }
215 
217 {
218  theDefinition = aSigmaZero;
219  thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.));
220  thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./12.));
221  thePartonInfo.push_back(new G4SPPartonInfo(3201, 1, 1./4.));
222  thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./12.));
223  thePartonInfo.push_back(new G4SPPartonInfo(3101, 2, 1./4.));
224 }
225 
227 {
228  theDefinition = aAntiSigmaZero;
229  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
230  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./12.));
231  thePartonInfo.push_back(new G4SPPartonInfo(-3201, -1, 1./4.));
232  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./12.));
233  thePartonInfo.push_back(new G4SPPartonInfo(-3101, -2, 1./4.));
234 }
235 
237 {
238  theDefinition = aSigmaMinus;
239  thePartonInfo.push_back(new G4SPPartonInfo(1103, 3, 1./3.));
240  thePartonInfo.push_back(new G4SPPartonInfo(3103, 1, 1./6.));
241  thePartonInfo.push_back(new G4SPPartonInfo(3101, 1, 1./2.));
242 }
243 
245 {
246  theDefinition = aAntiSigmaMinus;
247  thePartonInfo.push_back(new G4SPPartonInfo(-1103, -3, 1./3.));
248  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -1, 1./6.));
249  thePartonInfo.push_back(new G4SPPartonInfo(-3101, -1, 1./2.));
250 }
251 
253 {
254  theDefinition = aXiMinus;
255  thePartonInfo.push_back(new G4SPPartonInfo(3103, 3, 1./6.));
256  thePartonInfo.push_back(new G4SPPartonInfo(3101, 3, 1./2.));
257  thePartonInfo.push_back(new G4SPPartonInfo(3303, 1, 1./3.));
258 }
259 
261 {
262  theDefinition = aAntiXiMinus;
263  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -3, 1./6.));
264  thePartonInfo.push_back(new G4SPPartonInfo(-3101, -3, 1./2.));
265  thePartonInfo.push_back(new G4SPPartonInfo(-3303, -1, 1./3.));
266 }
267 
269 {
270  theDefinition = aXiZero;
271  thePartonInfo.push_back(new G4SPPartonInfo(3203, 3, 1./6.));
272  thePartonInfo.push_back(new G4SPPartonInfo(3201, 3, 1./2.));
273  thePartonInfo.push_back(new G4SPPartonInfo(3303, 2, 1./3.));
274 }
275 
277 {
278  theDefinition = aAntiXiZero;
279  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -3, 1./6.));
280  thePartonInfo.push_back(new G4SPPartonInfo(-3201, -3, 1./2.));
281  thePartonInfo.push_back(new G4SPPartonInfo(-3303, -2, 1./3.));
282 }
283 
285 {
286  theDefinition = anOmegaMinus;
287  thePartonInfo.push_back(new G4SPPartonInfo(3303, 3, 1.));
288 }
289 
291 {
292  theDefinition = anAntiOmegaMinus;
293  thePartonInfo.push_back(new G4SPPartonInfo(-3303, -3, 1.));
294 }
295 
296 // non static particles
298 {
299  theDefinition = aDefinition;
300  if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(2224))// D++
301  {
302  thePartonInfo.push_back(new G4SPPartonInfo(2203, 2, 1.));
303  }
304  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-2224))// anti D++
305  {
306  thePartonInfo.push_back(new G4SPPartonInfo(-2203, -2, 1.));
307  }
308  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(2214))// D+
309  {
310  thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3.));
311  thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 2./3.));
312  }
313  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-2214))// anti D+
314  {
315  thePartonInfo.push_back(new G4SPPartonInfo(-2203, -1, 1./3.));
316  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 2./3.));
317  }
318  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(2114))// D0
319  {
320  thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 2./3.));
321  thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./3.));
322  }
323  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-2114))// anti D0
324  {
325  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -1, 2./3.));
326  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -2, 1./3.));
327  }
328  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(1114))// D-
329  {
330  thePartonInfo.push_back(new G4SPPartonInfo(1103, 1, 1.));
331  }
332  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-1114))// anti D-
333  {
334  thePartonInfo.push_back(new G4SPPartonInfo(-1103, -1, 1.));
335  }
336  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(3224))// S*+
337  {
338  thePartonInfo.push_back(new G4SPPartonInfo(2203, 3, 1./3.));
339  thePartonInfo.push_back(new G4SPPartonInfo(3203, 2, 2./3.));
340  }
341  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-3224))// anti S*+
342  {
343  thePartonInfo.push_back(new G4SPPartonInfo(-2203, -3, 1./3.));
344  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -2, 2./3.));
345  }
346  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(3214))// S*0
347  {
348  thePartonInfo.push_back(new G4SPPartonInfo(2103, 3, 1./3.));
349  thePartonInfo.push_back(new G4SPPartonInfo(3203, 1, 1./3.));
350  thePartonInfo.push_back(new G4SPPartonInfo(3103, 2, 1./3.));
351  }
352  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-3214))// anti S*0
353  {
354  thePartonInfo.push_back(new G4SPPartonInfo(-2103, -3, 1./3.));
355  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -1, 1./3.));
356  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -2, 1./3.));
357  }
358  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(3114))// S*-
359  {
360  thePartonInfo.push_back(new G4SPPartonInfo(1103, 3, 1./3.));
361  thePartonInfo.push_back(new G4SPPartonInfo(3103, 1, 2./3.));
362  }
363  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-3224))// anti S*-
364  {
365  thePartonInfo.push_back(new G4SPPartonInfo(-1103, -3, 1./3.));
366  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -1, 2./3.));
367  }
368  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(3324))// Xi*0
369  {
370  thePartonInfo.push_back(new G4SPPartonInfo(3203, 3, 1./3.));
371  thePartonInfo.push_back(new G4SPPartonInfo(3303, 2, 2./3.));
372  }
373  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-3324))// anti Xi*0
374  {
375  thePartonInfo.push_back(new G4SPPartonInfo(-3203, -3, 1./3.));
376  thePartonInfo.push_back(new G4SPPartonInfo(-3303, -2, 2./3.));
377  }
378  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(3314))// Xi*-
379  {
380  thePartonInfo.push_back(new G4SPPartonInfo(3103, 3, 2./3.));
381  thePartonInfo.push_back(new G4SPPartonInfo(3303, 1, 1./3.));
382  }
383  else if(theDefinition == G4ParticleTable::GetParticleTable()->FindParticle(-3314))// anti Xi*-
384  {
385  thePartonInfo.push_back(new G4SPPartonInfo(-3103, -3, 2./3.));
386  thePartonInfo.push_back(new G4SPPartonInfo(-3303, -1, 1./3.));
387  }
388 }
389 
391 {
392  for(unsigned int i=0;i<thePartonInfo.size(); i++) delete thePartonInfo[i];
393 }
394 
G4double G4ParticleHPJENDLHEData::G4double result
G4int MatchDiQuarkAndGetQuark(const G4SPBaryon &aBaryon, G4int &aDiQuark) const
Definition: G4SPBaryon.cc:70
void SampleQuarkAndDiquark(G4int &quark, G4int &diQuark) const
Definition: G4SPBaryon.cc:95
void FindDiquark(G4int quark, G4int &diQuark) const
Definition: G4SPBaryon.cc:119
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
G4int FindQuark(G4int diQuark) const
Definition: G4SPBaryon.cc:32
G4double GetProbability(G4int diQuark) const
Definition: G4SPBaryon.cc:55
G4SPBaryon(G4Proton *aProton)
Definition: G4SPBaryon.cc:148
G4double total(Particle const *const p1, Particle const *const p2)
static G4ParticleTable * GetParticleTable()
double G4double
Definition: G4Types.hh:76