Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SPSPosDistribution Class Reference

#include <G4SPSPosDistribution.hh>

Public Member Functions

 G4SPSPosDistribution ()
 
 ~G4SPSPosDistribution ()
 
void SetPosDisType (G4String)
 
void SetPosDisShape (G4String)
 
void SetCentreCoords (G4ThreeVector)
 
void SetPosRot1 (G4ThreeVector)
 
void SetPosRot2 (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 (G4String)
 
void SetBiasRndm (G4SPSRandomGenerator *a)
 
void SetVerbosity (G4int a)
 
G4ThreeVector GenerateOne ()
 
G4String GetPosDisType () const
 
G4String GetPosDisShape () const
 
G4ThreeVector GetCentreCoords () const
 
G4double GetHalfX () const
 
G4double GetHalfY () const
 
G4double GetHalfZ () const
 
G4double GetRadius () const
 
G4ThreeVector GetSideRefVec1 () const
 
G4ThreeVector GetSideRefVec2 () const
 
G4ThreeVector GetSideRefVec3 () const
 
G4String GetSourcePosType () const
 
G4ThreeVector GetParticlePos () const
 

Detailed Description

Andrea Dotti Feb 2015 Important: This is a shared class between threads. Only one thread should use the set-methods here. Note that this is exactly what is achieved using UI commands. If you use the set methods to set defaults in your application take care that only one thread is executing them. In addition take care of calling these methods before the run is started Do not use these setters during the event loop

Definition at line 156 of file G4SPSPosDistribution.hh.

Constructor & Destructor Documentation

G4SPSPosDistribution::G4SPSPosDistribution ( )

Definition at line 67 of file G4SPSPosDistribution.cc.

67  : PosRndm(0)
68 {
69  SourcePosType = "Point";
70  Shape = "NULL";
71  CentreCoords = G4ThreeVector(0,0,0);
72  Rotx = CLHEP::HepXHat;
73  Roty = CLHEP::HepYHat;
74  Rotz = CLHEP::HepZHat;
75  halfx = 0.;
76  halfy = 0.;
77  halfz = 0.;
78  Radius = 0.;
79  Radius0 = 0.;
80  SR = 0.;
81  SX = 0.;
82  SY = 0.;
83  ParAlpha = 0.;
84  ParTheta = 0.;
85  ParPhi = 0.;
86  Confine = false; //If true confines source distribution to VolName
87  VolName = "NULL";
88  verbosityLevel = 0 ;
89  G4MUTEXINIT(a_mutex);
90 }
DLL_API const Hep3Vector HepZHat
CLHEP::Hep3Vector G4ThreeVector
#define G4MUTEXINIT(mutex)
Definition: G4Threading.hh:177
DLL_API const Hep3Vector HepYHat
DLL_API const Hep3Vector HepXHat
G4SPSPosDistribution::~G4SPSPosDistribution ( )

Definition at line 92 of file G4SPSPosDistribution.cc.

93 {
94  G4MUTEXDESTROY(a_mutex);
95 }
#define G4MUTEXDESTROY(mutex)
Definition: G4Threading.hh:178

Member Function Documentation

void G4SPSPosDistribution::ConfineSourceToVolume ( G4String  Vname)

Definition at line 275 of file G4SPSPosDistribution.cc.

276 {
277  VolName = Vname;
278  if(verbosityLevel == 2)
279  G4cout << VolName << G4endl;
280  G4VPhysicalVolume *tempPV = NULL;
281  G4PhysicalVolumeStore *PVStore = 0;
282  G4String theRequiredVolumeName = VolName;
284  G4int i = 0;
285  G4bool found = false;
286  if(verbosityLevel == 2)
287  G4cout << PVStore->size() << G4endl;
288  while (!found && i<G4int(PVStore->size())) {
289  tempPV = (*PVStore)[i];
290  found = tempPV->GetName() == theRequiredVolumeName;
291  if(verbosityLevel == 2)
292  G4cout << i << " " << " " << tempPV->GetName() << " " << theRequiredVolumeName << " " << found << G4endl;
293  if (!found)
294  {i++;}
295  }
296  // found = true then the volume exists else it doesnt.
297  if(found == true)
298  {
299  if(verbosityLevel >= 1)
300  G4cout << "Volume " << VolName << " exists" << G4endl;
301  Confine = true;
302  }
303  else
304  {
305  G4cout << " **** Error: Volume does not exist **** " << G4endl;
306  G4cout << " Ignoring confine condition" << G4endl;
307  Confine = false;
308  VolName = "NULL";
309  }
310 
311 }
int G4int
Definition: G4Types.hh:78
static G4PhysicalVolumeStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector G4SPSPosDistribution::GenerateOne ( )

Definition at line 1049 of file G4SPSPosDistribution.cc.

1050 {
1051  //
1052  G4ThreeVector localP;
1053  G4bool srcconf = false;
1054  G4int LoopCount = 0;
1055  while(srcconf == false)
1056  {
1057  if(SourcePosType == "Point")
1058  GeneratePointSource(localP);
1059  else if(SourcePosType == "Beam")
1060  GeneratePointsInBeam(localP);
1061  else if(SourcePosType == "Plane")
1062  GeneratePointsInPlane(localP);
1063  else if(SourcePosType == "Surface")
1064  GeneratePointsOnSurface(localP);
1065  else if(SourcePosType == "Volume")
1066  GeneratePointsInVolume(localP);
1067  else
1068  {
1070  msg << "Error: SourcePosType undefined\n";
1071  msg << "Generating point source\n";
1072  G4Exception("G4SPSPosDistribution::GenerateOne()","G4GPS001",JustWarning,msg);
1073  GeneratePointSource(localP);
1074  }
1075  if(Confine == true)
1076  {
1077  srcconf = IsSourceConfined(localP);
1078  // if source in confined srcconf = true terminating the loop
1079  // if source isnt confined srcconf = false and loop continues
1080  }
1081  else if(Confine == false)
1082  srcconf = true; // terminate loop
1083  LoopCount++;
1084  if(LoopCount == 100000)
1085  {
1087  msg << "LoopCount = 100000\n";
1088  msg << "Either the source distribution >> confinement\n";
1089  msg << "or any confining volume may not overlap with\n";
1090  msg << "the source distribution or any confining volumes\n";
1091  msg << "may not exist\n"<< G4endl;
1092  msg << "If you have set confine then this will be ignored\n";
1093  msg << "for this event.\n" << G4endl;
1094  G4Exception("G4SPSPosDistribution::GenerateOne()","G4GPS001",JustWarning,msg);
1095  srcconf = true; //Avoids an infinite loop
1096  }
1097  }
1098  ThreadData.Get().CParticlePos=localP;
1099  return localP;
1100 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
value_type & Get() const
Definition: G4Cache.hh:282
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector G4SPSPosDistribution::GetCentreCoords ( ) const

Definition at line 201 of file G4SPSPosDistribution.cc.

202 {
203  return CentreCoords;
204 }

Here is the caller graph for this function:

G4double G4SPSPosDistribution::GetHalfX ( ) const

Definition at line 206 of file G4SPSPosDistribution.cc.

207 {
208  return halfx;
209 }
G4double G4SPSPosDistribution::GetHalfY ( ) const

Definition at line 211 of file G4SPSPosDistribution.cc.

212 {
213  return halfy;
214 }
G4double G4SPSPosDistribution::GetHalfZ ( ) const

Definition at line 216 of file G4SPSPosDistribution.cc.

217 {
218  return halfz;
219 }
G4ThreeVector G4SPSPosDistribution::GetParticlePos ( ) const

Definition at line 241 of file G4SPSPosDistribution.cc.

241  {
242  return ThreadData.Get().CParticlePos;
243 }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

G4String G4SPSPosDistribution::GetPosDisShape ( ) const

Definition at line 196 of file G4SPSPosDistribution.cc.

197 {
198  return Shape;
199 }

Here is the caller graph for this function:

G4String G4SPSPosDistribution::GetPosDisType ( ) const

Definition at line 191 of file G4SPSPosDistribution.cc.

192 {
193  return SourcePosType;
194 }

Here is the caller graph for this function:

G4double G4SPSPosDistribution::GetRadius ( ) const

Definition at line 221 of file G4SPSPosDistribution.cc.

222 {
223  return Radius;
224 }
G4ThreeVector G4SPSPosDistribution::GetSideRefVec1 ( ) const

Definition at line 245 of file G4SPSPosDistribution.cc.

245  {
246  return ThreadData.Get().CSideRefVec1;
247 }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

G4ThreeVector G4SPSPosDistribution::GetSideRefVec2 ( ) const

Definition at line 249 of file G4SPSPosDistribution.cc.

249  {
250  return ThreadData.Get().CSideRefVec2;
251 }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

G4ThreeVector G4SPSPosDistribution::GetSideRefVec3 ( ) const

Definition at line 253 of file G4SPSPosDistribution.cc.

253  {
254  return ThreadData.Get().CSideRefVec3;
255 }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

G4String G4SPSPosDistribution::GetSourcePosType ( ) const

Definition at line 237 of file G4SPSPosDistribution.cc.

237  {
238  return SourcePosType;
239 }
void G4SPSPosDistribution::SetBeamSigmaInR ( G4double  r)

Definition at line 160 of file G4SPSPosDistribution.cc.

161 {
162  SX = SY = r;
163  SR = r;
164 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetBeamSigmaInX ( G4double  r)

Definition at line 166 of file G4SPSPosDistribution.cc.

167 {
168  SX = r;
169 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetBeamSigmaInY ( G4double  r)

Definition at line 171 of file G4SPSPosDistribution.cc.

172 {
173  SY = r;
174 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetBiasRndm ( G4SPSRandomGenerator a)

Definition at line 226 of file G4SPSPosDistribution.cc.

227 {
228  G4AutoLock l(&a_mutex);
229  PosRndm = a ;
230 }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33

Here is the caller graph for this function:

void G4SPSPosDistribution::SetCentreCoords ( G4ThreeVector  coordsOfCentre)

Definition at line 107 of file G4SPSPosDistribution.cc.

108 {
109  CentreCoords = coordsOfCentre;
110 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetHalfX ( G4double  xhalf)

Definition at line 135 of file G4SPSPosDistribution.cc.

136 {
137  halfx = xhalf;
138 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetHalfY ( G4double  yhalf)

Definition at line 140 of file G4SPSPosDistribution.cc.

141 {
142  halfy = yhalf;
143 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetHalfZ ( G4double  zhalf)

Definition at line 145 of file G4SPSPosDistribution.cc.

146 {
147  halfz = zhalf;
148 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetParAlpha ( G4double  paralp)

Definition at line 176 of file G4SPSPosDistribution.cc.

177 {
178  ParAlpha = paralp;
179 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetParPhi ( G4double  parphi)

Definition at line 186 of file G4SPSPosDistribution.cc.

187 {
188  ParPhi = parphi;
189 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetParTheta ( G4double  parthe)

Definition at line 181 of file G4SPSPosDistribution.cc.

182 {
183  ParTheta = parthe;
184 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetPosDisShape ( G4String  shapeType)

Definition at line 102 of file G4SPSPosDistribution.cc.

103 {
104  Shape = shapeType;
105 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetPosDisType ( G4String  PosType)

Important: This is a shared class between threads. Only one thread should use the set-methods here. Note that this is achieved by UI commands. If you use these methods to set defaults in your application take care that only one thread is executing them. In addition take care of calling these methods before the run is started Do not use these setters during the event loop

Definition at line 97 of file G4SPSPosDistribution.cc.

98 {
99  SourcePosType = PosType;
100 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetPosRot1 ( G4ThreeVector  posrot1)

Definition at line 112 of file G4SPSPosDistribution.cc.

113 {
114  // This should be x'
115  Rotx = posrot1;
116  if(verbosityLevel == 2)
117  {
118  G4cout << "Vector x' " << Rotx << G4endl;
119  }
120  GenerateRotationMatrices();
121 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4SPSPosDistribution::SetPosRot2 ( G4ThreeVector  posrot2)

Definition at line 123 of file G4SPSPosDistribution.cc.

124 {
125  // This is a vector in the plane x'y' but need not
126  // be y'
127  Roty = posrot2;
128  if(verbosityLevel == 2)
129  {
130  G4cout << "The vector in the x'-y' plane " << Roty << G4endl;
131  }
132  GenerateRotationMatrices();
133 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4SPSPosDistribution::SetRadius ( G4double  rds)

Definition at line 150 of file G4SPSPosDistribution.cc.

151 {
152  Radius = rds;
153 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetRadius0 ( G4double  rds)

Definition at line 155 of file G4SPSPosDistribution.cc.

156 {
157  Radius0 = rds;
158 }

Here is the caller graph for this function:

void G4SPSPosDistribution::SetVerbosity ( G4int  a)

Definition at line 232 of file G4SPSPosDistribution.cc.

233 {
234  verbosityLevel = a;
235 }
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33

Here is the caller graph for this function:


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