Geant4-11
Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
G4CascadeFinalStateAlgorithm Class Reference

#include <G4CascadeFinalStateAlgorithm.hh>

Inheritance diagram for G4CascadeFinalStateAlgorithm:
G4VHadDecayAlgorithm

Public Member Functions

void Configure (G4InuclElementaryParticle *bullet, G4InuclElementaryParticle *target, const std::vector< G4int > &particle_kinds)
 
 G4CascadeFinalStateAlgorithm ()
 
void Generate (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
const G4StringGetName () const
 
G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int verbose)
 
virtual ~G4CascadeFinalStateAlgorithm ()
 

Protected Member Functions

G4double BetaKopylov (G4int K) const
 
void ChooseGenerators (G4int is, G4int fs)
 
void FillDirections (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
void FillDirManyBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
void FillDirThreeBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
void FillMagnitudes (G4double initialMass, const std::vector< G4double > &masses)
 
void FillUsingKopylov (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
G4double GenerateCosTheta (G4int ptype, G4double pmod) const
 
virtual void GenerateMultiBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
virtual void GenerateTwoBody (G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
 
virtual G4bool IsDecayAllowed (G4double initialMass, const std::vector< G4double > &masses) const
 
void PrintVector (const std::vector< G4double > &v, const G4String &name, std::ostream &os) const
 
G4bool satisfyTriangle (const std::vector< G4double > &pmod) const
 
void SaveKinematics (G4InuclElementaryParticle *bullet, G4InuclElementaryParticle *target)
 
G4double TwoBodyMomentum (G4double M0, G4double M1, G4double M2) const
 
G4double UniformPhi () const
 
G4double UniformTheta () const
 

Private Attributes

const G4VTwoBodyAngDstangDist
 
G4double bullet_ekin
 
std::vector< G4intkinds
 
std::vector< G4doublemodules
 
G4ThreeVector mom
 
const G4VMultiBodyMomDstmomDist
 
G4int multiplicity
 
G4String name
 
G4LorentzConvertor toSCM
 
G4int verboseLevel
 

Static Private Attributes

static const G4int itry_max = 10
 
static const G4double maxCosTheta = 0.9999
 
static const G4double oneOverE = 0.3678794
 
static const G4double small = 1.e-10
 

Detailed Description

Definition at line 48 of file G4CascadeFinalStateAlgorithm.hh.

Constructor & Destructor Documentation

◆ G4CascadeFinalStateAlgorithm()

G4CascadeFinalStateAlgorithm::G4CascadeFinalStateAlgorithm ( )

Definition at line 75 of file G4CascadeFinalStateAlgorithm.cc.

76 : G4VHadDecayAlgorithm("G4CascadeFinalStateAlgorithm"),
77 momDist(0), angDist(0), multiplicity(0), bullet_ekin(0.) {;}
G4VHadDecayAlgorithm(const G4String &algName, G4int verbose=0)

◆ ~G4CascadeFinalStateAlgorithm()

G4CascadeFinalStateAlgorithm::~G4CascadeFinalStateAlgorithm ( )
virtual

Definition at line 79 of file G4CascadeFinalStateAlgorithm.cc.

79{;}

Member Function Documentation

◆ BetaKopylov()

G4double G4CascadeFinalStateAlgorithm::BetaKopylov ( G4int  K) const
protected

Definition at line 507 of file G4CascadeFinalStateAlgorithm.cc.

507 {
508 G4Pow* g4pow = G4Pow::GetInstance();
509
510 G4int N = 3*K - 5;
511 G4double xN = G4double(N);
512 G4double Fmax = std::sqrt(g4pow->powN(xN/(xN+1.),N)/(xN+1.));
513
514 G4double F, chi;
515 do { /* Loop checking 08.06.2015 MHK */
516 chi = G4UniformRand();
517 F = std::sqrt(g4pow->powN(chi,N)*(1.-chi));
518 } while ( Fmax*G4UniformRand() > F);
519 return chi;
520}
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4UniformRand()
Definition: Randomize.hh:52
Definition: G4Pow.hh:49
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double powN(G4double x, G4int n) const
Definition: G4Pow.cc:166

References G4UniformRand, G4Pow::GetInstance(), and G4Pow::powN().

Referenced by FillUsingKopylov().

◆ ChooseGenerators()

void G4CascadeFinalStateAlgorithm::ChooseGenerators ( G4int  is,
G4int  fs 
)
protected

Definition at line 136 of file G4CascadeFinalStateAlgorithm.cc.

136 {
137 if (GetVerboseLevel()>1)
138 G4cout << " >>> " << GetName() << "::ChooseGenerators"
139 << " is " << is << " fs " << fs << G4endl;
140
141 // Get generators for momentum and angle
144
145 if (fs > 0 && multiplicity == 2) {
146 G4int kw = (fs==is) ? 1 : 2;
148 } else if (multiplicity == 3) {
150 } else {
151 angDist = 0;
152 }
153
154 if (GetVerboseLevel()>1) {
155 G4cout << " " << (momDist?momDist->GetName().c_str():"") << " "
156 << (angDist?angDist->GetName().c_str():"") << G4endl;
157 }
158}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4bool usePhaseSpace()
static const G4VMultiBodyMomDst * GetDist(G4int is, G4int mult)
static const G4VTwoBodyAngDst * GetDist(G4int is, G4int fs, G4int kw)
const G4String & GetName() const
virtual const G4String & GetName() const
virtual const G4String & GetName() const

References angDist, G4cout, G4endl, G4TwoBodyAngularDist::GetDist(), G4MultiBodyMomentumDist::GetDist(), G4VMultiBodyMomDst::GetName(), G4VTwoBodyAngDst::GetName(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), momDist, multiplicity, and G4CascadeParameters::usePhaseSpace().

Referenced by Configure().

◆ Configure()

void G4CascadeFinalStateAlgorithm::Configure ( G4InuclElementaryParticle bullet,
G4InuclElementaryParticle target,
const std::vector< G4int > &  particle_kinds 
)

Definition at line 91 of file G4CascadeFinalStateAlgorithm.cc.

94 {
95 if (GetVerboseLevel()>1)
96 G4cout << " >>> " << GetName() << "::Configure" << G4endl;
97
98 // Identify initial and final state (if two-body) for algorithm selection
99 multiplicity = particle_kinds.size();
100 G4int is = bullet->type() * target->type();
101 G4int fs = (multiplicity==2) ? particle_kinds[0]*particle_kinds[1] : 0;
102
103 ChooseGenerators(is, fs);
104
105 // Save kinematics for use with distributions
106 SaveKinematics(bullet, target);
107
108 // Save particle types for use with distributions
109 kinds = particle_kinds;
110}
void SaveKinematics(G4InuclElementaryParticle *bullet, G4InuclElementaryParticle *target)

References ChooseGenerators(), G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), kinds, multiplicity, SaveKinematics(), and G4InuclElementaryParticle::type().

Referenced by G4CascadeFinalStateGenerator::Configure().

◆ FillDirections()

void G4CascadeFinalStateAlgorithm::FillDirections ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protected

Definition at line 312 of file G4CascadeFinalStateAlgorithm.cc.

314 {
315 if (GetVerboseLevel()>1)
316 G4cout << " >>> " << GetName() << "::FillDirections" << G4endl;
317
318 finalState.clear(); // Initialization and sanity check
319 if ((G4int)modules.size() != multiplicity) return;
320
321 // Different order of processing for three vs. N body
322 if (multiplicity == 3)
323 FillDirThreeBody(initialMass, masses, finalState);
324 else
325 FillDirManyBody(initialMass, masses, finalState);
326}
void FillDirThreeBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void FillDirManyBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)

References FillDirManyBody(), FillDirThreeBody(), G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), modules, and multiplicity.

Referenced by GenerateMultiBody().

◆ FillDirManyBody()

void G4CascadeFinalStateAlgorithm::FillDirManyBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protected

Definition at line 361 of file G4CascadeFinalStateAlgorithm.cc.

363 {
364 if (GetVerboseLevel()>1)
365 G4cout << " >>> " << GetName() << "::FillDirManyBody" << G4endl;
366
367 // Fill all but the last two particles randomly
368 G4double costh = 0.;
369
370 finalState.resize(multiplicity);
371
372 for (G4int i=0; i<multiplicity-2; i++) {
373 costh = GenerateCosTheta(kinds[i], modules[i]);
374 finalState[i] = generateWithFixedTheta(costh, modules[i], masses[i]);
375 finalState[i] = toSCM.rotate(finalState[i]); // Align target axis
376 }
377
378 // Total momentum so far, to compute recoil of last two particles
379 G4LorentzVector psum =
380 std::accumulate(finalState.begin(), finalState.end()-2, G4LorentzVector());
381 G4double pmod = psum.rho();
382
383 costh = -0.5 * (pmod*pmod +
386 / pmod / modules[multiplicity-2];
387
388 if (GetVerboseLevel() > 2) G4cout << " ct last " << costh << G4endl;
389
390 if (std::fabs(costh) >= maxCosTheta) { // Bad kinematics; abort generation
391 finalState.clear();
392 return;
393 }
394
395 // Report success
396 if (GetVerboseLevel()>2) G4cout << " ok for mult " << multiplicity << G4endl;
397
398 // First particle is at fixed angle to recoil system
399 finalState[multiplicity-2] =
401 masses[multiplicity-2]);
402 finalState[multiplicity-2] = toSCM.rotate(psum, finalState[multiplicity-2]);
403
404 // Remaining particle is constrained to recoil from entire rest of system
405 finalState[multiplicity-1].set(0.,0.,0.,initialMass);
406 finalState[multiplicity-1] -= psum + finalState[multiplicity-2];
407}
void set(double x, double y, double z, double t)
G4double GenerateCosTheta(G4int ptype, G4double pmod) const
G4LorentzVector rotate(const G4LorentzVector &mom) const
G4LorentzVector generateWithFixedTheta(G4double ct, G4double p, G4double mass=0.)

References G4cout, G4endl, GenerateCosTheta(), G4InuclSpecialFunctions::generateWithFixedTheta(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), kinds, maxCosTheta, modules, multiplicity, CLHEP::HepLorentzVector::rho(), G4LorentzConvertor::rotate(), CLHEP::HepLorentzVector::set(), and toSCM.

Referenced by FillDirections().

◆ FillDirThreeBody()

void G4CascadeFinalStateAlgorithm::FillDirThreeBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protected

Definition at line 328 of file G4CascadeFinalStateAlgorithm.cc.

330 {
331 if (GetVerboseLevel()>1)
332 G4cout << " >>> " << GetName() << "::FillDirThreeBody" << G4endl;
333
334 finalState.resize(3);
335
336 G4double costh = GenerateCosTheta(kinds[2], modules[2]);
337 finalState[2] = generateWithFixedTheta(costh, modules[2], masses[2]);
338 finalState[2] = toSCM.rotate(finalState[2]); // Align target axis
339
340 // Generate direction of first particle
341 costh = -0.5 * (modules[2]*modules[2] + modules[0]*modules[0] -
342 modules[1]*modules[1]) / modules[2] / modules[0];
343
344 if (std::fabs(costh) >= maxCosTheta) { // Bad kinematics; abort generation
345 finalState.clear();
346 return;
347 }
348
349 // Report success
350 if (GetVerboseLevel()>2) G4cout << " ok for mult 3" << G4endl;
351
352 // First particle is at fixed angle to recoil system
353 finalState[0] = generateWithFixedTheta(costh, modules[0], masses[0]);
354 finalState[0] = toSCM.rotate(finalState[2], finalState[0]);
355
356 // Remaining particle is constrained to recoil from entire rest of system
357 finalState[1].set(0.,0.,0.,initialMass);
358 finalState[1] -= finalState[0] + finalState[2];
359}

References G4cout, G4endl, GenerateCosTheta(), G4InuclSpecialFunctions::generateWithFixedTheta(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), kinds, maxCosTheta, modules, G4LorentzConvertor::rotate(), CLHEP::HepLorentzVector::set(), and toSCM.

Referenced by FillDirections().

◆ FillMagnitudes()

void G4CascadeFinalStateAlgorithm::FillMagnitudes ( G4double  initialMass,
const std::vector< G4double > &  masses 
)
protected

Definition at line 227 of file G4CascadeFinalStateAlgorithm.cc.

228 {
229 if (GetVerboseLevel()>1)
230 G4cout << " >>> " << GetName() << "::FillMagnitudes" << G4endl;
231
232 modules.clear(); // Initialization and sanity checks
233 if (!momDist) return;
234
235 modules.resize(multiplicity,0.); // Pre-allocate to avoid resizing
236
237 G4double mass_last = masses.back();
238 G4double pmod = 0.;
239
240 if (GetVerboseLevel() > 3){
241 G4cout << " knd_last " << kinds.back() << " mass_last "
242 << mass_last << G4endl;
243 }
244
245 G4int itry = -1;
246 while (++itry < itry_max) { /* Loop checking 08.06.2015 MHK */
247 if (GetVerboseLevel() > 3) {
248 G4cout << " itry in fillMagnitudes " << itry << G4endl;
249 }
250
251 G4double eleft = initialMass;
252
253 G4int i; // For access outside of loop
254 for (i=0; i < multiplicity-1; i++) {
256
257 if (pmod < small) break;
258 eleft -= std::sqrt(pmod*pmod + masses[i]*masses[i]);
259
260 if (GetVerboseLevel() > 3) {
261 G4cout << " kp " << kinds[i] << " pmod " << pmod
262 << " mass2 " << masses[i]*masses[i] << " eleft " << eleft
263 << "\n x1 " << eleft - mass_last << G4endl;
264 }
265
266 if (eleft <= mass_last) break;
267
268 modules[i] = pmod;
269 }
270
271 if (i < multiplicity-1) continue; // Failed to generate full kinematics
272
273 G4double plast = eleft * eleft - masses.back()*masses.back();
274 if (GetVerboseLevel() > 2) G4cout << " plast ** 2 " << plast << G4endl;
275
276 if (plast <= small) continue; // Not enough momentum left over
277
278 plast = std::sqrt(plast); // Final momentum is what's left over
279 modules.back() = plast;
280
281 if (multiplicity > 3 || satisfyTriangle(modules)) break; // Successful
282 } // while (itry < itry_max)
283
284 if (itry >= itry_max) { // Too many attempts
285 if (GetVerboseLevel() > 2)
286 G4cerr << " Unable to generate momenta for multiplicity "
287 << multiplicity << G4endl;
288
289 modules.clear(); // Something went wrong, throw away partial
290 }
291}
G4GLOB_DLL std::ostream G4cerr
G4bool satisfyTriangle(const std::vector< G4double > &pmod) const
virtual G4double GetMomentum(G4int ptype, const G4double &ekin) const =0

References bullet_ekin, G4cerr, G4cout, G4endl, G4VMultiBodyMomDst::GetMomentum(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), itry_max, kinds, modules, momDist, multiplicity, satisfyTriangle(), and small.

Referenced by GenerateMultiBody().

◆ FillUsingKopylov()

void G4CascadeFinalStateAlgorithm::FillUsingKopylov ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protected

Definition at line 463 of file G4CascadeFinalStateAlgorithm.cc.

466 {
467 if (GetVerboseLevel()>2)
468 G4cout << " >>> " << GetName() << "::FillUsingKopylov" << G4endl;
469
470 finalState.clear();
471
472 size_t N = masses.size();
473 finalState.resize(N);
474
475 G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
476 G4double mu = mtot;
477 G4double Mass = initialMass;
478 G4double T = Mass-mtot;
479 G4double recoilMass = 0.0;
480 G4ThreeVector momV, boostV; // Buffers to reduce memory churn
481 G4LorentzVector recoil(0.0,0.0,0.0,Mass);
482
483 for (size_t k=N-1; k>0; --k) {
484 mu -= masses[k];
485 T *= (k>1) ? BetaKopylov(k) : 0.;
486
487 recoilMass = mu + T;
488
489 boostV = recoil.boostVector(); // Previous system's rest frame
490
491 // Create momentum with a random direction isotropically distributed
492 // FIXME: Should theta distribution should use Bertini fit function?
493 momV.setRThetaPhi(TwoBodyMomentum(Mass,masses[k],recoilMass),
495
496 finalState[k].setVectM(momV,masses[k]);
497 recoil.setVectM(-momV,recoilMass);
498
499 finalState[k].boost(boostV);
500 recoil.boost(boostV);
501 Mass = recoilMass;
502 }
503
504 finalState[0] = recoil;
505}
void setRThetaPhi(double r, double theta, double phi)
G4double UniformTheta() const
G4double TwoBodyMomentum(G4double M0, G4double M1, G4double M2) const

References BetaKopylov(), CLHEP::HepLorentzVector::boost(), CLHEP::HepLorentzVector::boostVector(), G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), CLHEP::Hep3Vector::setRThetaPhi(), CLHEP::HepLorentzVector::setVectM(), G4VHadDecayAlgorithm::TwoBodyMomentum(), G4VHadDecayAlgorithm::UniformPhi(), and G4VHadDecayAlgorithm::UniformTheta().

Referenced by GenerateMultiBody().

◆ Generate()

void G4VHadDecayAlgorithm::Generate ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
inherited

Definition at line 48 of file G4VHadDecayAlgorithm.cc.

50 {
51 if (verboseLevel) G4cout << GetName() << "::Generate" << G4endl;
52
53 // Initialization and sanity check
54 finalState.clear();
55 if (!IsDecayAllowed(initialMass, masses)) return;
56
57 // Allow different procedures for two-body or N-body distributions
58 if (masses.size() == 2U)
59 GenerateTwoBody(initialMass, masses, finalState);
60 else
61 GenerateMultiBody(initialMass, masses, finalState);
62}
virtual void GenerateTwoBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)=0
virtual G4bool IsDecayAllowed(G4double initialMass, const std::vector< G4double > &masses) const
virtual void GenerateMultiBody(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)=0

References G4cout, G4endl, G4VHadDecayAlgorithm::GenerateMultiBody(), G4VHadDecayAlgorithm::GenerateTwoBody(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::IsDecayAllowed(), and G4VHadDecayAlgorithm::verboseLevel.

Referenced by G4HadDecayGenerator::Generate().

◆ GenerateCosTheta()

G4double G4CascadeFinalStateAlgorithm::GenerateCosTheta ( G4int  ptype,
G4double  pmod 
) const
protected

Definition at line 412 of file G4CascadeFinalStateAlgorithm.cc.

413 {
414 if (GetVerboseLevel() > 2) {
415 G4cout << " >>> " << GetName() << "::GenerateCosTheta " << ptype
416 << " " << pmod << G4endl;
417 }
418
419 if (multiplicity == 3) { // Use distribution for three-body
420 return angDist->GetCosTheta(bullet_ekin, ptype);
421 }
422
423 // Throw multi-body distribution
424 G4double p0 = ptype<3 ? 0.36 : 0.25; // Nucleon vs. everything else
425 G4double alf = 1.0 / p0 / (p0 - (pmod+p0)*G4Exp(-pmod / p0));
426
427 G4double sinth = 2.0;
428
429 G4int itry1 = -1; /* Loop checking 08.06.2015 MHK */
430 while (std::fabs(sinth) > maxCosTheta && ++itry1 < itry_max) {
431 G4double s1 = pmod * inuclRndm();
432 G4double s2 = alf * oneOverE * p0 * inuclRndm();
433 G4double salf = s1 * alf * G4Exp(-s1 / p0);
434 if (GetVerboseLevel() > 3) {
435 G4cout << " s1 * alf * G4Exp(-s1 / p0) " << salf
436 << " s2 " << s2 << G4endl;
437 }
438
439 if (salf > s2) sinth = s1 / pmod;
440 }
441
442 if (GetVerboseLevel() > 3)
443 G4cout << " itry1 " << itry1 << " sinth " << sinth << G4endl;
444
445 if (itry1 == itry_max) {
446 if (GetVerboseLevel() > 2)
447 G4cout << " high energy angles generation: itry1 " << itry1 << G4endl;
448
449 sinth = 0.5 * inuclRndm();
450 }
451
452 // Convert generated sin(theta) to cos(theta) with random sign
453 G4double costh = std::sqrt(1.0 - sinth * sinth);
454 if (inuclRndm() > 0.5) costh = -costh;
455
456 return costh;
457}
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
virtual G4double GetCosTheta(const G4double &ekin, const G4double &pcm) const =0

References angDist, bullet_ekin, G4cout, G4endl, G4Exp(), G4VTwoBodyAngDst::GetCosTheta(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), G4InuclSpecialFunctions::inuclRndm(), itry_max, maxCosTheta, multiplicity, and oneOverE.

Referenced by FillDirManyBody(), and FillDirThreeBody().

◆ GenerateMultiBody()

void G4CascadeFinalStateAlgorithm::GenerateMultiBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protectedvirtual

Implements G4VHadDecayAlgorithm.

Definition at line 204 of file G4CascadeFinalStateAlgorithm.cc.

206 {
207 if (GetVerboseLevel()>1)
208 G4cout << " >>> " << GetName() << "::GenerateMultiBody" << G4endl;
209
211 FillUsingKopylov(initialMass, masses, finalState);
212 return;
213 }
214
215 finalState.clear(); // Initialization and sanity checks
216 if (multiplicity < 3) return;
217 if (!momDist) return;
218
219 G4int itry = -1; /* Loop checking 08.06.2015 MHK */
220 while ((G4int)finalState.size() != multiplicity && ++itry < itry_max) {
221 FillMagnitudes(initialMass, masses);
222 FillDirections(initialMass, masses, finalState);
223 }
224}
void FillUsingKopylov(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void FillDirections(G4double initialMass, const std::vector< G4double > &masses, std::vector< G4LorentzVector > &finalState)
void FillMagnitudes(G4double initialMass, const std::vector< G4double > &masses)

References FillDirections(), FillMagnitudes(), FillUsingKopylov(), G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), itry_max, momDist, multiplicity, and G4CascadeParameters::usePhaseSpace().

◆ GenerateTwoBody()

void G4CascadeFinalStateAlgorithm::GenerateTwoBody ( G4double  initialMass,
const std::vector< G4double > &  masses,
std::vector< G4LorentzVector > &  finalState 
)
protectedvirtual

Implements G4VHadDecayAlgorithm.

Definition at line 163 of file G4CascadeFinalStateAlgorithm.cc.

165 {
166 if (GetVerboseLevel()>1)
167 G4cout << " >>> " << GetName() << "::GenerateTwoBody" << G4endl;
168
169 finalState.clear(); // Initialization and sanity checks
170
171 if (multiplicity != 2) return;
172
173 // Generate momentum vector in CMS for back-to-back particles
174 G4double pscm = TwoBodyMomentum(initialMass, masses[0], masses[1]);
175
177 : (2.*G4UniformRand() - 1.);
178
179 mom.setRThetaPhi(pscm, std::acos(costh), UniformPhi());
180
181 if (GetVerboseLevel()>3) { // Copied from old G4EPCollider
182 G4cout << " Particle kinds = " << kinds[0] << " , " << kinds[1]
183 << "\n pmod " << pscm
184 << "\n before rotation px " << mom.x() << " py " << mom.y()
185 << " pz " << mom.z() << G4endl;
186 }
187
188 finalState.resize(2); // Allows filling by index
189
190 finalState[0].setVectM(mom, masses[0]);
191 finalState[0] = toSCM.rotate(finalState[0]);
192
193 if (GetVerboseLevel()>3) { // Copied from old G4EPCollider
194 G4cout << " after rotation px " << finalState[0].x() << " py "
195 << finalState[0].y() << " pz " << finalState[0].z() << G4endl;
196 }
197
198 finalState[1].setVectM(-finalState[0].vect(), masses[1]);
199}
double z() const
double x() const
double y() const

References angDist, bullet_ekin, G4cout, G4endl, G4UniformRand, G4VTwoBodyAngDst::GetCosTheta(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), kinds, mom, multiplicity, G4LorentzConvertor::rotate(), CLHEP::Hep3Vector::setRThetaPhi(), toSCM, G4VHadDecayAlgorithm::TwoBodyMomentum(), G4VHadDecayAlgorithm::UniformPhi(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ GetName()

const G4String & G4VHadDecayAlgorithm::GetName ( ) const
inlineinherited

◆ GetVerboseLevel()

G4int G4VHadDecayAlgorithm::GetVerboseLevel ( ) const
inlineinherited

◆ IsDecayAllowed()

G4bool G4VHadDecayAlgorithm::IsDecayAllowed ( G4double  initialMass,
const std::vector< G4double > &  masses 
) const
protectedvirtualinherited

Definition at line 67 of file G4VHadDecayAlgorithm.cc.

69 {
70 G4bool okay =
71 (initialMass > 0. && masses.size() >= 2 &&
72 initialMass >= std::accumulate(masses.begin(),masses.end(),0.));
73
74 if (verboseLevel) {
75 G4cout << GetName() << "::IsDecayAllowed? initialMass " << initialMass
76 << " " << masses.size() << " masses sum "
77 << std::accumulate(masses.begin(),masses.end(),0.) << G4endl;
78
79 if (verboseLevel>1) PrintVector(masses," ",G4cout);
80
81 G4cout << " Returning " << okay << G4endl;
82 }
83
84 return okay;
85}
bool G4bool
Definition: G4Types.hh:86
void PrintVector(const std::vector< G4double > &v, const G4String &name, std::ostream &os) const

References G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::PrintVector(), and G4VHadDecayAlgorithm::verboseLevel.

Referenced by G4VHadDecayAlgorithm::Generate().

◆ PrintVector()

void G4VHadDecayAlgorithm::PrintVector ( const std::vector< G4double > &  v,
const G4String name,
std::ostream &  os 
) const
protectedinherited

Definition at line 121 of file G4VHadDecayAlgorithm.cc.

123 {
124 os << " " << vname << "(" << v.size() << ") ";
125 std::copy(v.begin(), v.end(), std::ostream_iterator<G4double>(os, " "));
126 os << std::endl;
127}
void copy(G4double dst[], const G4double src[], size_t size=G4FieldTrack::ncompSVEC)
Definition: G4FieldUtils.cc:98

References field_utils::copy().

Referenced by G4HadPhaseSpaceGenbod::FillEnergySteps(), G4HadPhaseSpaceGenbod::FillRandomBuffer(), G4HadPhaseSpaceNBodyAsai::GenerateMultiBody(), G4HadPhaseSpaceGenbod::Initialize(), and G4VHadDecayAlgorithm::IsDecayAllowed().

◆ satisfyTriangle()

G4bool G4CascadeFinalStateAlgorithm::satisfyTriangle ( const std::vector< G4double > &  pmod) const
protected

Definition at line 295 of file G4CascadeFinalStateAlgorithm.cc.

296 {
297 if (GetVerboseLevel() > 3)
298 G4cout << " >>> " << GetName() << "::satisfyTriangle" << G4endl;
299
300 return ( (pmod.size() != 3) ||
301 !(pmod[0] < std::fabs(pmod[1] - pmod[2]) ||
302 pmod[0] > pmod[1] + pmod[2] ||
303 pmod[1] < std::fabs(pmod[0] - pmod[2]) ||
304 pmod[1] > pmod[0] + pmod[2] ||
305 pmod[2] < std::fabs(pmod[0] - pmod[1]) ||
306 pmod[2] > pmod[1] + pmod[0])
307 );
308}

References G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), and G4VHadDecayAlgorithm::GetVerboseLevel().

Referenced by FillMagnitudes().

◆ SaveKinematics()

void G4CascadeFinalStateAlgorithm::SaveKinematics ( G4InuclElementaryParticle bullet,
G4InuclElementaryParticle target 
)
protected

Definition at line 114 of file G4CascadeFinalStateAlgorithm.cc.

116 {
117 if (GetVerboseLevel()>1)
118 G4cout << " >>> " << GetName() << "::SaveKinematics" << G4endl;
119
120 if (target->nucleon()) { // Which particle originated in nucleus?
121 toSCM.setBullet(bullet);
122 toSCM.setTarget(target);
123 } else {
124 toSCM.setBullet(target);
125 toSCM.setTarget(bullet);
126 }
127
129
131}
void setBullet(const G4InuclParticle *bullet)
G4double getKinEnergyInTheTRS() const
void setTarget(const G4InuclParticle *target)

References bullet_ekin, G4cout, G4endl, G4LorentzConvertor::getKinEnergyInTheTRS(), G4VHadDecayAlgorithm::GetName(), G4VHadDecayAlgorithm::GetVerboseLevel(), G4InuclElementaryParticle::nucleon(), G4LorentzConvertor::setBullet(), G4LorentzConvertor::setTarget(), toSCM, and G4LorentzConvertor::toTheCenterOfMass().

Referenced by Configure().

◆ SetVerboseLevel()

void G4CascadeFinalStateAlgorithm::SetVerboseLevel ( G4int  verbose)
virtual

◆ TwoBodyMomentum()

G4double G4VHadDecayAlgorithm::TwoBodyMomentum ( G4double  M0,
G4double  M1,
G4double  M2 
) const
protectedinherited

Definition at line 90 of file G4VHadDecayAlgorithm.cc.

91 {
92 G4double PSQ = (M0+M1+M2)*(M0+M1-M2)*(M0-M1+M2)*(M0-M1-M2);
93 if (PSQ < 0.) {
94 G4cout << GetName() << ": problem of decay of M(GeV) " << M0/GeV
95 << " to M1(GeV) " << M1/GeV << " and M2(GeV) " << M2/GeV
96 << " PSQ(MeV) " << PSQ/MeV << " < 0" << G4endl;
97 // exception only if the problem is numerically significant
98 if (PSQ < -CLHEP::eV) {
99 throw G4HadronicException(__FILE__, __LINE__,"Error in decay kinematics");
100 }
101
102 PSQ = 0.;
103 }
104
105 return std::sqrt(PSQ)/(2.*M0);
106}
static constexpr double GeV
Definition: G4SIunits.hh:203
static constexpr double MeV
Definition: G4SIunits.hh:200
static constexpr double eV

References CLHEP::eV, G4cout, G4endl, G4VHadDecayAlgorithm::GetName(), GeV, and MeV.

Referenced by G4HadPhaseSpaceGenbod::ComputeWeightScale(), G4HadPhaseSpaceGenbod::FillEnergySteps(), FillUsingKopylov(), G4HadPhaseSpaceKopylov::GenerateMultiBody(), G4HadPhaseSpaceNBodyAsai::GenerateMultiBody(), GenerateTwoBody(), and G4VHadPhaseSpaceAlgorithm::GenerateTwoBody().

◆ UniformPhi()

G4double G4VHadDecayAlgorithm::UniformPhi ( ) const
protectedinherited

Definition at line 114 of file G4VHadDecayAlgorithm.cc.

114 {
115 return twopi*G4UniformRand();
116}
static constexpr double twopi
Definition: G4SIunits.hh:56

References G4UniformRand, and twopi.

Referenced by FillUsingKopylov(), GenerateTwoBody(), and G4VHadPhaseSpaceAlgorithm::UniformVector().

◆ UniformTheta()

G4double G4VHadDecayAlgorithm::UniformTheta ( ) const
protectedinherited

Definition at line 110 of file G4VHadDecayAlgorithm.cc.

110 {
111 return std::acos(2.0*G4UniformRand() - 1.0);
112}

References G4UniformRand.

Referenced by FillUsingKopylov(), and G4VHadPhaseSpaceAlgorithm::UniformVector().

Field Documentation

◆ angDist

const G4VTwoBodyAngDst* G4CascadeFinalStateAlgorithm::angDist
private

◆ bullet_ekin

G4double G4CascadeFinalStateAlgorithm::bullet_ekin
private

◆ itry_max

const G4int G4CascadeFinalStateAlgorithm::itry_max = 10
staticprivate

◆ kinds

std::vector<G4int> G4CascadeFinalStateAlgorithm::kinds
private

◆ maxCosTheta

const G4double G4CascadeFinalStateAlgorithm::maxCosTheta = 0.9999
staticprivate

◆ modules

std::vector<G4double> G4CascadeFinalStateAlgorithm::modules
private

◆ mom

G4ThreeVector G4CascadeFinalStateAlgorithm::mom
private

Definition at line 116 of file G4CascadeFinalStateAlgorithm.hh.

Referenced by GenerateTwoBody().

◆ momDist

const G4VMultiBodyMomDst* G4CascadeFinalStateAlgorithm::momDist
private

◆ multiplicity

G4int G4CascadeFinalStateAlgorithm::multiplicity
private

◆ name

G4String G4VHadDecayAlgorithm::name
privateinherited

◆ oneOverE

const G4double G4CascadeFinalStateAlgorithm::oneOverE = 0.3678794
staticprivate

Definition at line 119 of file G4CascadeFinalStateAlgorithm.hh.

Referenced by GenerateCosTheta().

◆ small

const G4double G4CascadeFinalStateAlgorithm::small = 1.e-10
staticprivate

Definition at line 120 of file G4CascadeFinalStateAlgorithm.hh.

Referenced by FillMagnitudes().

◆ toSCM

G4LorentzConvertor G4CascadeFinalStateAlgorithm::toSCM
private

◆ verboseLevel

G4int G4VHadDecayAlgorithm::verboseLevel
privateinherited

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