Geant4  10.03
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 100828 2016-11-02 15:25:59Z 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 {
49  PartonIndex = -1;
50  Parton[0] = new G4Parton( 1 );
51  Parton[1] = new G4Parton(-1 );
52 }
53 
54 
55 //============================================================================
56 
58  G4VSplitableHadron( aPrimary )
59 {
60  PartonIndex = -2;
61  Parton[0] = NULL;
62 }
63 
64 
65 //============================================================================
66 
68  G4VSplitableHadron( aNucleon )
69 {
70  PartonIndex = -2;
71  Parton[0] = NULL;
72 }
73 
74 
75 //============================================================================
76 
78  G4VSplitableHadron( aNucleon )
79 {
80  PartonIndex = -2;
81  Parton[0] = NULL;
82 }
83 
84 
85 //============================================================================
86 
88  //G4cout << "Destruct G4DiffractiveSplitableHadron" << Parton[0] << " " << Parton[1] << G4endl;
89  //if ( Parton[0] != NULL ) { delete Parton[0]; delete Parton[1]; }
90 }
91 
92 
93 //============================================================================
94 
96  //G4cout << "SplitUp() IsSplit() Parton[0] " << IsSplit() << " " << Parton[0] << G4endl;
97  if ( IsSplit() ) return;
98  Splitting();
99  // Split once only...
100  if ( Parton[0] != NULL ) return;
101 
102  // flavours of quark ends
103  G4int PDGcode = GetDefinition()->GetPDGEncoding();
104  G4int stringStart, stringEnd;
105  ChooseStringEnds( PDGcode, &stringStart, &stringEnd );
106 
107  Parton[0] = new G4Parton( stringStart );
108  Parton[1] = new G4Parton( stringEnd );
109 
110  /* // Inversion of a string
111  if ( G4UniformRand() < 1.75 ) { //0.75
112  Parton[0] = new G4Parton( stringStart );
113  Parton[1] = new G4Parton( stringEnd );
114  } else {
115  Parton[0] = new G4Parton( stringEnd );
116  Parton[1] = new G4Parton( stringStart );
117  }
118  */
119 
120  PartonIndex = -1;
121 }
122 
123 
124 //============================================================================
125 
127  ++PartonIndex;
128  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
129  G4int PartonInd( PartonIndex );
130  if ( PartonIndex == 1 ) PartonIndex = -1;
131  return Parton[ PartonInd ];
132 }
133 
134 
135 //============================================================================
136 
138  ++PartonIndex;
139  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
140  G4int PartonInd( PartonIndex );
141  if ( PartonIndex == 1 ) PartonIndex = -1;
142  return Parton[ PartonInd ];
143 }
144 
145 
146 //============================================================================
147 
149  delete Parton[0];
150  Parton[0] = new G4Parton( PDGcode );
151 }
152 
153 
154 //============================================================================
155 
157  delete Parton[1];
158  Parton[1] = new G4Parton( PDGcode );
159 }
160 
161 
162 //============================================================================
163 
165  G4int* bEnd ) const {
166  G4int absPDGcode = std::abs( PDGcode );
167 
168  if ( absPDGcode < 1000 ) { //-------------------- Meson -------------
169  G4int heavy(0), light(0);
170  if(!((absPDGcode == 111)||(absPDGcode == 221)||(absPDGcode == 331)))
171  { // Ordinary mesons =======================
172  heavy = absPDGcode/100;
173  light = (absPDGcode % 100)/10;
174  //G4int anti = std::pow( -1 , std::max( heavy, light ) );
175  G4int anti = 1 - 2*( std::max( heavy, light ) % 2 );
176  if (PDGcode < 0 ) anti *= -1;
177  heavy *= anti;
178  light *= -1 * anti;
179  }
180  else
181  { // Pi0, Eta, Eta' =======================
182  if( G4UniformRand() < 0.5 ) {heavy = 1; light = -1;}
183  else {heavy = 2; light = -2;}
184  }
185  if ( G4UniformRand() < 0.5 ) {
186  *aEnd = heavy;
187  *bEnd = light;
188  } else {
189  *aEnd = light;
190  *bEnd = heavy;
191  }
192  } else { //-------------------- Baryon --------------
193  G4int j1000 = PDGcode/1000;
194  G4int j100 = (PDGcode % 1000)/100;
195  G4int j10 = (PDGcode % 100)/10;
196 
197  G4double SuppresUUDDSS=1.0/2.0;
198  if((j1000 == j100) && (j1000 == j10)) SuppresUUDDSS=1.;
199 
200 //
201  const G4int maxNumberOfLoops = 1000;
202  G4int loopCounter = 0;
203  do
204  {
205  G4double random = G4UniformRand();
206 
207  if(random < 0.33333)
208  {
209  if(( j100 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
210  *aEnd = j1000;
211  if( j100 == j10 ) {*bEnd = Diquark( j100, j10, 1 );}
212  else
213  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j100, j10, 0 );}
214  else {*bEnd = Diquark( j100, j10, 1 );}
215  break;
216  }
217  else if(random < 0.66667)
218  {
219  if(( j1000 == j10 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
220  *aEnd = j100;
221  if( j1000 == j10 ) {*bEnd = Diquark( j1000, j10, 1 );}
222  else
223  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j10, 0 );}
224  else {*bEnd = Diquark( j1000, j10, 1 );}
225  break;
226  }
227  else
228  {
229  if(( j1000 == j100 ) && ( G4UniformRand() > SuppresUUDDSS )) continue;
230  *aEnd = j10;
231  if( j1000 == j100 ) {*bEnd = Diquark( j1000, j100, 1 );}
232  else
233  if( G4UniformRand() > 0.25) {*bEnd = Diquark( j1000, j100, 0 );}
234  else {*bEnd = Diquark( j1000, j100, 1 );}
235  break;
236  }
237  } while ( (true) &&
238  ++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
239  if ( loopCounter >= maxNumberOfLoops ) {
240  *aEnd = j10; *bEnd = Diquark( j1000, j100, 1 ); // Just something acceptable, without any physics consideration.
241  }
242 
243  /*
244  if ( std::abs( j100 ) >= std::abs( j10 ) ) {
245  if ( random < udspin1 ) {
246  *aEnd = j1000;
247  *bEnd = Diquark( j100, j10, 1 );
248  } else if ( random < udspin1 + uuspin1 ) {
249  *aEnd = j10;
250  *bEnd = Diquark( j1000, j100, 1 );
251  } else {
252  *aEnd = j100;
253  // Careful, there is no diquark q1=q2, (q1 q2)0, possible for Omega-
254  *bEnd = Diquark( j1000, j10, j1000 != j100 ? 0 : 1 );
255  }
256  } else {
257  // Lambda-like hadrons have two lightest quarks in spin 0
258  if ( random < udspin1 ) {
259  *aEnd = j1000;
260  // as above, but with charmed baryons
261  *bEnd = Diquark( j100, j10, j100 != j10 ? 0 : 10 );
262  } else if ( random < udspin1 + uuspin1 ) {
263  *aEnd = j10;
264  *bEnd = Diquark( j1000, j100, 1 );
265  } else {
266  *aEnd = j100;
267  *bEnd = Diquark( j1000, j10, 1 );
268  }
269  }
270  */
271 
272  }
273 }
274 
275 
276 //============================================================================
277 
279  G4int diquarkPDG = std::max( std::abs( aquark ), std::abs( bquark ) ) * 1000 +
280  std::min( std::abs( aquark ), std::abs( bquark ) ) * 100 +
281  2*Spin + 1;
282  return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
283 }
284 
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