Geant4  10.01.p03
G4DiffractiveSplitableHadron.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 //
27 // $Id: G4DiffractiveSplitableHadron.cc 86646 2014-11-14 13:29:39Z gcosmo $
28 // GEANT4 tag $Name: $
29 //
30 
31 // ------------------------------------------------------------
32 // GEANT 4 class implementation file
33 //
34 // ---------------- G4DiffractiveSplitableHadron----------------
35 // by Gunter Folger, August 1998.
36 // class splitting an interacting particle. Used by FTF String Model.
37 // ------------------------------------------------------------
38 
40 
41 #include "G4ParticleDefinition.hh"
42 #include "Randomize.hh"
43 
44 
45 //============================================================================
46 
48  PartonIndex = -1;
49  Parton[0] = new G4Parton( 1 );
50  Parton[1] = new G4Parton(-1 );
51 }
52 
53 
54 //============================================================================
55 
57  G4VSplitableHadron( aPrimary )
58 {
59  PartonIndex = -2;
60  Parton[0] = NULL;
61 }
62 
63 
64 //============================================================================
65 
67  G4VSplitableHadron( aNucleon )
68 {
69  PartonIndex = -2;
70  Parton[0] = NULL;
71 }
72 
73 
74 //============================================================================
75 
77  G4VSplitableHadron( aNucleon )
78 {
79  PartonIndex = -2;
80  Parton[0] = NULL;
81 }
82 
83 
84 //============================================================================
85 
87  //G4cout << "Destruct G4DiffractiveSplitableHadron" << Parton[0] << " " << Parton[1] << G4endl;
88  //if ( Parton[0] != NULL ) { delete Parton[0]; delete Parton[1]; }
89 }
90 
91 
92 //============================================================================
93 
95  //G4cout << "SplitUp() IsSplit() Parton[0] " << IsSplit() << " " << Parton[0] << G4endl;
96  if ( IsSplit() ) return;
97  Splitting();
98  // Split once only...
99  if ( Parton[0] != NULL ) return;
100 
101  // flavours of quark ends
102  G4int PDGcode = GetDefinition()->GetPDGEncoding();
103  G4int stringStart, stringEnd;
104  ChooseStringEnds( PDGcode, &stringStart, &stringEnd );
105 
106  Parton[0] = new G4Parton( stringStart );
107  Parton[1] = new G4Parton( stringEnd );
108 
109 /* // Inversion of a string
110  if ( G4UniformRand() < 1.75 ) { //0.75
111  Parton[0] = new G4Parton( stringStart );
112  Parton[1] = new G4Parton( stringEnd );
113  } else {
114  Parton[0] = new G4Parton( stringEnd );
115  Parton[1] = new G4Parton( stringStart );
116  }
117 */
118  PartonIndex = -1;
119 }
120 
121 
122 //============================================================================
123 
125  ++PartonIndex;
126  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
127  G4int PartonInd( PartonIndex );
128  if ( PartonIndex == 1 ) PartonIndex = -1;
129  return Parton[ PartonInd ];
130 }
131 
132 
133 //============================================================================
134 
136  ++PartonIndex;
137  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
138  G4int PartonInd( PartonIndex );
139  if ( PartonIndex == 1 ) PartonIndex = -1;
140  return Parton[ PartonInd ];
141 }
142 
143 
144 //============================================================================
145 
147  delete Parton[0];
148  Parton[0] = new G4Parton( PDGcode );
149 }
150 
151 
152 //============================================================================
153 
155  delete Parton[1];
156  Parton[1] = new G4Parton( PDGcode );
157 }
158 
159 
160 //============================================================================
161 
163  G4int* bEnd ) const {
164  G4int absPDGcode = std::abs( PDGcode );
165 
166  if ( absPDGcode < 1000 ) { //-------------------- Meson -------------
167  G4int heavy(0), light(0);
168  if(!((absPDGcode == 111)||(absPDGcode == 221)||(absPDGcode == 331)))
169  { // Ordinary mesons =======================
170  heavy = absPDGcode/100;
171  light = (absPDGcode % 100)/10;
172  //G4int anti = std::pow( -1 , std::max( heavy, light ) );
173  G4int anti = 1 - 2*( std::max( heavy, light ) % 2 );
174  if (PDGcode < 0 ) anti *= -1;
175  heavy *= anti;
176  light *= -1 * anti;
177  }
178  else
179  { // Pi0, Eta, Eta' =======================
180  if( G4UniformRand() < 0.5 ) {heavy = 1; light = -1;}
181  else {heavy = 2; light = -2;}
182  }
183  if ( G4UniformRand() < 0.5 ) {
184  *aEnd = heavy;
185  *bEnd = light;
186  } else {
187  *aEnd = light;
188  *bEnd = heavy;
189  }
190  } else { //-------------------- Baryon --------------
191  G4int j1000 = PDGcode/1000;
192  G4int j100 = (PDGcode % 1000)/100;
193  G4int j10 = (PDGcode % 100)/10;
194 
195  G4double SuppresUUDDSS=1.0/2.0;
196  if((j1000 == j100) && (j1000 == j10)) SuppresUUDDSS=1.;
197 
198 //
199  do
200  {
201  G4double random = G4UniformRand();
202 
203  if(random < 0.33333)
204  {
205  if(( j100 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
206  *aEnd = j1000;
207  if( j100 == j10 ) {*bEnd = Diquark( j100, j10, 1 );}
208  else
209  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j100, j10, 0 );}
210  else {*bEnd = Diquark( j100, j10, 1 );}
211  break;
212  }
213  else if(random < 0.66667)
214  {
215  if(( j1000 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
216  *aEnd = j100;
217  if( j1000 == j10 ) {*bEnd = Diquark( j1000, j10, 1 );}
218  else
219  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j10, 0 );}
220  else {*bEnd = Diquark( j1000, j10, 1 );}
221  break;
222  }
223  else
224  {
225  if(( j1000 == j100 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
226  *aEnd = j10;
227  if( j1000 == j100 ) {*bEnd = Diquark( j1000, j100, 1 );}
228  else
229  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j100, 0 );}
230  else {*bEnd = Diquark( j1000, j100, 1 );}
231  break;
232  }
233  } while(true);
234 //
235 /*
236  if ( std::abs( j100 ) >= std::abs( j10 ) ) {
237  if ( random < udspin1 ) {
238  *aEnd = j1000;
239  *bEnd = Diquark( j100, j10, 1 );
240  } else if ( random < udspin1 + uuspin1 ) {
241  *aEnd = j10;
242  *bEnd = Diquark( j1000, j100, 1 );
243  } else {
244  *aEnd = j100;
245  // Careful, there is no diquark q1=q2, (q1 q2)0, possible for Omega-
246  *bEnd = Diquark( j1000, j10, j1000 != j100 ? 0 : 1 );
247  }
248  } else {
249  // Lambda-like hadrons have two lightest quarks in spin 0
250  if ( random < udspin1 ) {
251  *aEnd = j1000;
252  // as above, but with charmed baryons
253  *bEnd = Diquark( j100, j10, j100 != j10 ? 0 : 10 );
254  } else if ( random < udspin1 + uuspin1 ) {
255  *aEnd = j10;
256  *bEnd = Diquark( j1000, j100, 1 );
257  } else {
258  *aEnd = j100;
259  *bEnd = Diquark( j1000, j10, 1 );
260  }
261  }
262 */
263  }
264 }
265 
266 
267 //============================================================================
268 
270  G4int diquarkPDG = std::max( std::abs( aquark ), std::abs( bquark ) ) * 1000 +
271  std::min( std::abs( aquark ), std::abs( bquark ) ) * 100 +
272  2*Spin + 1;
273  return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
274 }
void ChooseStringEnds(G4int PDGcode, G4int *aEnd, G4int *bEnd) const
G4int Diquark(G4int aquark, G4int bquark, G4int Spin) const
int G4int
Definition: G4Types.hh:78
const G4ParticleDefinition * GetDefinition() const
#define G4UniformRand()
Definition: Randomize.hh:93
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
double G4double
Definition: G4Types.hh:76