Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 472 of file JScatteringModel.hh.

Constructor & Destructor Documentation

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

Constructor.

note that one should never set a<0

Definition at line 481 of file JScatteringModel.hh.

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

Member Function Documentation

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 490 of file JScatteringModel.hh.

490  {
491  //double ct = cos(dir.getTheta()) ;
492  return (1+a*ct*ct)/(4.0*M_PI*(1+a/3.0)) ;
493  }
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 495 of file JScatteringModel.hh.

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

Reimplemented in JMARKOV::JCombinedScattering.

Definition at line 72 of file JScatteringModel.hh.

72 { return lambda_scat ; }

Member Data Documentation

double JMARKOV::JRayleighScattering::a
protected

Definition at line 512 of file JScatteringModel.hh.

double JMARKOV::JScatteringModel::lambda_scat
protectedinherited

Definition at line 76 of file JScatteringModel.hh.


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