Geant4  10.02.p03
G4BigBanger Class Reference

#include <G4BigBanger.hh>

Inheritance diagram for G4BigBanger:
Collaboration diagram for G4BigBanger:

Public Member Functions

 G4BigBanger ()
 
virtual ~G4BigBanger ()
 
virtual void deExcite (const G4Fragment &target, G4CollisionOutput &output)
 
- Public Member Functions inherited from G4CascadeDeexciteBase
 G4CascadeDeexciteBase (const char *name)
 
virtual ~G4CascadeDeexciteBase ()
 
virtual void setVerboseLevel (G4int verbose=0)
 
- Public Member Functions inherited from G4VCascadeDeexcitation
 G4VCascadeDeexcitation (const G4String &name)
 
virtual ~G4VCascadeDeexcitation ()
 
virtual void collide (G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &globalOutput)
 
- Public Member Functions inherited from G4VCascadeCollider
 G4VCascadeCollider (const G4String &name, G4int verbose=0)
 
virtual ~G4VCascadeCollider ()
 

Private Member Functions

void generateBangInSCM (G4double etot, G4int a, G4int z)
 
void generateMomentumModules (G4double etot, G4int a, G4int z)
 
G4double xProbability (G4double x, G4int a) const
 
G4double maxProbability (G4int a) const
 
G4double generateX (G4int ia, G4double promax) const
 
 G4BigBanger (const G4BigBanger &)
 
G4BigBangeroperator= (const G4BigBanger &)
 

Private Attributes

std::vector< G4InuclElementaryParticleparticles
 
std::vector< G4doublemomModules
 
std::vector< G4LorentzVectorscm_momentums
 

Additional Inherited Members

- Protected Member Functions inherited from G4CascadeDeexciteBase
virtual G4bool explosion (const G4Fragment &target) const
 
virtual G4bool explosion (G4int A, G4int Z, G4double excitation) const
 
virtual G4bool validateOutput (const G4Fragment &target, G4CollisionOutput &output)
 
virtual G4bool validateOutput (const G4Fragment &target, const std::vector< G4InuclElementaryParticle > &particles)
 
virtual G4bool validateOutput (const G4Fragment &target, const std::vector< G4InuclNuclei > &fragments)
 
void getTargetData (const G4Fragment &target)
 
const G4FragmentmakeFragment (G4LorentzVector mom, G4int A, G4int Z, G4double EX=0.)
 
const G4FragmentmakeFragment (G4int A, G4int Z, G4double EX=0.)
 
- Protected Member Functions inherited from G4VCascadeCollider
virtual void setName (const G4String &name)
 
- Protected Attributes inherited from G4CascadeDeexciteBase
G4CascadeCheckBalancebalance
 
G4int A
 
G4int Z
 
G4LorentzVector PEX
 
G4double EEXS
 
G4Fragment aFragment
 
- Protected Attributes inherited from G4VCascadeCollider
G4String theName
 
G4int verboseLevel
 

Detailed Description

Definition at line 48 of file G4BigBanger.hh.

Constructor & Destructor Documentation

◆ G4BigBanger() [1/2]

G4BigBanger::G4BigBanger ( )

Definition at line 67 of file G4BigBanger.cc.

67 : G4CascadeDeexciteBase("G4BigBanger") {}
G4CascadeDeexciteBase(const char *name)

◆ ~G4BigBanger()

virtual G4BigBanger::~G4BigBanger ( )
inlinevirtual

Definition at line 51 of file G4BigBanger.hh.

51 {};
Here is the call graph for this function:

◆ G4BigBanger() [2/2]

G4BigBanger::G4BigBanger ( const G4BigBanger )
private

Member Function Documentation

◆ deExcite()

void G4BigBanger::deExcite ( const G4Fragment target,
G4CollisionOutput output 
)
virtual

Implements G4VCascadeDeexcitation.

Definition at line 69 of file G4BigBanger.cc.

70  {
71  if (verboseLevel) G4cout << " >>> G4BigBanger::deExcite" << G4endl;
72 
73  getTargetData(target);
74  G4ThreeVector toTheLabFrame = PEX.boostVector(); // From rest to lab
75 
76  // This "should" be difference between E-target and sum of m(nucleons)
77  G4double etot = (EEXS - bindingEnergy(A,Z)) * MeV/GeV; // To Bertini units
78  if (etot < 0.0) etot = 0.0;
79 
80  if (verboseLevel > 2) {
81  G4cout << " BigBanger: target\n" << target
82  << "\n etot " << etot << G4endl;
83  }
84 
85  if (verboseLevel > 3) {
86  G4LorentzVector PEXrest = PEX;
87  PEXrest.boost(-toTheLabFrame);
88  G4cout << " target rest frame: px " << PEXrest.px() << " py "
89  << PEXrest.py() << " pz " << PEXrest.pz() << " E " << PEXrest.e()
90  << G4endl;
91  }
92 
93  generateBangInSCM(etot, A, Z);
94 
95  if (verboseLevel > 2) {
96  G4cout << " particles " << particles.size() << G4endl;
97  for(G4int i = 0; i < G4int(particles.size()); i++)
98  G4cout << particles[i] << G4endl;
99  }
100 
101  if (particles.empty()) { // No bang! Don't know why...
102  G4cerr << " >>> G4BigBanger unable to process fragment "
103  << target << G4endl;
104 
105  // FIXME: This will violate baryon number, momentum, energy, etc.
106  return;
107  }
108 
109  // convert back to Lab
110  G4LorentzVector totscm;
111  G4LorentzVector totlab;
112 
113  if (verboseLevel > 2) G4cout << " BigBanger: boosting to lab" << G4endl;
114 
116  for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
117  G4LorentzVector mom = ipart->getMomentum();
118  if (verboseLevel > 2) totscm += mom;
119 
120  mom.boost(toTheLabFrame);
121  if (verboseLevel > 2) totlab += mom;
122 
123  ipart->setMomentum(mom);
124  if (verboseLevel > 2) G4cout << *ipart << G4endl;
125  }
126 
127  std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
128 
129  validateOutput(target, particles); // Checks <vector> directly
130 
131  if (verboseLevel > 2) {
132  G4cout << " In SCM: total outgoing momentum " << G4endl
133  << " E " << totscm.e() << " px " << totscm.x()
134  << " py " << totscm.y() << " pz " << totscm.z() << G4endl;
135  G4cout << " In Lab: mom cons " << G4endl
136  << " E " << PEX.e() - totlab.e() // PEX now includes EEXS
137  << " px " << PEX.x() - totlab.x()
138  << " py " << PEX.y() - totlab.y()
139  << " pz " << PEX.z() - totlab.z() << G4endl;
140  }
141 
142  globalOutput.addOutgoingParticles(particles);
143 }
static const double MeV
Definition: G4SIunits.hh:211
std::vector< G4InuclElementaryParticle > particles
Definition: G4BigBanger.hh:63
Int_t ipart
int G4int
Definition: G4Types.hh:78
void getTargetData(const G4Fragment &target)
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
static const double GeV
Definition: G4SIunits.hh:214
Hep3Vector boostVector() const
void generateBangInSCM(G4double etot, G4int a, G4int z)
Definition: G4BigBanger.cc:145
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
#define G4endl
Definition: G4ios.hh:61
virtual G4bool validateOutput(const G4Fragment &target, G4CollisionOutput &output)
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateBangInSCM()

void G4BigBanger::generateBangInSCM ( G4double  etot,
G4int  a,
G4int  z 
)
private

Definition at line 145 of file G4BigBanger.cc.

145  {
146  if (verboseLevel > 3) {
147  G4cout << " >>> G4BigBanger::generateBangInSCM" << G4endl;
148  }
149 
150  const G4double ang_cut = 0.9999;
151  const G4int itry_max = 1000;
152 
153  if (verboseLevel > 2) {
154  G4cout << " a " << a << " z " << z << G4endl;
155  }
156 
157  particles.clear(); // Reset output vector before filling
158 
159  if (a == 1) { // Special -- bare nucleon doesn't really "explode"
160  G4int knd = (z>0) ? 1 : 2;
161  particles.push_back(G4InuclElementaryParticle(knd)); // zero momentum
162  return;
163  }
164 
165  // NOTE: If distribution fails, need to regenerate magnitudes and angles!
166  //*** generateMomentumModules(etot, a, z);
167 
168  scm_momentums.reserve(a);
169  G4LorentzVector tot_mom;
170 
171  G4bool bad = true;
172  G4int itry = 0;
173  while(bad && itry < itry_max) { /* Loop checking 08.06.2015 MHK */
174  itry++;
175  scm_momentums.clear();
176 
177  generateMomentumModules(etot, a, z);
178  if (a == 2) {
179  // This is only a three-vector, not a four-vector
180  G4LorentzVector mom = generateWithRandomAngles(momModules[0]);
181  scm_momentums.push_back(mom);
182  scm_momentums.push_back(-mom); // Only safe since three-vector!
183  bad = false;
184  } else {
185  tot_mom *= 0.; // Easy way to reset accumulator
186 
187  for(G4int i = 0; i < a-2; i++) { // All but last two are thrown
188  // This is only a three-vector, not a four-vector
189  G4LorentzVector mom = generateWithRandomAngles(momModules[i]);
190  scm_momentums.push_back(mom);
191  tot_mom += mom;
192  };
193 
194  // handle last two
195  G4double tot_mod = tot_mom.rho();
196  G4double ct = -0.5*(tot_mod*tot_mod + momModules[a-2]*momModules[a-2]
197  - momModules[a-1]*momModules[a-1]) / tot_mod
198  / momModules[a-2];
199 
200  if (verboseLevel > 2) G4cout << " ct last " << ct << G4endl;
201 
202  if(std::fabs(ct) < ang_cut) {
203  // This is only a three-vector, not a four-vector
204  G4LorentzVector mom2 = generateWithFixedTheta(ct, momModules[a - 2]);
205 
206  // rotate to the normal system
207  G4LorentzVector apr = tot_mom/tot_mod;
208  G4double a_tr = std::sqrt(apr.x()*apr.x() + apr.y()*apr.y());
209  G4LorentzVector mom;
210  mom.setX(mom2.z()*apr.x() + ( mom2.x()*apr.y() + mom2.y()*apr.z()*apr.x())/a_tr);
211  mom.setY(mom2.z()*apr.y() + (-mom2.x()*apr.x() + mom2.y()*apr.z()*apr.y())/a_tr);
212  mom.setZ(mom2.z()*apr.z() - mom2.y()*a_tr);
213 
214  scm_momentums.push_back(mom);
215 
216  // and the last one (again, not actually a four-vector!)
217  G4LorentzVector mom1 = -mom - tot_mom;
218 
219  scm_momentums.push_back(mom1);
220  bad = false;
221  } // if (abs(ct) < ang_cut)
222  } // (a > 2)
223  } // while (bad && itry<itry_max)
224 
225  if (!bad) {
226  particles.resize(a); // Use assignment to avoid temporaries
227  for(G4int i = 0; i < a; i++) {
228  G4int knd = i < z ? 1 : 2;
230  };
231  };
232 
233  if (verboseLevel > 2) {
234  if (itry == itry_max) G4cout << " BigBanger -> can not generate bang " << G4endl;
235  }
236 
237  return;
238 }
std::vector< G4InuclElementaryParticle > particles
Definition: G4BigBanger.hh:63
int G4int
Definition: G4Types.hh:78
void generateMomentumModules(G4double etot, G4int a, G4int z)
Definition: G4BigBanger.cc:240
G4GLOB_DLL std::ostream G4cout
std::vector< G4LorentzVector > scm_momentums
Definition: G4BigBanger.hh:65
std::vector< G4double > momModules
Definition: G4BigBanger.hh:64
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateMomentumModules()

void G4BigBanger::generateMomentumModules ( G4double  etot,
G4int  a,
G4int  z 
)
private

Definition at line 240 of file G4BigBanger.cc.

240  {
241  if (verboseLevel > 3) {
242  G4cout << " >>> G4BigBanger::generateMomentumModules" << G4endl;
243  }
244 
245  // Proton and neutron masses
248 
249  momModules.clear(); // Reset buffer for filling
250 
251  G4double xtot = 0.0;
252 
253  if (a > 2) { // For "large" nuclei, energy is distributed
254  G4double promax = maxProbability(a);
255 
256  momModules.resize(a, 0.); // Pre-allocate to avoid memory churn
257  for(G4int i = 0; i < a; i++) {
258  momModules[i] = generateX(a, promax);
259  xtot += momModules[i];
260 
261  if (verboseLevel > 2) {
262  G4cout << " i " << i << " x " << momModules[i] << G4endl;
263  }
264  }
265  } else { // Two-body case is special, must be 50%
266  xtot = 1.;
267  momModules.push_back(0.5);
268  momModules.push_back(0.5);
269  }
270 
271  for(G4int i = 0; i < a; i++) {
272  G4double mass = i < z ? mp : mn;
273 
274  momModules[i] *= etot/xtot;
275  momModules[i] = std::sqrt(momModules[i] * (momModules[i] + 2.0 * mass));
276 
277  if (verboseLevel > 2) {
278  G4cout << " i " << i << " pmod " << momModules[i] << G4endl;
279  }
280  };
281 
282  return;
283 }
static G4double getParticleMass(G4int type)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
std::vector< G4double > momModules
Definition: G4BigBanger.hh:64
#define G4endl
Definition: G4ios.hh:61
G4double generateX(G4int ia, G4double promax) const
Definition: G4BigBanger.cc:313
double G4double
Definition: G4Types.hh:76
G4double maxProbability(G4int a) const
Definition: G4BigBanger.cc:305
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateX()

G4double G4BigBanger::generateX ( G4int  ia,
G4double  promax 
) const
private

Definition at line 313 of file G4BigBanger.cc.

313  {
314  if (verboseLevel > 3) G4cout << " >>> G4BigBanger::generateX" << G4endl;
315 
316  const G4int itry_max = 1000;
317  G4int itry = 0;
318  G4double x;
319 
320  while(itry < itry_max) { /* Loop checking 08.06.2015 MHK */
321  itry++;
322  x = inuclRndm();
323 
324  if(xProbability(x, a) >= promax * inuclRndm()) return x;
325  };
326  if (verboseLevel > 2) {
327  G4cout << " BigBanger -> can not generate x " << G4endl;
328  }
329 
330  return maxProbability(a);
331 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4double xProbability(G4double x, G4int a) const
Definition: G4BigBanger.cc:285
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double maxProbability(G4int a) const
Definition: G4BigBanger.cc:305
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maxProbability()

G4double G4BigBanger::maxProbability ( G4int  a) const
private

Definition at line 305 of file G4BigBanger.cc.

305  {
306  if (verboseLevel > 3) {
307  G4cout << " >>> G4BigBanger::maxProbability" << G4endl;
308  }
309 
310  return xProbability(2./3./(a-1.0), a);
311 }
G4GLOB_DLL std::ostream G4cout
G4double xProbability(G4double x, G4int a) const
Definition: G4BigBanger.cc:285
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4BigBanger& G4BigBanger::operator= ( const G4BigBanger )
private

◆ xProbability()

G4double G4BigBanger::xProbability ( G4double  x,
G4int  a 
) const
private

Definition at line 285 of file G4BigBanger.cc.

285  {
286  if (verboseLevel > 3) G4cout << " >>> G4BigBanger::xProbability" << G4endl;
287 
288  G4Pow* theG4Pow = G4Pow::GetInstance(); // For convenience
289 
290  G4double ekpr = 0.0;
291  if(x < 1.0 || x > 0.0) {
292  ekpr = x * x;
293 
294  if (a%2 == 0) { // even A
295  ekpr *= std::sqrt(1.0 - x) * theG4Pow->powN((1.0 - x), (3*a-6)/2);
296  }
297  else {
298  ekpr *= theG4Pow->powN((1.0 - x), (3*a-5)/2);
299  };
300  };
301 
302  return ekpr;
303 }
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
Definition: G4Pow.hh:56
G4double powN(G4double x, G4int n) const
Definition: G4Pow.cc:128
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ momModules

std::vector<G4double> G4BigBanger::momModules
private

Definition at line 64 of file G4BigBanger.hh.

◆ particles

std::vector<G4InuclElementaryParticle> G4BigBanger::particles
private

Definition at line 63 of file G4BigBanger.hh.

◆ scm_momentums

std::vector<G4LorentzVector> G4BigBanger::scm_momentums
private

Definition at line 65 of file G4BigBanger.hh.


The documentation for this class was generated from the following files: