Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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$
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 
45 
46 {
47  PartonIndex=-1;
48  Parton[0] = new G4Parton(1);
49  Parton[1] = new G4Parton(-1);
50 }
51 
53  : G4VSplitableHadron(aPrimary)
54 {
55  PartonIndex=-2;
56  Parton[0]=NULL;
57 }
58 
60  : G4VSplitableHadron(aNucleon)
61 {
62  PartonIndex=-2;
63  Parton[0]=NULL;
64 }
65 
67  : G4VSplitableHadron(aNucleon)
68 {
69  PartonIndex=-2;
70  Parton[0]=NULL;
71 }
72 
74 {
75 //G4cout<<"Destruct G4DiffractiveSplitableHadron"<<Parton[0]<<" "<<Parton[1]<<G4endl;
76 // if(Parton[0] != NULL){delete Parton[0]; delete Parton[1];}
77 }
78 
79 
81 {
82 //G4cout<<"SplitUp() IsSplit() Parton[0] "<<IsSplit()<<" "<<Parton[0]<<G4endl;
83  if (IsSplit()) return;
84  Splitting();
85 // Split once only...
86  if (Parton[0] != NULL) return;
87 
88 // flavours of quark ends
89 
90  G4int PDGcode=GetDefinition()->GetPDGEncoding();
91 
92  G4int stringStart, stringEnd;
93  ChooseStringEnds(PDGcode, &stringStart,&stringEnd);
94 
95  Parton[0] = new G4Parton(stringStart);
96  Parton[1] = new G4Parton(stringEnd);
97  PartonIndex=-1;
98 }
99 
101 {
102  ++PartonIndex;
103  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
104  G4int PartonInd(PartonIndex); // Vova
105  if(PartonIndex == 1) PartonIndex=-1; // Vova
106  return Parton[PartonInd];
107 // return Parton[PartonIndex];
108 }
109 
111 {
112  ++PartonIndex; // Uzhi 22.11.10
113  if ( PartonIndex > 1 || PartonIndex < 0 ) return NULL;
114  G4int PartonInd(PartonIndex);
115  if(PartonIndex == 1) PartonIndex=-1;
116  return Parton[PartonInd];
117 // return NULL; // to be looked at @@
118 }
119 
121 {
122  delete Parton[0];
123  Parton[0]=new G4Parton(PDGcode);
124 }
125 
127 {
128  delete Parton[1];
129  Parton[1]=new G4Parton(PDGcode);
130 }
131 //
132 //----------------------- Implementation--------------------------
133 //
134 void G4DiffractiveSplitableHadron::ChooseStringEnds(G4int PDGcode,G4int * aEnd, G4int * bEnd) const
135 {
136  const G4double udspin1= 1./6.;
137  const G4double uuspin1= 1./3.;
138 // const G4double udspin0= 1./2.; //@
139 
140  G4int absPDGcode=std::abs(PDGcode);
141 
142  if ( absPDGcode < 1000 ) //-------------------- Meson -------------
143  {
144  G4int heavy= absPDGcode/ 100;
145  G4int light= (absPDGcode %100)/10;
146 
147 // G4int anti= std::pow(-1 , std::max( heavy, light));
148  G4int anti= 1 -2 * ( std::max( heavy, light ) % 2 );
149  if (PDGcode < 0 ) anti *=-1;
150 
151  heavy *= anti;
152  light *= -1 * anti;
153 
154  if ( G4UniformRand() < 0.5 )
155  {
156  *aEnd=heavy;
157  *bEnd=light;
158  }
159  else
160  {
161  *aEnd=light;
162  *bEnd=heavy;
163  }
164  }
165  else //-------------------- Barion --------------
166  {
167  G4int j1000 = PDGcode/ 1000;
168  G4int j100 = (PDGcode % 1000) / 100;
169  G4int j10 = (PDGcode % 100) / 10;
170 
171  G4double random= G4UniformRand();
172 
173 
174  if ( std::abs(j100) >= std::abs(j10) )
175  {
176  if ( random < udspin1 )
177  {
178  *aEnd=j1000;
179  *bEnd= Diquark( j100, j10, 1);
180  } else if ( random < (udspin1 + uuspin1) )
181  {
182  *aEnd= j10;
183  *bEnd= Diquark( j1000, j100, 1);
184  } else
185  {
186  *aEnd=j100;
187  // Careful, there is no diquark q1=q2, (q1 q2)0,
188  // possible for Omega-
189  *bEnd= Diquark( j1000, j10, j1000 != j100 ? 0 : 1);
190  }
191  } else
192  {
193 // Lambda-like hadrons have two lightest quarks in spin 0
194  if ( random < udspin1 )
195  {
196  *aEnd=j1000;
197  // as above, but with charmed barions
198  *bEnd= Diquark( j100, j10, j100 != j10 ? 0 : 10);
199  } else if ( random < (udspin1 + uuspin1) )
200  {
201  *aEnd= j10;
202  *bEnd= Diquark( j1000, j100, 1);
203  } else
204  {
205  *aEnd=j100;
206  *bEnd= Diquark( j1000, j10, 1);
207  }
208 
209  }
210 
211  }
212 
213 
214 
215 }
216 
217 G4int G4DiffractiveSplitableHadron::Diquark(G4int aquark,G4int bquark,G4int Spin) const
218 {
219  G4int diquarkPDG;
220 
221  diquarkPDG = std::max( std::abs(aquark), std::abs(bquark) )*1000 +
222  std::min( std::abs(aquark), std::abs(bquark) )*100 +
223  2*Spin + 1;
224  return ( aquark > 0 && bquark > 0 ) ? diquarkPDG : -1*diquarkPDG;
225 }