Jpp  19.1.0-rc.1
the software that should make you happy
Public Member Functions | Protected Attributes | List of all members
JMARKOV::JRayleighScattering Class Reference

Implementation of the JScatteringModel interface with Rayleigh scattering. More...

#include <JScatteringModel.hh>

Inheritance diagram for JMARKOV::JRayleighScattering:
JMARKOV::JScatteringModel

Public Member Functions

 JRayleighScattering (double _lambda_scat, double _a)
 Constructor. More...
 
double getScatteringProbability (double ct)
 Return the probability density as a function of cos(theta) More...
 
JVersor3D generateDirection ()
 Return a randomly generated direction according to the scattering probability distribution. More...
 
virtual double getScatteringLength ()
 

Protected Attributes

double a
 
double lambda_scat
 

Detailed Description

Implementation of the JScatteringModel interface with Rayleigh scattering.

Definition at line 473 of file JScatteringModel.hh.

Constructor & Destructor Documentation

◆ JRayleighScattering()

JMARKOV::JRayleighScattering::JRayleighScattering ( double  _lambda_scat,
double  _a 
)
inline

Constructor.

note that one should never set a<0

Definition at line 482 of file JScatteringModel.hh.

482  {
483  lambda_scat = _lambda_scat ;
484  a = _a ;
485  if( fabs(a)<0 ) {
486  cerr << "Fatal error in initialization of JRayleighScattering: a<0 !" << endl ;
487  exit(1) ;
488  }
489  }

Member Function Documentation

◆ getScatteringProbability()

double JMARKOV::JRayleighScattering::getScatteringProbability ( double  ct)
inlinevirtual

Return the probability density as a function of cos(theta)

dP / dOmega = dP / dcosTheta dPhi

to scatter in a given direction. Theta=0 is forward scattering.

Implements JMARKOV::JScatteringModel.

Definition at line 491 of file JScatteringModel.hh.

491  {
492  //double ct = cos(dir.getTheta()) ;
493  return (1+a*ct*ct)/(4.0*M_PI*(1+a/3.0)) ;
494  }

◆ generateDirection()

JVersor3D JMARKOV::JRayleighScattering::generateDirection ( )
inlinevirtual

Return a randomly generated direction according to the scattering probability distribution.

This uses gRandom.

Implements JMARKOV::JScatteringModel.

Definition at line 496 of file JScatteringModel.hh.

496  {
497  double phi = gRandom->Uniform(0,2*M_PI) ;
498  double ct ;
499  if( a>0 ) {
500  double xi = gRandom->Uniform(0,1) ;
501  double d0 = -9/a ;
502  double d1 = 27.0*(1-2*xi)*(3+a)/a ;
503  double C = pow( 0.5*(d1 + sqrt(d1*d1-4*d0*d0*d0) ), 1.0/3.0 ) ;
504  ct = -1.0/(3.0)*(C+d0/C) ;
505  } else {
506  ct = gRandom->Uniform(-1,1) ;
507  }
508  return JDirection3D( JAngle3D( acos(ct),phi) ) ;
509  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:35
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
static const double C
Physics constants.

◆ getScatteringLength()

virtual double JMARKOV::JScatteringModel::getScatteringLength ( )
inlinevirtualinherited

Reimplemented in JMARKOV::JCombinedScattering.

Definition at line 73 of file JScatteringModel.hh.

73 { return lambda_scat ; }

Member Data Documentation

◆ a

double JMARKOV::JRayleighScattering::a
protected

Definition at line 513 of file JScatteringModel.hh.

◆ lambda_scat

double JMARKOV::JScatteringModel::lambda_scat
protectedinherited

Definition at line 77 of file JScatteringModel.hh.


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