GFluxWindow.cxx
Go to the documentation of this file.
1 // ROOT includes
2 #include "TVector3.h"
3 
4 // GENIE includes
5 #include "GENIE/Framework/Messenger/Messenger.h"
6 #include "GENIE/Framework/Numerical/RandomGen.h"
7 #include "GENIE/Framework/Conventions/Units.h"
8 
9 // NOvASoft includes
11 
12 using namespace genie::supernova;
13 
14 
15 //.......................................................................
16 GFluxWindow::GFluxWindow(TVector3 pos, double size):
17  fPosition(pos),
18  fDirection(-pos.Unit()),
19  fSize(size)
20 {
22 }
23 
24 
25 //.......................................................................
27 {
28  particle.SetDirection(fDirection);
29  particle.fPos.SetVect(GenPosition() * 0.01);
30 }
31 
32 
33 //.......................................................................
35 {
36  return fDirection;
37 }
38 
39 
40 //.......................................................................
42 {
43  return fSize * fSize;
44 }
45 
46 
47 //.......................................................................
49 {
51  double x = rnd->RndFlux().Uniform(-0.5, 0.5);
52  double y = rnd->RndFlux().Uniform(-0.5, 0.5);
53  return (fBasisX * x) + (fBasisY * y) + fPosition;
54 }
55 
56 
57 //.......................................................................
59 {
60  // Calculate Basis vectors
61  fBasisX = fDirection.Cross(TVector3(0, 1, 0));
62  if (fBasisX.Mag2() == 0)
63  fBasisX = fDirection.Cross(TVector3(0, 0, 1));
64 
65  fBasisY = fBasisX.Cross(fDirection);
66 
67  //normalize basis
68  fBasisX = fBasisX.Unit() * fSize;
69  fBasisY = fBasisY.Unit() * fSize;
70 }
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
void GenerateNext(GenParticle &)
Definition: GFluxWindow.cxx:26
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
TVector3 fBasisY
basis vectors in X for position generation
Definition: GFluxWindow.h:29
TVector3 Unit() const
void SetDirection(const TVector3 &dir)
Definition: GenParticle.cxx:25
TRandom3 & RndFlux(void) const
rnd number generator used by flux drivers
Definition: RandomGen.h:72
GFluxWindow(TVector3 pos, double size)
Definition: GFluxWindow.cxx:16