157      return r + 2.0 / (3.0*sqrt(3.0))*
getR0() ;
 
 
  162      if( sqrt(3.0)*rprime < 
getR0() ) 
return rprime*rprime*rprime/(
getR0()*
getR0()) ;
 
  163      return rprime - 2.0/(3.0*sqrt(3.0))*
getR0() ;
 
 
  171      double r = x.getDistance(xprev) ;
 
  173      return xprev + (rprime/r)*(x-xprev) ;
 
 
  183      return xprev + (r/rprime)*(xprime-xprev) ;
 
 
  189      for( 
int i=1; i<(int)pprime.size()-1; ++i ) {
 
 
  198      for( 
int i=1; i<(int)p.size()-1; ++i ) {
 
 
  227      if( sqrt(3.0)*rprime >= 
getR0() ) {
 
  230        return r*r/(rprime*rprime) ;
 
 
  247      for( 
int i=1; i<(int)p.size()-1; ++i ) {
 
 
 
  270      int nv = gRandom->Integer(nscat)+1 ;
 
  273      double r = p[nv-1].getDistance(p[nv]) ;
 
  275      if( gRandom->Uniform() > 0.5 ) {
 
  289        gRandom->Sphere( _x, _y, _z, _r ) ;
 
  291        double dr = _rnew - r ;
 
  302        double theta = gRandom->Exp(_stepsize_angle) ;
 
  303        double phi   = gRandom->Uniform(2.0*M_PI) ;
 
  304        JDirection3D dir( sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta) ) ;
 
  316      while( ct<=-1 ) ct = 1-gRandom->Exp(dct) ;
 
  317      double theta = acos(ct) ;
 
  318      double phi = gRandom->Uniform(2*M_PI) ;
 
 
  335    double dist = testpath[0].getDistanceSquared(src->
getPosition()) ;
 
  337      cerr << 
"ERROR in generateEnsemble: testpath position " << testpath[0] 
 
  338           << 
"does not match source position " << src->
getPosition() << 
"!" << endl ;
 
  344        cerr << 
"ERROR in generateEnsemble: testpath probability density = 0" << endl ;
 
  354    while( i!=nsteps_burn_in ) {
 
  368      while( j!=nsteps_save ) {
 
  377        result.push_back( testpath ) ;
 
 
  387    if( nscat == 0 && !(trg->
getRadius()>0) ) {
 
  405    if( rhoBefore == 0 ) {
 
  406      cerr << 
"FATAL ERROR: starting probability density = 0" << endl ;
 
  426    if( rhoAfter > rhoBefore ) {
 
  434      double P = rhoAfter/rhoBefore ;
 
  435      if( gRandom->Uniform()<P ) {
 
 
Data structure for angles in three dimensions.
 
Data structure for direction in three dimensions.
 
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
 
Data structure for position in three dimensions.
 
Data structure for vector in three dimensions.
 
double getDistance(const JVector3D &pos) const
Get distance to point.
 
The JMarkovPathGenerator generates ensembles of photon paths using a Markov Chain Monte Carlo (MCMC).
 
int getNsteps()
get the number of Markov steps taken in the last call to generateEnsemble (after burn-in)
 
void setRadialStepSize_m(double val)
set the average step size in [m] in the radial direction for the scattering vertices
 
JMarkovPathGenerator()
standard constructor
 
double getRemappedDistance(double r)
return the distance between the remapped vertex and the previous vertex given the distance between th...
 
double getRemappingCorrection(const JPhotonPath &p, const JPhotonPath &pprime)
Return the remapping correction for an entire photon path (product of the remapping correction for th...
 
void setCoordinateRemapping(bool val=true)
activate or deactive coordinate remapping
 
int getNrejectedSteps()
get the number of rejected steps during the last call to generateEnsemble (after burn-in)
 
bool doMarkovStep(JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs, JPhotonPath &p)
make one Markov chain step for a path
 
void setTargetStepSize_deg(double val)
set the average step size in degrees for the impact point on the target
 
bool getCoordinateRemapping()
returns true when coordinate remapping is activated, false otherwise
 
JPosition3D getUnmappedPosition(const JPosition3D &xprev, const JPosition3D &xprime)
Inverse of getRemappedPosition.
 
JPhotonPath getUnmappedPhotonPath(const JPhotonPath &pprime)
inverse of getRemappedPhotonPath
 
double getR0()
return R0; the length scale used in the 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...
 
double stepsize_angle_target
 
double getFractionAccepted_radial()
get the fraction of steps that were accepted when a radial step was performed during the last call to...
 
JPhotonPath getRemappedPhotonPath(const JPhotonPath &p)
returns a remapped version of the photon path
 
int getNacceptedSteps()
get the number of accepted steps taken during the last call to generateEnsemble (after burn-in)
 
bool apply_coordinate_remapping
 
std::vector< JPhotonPath > 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 scatter...
 
virtual int randomPathChange(JPhotonPath &p, JTargetModel *trg)
 
double getUnmappedDistance(double rprime)
inverse of getRemappedDistance
 
double getRemappingCorrection(const JPosition3D &xprev, const JPosition3D &xprime)
Returns the conversion factor J needed to compute the path probability density in the remapped coordi...
 
double getFractionAccepted_tangential()
get the fraction of steps that were accepted when a tangential step was performed during the last cal...
 
JPosition3D getRemappedPosition(const JPosition3D &xprev, const JPosition3D &x)
Return the remapped vertex position of x.
 
double getFractionAccepted()
get the fraction of accepted steps during the last call to generateEnsemble (after burn-in)
 
Virtual base class for a scattering model.
 
Virtual base class for a light source.
 
const JPosition3D & getPosition() const
 
Virtual base class for a light detector ("photon target").
 
const JPosition3D & getPosition() const
 
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.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).