This implementation of the JMarkovIntegrator interface generates 'natural' looking paths that might sample the phase space well in some cases.
More...
#include <JMarkovIntegrator.hh>
|
| JMarkovEnsembleIntegrator3D (const vector< JPhotonPath > &_ensemble, JTargetModel *_trg, int _nbinsx, int _nbinsy, int _nbinsz, JPosition3D _posmin, JPosition3D _posmax) |
|
| ~JMarkovEnsembleIntegrator3D () |
|
void | free_scattering_vertex_gens () |
|
void | writeHistograms () |
| write the histograms filled from the ensemble More...
|
|
JPosition3D | generateScatteringVertexPosition (int nscat, int nv, double &winv) |
|
vector< double > | integrate (int N, int nscat, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs) |
| Integrate with N samples. More...
|
|
vector< double > | dummy_integrate (int N, int nscat, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs) |
| Integrate a test function with N samples. More...
|
|
vector< JPhotonPath > | get_diagnostic_ensemble (int N, int nscat, JSourceModel *src, JScatteringModel *sm, JTargetModel *trg, double lambda_abs) |
| Return photon paths generated with the generatePath method. More...
|
|
This implementation of the JMarkovIntegrator interface generates 'natural' looking paths that might sample the phase space well in some cases.
Similar to JMarkovEnsembleIntegrator, but using a 3D histogram for each vertex instead of 3 1D histograms.
Definition at line 473 of file JMarkovIntegrator.hh.
◆ JMarkovEnsembleIntegrator3D()
Definition at line 477 of file JMarkovIntegrator.hh.
JMarkovEnsembleIntegrator(const vector< JPhotonPath > &_ensemble, JTargetModel *_trg, int _nbinsx, int _nbinsy, int _nbinsz)
◆ ~JMarkovEnsembleIntegrator3D()
JMARKOV::JMarkovEnsembleIntegrator3D::~JMarkovEnsembleIntegrator3D |
( |
| ) |
|
|
inline |
◆ free_scattering_vertex_gens()
void JMARKOV::JMarkovEnsembleIntegrator3D::free_scattering_vertex_gens |
( |
| ) |
|
|
inline |
Definition at line 484 of file JMarkovIntegrator.hh.
487 if( *it != NULL )
delete *it ;
vector< J3DhistGenerator * > gens
◆ writeHistograms()
void JMARKOV::JMarkovEnsembleIntegrator3D::writeHistograms |
( |
| ) |
|
|
inlinevirtual |
write the histograms filled from the ensemble
Implements JMARKOV::JMarkovEnsembleIntegrator.
Definition at line 491 of file JMarkovIntegrator.hh.
496 htmp = (TH2D*)(*it)->h->Project3D(
"yx") ;
497 htmp->SetOption(
"colz") ;
498 htmp->SetEntries(10) ;
500 htmp = (TH2D*)(*it)->h->Project3D(
"yz") ;
501 htmp->SetOption(
"colz") ;
502 htmp->SetEntries(10) ;
504 htmp = (TH2D*)(*it)->h->Project3D(
"zx") ;
505 htmp->SetOption(
"colz") ;
506 htmp->SetEntries(10) ;
◆ generateScatteringVertexPosition()
JPosition3D JMARKOV::JMarkovEnsembleIntegrator3D::generateScatteringVertexPosition |
( |
int |
nscat, |
|
|
int |
nv, |
|
|
double & |
winv |
|
) |
| |
|
inlinevirtual |
Implements JMARKOV::JMarkovEnsembleIntegrator.
Definition at line 512 of file JMarkovIntegrator.hh.
517 winv = 1.0/
gens[index]->getWeight(pos) ;
Data structure for position in three dimensions.
void initgenerators(int nscat)
initialize the position generators for a given number of scatterings (i.e. create histograms and fill...
int getIndex(int nv, int nscat)
return the internal index for a given number of scatterings and vertex number
◆ init_scattering_vertex_generators()
void JMARKOV::JMarkovEnsembleIntegrator3D::init_scattering_vertex_generators |
( |
int |
nscat | ) |
|
|
inlineprotectedvirtual |
Implements JMARKOV::JMarkovEnsembleIntegrator.
Definition at line 523 of file JMarkovIntegrator.hh.
526 if( (
int)
gens.size() < ilast )
gens.resize( ilast, NULL ) ;
528 for(
int nv=1 ; nv<=nscat ; ++nv ) {
529 int index = ifirst + nv - 1 ;
531 double xmin = 1.0/0.0 ;
532 double xmax = -1.0/0.0 ;
533 double ymin = 1.0/0.0 ;
534 double ymax = -1.0/0.0 ;
535 double zmin = 1.0/0.0 ;
536 double zmax = -1.0/0.0 ;
545 sprintf( hname,
"h3_nscat%i_vtx%i", nscat, nv ) ;
546 TH3F h(hname,
"Vertex position;X;Y;Z",
552 if( it->n-2 != nscat ) continue ;
554 h.Fill( vtx.getX(), vtx.getY(), vtx.getZ() ) ;
557 double excuseval = 0.01*h.Integral() / ( h.GetNbinsX() * h.GetNbinsY() * h.GetNbinsZ() ) ;
558 for( Int_t xbin=1 ; xbin<=h.GetNbinsX() ; ++xbin ) {
559 for( Int_t ybin=1 ; ybin<=h.GetNbinsY() ; ++ybin ) {
560 for( Int_t zbin=1 ; zbin<=h.GetNbinsZ() ; ++zbin ) {
561 Int_t bin = h.GetBin(xbin,ybin,zbin) ;
562 h.AddBinContent(bin,excuseval) ;
double getY() const
Get y position.
double getZ() const
Get z position.
double getX() const
Get x position.
Implementation of the JGenerator interface.
vector< JPhotonPath > ensemble
◆ generatePosition()
JPosition3D JMARKOV::JMarkovEnsembleIntegrator::generatePosition |
( |
int |
nscat, |
|
|
int |
nv, |
|
|
double & |
winv |
|
) |
| |
|
inlineprotectedvirtualinherited |
generate a position for vertex nv for the given number of scatterings, winv will be set to 1/weight
Implements JMARKOV::JMarkovIntegrator.
Definition at line 228 of file JMarkovIntegrator.hh.
235 if( nv == nscat+1 ) {
virtual JPosition3D generateScatteringVertexPosition(int nscat, int nv, double &winv)=0
JPosition3D source_position
vector< JSphereGenerator * > target_gens
◆ getIndex()
int JMARKOV::JMarkovEnsembleIntegrator::getIndex |
( |
int |
nv, |
|
|
int |
nscat |
|
) |
| |
|
inlineprotectedinherited |
return the internal index for a given number of scatterings and vertex number
Definition at line 251 of file JMarkovIntegrator.hh.
259 return (nscat*(nscat-1))/2 + nv - 1 ;
◆ initgenerators()
void JMARKOV::JMarkovEnsembleIntegrator::initgenerators |
( |
int |
nscat | ) |
|
|
inlineprotectedinherited |
initialize the position generators for a given number of scatterings (i.e. create histograms and fill them from the ensemble)
Definition at line 263 of file JMarkovIntegrator.hh.
virtual void init_scattering_vertex_generators(int nscat)=0
void init_target_generator(int nscat)
initialize the generator for a target vertex for a given number of scatterings
◆ init_target_generator()
void JMARKOV::JMarkovEnsembleIntegrator::init_target_generator |
( |
int |
nscat | ) |
|
|
inlineprotectedinherited |
initialize the generator for a target vertex for a given number of scatterings
Definition at line 272 of file JMarkovIntegrator.hh.
278 sprintf( hname,
"htarget_nscat%i", nscat ) ;
279 TH2D* ht =
new TH2D(hname,
";cos(#theta);#phi",100,-1,1,100,-M_PI,M_PI) ;
281 if( it->n-2 != nscat ) continue ;
283 ht->Fill( dir.getDZ(), dir.getPhi() ) ;
Data structure for direction in three dimensions.
Implementation of the JGenerator interface.
const JPosition3D & getPosition() const
◆ free_target_gens()
void JMARKOV::JMarkovEnsembleIntegrator::free_target_gens |
( |
| ) |
|
|
inlineprotectedinherited |
◆ integrate()
Integrate with N samples.
Returns a vector with the contribution to the integral of each sample. The mean of those values is the estimate of the result of the integral, while the distribution itself can be used to estimate the stability of the result. In this distribution, you want to avoid
- long tails (because they make the result unstable)
- small contributions (because it means that parts of the parameter space are being oversampled, so it is less efficient) This can be achieved by tuning the sample distribution to the problem at hand.
Definition at line 130 of file JMarkovIntegrator.hh.
133 for(
int i=0 ; i<N ; ++i ) {
138 contributions[i] = rho * winv ;
140 return contributions ;
virtual JPhotonPath generatePath(int nscat, double &winv)
Generate a random photon path with a given number of scatterings.
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.
◆ dummy_integrate()
Integrate a test function with N samples.
This can be used as a sanity check for derived classes of JMarkovIntegrator.
The integral should yield 1 when the complete relevant part of the volume is taken into account. If it does not, it may be a sign that the implementation is not correct.
Returns a vector with the contribution to the integral of each sample.
Definition at line 143 of file JMarkovIntegrator.hh.
146 for(
int i=0 ; i<N ; ++i ) {
147 const double r = 10 ;
150 double rho = 1.0/(4.0/3.0*M_PI*
r*
r*
r) ;
151 if( p[1].getLength()>
r ) rho = 0 ;
152 contributions[i] = rho * winv ;
154 return contributions ;
◆ get_diagnostic_ensemble()
Return photon paths generated with the generatePath method.
This can be used to identify the parts of parameter space that are over- or undersampled in a given problem so that the integrator may be optimized to handle those better.
Definition at line 157 of file JMarkovIntegrator.hh.
160 for(
int i=0 ; i<N ; ++i ) {
◆ generatePath()
virtual JPhotonPath JMARKOV::JMarkovIntegrator::generatePath |
( |
int |
nscat, |
|
|
double & |
winv |
|
) |
| |
|
inlineprotectedvirtualinherited |
Generate a random photon path with a given number of scatterings.
winv must be set to the inverted probability density to generate this particular path.
Definition at line 94 of file JMarkovIntegrator.hh.
99 for(
int nv=0 ; nv<nscat+2 ; ++nv ) {
virtual JPosition3D generatePosition(int nscat, int nv, double &winv)=0
Generate a random position for vertex nv.
◆ gens
◆ posmin
JPosition3D JMARKOV::JMarkovEnsembleIntegrator3D::posmin |
|
protected |
◆ posmax
JPosition3D JMARKOV::JMarkovEnsembleIntegrator3D::posmax |
|
protected |
◆ target_gens
◆ ensemble
◆ nbinsx
int JMARKOV::JMarkovEnsembleIntegrator::nbinsx |
|
protectedinherited |
◆ nbinsy
int JMARKOV::JMarkovEnsembleIntegrator::nbinsy |
|
protectedinherited |
◆ nbinsz
int JMARKOV::JMarkovEnsembleIntegrator::nbinsz |
|
protectedinherited |
◆ trg
◆ source_position
JPosition3D JMARKOV::JMarkovEnsembleIntegrator::source_position |
|
protectedinherited |
The documentation for this class was generated from the following file: