Geant4 10.7.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 (const G4String &)
 
void SetPosDisShape (const G4String &)
 
void SetCentreCoords (const G4ThreeVector &)
 
void SetPosRot1 (const G4ThreeVector &)
 
void SetPosRot2 (const G4ThreeVector &)
 
void SetHalfX (G4double)
 
void SetHalfY (G4double)
 
void SetHalfZ (G4double)
 
void SetRadius (G4double)
 
void SetRadius0 (G4double)
 
void SetBeamSigmaInR (G4double)
 
void SetBeamSigmaInX (G4double)
 
void SetBeamSigmaInY (G4double)
 
void SetParAlpha (G4double)
 
void SetParTheta (G4double)
 
void SetParPhi (G4double)
 
void ConfineSourceToVolume (const G4String &)
 
void SetBiasRndm (G4SPSRandomGenerator *a)
 
void SetVerbosity (G4int a)
 
G4ThreeVector GenerateOne ()
 
const G4StringGetPosDisType () const
 
const G4StringGetPosDisShape () const
 
const G4ThreeVectorGetCentreCoords () const
 
G4double GetHalfX () const
 
G4double GetHalfY () const
 
G4double GetHalfZ () const
 
G4double GetRadius () const
 
G4double GetRadius0 () const
 
G4double GetParAlpha () const
 
G4double GetParTheta () const
 
G4double GetParPhi () const
 
const G4ThreeVectorGetRotx () const
 
const G4ThreeVectorGetRoty () const
 
const G4ThreeVectorGetRotz () const
 
G4bool GetConfined () const
 
const G4StringGetConfineVolume () const
 
const G4ThreeVectorGetSideRefVec1 () const
 
const G4ThreeVectorGetSideRefVec2 () const
 
const G4ThreeVectorGetSideRefVec3 () const
 
const G4StringGetSourcePosType () const
 
const G4ThreeVectorGetParticlePos () const
 

Detailed Description

Definition at line 59 of file G4SPSPosDistribution.hh.

Constructor & Destructor Documentation

◆ G4SPSPosDistribution()

G4SPSPosDistribution::G4SPSPosDistribution ( )

Definition at line 51 of file G4SPSPosDistribution.cc.

52{
53 SourcePosType = "Point";
54 Shape = "NULL";
55 CentreCoords = G4ThreeVector(0,0,0);
56 Rotx = CLHEP::HepXHat;
57 Roty = CLHEP::HepYHat;
58 Rotz = CLHEP::HepZHat;
59 halfx = 0.;
60 halfy = 0.;
61 halfz = 0.;
62 Radius = 0.;
63 Radius0 = 0.;
64 SR = 0.;
65 SX = 0.;
66 SY = 0.;
67 ParAlpha = 0.;
68 ParTheta = 0.;
69 ParPhi = 0.;
70 VolName = "NULL";
71 verbosityLevel = 0 ;
72 G4MUTEXINIT(a_mutex);
73}
#define G4MUTEXINIT(mutex)
Definition: G4Threading.hh:87
CLHEP::Hep3Vector G4ThreeVector
DLL_API const Hep3Vector HepZHat
Definition: ThreeVector.h:419
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat
Definition: ThreeVector.h:419

◆ ~G4SPSPosDistribution()

G4SPSPosDistribution::~G4SPSPosDistribution ( )

Definition at line 75 of file G4SPSPosDistribution.cc.

76{
77 G4MUTEXDESTROY(a_mutex);
78}
#define G4MUTEXDESTROY(mutex)
Definition: G4Threading.hh:90

Member Function Documentation

◆ ConfineSourceToVolume()

void G4SPSPosDistribution::ConfineSourceToVolume ( const G4String Vname)

Definition at line 265 of file G4SPSPosDistribution.cc.

266{
267 VolName = Vname;
268 if(verbosityLevel == 2) { G4cout << VolName << G4endl; }
269
270 if(VolName=="NULL")
271 {
272 if(verbosityLevel >= 1)
273 { G4cout << "Volume confinement is set off." << G4endl; }
274 Confine = false;
275 return;
276 }
277
278 G4VPhysicalVolume* tempPV = nullptr;
279 G4PhysicalVolumeStore* PVStore = nullptr;
280 G4String theRequiredVolumeName = VolName;
282 G4int i = 0;
283 G4bool found = false;
284 if(verbosityLevel == 2) { G4cout << PVStore->size() << G4endl; }
285
286 while (!found && i<G4int(PVStore->size()))
287 {
288 tempPV = (*PVStore)[i];
289 found = tempPV->GetName() == theRequiredVolumeName;
290 if(verbosityLevel == 2)
291 {
292 G4cout << i << " " << " " << tempPV->GetName()
293 << " " << theRequiredVolumeName << " " << found << G4endl;
294 }
295 if (!found) { ++i; }
296 }
297
298 // found = true then the volume exists else it doesn't
299 //
300 if(found == true)
301 {
302 if(verbosityLevel >= 1)
303 {
304 G4cout << "Volume " << VolName << " exists" << G4endl;
305 }
306 Confine = true;
307 }
308 else
309 {
310 G4cout << " **** Error: Volume <" << VolName << "> does not exist **** " << G4endl;
311 G4cout << " Ignoring confine condition" << G4endl;
312 Confine = false;
313 VolName = "NULL";
314 }
315}
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4PhysicalVolumeStore * GetInstance()
const G4String & GetName() const

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ GenerateOne()

G4ThreeVector G4SPSPosDistribution::GenerateOne ( )

Definition at line 1259 of file G4SPSPosDistribution.cc.

1260{
1261 G4ThreeVector localP;
1262 G4bool srcconf = false;
1263 G4int LoopCount = 0;
1264 while(srcconf == false)
1265 {
1266 if(SourcePosType == "Point")
1267 GeneratePointSource(localP);
1268 else if(SourcePosType == "Beam")
1269 GeneratePointsInBeam(localP);
1270 else if(SourcePosType == "Plane")
1271 GeneratePointsInPlane(localP);
1272 else if(SourcePosType == "Surface")
1273 GeneratePointsOnSurface(localP);
1274 else if(SourcePosType == "Volume")
1275 GeneratePointsInVolume(localP);
1276 else
1277 {
1279 msg << "Error: SourcePosType undefined\n";
1280 msg << "Generating point source\n";
1281 G4Exception("G4SPSPosDistribution::GenerateOne()",
1282 "G4GPS001", JustWarning, msg);
1283 GeneratePointSource(localP);
1284 }
1285 if(Confine == true)
1286 {
1287 srcconf = IsSourceConfined(localP);
1288 // if source in confined srcconf = true terminating the loop
1289 // if source isnt confined srcconf = false and loop continues
1290 }
1291 else if(Confine == false)
1292 {
1293 srcconf = true; // terminate loop
1294 }
1295 ++LoopCount;
1296 if(LoopCount == 100000)
1297 {
1299 msg << "LoopCount = 100000\n";
1300 msg << "Either the source distribution >> confinement\n";
1301 msg << "or any confining volume may not overlap with\n";
1302 msg << "the source distribution or any confining volumes\n";
1303 msg << "may not exist\n"<< G4endl;
1304 msg << "If you have set confine then this will be ignored\n";
1305 msg << "for this event.\n" << G4endl;
1306 G4Exception("G4SPSPosDistribution::GenerateOne()",
1307 "G4GPS001", JustWarning, msg);
1308 srcconf = true; // Avoids an infinite loop
1309 }
1310 }
1311 ThreadData.Get().CParticlePos = localP;
1312 return localP;
1313}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
value_type & Get() const
Definition: G4Cache.hh:315

Referenced by G4SingleParticleSource::GeneratePrimaryVertex().

◆ GetCentreCoords()

const G4ThreeVector & G4SPSPosDistribution::GetCentreCoords ( ) const

Definition at line 185 of file G4SPSPosDistribution.cc.

186{
187 return CentreCoords;
188}

Referenced by G4GPSModel::DescribeYourselfTo(), and G4GeneralParticleSource::ListSource().

◆ GetConfined()

G4bool G4SPSPosDistribution::GetConfined ( ) const
inline

Definition at line 151 of file G4SPSPosDistribution.hh.

151{ return Confine; }

◆ GetConfineVolume()

const G4String & G4SPSPosDistribution::GetConfineVolume ( ) const
inline

Definition at line 152 of file G4SPSPosDistribution.hh.

152{ return VolName; }

◆ GetHalfX()

G4double G4SPSPosDistribution::GetHalfX ( ) const

Definition at line 190 of file G4SPSPosDistribution.cc.

191{
192 return halfx;
193}

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetHalfY()

G4double G4SPSPosDistribution::GetHalfY ( ) const

Definition at line 195 of file G4SPSPosDistribution.cc.

196{
197 return halfy;
198}

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetHalfZ()

G4double G4SPSPosDistribution::GetHalfZ ( ) const

Definition at line 200 of file G4SPSPosDistribution.cc.

201{
202 return halfz;
203}

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetParAlpha()

G4double G4SPSPosDistribution::GetParAlpha ( ) const
inline

Definition at line 145 of file G4SPSPosDistribution.hh.

145{ return ParAlpha; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetParPhi()

G4double G4SPSPosDistribution::GetParPhi ( ) const
inline

Definition at line 147 of file G4SPSPosDistribution.hh.

147{ return ParPhi; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetParTheta()

G4double G4SPSPosDistribution::GetParTheta ( ) const
inline

Definition at line 146 of file G4SPSPosDistribution.hh.

146{ return ParTheta; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetParticlePos()

const G4ThreeVector & G4SPSPosDistribution::GetParticlePos ( ) const

Definition at line 226 of file G4SPSPosDistribution.cc.

227{
228 return ThreadData.Get().CParticlePos;
229}

◆ GetPosDisShape()

const G4String & G4SPSPosDistribution::GetPosDisShape ( ) const

Definition at line 180 of file G4SPSPosDistribution.cc.

181{
182 return Shape;
183}

Referenced by G4GPSModel::DescribeYourselfTo(), and G4GeneralParticleSource::ListSource().

◆ GetPosDisType()

const G4String & G4SPSPosDistribution::GetPosDisType ( ) const

Definition at line 175 of file G4SPSPosDistribution.cc.

176{
177 return SourcePosType;
178}

Referenced by G4GPSModel::DescribeYourselfTo(), and G4GeneralParticleSource::ListSource().

◆ GetRadius()

G4double G4SPSPosDistribution::GetRadius ( ) const

Definition at line 205 of file G4SPSPosDistribution.cc.

206{
207 return Radius;
208}

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetRadius0()

G4double G4SPSPosDistribution::GetRadius0 ( ) const
inline

Definition at line 144 of file G4SPSPosDistribution.hh.

144{ return Radius0; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetRotx()

const G4ThreeVector & G4SPSPosDistribution::GetRotx ( ) const
inline

Definition at line 148 of file G4SPSPosDistribution.hh.

148{ return Rotx; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetRoty()

const G4ThreeVector & G4SPSPosDistribution::GetRoty ( ) const
inline

Definition at line 149 of file G4SPSPosDistribution.hh.

149{ return Roty; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetRotz()

const G4ThreeVector & G4SPSPosDistribution::GetRotz ( ) const
inline

Definition at line 150 of file G4SPSPosDistribution.hh.

150{ return Rotz; }

Referenced by G4GPSModel::DescribeYourselfTo().

◆ GetSideRefVec1()

const G4ThreeVector & G4SPSPosDistribution::GetSideRefVec1 ( ) const

Definition at line 231 of file G4SPSPosDistribution.cc.

232{
233 return ThreadData.Get().CSideRefVec1;
234}

◆ GetSideRefVec2()

const G4ThreeVector & G4SPSPosDistribution::GetSideRefVec2 ( ) const

Definition at line 236 of file G4SPSPosDistribution.cc.

237{
238 return ThreadData.Get().CSideRefVec2;
239}

◆ GetSideRefVec3()

const G4ThreeVector & G4SPSPosDistribution::GetSideRefVec3 ( ) const

Definition at line 241 of file G4SPSPosDistribution.cc.

242{
243 return ThreadData.Get().CSideRefVec3;
244}

◆ GetSourcePosType()

const G4String & G4SPSPosDistribution::GetSourcePosType ( ) const

Definition at line 221 of file G4SPSPosDistribution.cc.

222{
223 return SourcePosType;
224}

◆ SetBeamSigmaInR()

void G4SPSPosDistribution::SetBeamSigmaInR ( G4double  r)

Definition at line 144 of file G4SPSPosDistribution.cc.

145{
146 SX = SY = r;
147 SR = r;
148}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBeamSigmaInX()

void G4SPSPosDistribution::SetBeamSigmaInX ( G4double  r)

Definition at line 150 of file G4SPSPosDistribution.cc.

151{
152 SX = r;
153}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBeamSigmaInY()

void G4SPSPosDistribution::SetBeamSigmaInY ( G4double  r)

Definition at line 155 of file G4SPSPosDistribution.cc.

156{
157 SY = r;
158}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetBiasRndm()

void G4SPSPosDistribution::SetBiasRndm ( G4SPSRandomGenerator a)

Definition at line 210 of file G4SPSPosDistribution.cc.

211{
212 G4AutoLock l(&a_mutex);
213 PosRndm = a;
214}

Referenced by G4SingleParticleSource::G4SingleParticleSource().

◆ SetCentreCoords()

void G4SPSPosDistribution::SetCentreCoords ( const G4ThreeVector coordsOfCentre)

◆ SetHalfX()

void G4SPSPosDistribution::SetHalfX ( G4double  xhalf)

Definition at line 119 of file G4SPSPosDistribution.cc.

120{
121 halfx = xhalf;
122}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetHalfY()

void G4SPSPosDistribution::SetHalfY ( G4double  yhalf)

Definition at line 124 of file G4SPSPosDistribution.cc.

125{
126 halfy = yhalf;
127}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetHalfZ()

void G4SPSPosDistribution::SetHalfZ ( G4double  zhalf)

Definition at line 129 of file G4SPSPosDistribution.cc.

130{
131 halfz = zhalf;
132}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParAlpha()

void G4SPSPosDistribution::SetParAlpha ( G4double  paralp)

Definition at line 160 of file G4SPSPosDistribution.cc.

161{
162 ParAlpha = paralp;
163}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParPhi()

void G4SPSPosDistribution::SetParPhi ( G4double  parphi)

Definition at line 170 of file G4SPSPosDistribution.cc.

171{
172 ParPhi = parphi;
173}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetParTheta()

void G4SPSPosDistribution::SetParTheta ( G4double  parthe)

Definition at line 165 of file G4SPSPosDistribution.cc.

166{
167 ParTheta = parthe;
168}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetPosDisShape()

void G4SPSPosDistribution::SetPosDisShape ( const G4String shapeType)

◆ SetPosDisType()

◆ SetPosRot1()

void G4SPSPosDistribution::SetPosRot1 ( const G4ThreeVector posrot1)

Definition at line 95 of file G4SPSPosDistribution.cc.

96{
97 // This should be x'
98
99 Rotx = posrot1;
100 if(verbosityLevel == 2)
101 {
102 G4cout << "Vector x' " << Rotx << G4endl;
103 }
104 GenerateRotationMatrices();
105}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetPosRot2()

void G4SPSPosDistribution::SetPosRot2 ( const G4ThreeVector posrot2)

Definition at line 107 of file G4SPSPosDistribution.cc.

108{
109 // This is a vector in the plane x'y' but need not be y'
110
111 Roty = posrot2;
112 if(verbosityLevel == 2)
113 {
114 G4cout << "The vector in the x'-y' plane " << Roty << G4endl;
115 }
116 GenerateRotationMatrices();
117}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetRadius()

void G4SPSPosDistribution::SetRadius ( G4double  rds)

◆ SetRadius0()

void G4SPSPosDistribution::SetRadius0 ( G4double  rds)

Definition at line 139 of file G4SPSPosDistribution.cc.

140{
141 Radius0 = rds;
142}

Referenced by G4GeneralParticleSourceMessenger::SetNewValue().

◆ SetVerbosity()

void G4SPSPosDistribution::SetVerbosity ( G4int  a)

Definition at line 216 of file G4SPSPosDistribution.cc.

217{
218 verbosityLevel = a;
219}

Referenced by G4SingleParticleSource::SetVerbosity().


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