Go to the documentation of this file.
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() ;
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 JVersor3D dir( sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta) ) ;
307 dir = dir.rotate_back(rot) ;
316 while( ct<=-1 ) ct = 1-gRandom->Exp(dct) ;
317 double theta = acos(ct) ;
318 double phi = gRandom->Uniform(2*M_PI) ;
322 new_dir = new_dir.rotate_back(R) ;
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 ) {
double getFractionAccepted()
get the fraction of accepted 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
double getFractionAccepted_tangential()
get the fraction of steps that were accepted when a tangential step was performed during the last cal...
JPhotonPath getUnmappedPhotonPath(const JPhotonPath &pprime)
inverse of getRemappedPhotonPath
virtual int randomPathChange(JPhotonPath &p, JTargetModel *trg)
JPosition3D getUnmappedPosition(const JPosition3D &xprev, const JPosition3D &xprime)
Inverse of getRemappedPosition.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getRemappingCorrection(const JPosition3D &xprev, const JPosition3D &xprime)
Returns the conversion factor J needed to compute the path probability density in the remapped coordi...
Data structure for normalised vector in three dimensions.
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...
void copy(const Head &from, JHead &to)
Copy header from from to to.
void setRadialStepSize_m(double val)
set the average step size in [m] in the radial direction for the scattering vertices
int getNsteps()
get the number of Markov steps taken in the last call to generateEnsemble (after burn-in)
double getFractionAccepted_radial()
get the fraction of steps that were accepted when a radial step was performed during the last call to...
The JMarkovPathGenerator generates ensembles of photon paths using a Markov Chain Monte Carlo (MCMC).
double stepsize_angle_target
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Data structure for vector in three dimensions.
bool getCoordinateRemapping()
returns true when coordinate remapping is activated, false otherwise
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
double getUnmappedDistance(double rprime)
inverse of getRemappedDistance
Virtual base class for a light source.
void setCoordinateRemapping(bool val=true)
activate or deactive coordinate remapping
double getRemappingCorrection(const JPhotonPath &p, const JPhotonPath &pprime)
Return the remapping correction for an entire photon path (product of the remapping correction for th...
JMarkovPathGenerator()
standard constructor
Virtual base class for a scattering model.
int getNrejectedSteps()
get the number of rejected steps during the last call to generateEnsemble (after burn-in)
void setTargetStepSize_deg(double val)
set the average step size in degrees for the impact point on the target
Data structure for angles in three dimensions.
Virtual base class for a light detector ("photon target").
bool apply_coordinate_remapping
JPhotonPath getRemappedPhotonPath(const JPhotonPath &p)
returns a remapped version of the photon path
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.
const JPosition3D & getPosition() const
int getNacceptedSteps()
get the number of accepted steps taken during the last call to generateEnsemble (after burn-in)
double getRemappedDistance(double r)
return the distance between the remapped vertex and the previous vertex given the distance between th...
void setTangentialStepSize_deg(double val)
Set the average step size theta in degrees for steps in the tangential direction for the scattering v...
double getR0()
return R0; the length scale used in the coordinate remapping
JPosition3D getRemappedPosition(const JPosition3D &xprev, const JPosition3D &x)
Return the remapped vertex position of x.