Jpp  18.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
JMARKOV::JMarkovPathGenerator Class Reference

The JMarkovPathGenerator generates ensembles of photon paths using a Markov Chain Monte Carlo (MCMC). More...

#include <JMarkovPathGenerator.hh>

Public Member Functions

 JMarkovPathGenerator ()
 standard constructor More...
 
std::vector< JPhotonPathgenerateEnsemble (int n, const JPhotonPath &start_path, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs, int nsteps_burn_in, int nsteps_save)
 Generate an ensemble of n paths with a fixed number of scatterings by MCMC-sampling the given scattering model. More...
 
int getNsteps ()
 get the number of Markov steps taken in the last call to generateEnsemble (after burn-in) More...
 
int getNacceptedSteps ()
 get the number of accepted steps taken during the last call to generateEnsemble (after burn-in) More...
 
int getNrejectedSteps ()
 get the number of rejected steps during the last call to generateEnsemble (after burn-in) More...
 
double getFractionAccepted ()
 get the fraction of accepted steps during the last call to generateEnsemble (after burn-in) More...
 
double getFractionAccepted_radial ()
 get the fraction of steps that were accepted when a radial step was performed during the last call to generateEnsemble (after burn-in) More...
 
double getFractionAccepted_tangential ()
 get the fraction of steps that were accepted when a tangential step was performed during the last call to generateEnsemble (after burn-in) More...
 
bool doMarkovStep (JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs, JPhotonPath &p)
 make one Markov chain step for a path More...
 
virtual int randomPathChange (JPhotonPath &p, JTargetModel *trg)
 
void setTargetStepSize_deg (double val)
 set the average step size in degrees for the impact point on the target More...
 
void setRadialStepSize_m (double val)
 set the average step size in [m] in the radial direction for the scattering vertices More...
 
void setTangentialStepSize_deg (double val)
 Set the average step size theta in degrees for steps in the tangential direction for the scattering vertices. More...
 
void setCoordinateRemapping (bool val=true)
 activate or deactive coordinate remapping More...
 
bool getCoordinateRemapping ()
 returns true when coordinate remapping is activated, false otherwise More...
 

Private Member Functions

double getR0 ()
 return R0; the length scale used in the coordinate remapping More...
 
double getRemappedDistance (double r)
 return the distance between the remapped vertex and the previous vertex given the distance between the not-remapped vertex and the previous vertex More...
 
double getUnmappedDistance (double rprime)
 inverse of getRemappedDistance More...
 
JPosition3D getRemappedPosition (const JPosition3D &xprev, const JPosition3D &x)
 Return the remapped vertex position of x. More...
 
JPosition3D getUnmappedPosition (const JPosition3D &xprev, const JPosition3D &xprime)
 Inverse of getRemappedPosition. More...
 
JPhotonPath getRemappedPhotonPath (const JPhotonPath &p)
 returns a remapped version of the photon path More...
 
JPhotonPath getUnmappedPhotonPath (const JPhotonPath &pprime)
 inverse of getRemappedPhotonPath More...
 
double getRemappingCorrection (const JPosition3D &xprev, const JPosition3D &xprime)
 Returns the conversion factor J needed to compute the path probability density in the remapped coordinates, for a given vertex. More...
 
double getRemappingCorrection (const JPhotonPath &p, const JPhotonPath &pprime)
 Return the remapping correction for an entire photon path (product of the remapping correction for the individual scattering vertices). More...
 

Private Attributes

bool apply_coordinate_remapping
 
int naccepted_r
 
int nrejected_r
 
int naccepted_t
 
int nrejected_t
 
double stepsize_angle_target
 
double stepsize_r
 
double stepsize_angle
 

Detailed Description

The JMarkovPathGenerator generates ensembles of photon paths using a Markov Chain Monte Carlo (MCMC).

In the Markov chain, the number of scatterings does not change. Therefore the ensembles have to be generated separately for each given number of scatterings.

The small modification of the path that is proposed in each step, is defined by the function 'randomPathChange'. This function is virtual so that it can be overrided in a derived class. The initial and final vertex are fixed and one of the other vertices is displaced in a random direction following an exponential distribution.

The source, target and scattering models are used to calculate the probability density of the path.

Random numbers are drawn from gRandom.

By default, the coordinates are remapped such that the 1/r^2 singularities in the path probability density disappear. This option can be turned off (but do not do it, unless you want to convince yourself that it is necessary) with the setCoordinateRemapping method.

Definition at line 50 of file JMarkovPathGenerator.hh.

Constructor & Destructor Documentation

JMARKOV::JMarkovPathGenerator::JMarkovPathGenerator ( )
inline

standard constructor

Definition at line 54 of file JMarkovPathGenerator.hh.

54  {
55  naccepted_r = -1 ;
56  nrejected_r = -1 ;
57  naccepted_t = -1 ;
58  nrejected_t = -1 ;
60  setRadialStepSize_m(1.0) ;
63  }
void setCoordinateRemapping(bool val=true)
activate or deactive coordinate remapping
void setTangentialStepSize_deg(double val)
Set the average step size theta in degrees for steps in the tangential direction for the scattering v...
void setRadialStepSize_m(double val)
set the average step size in [m] in the radial direction for the scattering vertices ...
void setTargetStepSize_deg(double val)
set the average step size in degrees for the impact point on the target

Member Function Documentation

std::vector< JPhotonPath > JMARKOV::JMarkovPathGenerator::generateEnsemble ( int  n,
const JPhotonPath start_path,
JSourceModel src,
JScatteringModel sm,
JTargetModel trg,
double  lambda_abs,
int  nsteps_burn_in,
int  nsteps_save 
)

Generate an ensemble of n paths with a fixed number of scatterings by MCMC-sampling the given scattering model.

The paths start at the source (a well-defined position) and end on the target (either a fixed position or, in the case of a finite source, the surface of a sphere).

start_path is a photon path that is used a starting point for the MCMC. It has to be supplied by the user (due to the various source and target profiles it is not straightforward to generate one automatically) and must have a path probability density != 0. The number of scatterings is also defined by the start_path.

nsteps_burn_in is the number of steps taken for burn-in.

nsteps_save determines the number of MCMC steps between the paths that are saved to the ensemble.

Definition at line 329 of file JMarkovPathGenerator.hh.

329  {
330  vector<JPhotonPath> result ;
331 
332  JPhotonPath testpath(start_path) ;
333 
334  // check that the starting path is okay
335  double dist = testpath[0].getDistanceSquared(src->getPosition()) ;
336  if( dist != 0 ) {
337  cerr << "ERROR in generateEnsemble: testpath position " << testpath[0]
338  << "does not match source position " << src->getPosition() << "!" << endl ;
339  return result ;
340  }
341  {
342  double rho = getPhotonPathProbabilityDensity(testpath,src,sm,trg,lambda_abs) ;
343  if( rho == 0 ) {
344  cerr << "ERROR in generateEnsemble: testpath probability density = 0" << endl ;
345  return result ;
346  }
347  }
348 
349  // convert the path to remapped coordinates
350  if( apply_coordinate_remapping ) testpath = getRemappedPhotonPath(testpath) ;
351 
352  // burn-in
353  int i = 0 ;
354  while( i!=nsteps_burn_in ) {
355  doMarkovStep(src,sm,trg,lambda_abs,testpath) ;
356  ++i ;
357  }
358 
359  // ensemble generation
360  i = 0 ;
361  naccepted_r = 0 ;
362  nrejected_r = 0 ;
363  naccepted_t = 0 ;
364  nrejected_t = 0 ;
365  while( i!=n ) {
366  // take nsteps_save steps
367  int j = 0 ;
368  while( j!=nsteps_save ) {
369  if( doMarkovStep(src,sm,trg,lambda_abs,testpath) ) {
370  ++j ;
371  }
372  }
373  // save the path to the ensemble
375  result.push_back( getUnmappedPhotonPath(testpath) ) ;
376  } else {
377  result.push_back( testpath ) ;
378  }
379  ++i ;
380  }
381 
382  return result ;
383  }
JPhotonPath getRemappedPhotonPath(const JPhotonPath &p)
returns a remapped version of the photon path
const JPosition3D & getPosition() const
A photon path.
Definition: JPhotonPath.hh:38
bool doMarkovStep(JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs, JPhotonPath &p)
make one Markov chain step for a path
const int n
Definition: JPolint.hh:786
JPhotonPath getUnmappedPhotonPath(const JPhotonPath &pprime)
inverse of getRemappedPhotonPath
int j
Definition: JPolint.hh:792
double getPhotonPathProbabilityDensity(JPhotonPath &p, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs)
Return the probability density for a photon path with the given ingredients.
int JMARKOV::JMarkovPathGenerator::getNsteps ( )
inline

get the number of Markov steps taken in the last call to generateEnsemble (after burn-in)

Definition at line 86 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::getNacceptedSteps ( )
inline

get the number of accepted steps taken during the last call to generateEnsemble (after burn-in)

Definition at line 89 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::getNrejectedSteps ( )
inline

get the number of rejected steps during the last call to generateEnsemble (after burn-in)

Definition at line 92 of file JMarkovPathGenerator.hh.

double JMARKOV::JMarkovPathGenerator::getFractionAccepted ( )
inline

get the fraction of accepted steps during the last call to generateEnsemble (after burn-in)

Definition at line 95 of file JMarkovPathGenerator.hh.

95  {
96  if( getNsteps() <= 0 ) return 0 ;
97  return 1.0*getNacceptedSteps()/getNsteps() ;
98  }
int getNsteps()
get the number of Markov steps taken in the last call to generateEnsemble (after burn-in) ...
int getNacceptedSteps()
get the number of accepted steps taken during the last call to generateEnsemble (after burn-in) ...
double JMARKOV::JMarkovPathGenerator::getFractionAccepted_radial ( )
inline

get the fraction of steps that were accepted when a radial step was performed during the last call to generateEnsemble (after burn-in)

Definition at line 101 of file JMarkovPathGenerator.hh.

101  {
102  if( naccepted_r + nrejected_r <= 0 ) return 0 ;
103  return 1.0*naccepted_r/(naccepted_r+nrejected_r) ;
104  }
double JMARKOV::JMarkovPathGenerator::getFractionAccepted_tangential ( )
inline

get the fraction of steps that were accepted when a tangential step was performed during the last call to generateEnsemble (after burn-in)

Definition at line 107 of file JMarkovPathGenerator.hh.

bool JMARKOV::JMarkovPathGenerator::doMarkovStep ( JSourceModel src,
JScatteringModel sm,
JTargetModel trg,
double  lambda_abs,
JPhotonPath p 
)

make one Markov chain step for a path

Definition at line 385 of file JMarkovPathGenerator.hh.

385  {
386  int nscat = p.n-2 ;
387  if( nscat == 0 && !trg->getRadius()>0 ) {
388  return false ;
389  }
390 
391  // copy path
392  JPhotonPath copy = p ;
393 
394  double rhoBefore ;
396  rhoBefore = getPhotonPathProbabilityDensity(copy,src,sm,trg,lambda_abs) ;
397  } else {
398  // we are working in remapped coordinates, so we have to calculate a corrected
399  // probability density
400  JPhotonPath copy_unmapped = getUnmappedPhotonPath(copy) ;
401  rhoBefore = getPhotonPathProbabilityDensity(copy_unmapped,src,sm,trg,lambda_abs) ;
402  rhoBefore *= getRemappingCorrection(copy_unmapped,copy) ;
403  }
404 
405  if( rhoBefore == 0 ) {
406  cerr << "FATAL ERROR: starting probability density = 0" << endl ;
407  exit(1) ;
408  }
409 
410  // apply random change to the path
411  int type = randomPathChange(copy,trg) ;
412 
413  // recalculate log L
414  double rhoAfter ;
416  rhoAfter = getPhotonPathProbabilityDensity(copy,src,sm,trg,lambda_abs) ;
417  } else {
418  // we are working in remapped coordinates, so we have to calculate a corrected
419  // probability density
420  JPhotonPath copy_unmapped = getUnmappedPhotonPath(copy) ;
421  rhoAfter = getPhotonPathProbabilityDensity(copy_unmapped,src,sm,trg,lambda_abs) ;
422  rhoAfter *= getRemappingCorrection(copy_unmapped,copy) ;
423  }
424 
425  // use Metropolis-Hastings algorithm to keep or reject change
426  if( rhoAfter > rhoBefore ) {
427  // accept the change
428  p = copy ;
429  if( type < 2 ) ++naccepted_r ;
430  if( type == 2 ) ++naccepted_t ;
431  return true ;
432  } else {
433  // accept the change with some probability
434  double P = rhoAfter/rhoBefore ;
435  if( gRandom->Uniform()<P ) {
436  p = copy ;
437  if( type < 2 ) ++naccepted_r ;
438  if( type == 2 ) ++naccepted_t ;
439  return true ;
440  }
441  }
442  if( type < 2 ) ++nrejected_r ;
443  if( type == 2 ) ++nrejected_t ;
444  return false ;
445  }
double getRadius() const
A photon path.
Definition: JPhotonPath.hh:38
exit
Definition: JPizza.sh:36
JPhotonPath getUnmappedPhotonPath(const JPhotonPath &pprime)
inverse of getRemappedPhotonPath
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
virtual int randomPathChange(JPhotonPath &p, JTargetModel *trg)
double getPhotonPathProbabilityDensity(JPhotonPath &p, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs)
Return the probability density for a photon path with the given ingredients.
double getRemappingCorrection(const JPosition3D &xprev, const JPosition3D &xprime)
Returns the conversion factor J needed to compute the path probability density in the remapped coordi...
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
int JMARKOV::JMarkovPathGenerator::randomPathChange ( JPhotonPath p,
JTargetModel trg 
)
virtual

Definition at line 264 of file JMarkovPathGenerator.hh.

264  {
265  int nscat = p.n-2 ;
266  int type = 0 ;
267 
268  if( nscat>0 ) {
269  // pick vertex from 1 to nscat+1 (so excluding the start and end point)
270  int nv = gRandom->Integer(nscat)+1 ;
271 
272  // distance w.r.t. previous vertex
273  double r = p[nv-1].getDistance(p[nv]) ;
274 
275  if( gRandom->Uniform() > 0.5 ) {
276  // with P=1/2, take a step in the radial direction
277  type = 1 ;
278 
279  // to avoid nasty phase space Jacobian issues, I use this rather primitive method
280  // where I simply generate a new position with a step in a random direction, then
281  // only apply the radial part of the change
282  //
283  // NOTE: simply choosing
284  // *) r+dr with P proportional to (r+dr)^2
285  // *) r-dr with P proportional to (r-dr)^2
286  // does not work. Trust me. I've tried.
287  double _r = gRandom->Exp(stepsize_r) ;
288  double _x, _y, _z ;
289  gRandom->Sphere( _x, _y, _z, _r ) ;
290  double _rnew = ( JPosition3D(_x,_y,_z) + JPosition3D(0,0,r) ).getLength() ;
291  double dr = _rnew - r ;
292 
293  p[nv] = p[nv] + dr * JPosition3D(JVersor3D(p[nv]-p[nv-1])) ;
294 
295  } else {
296  // with P=1/2, take a step in the tangential direction
297  type = 2 ;
298 
299  // for large radii, limit the maximum angle over which we can move
300  // so that the average change in distance does not exceed stepsize_r too much
301  double _stepsize_angle = min(stepsize_angle,stepsize_r/r) ;
302  double theta = gRandom->Exp(_stepsize_angle) ;
303  double phi = gRandom->Uniform(2.0*M_PI) ;
304  JVersor3D dir( sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta) ) ;
305  JVersor3D xdir( p[nv] - p[nv-1] ) ;
306  JRotation3D rot(xdir) ;
307  dir = dir.rotate_back(rot) ;
308  p[nv] = p[nv-1] + r * JVector3D(dir) ;
309  }
310  }
311 
312  // in case of a finite target, also move the end point
313  if( trg->getRadius() > 0 ) {
314  const double dct = 1-cos(stepsize_angle_target) ;
315  double ct = -2 ;
316  while( ct<=-1 ) ct = 1-gRandom->Exp(dct) ;
317  double theta = acos(ct) ;
318  double phi = gRandom->Uniform(2*M_PI) ;
319  JVersor3D original_dir( p.back()-trg->getPosition() ) ;
320  const JRotation3D R( original_dir ) ;
321  JVersor3D new_dir( JAngle3D(theta,phi) ) ;
322  new_dir = new_dir.rotate_back(R) ;
323  p.back() = trg->getPosition() + trg->getRadius() * JVector3D(new_dir) ;
324  }
325 
326  return type ;
327  }
double getRadius() const
data_type r[M+1]
Definition: JPolint.hh:868
then usage set_variable ACOUSTICS_WORKDIR $WORKDIR set_variable FORMULA sin([0]+2 *$PI *([1]+[2]*x)*x)" set_variable DY 1.0e-8 mkdir $WORKDIR for DETECTOR in $DETECTORS[*]
const JPosition3D & getPosition() const
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
void JMARKOV::JMarkovPathGenerator::setTargetStepSize_deg ( double  val)
inline

set the average step size in degrees for the impact point on the target

Definition at line 118 of file JMarkovPathGenerator.hh.

118  {
119  stepsize_angle_target = val * M_PI / 180 ;
120  }
void JMARKOV::JMarkovPathGenerator::setRadialStepSize_m ( double  val)
inline

set the average step size in [m] in the radial direction for the scattering vertices

Definition at line 123 of file JMarkovPathGenerator.hh.

123  {
124  stepsize_r = val ;
125  }
void JMARKOV::JMarkovPathGenerator::setTangentialStepSize_deg ( double  val)
inline

Set the average step size theta in degrees for steps in the tangential direction for the scattering vertices.

When r * theta is larger than the radial step size, the effective theta will be temporarily set to a smaller value to avoid taking steps that are too large.

Definition at line 133 of file JMarkovPathGenerator.hh.

133  {
134  stepsize_angle = val * M_PI / 180 ;
135  }
void JMARKOV::JMarkovPathGenerator::setCoordinateRemapping ( bool  val = true)
inline

activate or deactive coordinate remapping

Definition at line 138 of file JMarkovPathGenerator.hh.

138  {
140  }
bool JMARKOV::JMarkovPathGenerator::getCoordinateRemapping ( )
inline

returns true when coordinate remapping is activated, false otherwise

Definition at line 143 of file JMarkovPathGenerator.hh.

double JMARKOV::JMarkovPathGenerator::getR0 ( )
inlineprivate

return R0; the length scale used in the coordinate remapping

Definition at line 149 of file JMarkovPathGenerator.hh.

149 { return 3 * stepsize_r ; }
double JMARKOV::JMarkovPathGenerator::getRemappedDistance ( double  r)
inlineprivate

return the distance between the remapped vertex and the previous vertex given the distance between the not-remapped vertex and the previous vertex

Definition at line 155 of file JMarkovPathGenerator.hh.

155  {
156  if( 3.0*sqrt(3)*r < getR0() ) return pow(r*getR0()*getR0(),1.0/3.0) ;
157  return r + 2.0 / (3.0*sqrt(3.0))*getR0() ;
158  }
data_type r[M+1]
Definition: JPolint.hh:868
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
double getR0()
return R0; the length scale used in the coordinate remapping
double JMARKOV::JMarkovPathGenerator::getUnmappedDistance ( double  rprime)
inlineprivate

inverse of getRemappedDistance

Definition at line 161 of file JMarkovPathGenerator.hh.

161  {
162  if( sqrt(3.0)*rprime < getR0() ) return rprime*rprime*rprime/(getR0()*getR0()) ;
163  return rprime - 2.0/(3.0*sqrt(3.0))*getR0() ;
164  }
double getR0()
return R0; the length scale used in the coordinate remapping
JPosition3D JMARKOV::JMarkovPathGenerator::getRemappedPosition ( const JPosition3D xprev,
const JPosition3D x 
)
inlineprivate

Return the remapped vertex position of x.

xprev is the (not remapped!) coordinate of the previous vertex in the photon path.

Definition at line 170 of file JMarkovPathGenerator.hh.

170  {
171  double r = x.getDistance(xprev) ;
172  double rprime = getRemappedDistance(r) ;
173  return xprev + (rprime/r)*(x-xprev) ;
174  }
data_type r[M+1]
Definition: JPolint.hh:868
double getRemappedDistance(double r)
return the distance between the remapped vertex and the previous vertex given the distance between th...
JPosition3D JMARKOV::JMarkovPathGenerator::getUnmappedPosition ( const JPosition3D xprev,
const JPosition3D xprime 
)
inlineprivate

Inverse of getRemappedPosition.

Again, xprev is the (not remapped!) coordinate of the previous vertex in the photon path.

Definition at line 180 of file JMarkovPathGenerator.hh.

180  {
181  double rprime = xprime.getDistance(xprev) ;
182  double r = getUnmappedDistance(rprime) ;
183  return xprev + (r/rprime)*(xprime-xprev) ;
184  }
double getUnmappedDistance(double rprime)
inverse of getRemappedDistance
data_type r[M+1]
Definition: JPolint.hh:868
JPhotonPath JMARKOV::JMarkovPathGenerator::getRemappedPhotonPath ( const JPhotonPath p)
inlineprivate

returns a remapped version of the photon path

Definition at line 187 of file JMarkovPathGenerator.hh.

187  {
188  JPhotonPath pprime(p) ;
189  for( int i=1; i<(int)pprime.size()-1; ++i ) {
190  pprime[i] = getRemappedPosition(p[i-1],p[i]) ;
191  }
192  return pprime ;
193  }
A photon path.
Definition: JPhotonPath.hh:38
JPosition3D getRemappedPosition(const JPosition3D &xprev, const JPosition3D &x)
Return the remapped vertex position of x.
JPhotonPath JMARKOV::JMarkovPathGenerator::getUnmappedPhotonPath ( const JPhotonPath pprime)
inlineprivate

inverse of getRemappedPhotonPath

Definition at line 196 of file JMarkovPathGenerator.hh.

196  {
197  JPhotonPath p(pprime) ;
198  for( int i=1; i<(int)p.size()-1; ++i ) {
199  p[i] = getUnmappedPosition(p[i-1],p[i]) ;
200  }
201  return p ;
202  }
A photon path.
Definition: JPhotonPath.hh:38
JPosition3D getUnmappedPosition(const JPosition3D &xprev, const JPosition3D &xprime)
Inverse of getRemappedPosition.
double JMARKOV::JMarkovPathGenerator::getRemappingCorrection ( const JPosition3D xprev,
const JPosition3D xprime 
)
inlineprivate

Returns the conversion factor J needed to compute the path probability density in the remapped coordinates, for a given vertex.

xprime is the remapped vertex position xprev is the (not remapped!) position of the previous vertex

In casual notation (the ' indicates remapped coordinates):

rho(x) dV = rho(x) r^2 dr dOmega = rho(x) r^2 / r'^2 dr/dr' r'^2 dr' dOmega = rho( x(x') ) r^2 / r'^2 dr/dr' dV' <— since dOmega == dOmega' := J x rho( x(x') ) dV' := rho'(x') dV' Where J := r^2 / r'^2 dr/dr'

The point of this is that we typically pick r proportional to r'^3, so that dr/dr' is proportional to r'^2, which cancels the factor 1/r'^2 in rho'. The new factor r^2 then cancels the typical 1/r^2 singularity present in rho.

Definition at line 224 of file JMarkovPathGenerator.hh.

224  {
225  double rprime = xprev.getDistance(xprime) ;
226  double r = getUnmappedDistance(rprime) ;
227  if( sqrt(3.0)*rprime >= getR0() ) {
228  // J = r^2 / r'^2 * dr/dr'
229  // dr/dr' = 1
230  return r*r/(rprime*rprime) ;
231  }
232  // J = r^2 / r'^2 * dr/dr'
233  // dr/dr' = 3 * r'^2/R0^2
234  // ==> J = 3 * r^2 / R0^2
235  return 3*r*r/(getR0()*getR0()) ;
236  }
double getUnmappedDistance(double rprime)
inverse of getRemappedDistance
data_type r[M+1]
Definition: JPolint.hh:868
double getR0()
return R0; the length scale used in the coordinate remapping
double JMARKOV::JMarkovPathGenerator::getRemappingCorrection ( const JPhotonPath p,
const JPhotonPath pprime 
)
inlineprivate

Return the remapping correction for an entire photon path (product of the remapping correction for the individual scattering vertices).

p is the photon path in normal coordinates pprime is the remapped version of p

Definition at line 245 of file JMarkovPathGenerator.hh.

245  {
246  double J = 1 ;
247  for( int i=1; i<(int)p.size()-1; ++i ) {
248  J *= getRemappingCorrection(p[i-1],pprime[i]) ;
249  }
250  return J ;
251  }
double getRemappingCorrection(const JPosition3D &xprev, const JPosition3D &xprime)
Returns the conversion factor J needed to compute the path probability density in the remapped coordi...

Member Data Documentation

bool JMARKOV::JMarkovPathGenerator::apply_coordinate_remapping
private

Definition at line 254 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::naccepted_r
private

Definition at line 255 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::nrejected_r
private

Definition at line 256 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::naccepted_t
private

Definition at line 257 of file JMarkovPathGenerator.hh.

int JMARKOV::JMarkovPathGenerator::nrejected_t
private

Definition at line 258 of file JMarkovPathGenerator.hh.

double JMARKOV::JMarkovPathGenerator::stepsize_angle_target
private

Definition at line 259 of file JMarkovPathGenerator.hh.

double JMARKOV::JMarkovPathGenerator::stepsize_r
private

Definition at line 260 of file JMarkovPathGenerator.hh.

double JMARKOV::JMarkovPathGenerator::stepsize_angle
private

Definition at line 261 of file JMarkovPathGenerator.hh.


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