Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SPSPosDistribution Class Reference

#include <G4SPSPosDistribution.hh>

Public Member Functions

 G4SPSPosDistribution ()
 
 ~G4SPSPosDistribution ()
 
void SetPosDisType (G4String)
 
G4String GetPosDisType ()
 
void SetPosDisShape (G4String)
 
G4String GetPosDisShape ()
 
void SetCentreCoords (G4ThreeVector)
 
G4ThreeVector GetCentreCoords ()
 
void SetPosRot1 (G4ThreeVector)
 
void SetPosRot2 (G4ThreeVector)
 
void SetHalfX (G4double)
 
G4double GetHalfX ()
 
void SetHalfY (G4double)
 
G4double GetHalfY ()
 
void SetHalfZ (G4double)
 
G4double GetHalfZ ()
 
void SetRadius (G4double)
 
G4double GetRadius ()
 
void SetRadius0 (G4double)
 
void SetBeamSigmaInR (G4double)
 
void SetBeamSigmaInX (G4double)
 
void SetBeamSigmaInY (G4double)
 
void SetParAlpha (G4double)
 
void SetParTheta (G4double)
 
void SetParPhi (G4double)
 
void ConfineSourceToVolume (G4String)
 
void SetBiasRndm (G4SPSRandomGenerator *a)
 
void SetVerbosity (G4int a)
 
G4ThreeVector GenerateOne ()
 

Friends

class G4SPSAngDistribution
 

Detailed Description

Definition at line 138 of file G4SPSPosDistribution.hh.

Constructor & Destructor Documentation

◆ G4SPSPosDistribution()

G4SPSPosDistribution::G4SPSPosDistribution ( )

Definition at line 56 of file G4SPSPosDistribution.cc.

57 : posRndm(0)
58{
59
60 // Initialise all variables
61 // Position distribution Variables
62
63 SourcePosType = "Point";
64 Shape = "NULL";
65 halfx = 0.;
66 halfy = 0.;
67 halfz = 0.;
68 Radius = 0.;
69 Radius0 = 0.;
70 SR = 0.;
71 SX = 0.;
72 SY = 0.;
73 ParAlpha = 0.;
74 ParTheta = 0.;
75 ParPhi = 0.;
76 CentreCoords = G4ThreeVector(0., 0., 0.);
77 Rotx = CLHEP::HepXHat;
78 Roty = CLHEP::HepYHat;
79 Rotz = CLHEP::HepZHat;
80 Confine = false; //If true confines source distribution to VolName
81 VolName = "NULL";
82 SideRefVec1 = CLHEP::HepXHat; // x-axis
83 SideRefVec2 = CLHEP::HepYHat; // y-axis
84 SideRefVec3 = CLHEP::HepZHat; // z-axis
85 verbosityLevel = 0 ;
88}
CLHEP::Hep3Vector G4ThreeVector
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
DLL_API const Hep3Vector HepZHat
Definition: ThreeVector.h:424
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat
Definition: ThreeVector.h:424

◆ ~G4SPSPosDistribution()

G4SPSPosDistribution::~G4SPSPosDistribution ( )

Definition at line 90 of file G4SPSPosDistribution.cc.

91{
92}

Member Function Documentation

◆ ConfineSourceToVolume()

void G4SPSPosDistribution::ConfineSourceToVolume ( G4String  Vname)

Definition at line 206 of file G4SPSPosDistribution.cc.

207{
208 VolName = Vname;
209 if(verbosityLevel == 2)
210 G4cout << VolName << G4endl;
211 G4VPhysicalVolume *tempPV = NULL;
212 G4PhysicalVolumeStore *PVStore = 0;
213 G4String theRequiredVolumeName = VolName;
215 G4int i = 0;
216 G4bool found = false;
217 if(verbosityLevel == 2)
218 G4cout << PVStore->size() << G4endl;
219 while (!found && i<G4int(PVStore->size())) {
220 tempPV = (*PVStore)[i];
221 found = tempPV->GetName() == theRequiredVolumeName;
222 if(verbosityLevel == 2)
223 G4cout << i << " " << " " << tempPV->GetName() << " " << theRequiredVolumeName << " " << found << G4endl;
224 if (!found)
225 {i++;}
226 }
227 // found = true then the volume exists else it doesnt.
228 if(found == true)
229 {
230 if(verbosityLevel >= 1)
231 G4cout << "Volume " << VolName << " exists" << G4endl;
232 Confine = true;
233 }
234 else
235 {
236 G4cout << " **** Error: Volume does not exist **** " << G4endl;
237 G4cout << " Ignoring confine condition" << G4endl;
238 Confine = false;
239 VolName = "NULL";
240 }
241
242}
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4PhysicalVolumeStore * GetInstance()
const G4String & GetName() const

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ GenerateOne()

G4ThreeVector G4SPSPosDistribution::GenerateOne ( )

Definition at line 974 of file G4SPSPosDistribution.cc.

975{
976 //
977 G4bool srcconf = false;
978 G4int LoopCount = 0;
979 while(srcconf == false)
980 {
981 if(SourcePosType == "Point")
982 GeneratePointSource();
983 else if(SourcePosType == "Beam")
984 GeneratePointsInBeam();
985 else if(SourcePosType == "Plane")
986 GeneratePointsInPlane();
987 else if(SourcePosType == "Surface")
988 GeneratePointsOnSurface();
989 else if(SourcePosType == "Volume")
990 GeneratePointsInVolume();
991 else
992 {
993 G4cout << "Error: SourcePosType undefined" << G4endl;
994 G4cout << "Generating point source" << G4endl;
995 GeneratePointSource();
996 }
997 if(Confine == true)
998 {
999 srcconf = IsSourceConfined();
1000 // if source in confined srcconf = true terminating the loop
1001 // if source isnt confined srcconf = false and loop continues
1002 }
1003 else if(Confine == false)
1004 srcconf = true; // terminate loop
1005 LoopCount++;
1006 if(LoopCount == 100000)
1007 {
1008 G4cout << "*************************************" << G4endl;
1009 G4cout << "LoopCount = 100000" << G4endl;
1010 G4cout << "Either the source distribution >> confinement" << G4endl;
1011 G4cout << "or any confining volume may not overlap with" << G4endl;
1012 G4cout << "the source distribution or any confining volumes" << G4endl;
1013 G4cout << "may not exist"<< G4endl;
1014 G4cout << "If you have set confine then this will be ignored" <<G4endl;
1015 G4cout << "for this event." << G4endl;
1016 G4cout << "*************************************" << G4endl;
1017 srcconf = true; //Avoids an infinite loop
1018 }
1019 }
1020 return particle_position;
1021}

Referenced by G4SingleParticleSource::GeneratePrimaryVertex().

◆ GetCentreCoords()

G4ThreeVector G4SPSPosDistribution::GetCentreCoords ( )
inline

Definition at line 154 of file G4SPSPosDistribution.hh.

154{ return CentreCoords; } ;

◆ GetHalfX()

G4double G4SPSPosDistribution::GetHalfX ( )
inline

Definition at line 158 of file G4SPSPosDistribution.hh.

158{ return halfx; } ;

◆ GetHalfY()

G4double G4SPSPosDistribution::GetHalfY ( )
inline

Definition at line 160 of file G4SPSPosDistribution.hh.

160{ return halfy; } ;

◆ GetHalfZ()

G4double G4SPSPosDistribution::GetHalfZ ( )
inline

Definition at line 162 of file G4SPSPosDistribution.hh.

162{ return halfz; } ;

◆ GetPosDisShape()

G4String G4SPSPosDistribution::GetPosDisShape ( )
inline

Definition at line 150 of file G4SPSPosDistribution.hh.

150{ return Shape; };

◆ GetPosDisType()

G4String G4SPSPosDistribution::GetPosDisType ( )
inline

Definition at line 148 of file G4SPSPosDistribution.hh.

148{ return SourcePosType; };

◆ GetRadius()

G4double G4SPSPosDistribution::GetRadius ( )
inline

Definition at line 164 of file G4SPSPosDistribution.hh.

164{ return Radius; };

◆ SetBeamSigmaInR()

void G4SPSPosDistribution::SetBeamSigmaInR ( G4double  r)

Definition at line 157 of file G4SPSPosDistribution.cc.

158{
159 SX = SY = r;
160 SR = r;
161}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBeamSigmaInX()

void G4SPSPosDistribution::SetBeamSigmaInX ( G4double  r)

Definition at line 163 of file G4SPSPosDistribution.cc.

164{
165 SX = r;
166}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBeamSigmaInY()

void G4SPSPosDistribution::SetBeamSigmaInY ( G4double  r)

Definition at line 168 of file G4SPSPosDistribution.cc.

169{
170 SY = r;
171}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBiasRndm()

void G4SPSPosDistribution::SetBiasRndm ( G4SPSRandomGenerator a)
inline

Definition at line 174 of file G4SPSPosDistribution.hh.

174{ posRndm = a ; };

Referenced by G4SingleParticleSource::G4SingleParticleSource().

◆ SetCentreCoords()

void G4SPSPosDistribution::SetCentreCoords ( G4ThreeVector  coordsOfCentre)

◆ SetHalfX()

void G4SPSPosDistribution::SetHalfX ( G4double  xhalf)

Definition at line 132 of file G4SPSPosDistribution.cc.

133{
134 halfx = xhalf;
135}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetHalfY()

void G4SPSPosDistribution::SetHalfY ( G4double  yhalf)

Definition at line 137 of file G4SPSPosDistribution.cc.

138{
139 halfy = yhalf;
140}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetHalfZ()

void G4SPSPosDistribution::SetHalfZ ( G4double  zhalf)

Definition at line 142 of file G4SPSPosDistribution.cc.

143{
144 halfz = zhalf;
145}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParAlpha()

void G4SPSPosDistribution::SetParAlpha ( G4double  paralp)

Definition at line 173 of file G4SPSPosDistribution.cc.

174{
175 ParAlpha = paralp;
176}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParPhi()

void G4SPSPosDistribution::SetParPhi ( G4double  parphi)

Definition at line 183 of file G4SPSPosDistribution.cc.

184{
185 ParPhi = parphi;
186}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParTheta()

void G4SPSPosDistribution::SetParTheta ( G4double  parthe)

Definition at line 178 of file G4SPSPosDistribution.cc.

179{
180 ParTheta = parthe;
181}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetPosDisShape()

void G4SPSPosDistribution::SetPosDisShape ( G4String  shapeType)

◆ SetPosDisType()

◆ SetPosRot1()

void G4SPSPosDistribution::SetPosRot1 ( G4ThreeVector  posrot1)

Definition at line 109 of file G4SPSPosDistribution.cc.

110{
111 // This should be x'
112 Rotx = posrot1;
113 if(verbosityLevel == 2)
114 {
115 G4cout << "Vector x' " << Rotx << G4endl;
116 }
117 GenerateRotationMatrices();
118}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetPosRot2()

void G4SPSPosDistribution::SetPosRot2 ( G4ThreeVector  posrot2)

Definition at line 120 of file G4SPSPosDistribution.cc.

121{
122 // This is a vector in the plane x'y' but need not
123 // be y'
124 Roty = posrot2;
125 if(verbosityLevel == 2)
126 {
127 G4cout << "The vector in the x'-y' plane " << Roty << G4endl;
128 }
129 GenerateRotationMatrices();
130}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetRadius()

void G4SPSPosDistribution::SetRadius ( G4double  rds)

◆ SetRadius0()

void G4SPSPosDistribution::SetRadius0 ( G4double  rds)

Definition at line 152 of file G4SPSPosDistribution.cc.

153{
154 Radius0 = rds;
155}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetVerbosity()

void G4SPSPosDistribution::SetVerbosity ( G4int  a)
inline

Definition at line 176 of file G4SPSPosDistribution.hh.

176{verbosityLevel = a; } ;

Referenced by G4SingleParticleSource::SetVerbosity().

Friends And Related Function Documentation

◆ G4SPSAngDistribution

friend class G4SPSAngDistribution
friend

Definition at line 141 of file G4SPSPosDistribution.hh.


The documentation for this class was generated from the following files: