Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
tpia_kinetics.cc File Reference
#include <string.h>
#include <cmath>
#include <tpia_target.h>

Go to the source code of this file.

Functions

int tpia_kinetics_2BodyReaction (statusMessageReporting *smr, tpia_decayChannel *decayChannel, double K, double mu, double phi, tpia_productOutgoingData *outgoingData)
 
int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum (statusMessageReporting *, double beta, double e_kinetic_com, double mu, double phi, double m3cc, double m4cc, tpia_productOutgoingData *outgoingData)
 

Function Documentation

int tpia_kinetics_2BodyReaction ( statusMessageReporting smr,
tpia_decayChannel decayChannel,
double  K,
double  mu,
double  phi,
tpia_productOutgoingData outgoingData 
)

Definition at line 48 of file tpia_kinetics.cc.

References tpia_productOutgoingData_s::decayChannel, tpia_product_s::decayChannel, tpia_particle_s::fullMass_MeV, tpia_productOutgoingData_s::genre, tpia_decayChannel_s::m1_fullMass_MeV, python.hepunit::m2, tpia_decayChannel_s::m2_fullMass_MeV, python.hepunit::m3, tpia_productOutgoingData_s::productID, tpia_product_s::productID, tpia_decayChannel_getFirstProduct(), tpia_decayChannel_getNextProduct(), tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum(), and test::x.

Referenced by tpia_decayChannel_sampleProductsAtE().

49  {
50 
51  tpia_product *pp3 = tpia_decayChannel_getFirstProduct( decayChannel ), *pp4;
52  double m1 = decayChannel->m1_fullMass_MeV, m2 = decayChannel->m2_fullMass_MeV, m3, m4, mi, mf, Kp, x, beta;
53 
55  m3 = pp3->productID->fullMass_MeV;
56  m4 = pp4->productID->fullMass_MeV;
57  mi = m1 + m2;
58  mf = m3 + m4;
59  beta = std::sqrt( K * ( K + 2. * m1 ) ) / ( K + mi );
60  x = K * m2 / ( mi * mi );
61  if( x < 2e-5 ) { /* Kp is the total kinetic energy for m3 and m4 in the COM frame. */
62  Kp = mi - mf + K * m2 / mi * ( 1 - 0.5 * x * ( 1 - x ) ); }
63  else {
64  Kp = std::sqrt( mi * mi + 2 * K * m2 ) - mf;
65  }
66  if( Kp < 0 ) Kp = 0.; /* ???? There needs to be a better test here. */
67  outgoingData[0].decayChannel = &(pp3->decayChannel);
68  outgoingData[1].genre = outgoingData[0].genre;
69  outgoingData[1].productID = pp4->productID;
70  outgoingData[1].decayChannel = &(pp4->decayChannel);
71  return( tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum( smr, beta, Kp, mu, phi, m3, m4, outgoingData ) );
72 }
tpia_decayChannel decayChannel
Definition: tpia_target.h:247
double fullMass_MeV
Definition: tpia_target.h:130
int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum(statusMessageReporting *, double beta, double e_kinetic_com, double mu, double phi, double m3cc, double m4cc, tpia_productOutgoingData *outgoingData)
tpia_particle * productID
Definition: tpia_target.h:165
tpia_decayChannel * decayChannel
Definition: tpia_target.h:170
tpia_product * tpia_decayChannel_getFirstProduct(tpia_decayChannel *decayChannel)
tpia_particle * productID
Definition: tpia_target.h:236
tpia_product * tpia_decayChannel_getNextProduct(tpia_product *product)
int tpia_kinetics_COMKineticEnergy2LabEnergyAndMomentum ( statusMessageReporting ,
double  beta,
double  e_kinetic_com,
double  mu,
double  phi,
double  m3cc,
double  m4cc,
tpia_productOutgoingData outgoingData 
)

Definition at line 77 of file tpia_kinetics.cc.

References tpia_productOutgoingData_s::frame, tpia_productOutgoingData_s::isVelocity, tpia_productOutgoingData_s::kineticEnergy, tpia_productOutgoingData_s::px_vx, tpia_productOutgoingData_s::py_vy, tpia_productOutgoingData_s::pz_vz, tpia_frame_getColumn(), tpia_referenceFrame_lab, tpia_speedOfLight_cm_sec, and test::x.

Referenced by tpia_kinetics_2BodyReaction().

78  {
79 /*
80 * beta the velocity/speedOflight of the com frame relative to the lab frame.
81 * e_kinetic_com Total kinetic energy (K1 + K2) in the COM frame.
82 * mu std::cos( theta ) in the COM frame.
83 */
84  double x, v_p, p, pp3, pp4, px3, py3, pz3, pz4, pz, p_perp2, E3, E4, gamma, m3cc2 = m3cc * m3cc, m4cc2 = m4cc * m4cc;
85 
86  p = std::sqrt( e_kinetic_com * ( e_kinetic_com + 2. * m3cc ) * ( e_kinetic_com + 2. * m4cc ) * ( e_kinetic_com + 2. * ( m3cc + m4cc ) ) ) /
87  ( 2. * ( e_kinetic_com + m3cc + m4cc ) );
88  py3 = p * std::sqrt( 1 - mu * mu );
89  px3 = py3 * std::cos( phi );
90  py3 *= std::sin( phi );
91  pz = p * mu;
92  if( tpia_frame_getColumn( NULL, &(outgoingData[0].frame), 0 ) == tpia_referenceFrame_lab ) {
93  E3 = std::sqrt( p * p + m3cc2 );
94  E4 = std::sqrt( p * p + m4cc2 );
95  gamma = std::sqrt( 1. / ( 1. - beta * beta ) );
96  pz3 = gamma * ( pz + beta * E3 );
97  pz4 = gamma * ( -pz + beta * E4 ); }
98  else {
99  pz3 = pz;
100  pz4 = -pz;
101  }
102  outgoingData[1].isVelocity = outgoingData[0].isVelocity;
103  outgoingData[1].frame = outgoingData[0].frame;
104 
105  p_perp2 = px3 * px3 + py3 * py3;
106 
107  outgoingData[0].px_vx = px3;
108  outgoingData[0].py_vy = py3;
109  outgoingData[0].pz_vz = pz3;
110  pp3 = p_perp2 + pz3 * pz3;
111  x = pp3 / ( 2 * m3cc2 );
112  if( x < 1e-5 ) {
113  outgoingData[0].kineticEnergy = m3cc * x * ( 1 - 0.5 * x * ( 1 - x ) ); }
114  else {
115  outgoingData[0].kineticEnergy = std::sqrt( m3cc2 + pp3 ) - m3cc;
116  }
117  outgoingData[1].px_vx = -px3;
118  outgoingData[1].py_vy = -py3;
119  outgoingData[1].pz_vz = pz4;
120  pp4 = p_perp2 + pz4 * pz4;
121  x = pp4 / ( 2 * m4cc2 );
122  if( x < 1e-5 ) {
123  outgoingData[1].kineticEnergy = m4cc * x * ( 1 - 0.5 * x * ( 1 - x ) ); }
124  else {
125  outgoingData[1].kineticEnergy = std::sqrt( m4cc2 + pp4 ) - m4cc;
126  }
127 
128  if( outgoingData[0].isVelocity ) {
129  v_p = tpia_speedOfLight_cm_sec / std::sqrt( pp3 + m3cc2 );
130  outgoingData[0].px_vx *= v_p;
131  outgoingData[0].py_vy *= v_p;
132  outgoingData[0].pz_vz *= v_p;
133 
134  v_p = tpia_speedOfLight_cm_sec / std::sqrt( pp4 + m4cc2 );
135  outgoingData[1].px_vx *= v_p;
136  outgoingData[1].py_vy *= v_p;
137  outgoingData[1].pz_vz *= v_p;
138  }
139 
140  return( 0 );
141 }
const char * p
Definition: xmltok.h:285
#define tpia_speedOfLight_cm_sec
Definition: tpia_target.h:100
#define tpia_referenceFrame_lab
Definition: tpia_target.h:85
int tpia_frame_getColumn(statusMessageReporting *smr, tpia_data_frame *frame, int column)
Definition: tpia_frame.cc:214