Geant4  10.02.p02
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 91914 2015-08-11 07:00: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  const G4int maxNumberOfLoops = 1000;
200  G4int loopCounter = 0;
201  do
202  {
203  G4double random = G4UniformRand();
204 
205  if(random < 0.33333)
206  {
207  if(( j100 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
208  *aEnd = j1000;
209  if( j100 == j10 ) {*bEnd = Diquark( j100, j10, 1 );}
210  else
211  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j100, j10, 0 );}
212  else {*bEnd = Diquark( j100, j10, 1 );}
213  break;
214  }
215  else if(random < 0.66667)
216  {
217  if(( j1000 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
218  *aEnd = j100;
219  if( j1000 == j10 ) {*bEnd = Diquark( j1000, j10, 1 );}
220  else
221  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j10, 0 );}
222  else {*bEnd = Diquark( j1000, j10, 1 );}
223  break;
224  }
225  else
226  {
227  if(( j1000 == j100 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
228  *aEnd = j10;
229  if( j1000 == j100 ) {*bEnd = Diquark( j1000, j100, 1 );}
230  else
231  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j100, 0 );}
232  else {*bEnd = Diquark( j1000, j100, 1 );}
233  break;
234  }
235  } while ( (true) &&
236  ++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
237  if ( loopCounter >= maxNumberOfLoops ) {
238  *aEnd = j10; *bEnd = Diquark( j1000, j100, 1 ); // Just something acceptable, without any physics consideration.
239  }
240 
241 //
242 /*
243  if ( std::abs( j100 ) >= std::abs( j10 ) ) {
244  if ( random < udspin1 ) {
245  *aEnd = j1000;
246  *bEnd = Diquark( j100, j10, 1 );
247  } else if ( random < udspin1 + uuspin1 ) {
248  *aEnd = j10;
249  *bEnd = Diquark( j1000, j100, 1 );
250  } else {
251  *aEnd = j100;
252  // Careful, there is no diquark q1=q2, (q1 q2)0, possible for Omega-
253  *bEnd = Diquark( j1000, j10, j1000 != j100 ? 0 : 1 );
254  }
255  } else {
256  // Lambda-like hadrons have two lightest quarks in spin 0
257  if ( random < udspin1 ) {
258  *aEnd = j1000;
259  // as above, but with charmed baryons
260  *bEnd = Diquark( j100, j10, j100 != j10 ? 0 : 10 );
261  } else if ( random < udspin1 + uuspin1 ) {
262  *aEnd = j10;
263  *bEnd = Diquark( j1000, j100, 1 );
264  } else {
265  *aEnd = j100;
266  *bEnd = Diquark( j1000, j10, 1 );
267  }
268  }
269 */
270  }
271 }
272 
273 
274 //============================================================================
275 
277  G4int diquarkPDG = std::max( std::abs( aquark ), std::abs( bquark ) ) * 1000 +
278  std::min( std::abs( aquark ), std::abs( bquark ) ) * 100 +
279  2*Spin + 1;
280  return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
281 }
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:97
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