Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
JMARKOV Namespace Reference

Classes

class  JGenerator
 Abstract interface for the generation of points in 3D space. More...
 
class  JUniformGenerator
 Implementation of the JGenerator interface. More...
 
class  JBallGenerator
 Implementation of the JGenerator interface. More...
 
class  JExpRsqInvGenerator
 Implementation of the JGenerator interface. More...
 
class  JMagicalDistribution
 The 'magical distributions' are a class of distributions. More...
 
class  JSingularityGenerator
 Implementation of the JGenerator interface. More...
 
class  JExponentialGenerator
 Implementation of the JGenerator interface. More...
 
class  JGaussianGenerator
 Implementation of the JGenerator interface. More...
 
class  JCombinedGenerator
 Implementation of the JGenerator interface. More...
 
class  JTripleGenerator
 Implementation of the JGenerator interface. More...
 
class  JShiftedGenerator
 Implementation of the JGenerator interface. More...
 
class  JHistGenerator
 Implementation of the JGenerator interface. More...
 
class  JSphereGenerator
 Implementation of the JGenerator interface. More...
 
class  J3DhistGenerator
 Implementation of the JGenerator interface. 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  JMarkovUniformIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is a flat distribution. 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  JSourceTargetIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is built up out of three components: More...
 
class  JExperimentalIntegrator
 In this implementation of the JMarkovIntegrator interface, the sample distribution is built up out of correlated path vertices. 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  JPhotonPath
 A photon path. More...
 
class  JPhotonPathReader
 
class  JPhotonPathWriter
 
class  JScatteringModel
 Virtual base class for a scattering model. More...
 
class  JSourceModel
 Virtual base class for a light source. More...
 
class  JIsotropicSource
 Implementation of the JSourceModel class that represents an isotropic source. More...
 
class  JDirectedSource
 Implementation of the JSourceModel class that represents a directed source with a flat intensity distribution. More...
 
class  JTargetModel
 Virtual base class for a light detector ("photon target"). More...
 
class  JPMTTarget
 Implementation of the JTargetModel class that represents a single PMT on a DOM. More...
 
class  JIsotropicTarget
 Implementation of the JTargetModel class that represents a spherically symmetric target. More...
 
class  JCosineTarget
 Implementation of the JTargetModel class that represents a directed target with a cos(theta) acceptance. More...
 
class  JHenyeyGreensteinScattering
 Implementation of the JScatteringModel interface with scattering according to the Henyey-Greenstein function. More...
 
class  JIsotropicScattering
 Implementation of the JScatteringModel interface with isotropic scattering. More...
 
class  JRayleighScattering
 Implementation of the JScatteringModel interface with Rayleigh scattering. More...
 
class  JCombinedScattering
 Implementation of the JScatteringModel interface with that combines two scattering models into one effective model. 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. More...
 

Detailed Description

Author
mjongen

Function Documentation

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 582 of file JScatteringModel.hh.

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