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