From cbed9a6d474fec393e659aac19bddeec93e08c97 Mon Sep 17 00:00:00 2001 From: Unknown <unknown> Date: Wed, 2 Oct 2013 10:00:25 +0000 Subject: [PATCH] --- Inputs/EventGenerator/11Li.beam | 2 +- NPSimulation/include/VEventGenerator.hh | 7 +---- NPSimulation/src/VEventGenerator.cc | 41 ++++--------------------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/Inputs/EventGenerator/11Li.beam b/Inputs/EventGenerator/11Li.beam index 132ccd747..e7c437519 100644 --- a/Inputs/EventGenerator/11Li.beam +++ b/Inputs/EventGenerator/11Li.beam @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% An Isotropic Source to be used as EventGenerator %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Energy are given in MeV , Position in mm % +% Energy are given in MeV , Position in mm , Angle is deg % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Beam ParticleZ= 3 diff --git a/NPSimulation/include/VEventGenerator.hh b/NPSimulation/include/VEventGenerator.hh index 507d2b3fb..1904d054c 100644 --- a/NPSimulation/include/VEventGenerator.hh +++ b/NPSimulation/include/VEventGenerator.hh @@ -35,9 +35,6 @@ #include "G4ParticleGun.hh" #include "G4Event.hh" -// ROOT headers -#include"TRandom3.h" -#include "Randomize.hh" using namespace CLHEP; using namespace std; @@ -60,10 +57,8 @@ public: virtual void SetTargetCoordinate(G4double, G4double, G4double) {}; // Used to simulate beam emmitance effect - void RandomGaussian2D(double MeanX,double MeanY,double SigmaX,double SigmaY,double &X,double &Y, double NumberOfSigma=7); + void RandomGaussian2D(double MeanX,double MeanY,double SigmaX,double SigmaY,double &X,double &Y, double NumberOfSigma=10000); -private: // Random Engine used by RandomGaussian2D - TRandom3 m_RandomEngine ; }; diff --git a/NPSimulation/src/VEventGenerator.cc b/NPSimulation/src/VEventGenerator.cc index 1e9fa054f..4c91b8696 100644 --- a/NPSimulation/src/VEventGenerator.cc +++ b/NPSimulation/src/VEventGenerator.cc @@ -25,16 +25,16 @@ *****************************************************************************/ #include "VEventGenerator.hh" -//Root +// ROOT headers #include"TMath.h" +// CLHEP headers +#include "Randomize.hh" VEventGenerator::VEventGenerator() { } - - VEventGenerator::~VEventGenerator() { } @@ -44,51 +44,22 @@ void VEventGenerator::RandomGaussian2D(double MeanX,double MeanY,double SigmaX,d if(SigmaX!=0) { - X=100*SigmaX; + X=2* NumberOfSigma *SigmaX; while(X>NumberOfSigma*SigmaX) - // X = m_RandomEngine.Gaus( MeanX , SigmaX) ; X = RandGauss::shoot( MeanX , SigmaX); - G4cout << MeanX << " " << SigmaX << G4endl ; double a = NumberOfSigma * SigmaX/2 ; double b = NumberOfSigma * SigmaY/2 ; double SigmaYPrim = b * sqrt( 1 - X*X / (a*a) ) ; SigmaYPrim = 2*SigmaYPrim / NumberOfSigma ; -// Y = m_RandomEngine.Gaus( MeanY , SigmaYPrim) ; Y = RandGauss::shoot( MeanY , SigmaYPrim) ; - } else { - X= MeanX; - Y = m_RandomEngine.Gaus( MeanY , SigmaY) ; + X = MeanX ; + Y = RandGauss::shoot( MeanY , SigmaY) ; } - - /* if(SigmaX!=0) - { - X = m_RandomEngine.Gaus( MeanX , SigmaX) ; - - double NumberOfSigma ; - double a = SigmaX / 2. ; - double b = SigmaY / 2. ; - - NumberOfSigma = ( X / a ) ; - NumberOfSigma = TMath::Floor( sqrt(NumberOfSigma*NumberOfSigma)+1) ; - - double SigmaYPrim = NumberOfSigma*b * sqrt( 1 - X*X / (a*NumberOfSigma*a*NumberOfSigma) ) ; - SigmaYPrim = 2*SigmaYPrim / NumberOfSigma ; - - Y = m_RandomEngine.Gaus( MeanY , SigmaYPrim) ; - - } - - else - { - X= MeanX; - Y = m_RandomEngine.Gaus( MeanY , SigmaY) ; - }*/ - } -- GitLab