Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JMARKOV::JMarkovPhotonTracker Class Reference

The JMarkovPhotonTracker generates ensembles of photon paths by tracking photons from a source to a target. More...

#include <JMarkovPhotonTracker.hh>

Public Member Functions

 JMarkovPhotonTracker ()
 standard constructor
 
std::vector< JPhotonPathtrackPhotons (unsigned long int n, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs)
 Track n photons.
 

Detailed Description

The JMarkovPhotonTracker generates ensembles of photon paths by tracking photons from a source to a target.

The target is modelled as a sphere with finite radius r.

Random numbers are drawn from gRandom.

Definition at line 35 of file JMarkovPhotonTracker.hh.

Constructor & Destructor Documentation

◆ JMarkovPhotonTracker()

JMARKOV::JMarkovPhotonTracker::JMarkovPhotonTracker ( )
inline

standard constructor

Definition at line 39 of file JMarkovPhotonTracker.hh.

39{}

Member Function Documentation

◆ trackPhotons()

std::vector< JPhotonPath > JMARKOV::JMarkovPhotonTracker::trackPhotons ( unsigned long int n,
JSourceModel * src,
JScatteringModel * sm,
JTargetModel * trg,
double lambda_abs )

Track n photons.

The tracks of all photons that hit the target are returned.

Definition at line 50 of file JMarkovPhotonTracker.hh.

50 {
51 const double lambda_scat = sm->getScatteringLength() ;
53
54 for( unsigned long int i=0 ; i<n ; ++i ) {
55 // how long until the photon is absorbed
56 double Lmax = gRandom->Exp(lambda_abs) ;
57 // initial direction
58 JDirection3D dir = src->generateDirection() ;
59
60 // current length of the photon path
61 double L = 0 ;
62 // how often the photon has scattered so far
63 int nscat = 0 ;
64
65 // initialize path
66 JPhotonPath p(0) ;
67 p[0] = src->getPosition() ;
68 p[1] = src->getPosition() ; // temporary placeholder
69
70 while( true ) {
71 // distance until next scattering (or absorption)
72 double stepsize = gRandom->Exp( lambda_scat ) ;
73 // whether this is going to be the last step
74 bool isAbsorbed = false ;
75 if( stepsize > Lmax-L ) {
76 stepsize = Lmax-L ;
77 isAbsorbed = true ;
78 }
79
80 // set new vertex position
81 p[1+nscat] = p[nscat] + stepsize * JPosition3D(dir) ;
82
83 // check whether the photon hits the target
84 JPhotonPath lastvertex(0) ;
85 lastvertex[0] = p[p.size()-2] ;
86 lastvertex[1] = p[p.size()-1] ;
87 if( lastvertex.hitsSphere(trg->getPosition(),trg->getRadius()) ) {
88 const JPosition3D hit_position = lastvertex.getSphereHitPosition( trg->getPosition(), trg->getRadius() ) ;
89
90 // correct the position of the final vertex
91 p[p.size()-1] = hit_position ;
92 // weigh the photon path with the target efficiency
93 p.weight = trg->getEfficiency( JDirection3D(p[p.size()-1]-p[p.size()-2]) ) ;
94 // add to the ensemble
95 ensemble.push_back(p) ;
96 break ;
97 }
98
99 if( isAbsorbed ) break ;
100
101 L += lastvertex.getLength() ;
102
103 // scatter
104 ++nscat ;
105 JRotation3D rot(dir) ;
106 dir = sm->generateDirection() ;
107 dir = dir.rotate_back(rot) ;
108 p.addVertex() ;
109 }
110 }
111
112 return ensemble ;
113 }
const int n
Definition JPolint.hh:791

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