Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JMarkovGenerator.hh
Go to the documentation of this file.
1 #ifndef H_MARKOV_GENERATOR
2 #define H_MARKOV_GENERATOR
3 
4 /**
5  * \author mjongen
6  */
7 
8 // c++ standard library includes
9 #include<iostream>
10 #include<iomanip>
11 #include<cmath>
12 #include<cstdlib>
13 
14 // root includes
15 #include "TObject.h"
16 #include "TH1F.h"
17 #include "TH3F.h"
18 #include "TH2.h"
19 #include "TRandom3.h"
20 
21 // JPP includes
24 
25 namespace JMARKOV {}
26 namespace JPP { using namespace JMARKOV; }
27 
28 namespace JMARKOV {
29 
30  using namespace JGEOMETRY3D ;
31 
32  /**
33  Abstract interface for the generation of points in 3D space.
34  By convention, the random number generator used in the derived
35  classes is gRandom.
36  **/
37  class JGenerator {
38  public:
39 
40  virtual ~JGenerator() {}
41 
42  /**
43  Return a randomly generated position
44  **/
45  virtual JPosition3D getPosition() = 0 ;
46 
47  /**
48  return the weight (=probability density dP/dV) for the
49  given position.
50  When the generator is properly normalized, the integral
51  of this quantity over the whole space is 1.
52  **/
53  virtual double getWeight( JPosition3D pos ) = 0 ;
54 
55  protected :
56 
57  } ;
58 
59  /**
60  Implementation of the JGenerator interface.
61 
62  Generates positions uniformly within a rectangular cuboid,
63  **/
64  class JUniformGenerator : public JGenerator {
65 
66  public :
67 
68  /**
69  Constructor. The arguments are the limits of each coordinate.
70  **/
71  JUniformGenerator( double xmin, double ymin, double zmin, double xmax, double ymax, double zmax ) : posmin(xmin,ymin,zmin), posmax(xmax,ymax,zmax) {
72  setVolume() ;
73  }
74 
75  /**
76  Constructor. The arguments are the 'lower left bottom' corner and the
77  'upper right top' corner.
78  **/
79  JUniformGenerator( JPosition3D _posmin, JPosition3D _posmax ) : posmin(_posmin), posmax(_posmax) {
80  setVolume() ;
81  }
82 
84  double x = gRandom->Uniform( posmin.getX(), posmax.getX() ) ;
85  double y = gRandom->Uniform( posmin.getY(), posmax.getY() ) ;
86  double z = gRandom->Uniform( posmin.getZ(), posmax.getZ() ) ;
87  return JPosition3D(x,y,z) ;
88  }
89 
90  double getWeight( JPosition3D pos ) {
91  if( pos.getX() < posmin.getX() || pos.getX() > posmax.getX() ) return 0.0 ;
92  if( pos.getY() < posmin.getY() || pos.getY() > posmax.getY() ) return 0.0 ;
93  if( pos.getZ() < posmin.getZ() || pos.getZ() > posmax.getZ() ) return 0.0 ;
94  return 1.0/V ;
95  }
96 
97  protected :
98 
99  void setVolume() {
100  V = (posmax.getX()-posmin.getX())*(posmax.getY()-posmin.getY())*(posmax.getZ()-posmin.getZ()) ;
101  }
102 
105  double V ; // the total volume
106  } ;
107 
108  /**
109  Implementation of the JGenerator interface.
110 
111  Generates positions uniformly within a ball of a given radius
112  centered around the origin.
113  **/
114  class JBallGenerator : public JGenerator {
115  public :
116 
117  /**
118  Constructor. The argument is the radius of the ball.
119  **/
120  JBallGenerator( double _R ) : R(_R), Rcube(_R*_R*_R) {
121  setVolume() ;
122  }
123 
125  double rcube = gRandom->Uniform(0,Rcube) ;
126  double r = pow(rcube,1.0/3.0) ;
127  double x,y,z ;
128  gRandom->Sphere(x,y,z,r) ;
129  return JPosition3D(x,y,z) ;
130  }
131 
132  double getWeight( JPosition3D pos ) {
133  if( pos.getLength()>R ) return 0.0 ;
134  return 1.0/V ;
135  }
136 
137  protected :
138 
139  void setVolume() { V = 4.0/3.0*M_PI*Rcube ; }
140 
141  const double R ;
142  const double Rcube ;
143  double V ;
144  } ;
145 
146  /**
147  Implementation of the JGenerator interface.
148 
149  Generates positions according to the distribution
150 
151  1/r^2 exp(-r/lambda)
152 
153  around the origin.
154  **/
156  public :
157 
158  /**
159  Constructor. The argument is the radius of the ball.
160  **/
161  JExpRsqInvGenerator( double _lambda ) : lambda(_lambda) {}
162 
164  double xi = gRandom->Uniform() ;
165  double r = -lambda*log(1-xi) ;
166  double x,y,z ;
167  gRandom->Sphere(x,y,z,r) ;
168  return JPosition3D(x,y,z) ;
169  }
170 
171  double getWeight( JPosition3D pos ) {
172  double r = pos.getLength() ;
173  return lambda*exp(-r/lambda)/(r*r*4*M_PI) ;
174  }
175 
176  protected :
177 
178  const double lambda ;
179  } ;
180 
181  /**
182  The 'magical distributions' are a class of distributions.
183 
184  The magical distribution of degree N is the distribution of the distance
185  to the origin after taking N random steps where the step size r is drawn
186  from an "exponential inverse r-squared" 1/r^2 exp(-r/lambda)
187  distribution, which is the base behaviour for scattering
188 
189  Note that it seems to satisfy the property (for lambda = 1 )
190  mean = -0.5 + sqrt( (1+8*n)/4 )
191  **/
193 
194  public :
195 
196  JMagicalDistribution( unsigned int _N, double _lambda ) : N(_N), lambda(_lambda), gen(1) {
197  const int nbins = 1000 ;
198  const double xmax = 100 ;
199  const int nsamples = 10000000 ;
200  h = new TH1F("h","",nbins,0,xmax) ;
201  for( int i=0 ; i<nsamples ; ++i ) {
202  JPosition3D pos = gen.getPosition() ;
203  for( unsigned int n=1 ; n<N ; ++n ) pos += gen.getPosition() ;
204  double r = pos.getLength() ;
205  h->Fill(r) ;
206  }
207  h->Scale( 1.0/h->Integral("width") ) ;
208  }
209 
211  delete h ;
212  }
213 
215  double r = h->GetRandom() ;
216  double x,y,z ;
217  gRandom->Sphere(x,y,z,r) ;
218  return JPosition3D(x,y,z) ;
219  }
220 
221  double getWeight( JPosition3D pos ) {
222  double r = pos.getLength() ;
223  Int_t bin = h->FindBin(r) ;
224  return h->GetBinContent(bin)/(r*r) ;
225  }
226 
227  protected :
228 
229  unsigned int N ; // degree
230  double lambda ;
232  TH1F* h ;
233  } ;
234 
235  /**
236  Implementation of the JGenerator interface.
237 
238  Generates positions according to a probability density proportional
239  to 1/r^2 centered around some point.
240  **/
242  public :
243 
244  /**
245  Constructor. The argument is the maximal distance from _x0
246  **/
247  JSingularityGenerator( double _R, JPosition3D _x0 ) : R(_R), C(1.0/(4*M_PI*R)), x0(_x0) {}
248 
250  double r = gRandom->Uniform(0,R) ;
251  double x,y,z ;
252  gRandom->Sphere(x,y,z,r) ;
253  return JPosition3D(x,y,z)+x0 ;
254  }
255 
256  double getWeight( JPosition3D pos ) {
257  pos -= x0 ;
258  if( pos.getLength()>R ) return 0.0 ;
259  return C/pos.getLengthSquared() ;
260  }
261 
262  protected :
263 
264  const double R ;
265  const double C ; // constant factor in weight calculation
267  } ;
268 
269  /**
270  Implementation of the JGenerator interface.
271 
272  Generates positions according to an exponential distribution,
273  around the origin, i.e. with probability density
274 
275  rho( vec x ) = alpha * exp(-r/l)
276 
277  for given l. The minimal and maximal values of r are given by
278  r1 and r2, respectively.
279  **/
281 
282  public :
283 
284  /**
285  Constructor.
286  _r1 and _r2 are the minimal and maximal allowed value of r.
287  _L is the length scale.
288  **/
289  JExponentialGenerator( double _r1, double _r2, double _L ) :
290  r1(_r1), r2(_r2), L(_L)
291  {
292  // normalization factor
293  ximin = getIntegrand(r1) ;
294  ximax = getIntegrand(r2) ;
295  C = ximax-ximin ;
296  }
297 
298  double getWeight( JPosition3D pos ) {
299  return getWeight( pos.getLength() ) ;
300  }
301 
303  double x, y, z ;
304  double r = getR() ;
305  gRandom->Sphere(x,y,z,r) ;
306  return JPosition3D(x,y,z) ;
307  }
308 
309  double getR() {
310  // generate integrand value
311  double xi = gRandom->Uniform(ximin,ximax) ;
312  // find matching value of r
313  return getInvertedIntegrand(xi) ;
314  }
315 
316  double getWeight( double r ) {
317  return exp(-r/L) / C ;
318  }
319 
320 
321  protected :
322 
323  double getIntegrand( double r ) {
324  return -4*M_PI*L*exp(-r/L)*(2*L*L+2*L*r+r*r) ;
325  }
326 
327  /// return value y such that getIntegrand(y) = x
328  double getInvertedIntegrand( double x ) {
329  const double precision = 1e-10 ;
330  // using the bisection algorithm
331  double rl = r1 ;
332  double vl = getIntegrand(rl)-x ;
333  double rr = r2 ;
334  double vr = getIntegrand(rr)-x ;
335  double rc ;
336  double vc ;
337 
338  while( rr-rl > precision ) {
339  rc = 0.5*(rl+rr) ;
340  vc = getIntegrand(rc)-x ;
341  if( (vc>0) == (vr>0) ) {
342  // must be in left half
343  rr = rc ;
344  vr = vc ;
345  } else {
346  // must be in right half
347  rl = rc ;
348  vl = vc ;
349  }
350  }
351  return rc ;
352  }
353 
354  double r1 ;
355  double r2 ;
356  double L ;
357  double C ;
358  double ximin ;
359  double ximax ;
360  } ;
361 
362  /**
363  Implementation of the JGenerator interface.
364 
365  Generates positions according to a 3D Gaussian distribution
366  centered around the origin.
367  **/
369  public :
370 
371  /**
372  Constructor. The argument is the width of the gaussian.
373  **/
374  JGaussianGenerator( double _sigma ) : sigma(_sigma) {
375  C = 1.0 / ( 2*M_PI*sqrt(2*M_PI) * sigma * sigma * sigma ) ;
376  }
377 
379  double x = gRandom->Gaus(0,sigma) ;
380  double y = gRandom->Gaus(0,sigma) ;
381  double z = gRandom->Gaus(0,sigma) ;
382  return JPosition3D(x,y,z) ;
383  }
384 
385  double getWeight( JPosition3D pos ) {
386  return C*exp(-0.5*pos.getLengthSquared()/(sigma*sigma)) ;
387  }
388 
389  protected :
390 
391  const double sigma ;
392  double C ;
393  } ;
394 
395  /**
396  Implementation of the JGenerator interface.
397 
398  Generates positions by combining two other JGenerators
399  **/
401  public :
402 
403  /**
404  Constructor.
405 
406  The arguments _gn are pointers to the two JGenerators to use.
407  Note that ownership is not transferred, i.e.
408  - the memory taken by the _gn is not freed when JCombinedGenerator
409  is deleted
410  - changes made to the instances pointed to by the _gn will affect
411  the behaviour of the JCombinedGenerator
412 
413  The arguments _cn are the relative weights of the two generators.
414  They do not have to add up to 1.
415  The probability that a value is generated from g1 is
416  c1/(c1+c2).
417  **/
418  JCombinedGenerator( double _c1, JGenerator* _g1, double _c2, JGenerator* _g2 ) : g1(_g1), g2(_g2) {
419  p1 = _c1/(_c1+_c2) ;
420  p2 = 1-p1 ;
421  }
422 
424  if( gRandom->Uniform()<p1 ) {
425  return g1->getPosition() ;
426  } else {
427  return g2->getPosition() ;
428  }
429  }
430 
431  double getWeight( JPosition3D pos ) {
432  double w1 = g1->getWeight(pos) ;
433  double w2 = g2->getWeight(pos) ;
434  return p1*w1 + p2*w2 ;
435  }
436 
437  protected :
438 
441  double p1 ;
442  double p2 ;
443  } ;
444 
445  /**
446  Implementation of the JGenerator interface.
447 
448  Generates positions by combining three other JGenerators
449  **/
450  class JTripleGenerator : public JGenerator {
451  public :
452  /**
453  Constructor.
454 
455  The arguments gn are pointers to the three JGenerators to use.
456  Note that ownership is not transferred, i.e.
457  - the memory taken by the _gn is not freed when JTripleGenerator
458  is deleted
459  - changes made to the instances pointed to by the _gn will affect
460  the behaviour of the JTripleGenerator
461 
462  The arguments cn are the relative weights of the two generators.
463  They do not have to add up to 1.
464  The probability that a value is generated from gi is
465  ci/(c1+c2+c3).
466  **/
467  JTripleGenerator( double c1, JGenerator* g1, double c2, JGenerator* g2, double c3, JGenerator* g3 ) :
468  gsub(c1,g1,c2,g2), g(c1+c2,&gsub,c3,g3) {}
469 
471 
472  double getWeight( JPosition3D pos ) { return g.getWeight(pos) ; }
473 
474  protected :
475 
478  } ;
479 
480  /**
481  Implementation of the JGenerator interface.
482 
483  Generates positions by shifting the positions from another JGenerator
484  **/
485  class JShiftedGenerator : public JGenerator {
486  public :
487 
488  /**
489  Constructor.
490 
491  _g is a pointer to some other generator, note that
492  memory ownership of the instance pointed to by _g
493  is not transferred, so
494  - it will not be deleted with JShiftedGenerator
495  - changes to _g affect JShiftedGenerator as well
496  **/
498  g(_g), shift(_shift) {}
499 
501  return g->getPosition() + shift ;
502  }
503 
504  double getWeight( JPosition3D pos ) {
505  return g->getWeight( pos-shift ) ;
506  }
507 
508  protected :
509 
512  } ;
513 
514  /**
515  Implementation of the JGenerator interface.
516 
517  Generates positions by sampling from 3 histograms
518  that represent the projection of the distribution along the
519  X, Y and Z axis.
520  **/
521  class JHistGenerator : public JGenerator {
522  public :
523 
524  /**
525  Constructor.
526  The histograms are cloned and automatically normalized.
527 
528  Note: empty bins should always be avoided!
529  **/
530  JHistGenerator( TH1* _hx, TH1* _hy, TH1* _hz ) {
531  // copy histograms
532  hx = (TH1*) _hx->Clone( _hx->GetName() ) ;
533  hy = (TH1*) _hy->Clone( _hy->GetName() ) ;
534  hz = (TH1*) _hz->Clone( _hz->GetName() ) ;
535  // normalize histograms
536  hx->Scale( 1.0/hx->Integral("width") ) ;
537  hy->Scale( 1.0/hy->Integral("width") ) ;
538  hz->Scale( 1.0/hz->Integral("width") ) ;
539  }
540 
542  delete hx ;
543  delete hy ;
544  delete hz ;
545  }
546 
548  double x = hx->GetRandom() ;
549  double y = hy->GetRandom() ;
550  double z = hz->GetRandom() ;
551  return JPosition3D(x,y,z) ;
552  }
553 
554  double getWeight( JPosition3D pos ) {
555  Int_t bin ;
556  double w = 1 ;
557 
558  bin = hx->GetXaxis()->FindBin( pos.getX() ) ;
559  if( bin==0 || bin==hx->GetNbinsX()+1 ) return 0.0 ; // out of range
560  w *= hx->GetBinContent(bin) ;
561 
562  bin = hy->GetXaxis()->FindBin( pos.getY() ) ;
563  if( bin==0 || bin==hy->GetNbinsX()+1 ) return 0.0 ; // out of range
564  w *= hy->GetBinContent(bin) ;
565 
566  bin = hz->GetXaxis()->FindBin( pos.getZ() ) ;
567  if( bin==0 || bin==hz->GetNbinsX()+1 ) return 0.0 ; // out of range
568  w *= hz->GetBinContent(bin) ;
569 
570  return w ;
571  }
572 
573  TH1* hx ;
574  TH1* hy ;
575  TH1* hz ;
576  } ;
577 
578  /**
579  Implementation of the JGenerator interface.
580 
581  Generates positions on a sphere of radius _r centered at _x0
582  by sampling from a 2D histogram of cosTheta vs phi.
583 
584  When r=0, it simply returns the position x0.
585  **/
586  class JSphereGenerator : public JGenerator {
587  public :
588 
589  /**
590  Constructor.
591  The histogram is cloned and automatically normalized.
592  The x-axis is assumed to be cos(theta), and the y-axis is
593  assumed to be phi in radians.
594  Empty bins should be avoided!
595  **/
596  JSphereGenerator( const JPosition3D& _x0, double _r=0, TH2* _h=NULL ) : x0(_x0), r(_r) {
597 
598  using namespace std;
599  using namespace JPP;
600 
601  h = NULL ;
602 
603  if( r>0 ) {
604  // copy histogram
605  h = (TH2*) _h->Clone( _h->GetName() ) ;
606  // check that it has the proper limits
607  if( h->GetXaxis()->GetXmin()<-1 || h->GetXaxis()->GetXmax()>1 ) {
608  cerr << "FATAL ERROR in JSphereGenerator. Invalid x-axis range." << endl ;
609  exit(1) ;
610  }
611  if( h->GetYaxis()->GetXmin() < -M_PI || h->GetYaxis()->GetXmax() > M_PI ) {
612  cerr << "FATAL ERROR in JSphereGenerator. Invalid y-axis range." << endl ;
613  exit(1) ;
614  }
615  // normalize histogram
616  h->Scale( 1.0/h->Integral("width") ) ;
617  h->SetOption("colz") ;
618  }
619  }
620 
622  delete h ;
623  }
624 
626 
627  using namespace std;
628  using namespace JPP;
629 
630  if( r==0 ) return x0 ;
631 
632  double costheta, phi ;
633  h->GetRandom2(costheta,phi) ;
634  return x0 + r * JPosition3D(JAngle3D(acos(costheta),phi));
635  }
636 
637  double getWeight( JPosition3D pos ) {
638 
639  using namespace std;
640  using namespace JPP;
641 
642  if( r==0 ) return 1 ;
643 
644  // check that the position is in fact on the target surface
645  const double tolerance = 1e-5 ;
646  if( fabs( pos.getDistance(x0)-r ) > tolerance*r ) {
647  return 0.0 ;
648  }
649 
650  JDirection3D dir(pos-x0) ;
651  double ct = dir.getDZ() ;
652  double phi = dir.getPhi() ;
653 
654  if( ct < h->GetXaxis()->GetXmin() || ct >=h->GetXaxis()->GetXmax() ) return 0.0 ;
655  if( phi< h->GetYaxis()->GetXmin() || phi>=h->GetYaxis()->GetXmax() ) return 0.0 ;
656 
657  Int_t bin = h->FindBin(ct,phi) ;
658  return h->GetBinContent(bin) / (r*r) ;
659  }
660 
662  double r ;
663  TH2* h ;
664  } ;
665 
666  /**
667  Implementation of the JGenerator interface.
668 
669  Generates positions uniformly by sampling from a histogram
670  that represents the x,y,z distribution
671  **/
672  class J3DhistGenerator : public JGenerator {
673  public :
674 
675  /**
676  Constructor.
677  The histogram is cloned and automatically normalized.
678 
679  Note: empty bins should always be avoided!
680  **/
681  J3DhistGenerator( TH3* _h ) {
682  // copy histogram
683  h = (TH3*) _h->Clone( _h->GetName() ) ;
684  // normalize histogram
685  h->Scale( 1.0/h->Integral("width") ) ;
686  }
687 
689  delete h ;
690  }
691 
693  double x, y, z ;
694  h->GetRandom3(x,y,z) ;
695  return JPosition3D(x,y,z) ;
696  }
697 
698  double getWeight( JPosition3D pos ) {
699  // return 0 outside histogram range
700  if( pos.getX()<h->GetXaxis()->GetXmin() || pos.getX()>=h->GetXaxis()->GetXmax() ) return 0.0 ;
701  if( pos.getY()<h->GetYaxis()->GetXmin() || pos.getY()>=h->GetYaxis()->GetXmax() ) return 0.0 ;
702  if( pos.getZ()<h->GetZaxis()->GetXmin() || pos.getZ()>=h->GetZaxis()->GetXmax() ) return 0.0 ;
703  // return weight
704  Int_t bin = h->FindBin( pos.getX(), pos.getY(), pos.getZ() ) ;
705  return h->GetBinContent(bin) ;
706  }
707 
708  TH3* h ;
709  } ;
710 
711 }
712 
713 #endif
714 
TCanvas * c1
Global variables to handle mouse events.
TPaveText * p1
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:35
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:35
Data structure for position in three dimensions.
Definition: JPosition3D.hh:38
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getLength() const
Get length.
Definition: JVector3D.hh:246
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235
double getDistance(const JVector3D &pos) const
Get distance to point.
Definition: JVector3D.hh:270
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getPhi() const
Get phi angle.
Definition: JVersor3D.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
Implementation of the JGenerator interface.
JPosition3D getPosition()
Return a randomly generated position.
J3DhistGenerator(TH3 *_h)
Constructor.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JBallGenerator(double _R)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
Implementation of the JGenerator interface.
JPosition3D getPosition()
Return a randomly generated position.
JCombinedGenerator(double _c1, JGenerator *_g1, double _c2, JGenerator *_g2)
Constructor.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
JPosition3D getPosition()
Return a randomly generated position.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JExpRsqInvGenerator(double _lambda)
Constructor.
Implementation of the JGenerator interface.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JExponentialGenerator(double _r1, double _r2, double _L)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
double getInvertedIntegrand(double x)
return value y such that getIntegrand(y) = x
Implementation of the JGenerator interface.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JGaussianGenerator(double _sigma)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
Abstract interface for the generation of points in 3D space.
virtual JPosition3D getPosition()=0
Return a randomly generated position.
virtual double getWeight(JPosition3D pos)=0
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JHistGenerator(TH1 *_hx, TH1 *_hy, TH1 *_hz)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
The 'magical distributions' are a class of distributions.
JMagicalDistribution(unsigned int _N, double _lambda)
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JPosition3D getPosition()
Return a randomly generated position.
Implementation of the JGenerator interface.
JShiftedGenerator(JGenerator *_g, JPosition3D _shift)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
JPosition3D getPosition()
Return a randomly generated position.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JSingularityGenerator(double _R, JPosition3D _x0)
Constructor.
Implementation of the JGenerator interface.
JPosition3D getPosition()
Return a randomly generated position.
JSphereGenerator(const JPosition3D &_x0, double _r=0, TH2 *_h=NULL)
Constructor.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
JTripleGenerator(double c1, JGenerator *g1, double c2, JGenerator *g2, double c3, JGenerator *g3)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
Implementation of the JGenerator interface.
double getWeight(JPosition3D pos)
return the weight (=probability density dP/dV) for the given position.
JUniformGenerator(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
Constructor.
JPosition3D getPosition()
Return a randomly generated position.
JUniformGenerator(JPosition3D _posmin, JPosition3D _posmax)
Constructor.
const double sigma[]
Definition: JQuadrature.cc:74
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23
double getWeight(T __begin, T __end)
Get total weight of data points.
Definition: JKatoomba_t.hh:61
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition: JAngle3D.hh:19
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
data_type w[N+1][M+1]
Definition: JPolint.hh:867
const int n
Definition: JPolint.hh:786
data_type r[M+1]
Definition: JPolint.hh:868
Definition: JSTDTypes.hh:14