Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JMARKOV Namespace Reference

Classes

class  J3DhistGenerator
 Implementation of the JGenerator interface. More...
 
class  JBallGenerator
 Implementation of the JGenerator interface. More...
 
class  JCombinedGenerator
 Implementation of the JGenerator interface. More...
 
class  JCombinedScattering
 Implementation of the JScatteringModel interface with that combines two scattering models into one effective model. More...
 
class  JCosineTarget
 Implementation of the JTargetModel class that represents a directed target with a cos(theta) acceptance. More...
 
class  JDirectedSource
 Implementation of the JSourceModel class that represents a directed source with a flat intensity distribution. More...
 
class  JExperimentalIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is built up out of correlated path vertices. More...
 
class  JExponentialGenerator
 Implementation of the JGenerator interface. More...
 
class  JExpRsqInvGenerator
 Implementation of the JGenerator interface. More...
 
class  JGaussianGenerator
 Implementation of the JGenerator interface. More...
 
class  JGenerator
 Abstract interface for the generation of points in 3D space. More...
 
class  JHenyeyGreensteinScattering
 Implementation of the JScatteringModel interface with scattering according to the Henyey-Greenstein function. More...
 
class  JHistGenerator
 Implementation of the JGenerator interface. More...
 
class  JIsotropicScattering
 Implementation of the JScatteringModel interface with isotropic scattering. More...
 
class  JIsotropicSource
 Implementation of the JSourceModel class that represents an isotropic source. More...
 
class  JIsotropicTarget
 Implementation of the JTargetModel class that represents a spherically symmetric target. More...
 
class  JMagicalDistribution
 The 'magical distributions' are a class of distributions. More...
 
class  JMarkovEnsembleIntegrator
 Abstract base class for implementations of the JMarkovIntegrator interface, where the sample distribution is based on histograms filled from an ensemble of representative paths. More...
 
class  JMarkovEnsembleIntegrator1D
 Implementation of JMarkovEnsembleIntegrator interface with 1D histograms. More...
 
class  JMarkovEnsembleIntegrator3D
 This implementation of the JMarkovIntegrator interface generates 'natural' looking paths that might sample the phase space well in some cases. More...
 
class  JMarkovIntegrator
 Abstract base class for calculating the total probability (/m^2 target cross-section) for a photon from the source to hit the target (with a given, fixed number of scatterings) by Monte Carlo sampling the available nscat*3 dimensional phase space. More...
 
class  JMarkovPathGenerator
 The JMarkovPathGenerator generates ensembles of photon paths using a Markov Chain Monte Carlo (MCMC). More...
 
class  JMarkovPhotonTracker
 The JMarkovPhotonTracker generates ensembles of photon paths by tracking photons from a source to a target. More...
 
class  JMarkovUniformIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is a flat distribution. More...
 
class  JPhotonPath
 A photon path. More...
 
class  JPhotonPathReader
 
class  JPhotonPathWriter
 
class  JPMTTarget
 Implementation of the JTargetModel class that represents a single PMT on a DOM. More...
 
class  JRayleighScattering
 Implementation of the JScatteringModel interface with Rayleigh scattering. More...
 
class  JScatteringModel
 Virtual base class for a scattering model. More...
 
class  JShiftedGenerator
 Implementation of the JGenerator interface. More...
 
class  JSingularityGenerator
 Implementation of the JGenerator interface. More...
 
class  JSourceModel
 Virtual base class for a light source. More...
 
class  JSourceTargetIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is built up out of three components: More...
 
class  JSphereGenerator
 Implementation of the JGenerator interface. More...
 
class  JTargetModel
 Virtual base class for a light detector ("photon target"). More...
 
class  JTripleGenerator
 Implementation of the JGenerator interface. More...
 
class  JUniformGenerator
 Implementation of the JGenerator interface. More...
 

Functions

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.
 

Detailed Description

Author
mjongen

Function Documentation

◆ getPhotonPathProbabilityDensity()

double JMARKOV::getPhotonPathProbabilityDensity ( JPhotonPath & p,
JSourceModel * src,
JScatteringModel * sm,
JTargetModel * trg,
double lambda_abs )

Return the probability density for a photon path with the given ingredients.

These are

  • a model of the source direction distribution
  • a scattering model
  • a target model
  • the absorption length (note that this is allowed to be +INFTY)

Multiply by dV1, dV2, etc. and the target cross-section sigma to get a probability.

The first (last) vertex of the photon path is used as the source (target) position.

Definition at line 583 of file JScatteringModel.hh.

583 {
584 //const bool verbose = true ;
585
586 // calculate inverse scattering and absorption lengths
587 const double lambda_scat_inv = 1.0/sm->getScatteringLength() ;
588 double lambda_abs_inv = 0 ;
589 // if the absorption length is not infinite
590 if( lambda_abs == lambda_abs ) lambda_abs_inv = 1.0/lambda_abs ;
591
592 double rho = 1 ;
593 const int nvert = p.n ; // number of vertices in the path
594 const int nscat = p.n-2 ; // number of scattering vertices in the path
595
596 //if( verbose ) cout << "$ rho = " << rho << " (before calculating path segment lengths)" << endl ;
597
598 // calculate path segment lengths
599 // index i corresponds to the path segment connecting
600 // vertex i and vertex i+1
601 double Ltotal = 0 ;
602 vector<double> lengths(nvert-1) ;
603 for( int i=0 ; i<nvert-1 ; ++i ) {
604 lengths[i] = (p[i+1]-p[i]).getLength() ;
605 Ltotal += lengths[i] ;
606 }
607
608 //if( verbose ) cout << "$ Total length = " << Ltotal << " m" << endl ;
609
610 // cosine of scattering angles (angle between previous segment and new segment)
611 // index i is the cosine of the angle of segment i+1 w.r.t segment i
612 vector<double> cts(nscat) ;
613
614 // scattering angles
615 for( int i=0 ; i<nscat ; ++i ) {
616 JDirection3D seg1(p[i+1]-p[i]) ;
617 JDirection3D seg2(p[i+2]-p[i+1]) ;
618 cts[i] = seg1.getDot(seg2) ;
619 }
620
621 // term for absorption length
622 // (=probability to not be absorbed within Ltotal)
623 rho *= exp(-Ltotal*lambda_abs_inv ) ;
624
625 //if( verbose ) cout << "$ rho = " << rho << " (after absorption length)" << endl ;
626
627 // term for emission profile
628 rho *= src->getEmissionProbability( JDirection3D(p[1]-p[0]) ) ;
629
630 //if( verbose ) cout << "$ rho = " << rho << " (after emission probability)" << endl ;
631
632 // term for target efficiency
633 if( trg->getRadius()>0 ) {
634 // finite target (spherical), the efficiency is a measure of how good the
635 // target is at a given spot
636 rho *= trg->getEfficiency( JDirection3D(p[nscat+1]-trg->getPosition()) ) ;
637 // this factor accounts for the angle of incidence
638 double ct = JDirection3D(p[nscat]-p[nscat+1]).getDot( JDirection3D(p[nscat+1]-trg->getPosition()) ) ;
639 rho *= max(0.0,ct) ;
640
641 //if( verbose ) cout << "$ rho = " << rho << " (after target efficiency and angle of incidence)" << endl ;
642
643 // check whether the photon path hits the sphere
644 // we do not need to consider the last vertex, because if that intersects the sphere
645 // the angle of incidence factor above would be 0.
646 if( p.n>2 ) {
647 JPhotonPath pshort(p) ;
648 pshort.resize( pshort.size()-1 ) ;
649 --pshort.n ;
650 if( pshort.hitsSphere(trg->getPosition(),trg->getRadius()) ) {
651 /*cout << "Path hits sphere at "
652 << JPosition3D(pshort.getSphereHitPosition(trg->getPosition(),trg->getRadius())-trg->getPosition())
653 << endl ;*/
654 rho *= 0 ;
655 }
656 }
657 } else {
658 rho *= trg->getEfficiency( JDirection3D(p[nscat+1]-p[nscat]) ) ;
659 }
660
661 //if( verbose ) cout << "$ rho = " << rho << " (after target efficiency)" << endl ;
662
663 // terms for scattering directions
664 for( int i=0 ; i<nscat ; ++i ) {
665 rho *= sm->getScatteringProbability(cts[i]) ;
666 }
667
668 //if( verbose ) cout << "$ rho = " << rho << " (after scattering directions)" << endl ;
669
670 // phase space terms for scattering to each of the scattering
671 // vertices
672 // this is the probability/dV to scatter into a volume element
673 // dV at a given distance
674 // (although it is missing the direction-dependent term, which is
675 // the emission probability or scattering probability)
676 for( int i=0; i<nscat; ++i ) {
677 // reminder: lengths[i] is the length from vertex i to vertex i+1
678 rho *= lambda_scat_inv / (lengths[i]*lengths[i]) * exp(-lengths[i]*lambda_scat_inv) ;
679 }
680
681 //if( verbose ) cout << "$ rho = " << rho << " (after scattering phase space term)" << endl ;
682
683 // phase space term for scattering to the target
684 // this is the probability/dsigma to hit a target at a given
685 // distance, without scattering along the way
686 rho *= exp(-lengths[nscat]*lambda_scat_inv) / ( lengths[nscat]*lengths[nscat] ) ;
687
688 //if( verbose ) cout << "$ rho = " << rho << " (after target phase space term)" << endl ;
689
690 // check for NaN
691 if( rho!=rho ) {
692 cerr << "NaN for probability density" << endl ;
693 cerr << "rho = " << rho << endl ;
694 exit(1) ;
695 }
696
697 //if( verbose ) cout << "$ rho = " << rho << endl ;
698
699 return rho ;
700 }
virtual double getScatteringLength()
virtual double getScatteringProbability(double ct)=0
Return the probability density as a function of cos(theta)
virtual double getEmissionProbability(JVersor3D dir)=0
Return the probability density.
virtual double getEfficiency(JVersor3D dir) const =0
Return the efficiency, which is defined as the probability that a photon with the given direction hit...
const JPosition3D & getPosition() const