Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI::Sampling::ProductHandler Class Reference

#include <MCGIDI_sampling.hpp>

Inheritance diagram for MCGIDI::Sampling::ProductHandler:

Public Member Functions

LUPI_HOST_DEVICE ProductHandler ()
LUPI_HOST_DEVICE ~ProductHandler ()
template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void add (double a_projectileEnergy, int a_productIntid, int a_productIndex, int a_userProductIndex, double a_productMass, Input &a_input, RNG &&a_rng, PUSHBACK &&push_back, bool isPhoton)

Detailed Description

Definition at line 242 of file MCGIDI_sampling.hpp.

Constructor & Destructor Documentation

◆ ProductHandler()

LUPI_HOST_DEVICE MCGIDI::Sampling::ProductHandler::ProductHandler ( )
inline

Definition at line 245 of file MCGIDI_sampling.hpp.

245{}

◆ ~ProductHandler()

LUPI_HOST_DEVICE MCGIDI::Sampling::ProductHandler::~ProductHandler ( )
inline

Definition at line 246 of file MCGIDI_sampling.hpp.

246{}

Member Function Documentation

◆ add()

template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE void MCGIDI::Sampling::ProductHandler::add ( double a_projectileEnergy,
int a_productIntid,
int a_productIndex,
int a_userProductIndex,
double a_productMass,
Input & a_input,
RNG && a_rng,
PUSHBACK && push_back,
bool isPhoton )

Definition at line 3364 of file MCGIDI_headerSource.hpp.

3365 {
3366
3367 Product product;
3368
3369 if( a_isPhoton && ( a_input.m_sampledType != SampledType::unspecified ) ) a_input.m_sampledType = SampledType::photon;
3370
3371 product.m_sampledType = a_input.m_sampledType;
3372 product.m_isVelocity = a_input.wantVelocity( );
3373 product.m_productIntid = a_productIntid;
3374 product.m_productIndex = a_productIndex;
3375 product.m_userProductIndex = a_userProductIndex;
3376 product.m_numberOfDBRC_rejections = a_input.m_numberOfDBRC_rejections;
3377 product.m_productMass = a_productMass;
3378
3379 product.m_delayedNeutronIndex = a_input.m_delayedNeutronIndex;
3380 product.m_delayedNeutronDecayRate = a_input.m_delayedNeutronDecayRate;
3381 product.m_birthTimeSec = 0.;
3382 if( product.m_delayedNeutronDecayRate > 0. ) {
3383 product.m_birthTimeSec = -log( a_rng( ) ) / product.m_delayedNeutronDecayRate;
3384 }
3385
3386 if( a_input.m_sampledType == SampledType::unspecified ) {
3387 product.m_kineticEnergy = 0.0;
3388 product.m_px_vx = 0.0;
3389 product.m_py_vy = 0.0;
3390 product.m_pz_vz = 0.0; }
3391 else if( a_input.m_sampledType == SampledType::uncorrelatedBody ) {
3392 if( a_input.m_frame == GIDI::Frame::centerOfMass ) {
3393 a_input.m_frame = GIDI::Frame::lab;
3394
3395 double massRatio = a_input.m_projectileMass + a_input.m_targetMass;
3396 massRatio = a_input.m_projectileMass * a_productMass / ( massRatio * massRatio );
3397 double modifiedProjectileEnergy = massRatio * a_projectileEnergy;
3398
3399 double sqrtModifiedProjectileEnergy = sqrt( modifiedProjectileEnergy );
3400 double sqrtEnergyOut_com = a_input.m_mu * sqrt( a_input.m_energyOut1 );
3401
3402 a_input.m_energyOut1 += modifiedProjectileEnergy + 2. * sqrtModifiedProjectileEnergy * sqrtEnergyOut_com;
3403 if( a_input.m_energyOut1 != 0 ) a_input.m_mu = ( sqrtModifiedProjectileEnergy + sqrtEnergyOut_com ) / sqrt( a_input.m_energyOut1 );
3404 }
3405
3406 product.m_kineticEnergy = a_input.m_energyOut1;
3407
3408 double p_v = sqrt( a_input.m_energyOut1 * ( a_input.m_energyOut1 + 2. * a_productMass ) );
3409 if( product.m_isVelocity ) p_v *= MCGIDI_speedOfLight_cm_sec / ( a_input.m_energyOut1 + a_productMass );
3410
3411 product.m_pz_vz = p_v * a_input.m_mu;
3412 p_v *= sqrt( 1. - a_input.m_mu * a_input.m_mu );
3413 product.m_px_vx = p_v * sin( a_input.m_phi );
3414 product.m_py_vy = p_v * cos( a_input.m_phi ); }
3415 else if( a_input.m_sampledType == SampledType::firstTwoBody ) {
3416 product.m_kineticEnergy = a_input.m_energyOut1;
3417 product.m_px_vx = a_input.m_px_vx1;
3418 product.m_py_vy = a_input.m_py_vy1;
3419 product.m_pz_vz = a_input.m_pz_vz1;
3420 a_input.m_sampledType = SampledType::secondTwoBody; }
3421 else if( a_input.m_sampledType == SampledType::secondTwoBody ) {
3422 product.m_kineticEnergy = a_input.m_energyOut2;
3423 product.m_px_vx = a_input.m_px_vx2;
3424 product.m_py_vy = a_input.m_py_vy2;
3425 product.m_pz_vz = a_input.m_pz_vz2; }
3426 else if( a_input.m_sampledType == SampledType::photon ) {
3427 product.m_kineticEnergy = a_input.m_energyOut1;
3428
3429 double pz_vz_factor = a_input.m_energyOut1;
3430 if( product.m_isVelocity ) pz_vz_factor = MCGIDI_speedOfLight_cm_sec;
3431 product.m_pz_vz = a_input.m_mu * pz_vz_factor;
3432
3433 double v_perp = sqrt( 1.0 - a_input.m_mu * a_input.m_mu ) * pz_vz_factor;
3434 product.m_px_vx = cos( a_input.m_phi ) * v_perp;
3435 product.m_py_vy = sin( a_input.m_phi ) * v_perp; }
3436 else {
3437 product.m_kineticEnergy = a_input.m_energyOut2;
3438 product.m_px_vx = a_input.m_px_vx2;
3439 product.m_py_vy = a_input.m_py_vy2;
3440 product.m_pz_vz = a_input.m_pz_vz2;
3441 }
3442
3443 if( a_input.m_dataInTargetFrame && ( a_input.m_sampledType != SampledType::photon ) ) upScatterModelABoostParticle( a_input, a_rng, product );
3444
3445 a_push_back( product );
3446}
#define MCGIDI_speedOfLight_cm_sec
Definition MCGIDI.hpp:68
@ centerOfMass
Definition GIDI.hpp:146
LUPI_HOST_DEVICE void upScatterModelABoostParticle(Sampling::Input &a_input, RNG &&a_rng, Sampling::Product &a_product)

Referenced by MCGIDI::ProtareSingle::sampleBranchingGammas(), MCGIDI::Product::sampleFinalState(), MCGIDI::Reaction::sampleNullProducts(), MCGIDI::GRIN_capture::sampleProducts(), MCGIDI::GRIN_inelastic::sampleProducts(), MCGIDI::OutputChannel::sampleProducts(), MCGIDI::Product::sampleProducts(), and MCGIDI::Reaction::sampleProducts().


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