Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4HadronBuilder.cc
이 파일의 문서화 페이지로 가기
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: G4HadronBuilder.cc 107968 2017-12-14 13:16:35Z gcosmo $
28 //
29 // -----------------------------------------------------------------------------
30 // GEANT 4 class implementation file
31 //
32 // History:
33 // Gunter Folger, August/September 2001
34 // Create class; algorithm previously in G4VLongitudinalStringDecay.
35 // -----------------------------------------------------------------------------
36 
37 #include "G4HadronBuilder.hh"
38 #include "G4SystemOfUnits.hh"
39 #include "Randomize.hh"
40 #include "G4HadronicException.hh"
41 #include "G4ParticleTable.hh"
42 
44  std::vector<double> scalarMesonMix,
45  std::vector<double> vectorMesonMix)
46 {
47  mesonSpinMix=mesonMix;
48  barionSpinMix=barionMix;
49  scalarMesonMixings=scalarMesonMix;
50  vectorMesonMixings=vectorMesonMix;
51 }
52 
54 {
55 
56  if (black->GetParticleSubType()== "di_quark" || white->GetParticleSubType()== "di_quark" ) {
57 
58 // Barion
60 
61  return Barion(black,white,spin);
62 
63  } else {
64 
65 // Meson
67  return Meson(black,white,spin);
68  }
69 }
70 
71 //-------------------------------------------------------------------------
72 
74 {
75  if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
76  return Meson(black,white, SpinZero);
77  } else {
78 // will return a SpinThreeHalf Barion if all quarks the same
79  return Barion(black,white, SpinHalf);
80  }
81 }
82 
83 //-------------------------------------------------------------------------
84 
86 {
87  if ( black->GetParticleSubType()== "quark" && white->GetParticleSubType()== "quark" ) {
88  return Meson(black,white, SpinOne);
89  } else {
90  return Barion(black,white,SpinThreeHalf);
91  }
92 }
93 
94 //-------------------------------------------------------------------------
95 
97  G4ParticleDefinition * white, Spin theSpin)
98 {
99 #ifdef G4VERBOSE
100 // Verify Input Charge
101 
102  G4double charge = black->GetPDGCharge()
103  + white->GetPDGCharge();
104  if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent ) // 1.001 to avoid int(.9999) -> 0
105  {
106  G4cerr << " G4HadronBuilder::Build()" << G4endl;
107  G4cerr << " Invalid total charge found for on input: "
108  << charge<< G4endl;
109  G4cerr << " PGDcode input quark1/quark2 : " <<
110  black->GetPDGEncoding() << " / "<<
111  white->GetPDGEncoding() << G4endl;
112  G4cerr << G4endl;
113  }
114 #endif
115 
116  G4int id1= black->GetPDGEncoding();
117  G4int id2= white->GetPDGEncoding();
118 // G4int ifl1= std::max(std::abs(id1), std::abs(id2));
119  if ( std::abs(id1) < std::abs(id2) )
120  {
121  G4int xchg = id1;
122  id1 = id2;
123  id2 = xchg;
124  }
125 
126  if (std::abs(id1) > 3 )
127  throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Meson : Illegal Quark content as input");
128 
129  G4int PDGEncoding=0;
130 
131  if (id1 + id2 == 0) {
132  G4double rmix = G4UniformRand();
133  G4int imix = 2*std::abs(id1) - 1;
134  if(theSpin == SpinZero) {
135  PDGEncoding = 110*(1 + (G4int)(rmix + scalarMesonMixings[imix - 1])
136  + (G4int)(rmix + scalarMesonMixings[imix])
137  ) + theSpin;
138  } else {
139  PDGEncoding = 110*(1 + (G4int)(rmix + vectorMesonMixings[imix - 1])
140  + (G4int)(rmix + vectorMesonMixings[imix])
141  ) + theSpin;
142  }
143  } else {
144  PDGEncoding = 100 * std::abs(id1) + 10 * std::abs(id2) + theSpin;
145  G4bool IsUp = (std::abs(id1)&1) == 0; // quark 1 up type quark (u or c)
146  G4bool IsAnti = id1 < 0; // quark 1 is antiquark?
147  if( (IsUp && IsAnti ) || (!IsUp && !IsAnti ) )
148  PDGEncoding = - PDGEncoding;
149  }
150 
151  G4ParticleDefinition * MesonDef=
153 #ifdef G4VERBOSE
154  if (MesonDef == 0 ) {
155  G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
156  << PDGEncoding << G4endl;
157  } else if ( ( black->GetPDGCharge() + white->GetPDGCharge()
158  - MesonDef->GetPDGCharge() ) > perCent ) {
159  G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
160  << " Quark1/2 = "
161  << black->GetParticleName() << " / "
162  << white->GetParticleName()
163  << " resulting Hadron " << MesonDef->GetParticleName()
164  << G4endl;
165  }
166 #endif
167 
168  return MesonDef;
169 }
170 
171 
173  G4ParticleDefinition * white,Spin theSpin)
174 {
175 
176 #ifdef G4VERBOSE
177 // Verify Input Charge
178  G4double charge = black->GetPDGCharge()
179  + white->GetPDGCharge();
180  if (std::abs(charge) > 2 || std::abs(3.*charge - 3*G4int(charge*1.001)) > perCent )
181  {
182  G4cerr << " G4HadronBuilder::Build()" << G4endl;
183  G4cerr << " Invalid total charge found for on input: "
184  << charge<< G4endl;
185  G4cerr << " PGDcode input quark1/quark2 : " <<
186  black->GetPDGEncoding() << " / "<<
187  white->GetPDGEncoding() << G4endl;
188  G4cerr << G4endl;
189  }
190 #endif
191  G4int id1= black->GetPDGEncoding();
192  G4int id2= white->GetPDGEncoding();
193  if ( std::abs(id1) < std::abs(id2) )
194  {
195  G4int xchg = id1;
196  id1 = id2;
197  id2 = xchg;
198  }
199 
200  if (std::abs(id1) < 1000 || std::abs(id2) > 3 )
201  throw G4HadronicException(__FILE__, __LINE__, "G4HadronBuilder::Barion: Illegal quark content as input");
202 
203  G4int ifl1= std::abs(id1)/1000;
204  G4int ifl2 = (std::abs(id1) - ifl1 * 1000)/100;
205  G4int diquarkSpin = std::abs(id1)%10;
206  G4int ifl3 = id2;
207  if (id1 < 0)
208  {
209  ifl1 = - ifl1;
210  ifl2 = - ifl2;
211  }
212  //... Construct barion, distinguish Lambda and Sigma barions.
213  G4int kfla = std::abs(ifl1);
214  G4int kflb = std::abs(ifl2);
215  G4int kflc = std::abs(ifl3);
216 
217  G4int kfld = std::max(kfla,kflb);
218  kfld = std::max(kfld,kflc);
219  G4int kflf = std::min(kfla,kflb);
220  kflf = std::min(kflf,kflc);
221 
222  G4int kfle = kfla + kflb + kflc - kfld - kflf;
223 
224  //... barion with content uuu or ddd or sss has always spin = 3/2
225  theSpin = (kfla == kflb && kflb == kflc)? SpinThreeHalf : theSpin;
226 
227  G4int kfll = 0;
228  if(theSpin == SpinHalf && kfld > kfle && kfle > kflf) {
229 // Spin J=1/2 and all three quarks different
230 // Two states exist: (uds -> lambda or sigma0)
231 // - lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
232 // - sigma0: s(ud)1 s : 3212
233  if(diquarkSpin == 1 ) {
234  if ( kfla == kfld) { // heaviest quark in diquark
235  kfll = 1;
236  } else {
237  kfll = (G4int)(0.25 + G4UniformRand());
238  }
239  }
240  if(diquarkSpin == 3 && kfla != kfld)
241  kfll = (G4int)(0.75 + G4UniformRand());
242  }
243 
244  G4int PDGEncoding;
245  if (kfll == 1)
246  PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
247  else
248  PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
249 
250  if (id1 < 0)
251  PDGEncoding = -PDGEncoding;
252 
253 
254  G4ParticleDefinition * BarionDef=
256 #ifdef G4VERBOSE
257  if (BarionDef == 0 ) {
258  G4cerr << " G4HadronBuilder - Warning: No particle for PDGcode= "
259  << PDGEncoding << G4endl;
260  } else if ( ( black->GetPDGCharge() + white->GetPDGCharge()
261  - BarionDef->GetPDGCharge() ) > perCent ) {
262  G4cerr << " G4HadronBuilder - Warning: Incorrect Charge : "
263  << " DiQuark/Quark = "
264  << black->GetParticleName() << " / "
265  << white->GetParticleName()
266  << " resulting Hadron " << BarionDef->GetParticleName()
267  << G4endl;
268  }
269 #endif
270 
271  return BarionDef;
272 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ParticleDefinition * Build(G4ParticleDefinition *black, G4ParticleDefinition *white)
G4ParticleDefinition * Barion(G4ParticleDefinition *black, G4ParticleDefinition *white, Spin spin)
G4double barionSpinMix
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * BuildLowSpin(G4ParticleDefinition *black, G4ParticleDefinition *white)
std::vector< double > vectorMesonMixings
const G4String & GetParticleSubType() const
#define G4endl
Definition: G4ios.hh:61
static constexpr double perCent
Definition: G4SIunits.hh:332
const G4String & GetParticleName() const
G4double GetPDGCharge() const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
#define G4UniformRand()
Definition: Randomize.hh:53
G4GLOB_DLL std::ostream G4cerr
G4ParticleDefinition * BuildHighSpin(G4ParticleDefinition *black, G4ParticleDefinition *white)
int G4int
Definition: G4Types.hh:78
G4ParticleDefinition * Meson(G4ParticleDefinition *black, G4ParticleDefinition *white, Spin spin)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
std::vector< double > scalarMesonMixings