Geant4  10.00.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 74627 2013-10-17 07:04:38Z 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  PartonIndex = -1;
109 }
110 
111 
112 //============================================================================
113 
115  ++PartonIndex;
116  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
117  G4int PartonInd( PartonIndex );
118  if ( PartonIndex == 1 ) PartonIndex = -1;
119  return Parton[ PartonInd ];
120 }
121 
122 
123 //============================================================================
124 
126  ++PartonIndex;
127  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
128  G4int PartonInd( PartonIndex );
129  if ( PartonIndex == 1 ) PartonIndex = -1;
130  return Parton[ PartonInd ];
131 }
132 
133 
134 //============================================================================
135 
137  delete Parton[0];
138  Parton[0] = new G4Parton( PDGcode );
139 }
140 
141 
142 //============================================================================
143 
145  delete Parton[1];
146  Parton[1] = new G4Parton( PDGcode );
147 }
148 
149 
150 //============================================================================
151 
153  G4int* bEnd ) const {
154  const G4double udspin1 = 1.0/6.0;
155  const G4double uuspin1 = 1.0/3.0;
156  //const G4double udspin0 = 1.0/2.0;
157 
158  G4int absPDGcode = std::abs( PDGcode );
159 
160  if ( absPDGcode < 1000 ) { //-------------------- Meson -------------
161  G4int heavy = absPDGcode/100;
162  G4int light = (absPDGcode % 100)/10;
163  //G4int anti = std::pow( -1 , std::max( heavy, light ) );
164  G4int anti = 1 - 2*( std::max( heavy, light ) % 2 );
165  if (PDGcode < 0 ) anti *= -1;
166  heavy *= anti;
167  light *= -1 * anti;
168  if ( G4UniformRand() < 0.5 ) {
169  *aEnd = heavy;
170  *bEnd = light;
171  } else {
172  *aEnd = light;
173  *bEnd = heavy;
174  }
175  } else { //-------------------- Baryon --------------
176  G4int j1000 = PDGcode/1000;
177  G4int j100 = (PDGcode % 1000)/100;
178  G4int j10 = (PDGcode % 100)/10;
179  G4double random = G4UniformRand();
180  if ( std::abs( j100 ) >= std::abs( j10 ) ) {
181  if ( random < udspin1 ) {
182  *aEnd = j1000;
183  *bEnd = Diquark( j100, j10, 1 );
184  } else if ( random < udspin1 + uuspin1 ) {
185  *aEnd = j10;
186  *bEnd = Diquark( j1000, j100, 1 );
187  } else {
188  *aEnd = j100;
189  // Careful, there is no diquark q1=q2, (q1 q2)0, possible for Omega-
190  *bEnd = Diquark( j1000, j10, j1000 != j100 ? 0 : 1 );
191  }
192  } else {
193  // Lambda-like hadrons have two lightest quarks in spin 0
194  if ( random < udspin1 ) {
195  *aEnd = j1000;
196  // as above, but with charmed baryons
197  *bEnd = Diquark( j100, j10, j100 != j10 ? 0 : 10 );
198  } else if ( random < udspin1 + uuspin1 ) {
199  *aEnd = j10;
200  *bEnd = Diquark( j1000, j100, 1 );
201  } else {
202  *aEnd = j100;
203  *bEnd = Diquark( j1000, j10, 1 );
204  }
205  }
206  }
207 
208 }
209 
210 
211 //============================================================================
212 
214  G4int diquarkPDG = std::max( std::abs( aquark ), std::abs( bquark ) ) * 1000 +
215  std::min( std::abs( aquark ), std::abs( bquark ) ) * 100 +
216  2*Spin + 1;
217  return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
218 }
void ChooseStringEnds(G4int PDGcode, G4int *aEnd, G4int *bEnd) const
G4int Diquark(G4int aquark, G4int bquark, G4int Spin) const
int G4int
Definition: G4Types.hh:78
G4ParticleDefinition * GetDefinition() const
#define G4UniformRand()
Definition: Randomize.hh:87
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