Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SPSAngDistribution.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4SPSAngDistribution class implementation
27//
28// Author: Fan Lei, QinetiQ ltd. - 05/02/2004
29// Customer: ESA/ESTEC
30// Revisions: Andrea Dotti, SLAC
31// --------------------------------------------------------------------
32
34
35#include "Randomize.hh"
37
39 : Theta(0.), Phi(0.)
40{
41 // Angular distribution Variables
42 G4ThreeVector zero;
43 particle_momentum_direction = G4ParticleMomentum(0,0,-1);
44
45 AngDistType = "planar";
46 AngRef1 = CLHEP::HepXHat;
47 AngRef2 = CLHEP::HepYHat;
48 AngRef3 = CLHEP::HepZHat;
49 MinTheta = 0.;
50 MaxTheta = pi;
51 MinPhi = 0.;
52 MaxPhi = twopi;
53 DR = 0.;
54 DX = 0.;
55 DY = 0.;
56 FocusPoint = G4ThreeVector(0., 0., 0.);
57 UserDistType = "NULL";
58 UserWRTSurface = true;
59 UserAngRef = false;
60 IPDFThetaExist = false;
61 IPDFPhiExist = false;
62 verbosityLevel = 0;
63
65}
66
68{
70}
71
73{
74 G4AutoLock l(&mutex);
75 if(atype != "iso" && atype != "cos" && atype != "user" && atype != "planar"
76 && atype != "beam1d" && atype != "beam2d" && atype != "focused")
77 {
78 G4cout << "Error, distribution must be iso, cos, planar, beam1d, beam2d, focused or user"
79 << G4endl;
80 }
81 else
82 {
83 AngDistType = atype;
84 }
85 if (AngDistType == "cos") { MaxTheta = pi/2.; }
86 if (AngDistType == "user")
87 {
88 UDefThetaH = IPDFThetaH = ZeroPhysVector;
89 IPDFThetaExist = false;
90 UDefPhiH = IPDFPhiH = ZeroPhysVector;
91 IPDFPhiExist = false;
92 }
93}
94
96 const G4ThreeVector& ref)
97{
98 G4AutoLock l(&mutex);
99 if (refname == "angref1")
100 AngRef1 = ref.unit(); // x'
101 else if (refname == "angref2")
102 AngRef2 = ref.unit(); // vector in x'y' plane
103
104 // User defines x' (AngRef1) and a vector in the x'y'
105 // plane (AngRef2). Then, AngRef1 x AngRef2 = AngRef3
106 // the z' vector. Then, AngRef3 x AngRef1 = AngRef2
107 // which will now be y'.
108
109 AngRef3 = AngRef1.cross(AngRef2); // z'
110 AngRef2 = AngRef3.cross(AngRef1); // y'
111 UserAngRef = true ;
112 if(verbosityLevel == 2)
113 {
114 G4cout << "Angular distribution rotation axes " << AngRef1
115 << " " << AngRef2 << " " << AngRef3 << G4endl;
116 }
117}
118
120{
121 G4AutoLock l(&mutex);
122 MinTheta = mint;
123}
124
126{
127 G4AutoLock l(&mutex);
128 MinPhi = minp;
129}
130
132{
133 G4AutoLock l(&mutex);
134 MaxTheta = maxt;
135}
136
138{
139 G4AutoLock l(&mutex);
140 MaxPhi = maxp;
141}
142
144{
145 G4AutoLock l(&mutex);
146 DR = r;
147}
148
150{
151 G4AutoLock l(&mutex);
152 DX = r;
153}
154
156{
157 G4AutoLock l(&mutex);
158 DY = r;
159}
160
162SetParticleMomentumDirection(const G4ParticleMomentum& aMomentumDirection)
163{
164 G4AutoLock l(&mutex);
165 particle_momentum_direction = aMomentumDirection.unit();
166}
167
169{
170 G4AutoLock l(&mutex);
171 posDist = a;
172}
173
175{
176 G4AutoLock l(&mutex);
177 angRndm = a;
178}
179
181{
182 G4AutoLock l(&mutex);
183 verbosityLevel = a;
184}
185
187{
188 G4AutoLock l(&mutex);
189 if(UserDistType == "NULL") UserDistType = "theta";
190 if(UserDistType == "phi") UserDistType = "both";
191 G4double thi, val;
192 thi = input.x();
193 val = input.y();
194 if(verbosityLevel >= 1) G4cout << "In UserDefAngTheta" << G4endl;
195 UDefThetaH.InsertValues(thi, val);
196}
197
199{
200 G4AutoLock l(&mutex);
201 return AngDistType;
202}
203
205{
206 G4AutoLock l(&mutex);
207 return MinTheta;
208}
209
211{
212 G4AutoLock l(&mutex);
213 return MaxTheta;
214}
215
217{
218 G4AutoLock l(&mutex);
219 return MinPhi;
220}
221
223{
224 G4AutoLock l(&mutex);
225 return MaxPhi;
226}
227
229{
230 G4AutoLock l(&mutex);
231 return particle_momentum_direction;
232}
233
235{
236 G4AutoLock l(&mutex);
237 if(UserDistType == "NULL") UserDistType = "phi";
238 if(UserDistType == "theta") UserDistType = "both";
239 G4double phhi, val;
240 phhi = input.x();
241 val = input.y();
242 if(verbosityLevel >= 1) G4cout << "In UserDefAngPhi" << G4endl;
243 UDefPhiH.InsertValues(phhi, val);
244}
245
247{
248 G4AutoLock l(&mutex);
249 FocusPoint = input;
250}
251
253{
254 G4AutoLock l(&mutex);
255
256 // if UserWRTSurface = true then the user wants momenta with respect
257 // to the surface normals.
258 // When doing this theta has to be 0-90 only otherwise there will be
259 // errors, which currently are flagged anywhere.
260 //
261 UserWRTSurface = wrtSurf;
262}
263
265{
266 G4AutoLock l(&mutex);
267
268 // if UserAngRef = true the angular distribution is defined wrt
269 // the user defined coordinates
270 //
271 UserAngRef = userang;
272}
273
274void G4SPSAngDistribution::GenerateBeamFlux(G4ParticleMomentum& mom)
275{
276 G4double theta, phi;
277 G4double px, py, pz;
278 if (AngDistType == "beam1d")
279 {
280 theta = G4RandGauss::shoot(0.0,DR);
281 phi = twopi * G4UniformRand();
282 }
283 else
284 {
285 px = G4RandGauss::shoot(0.0,DX);
286 py = G4RandGauss::shoot(0.0,DY);
287 theta = std::sqrt (px*px + py*py);
288 if (theta != 0.)
289 {
290 phi = std::acos(px/theta);
291 if ( py < 0.) phi = -phi;
292 }
293 else
294 {
295 phi = 0.0;
296 }
297 }
298 px = -std::sin(theta) * std::cos(phi);
299 py = -std::sin(theta) * std::sin(phi);
300 pz = -std::cos(theta);
301 G4double finx, finy, finz;
302 finx=px, finy=py, finz=pz;
303 if (UserAngRef)
304 {
305 // Apply Angular Rotation Matrix
306 // x * AngRef1, y * AngRef2 and z * AngRef3
307 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
308 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
309 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
310 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
311 finx = finx/ResMag;
312 finy = finy/ResMag;
313 finz = finz/ResMag;
314 }
315 mom.setX(finx);
316 mom.setY(finy);
317 mom.setZ(finz);
318
319 // particle_momentum_direction now holds unit momentum vector
320
321 if(verbosityLevel >= 1)
322 {
323 G4cout << "Generating beam vector: " << mom << G4endl;
324 }
325}
326
327void G4SPSAngDistribution::GenerateFocusedFlux(G4ParticleMomentum& mom)
328{
329 mom = (FocusPoint - posDist->GetParticlePos()).unit();
330
331 // particle_momentum_direction now holds unit momentum vector.
332
333 if(verbosityLevel >= 1)
334 {
335 G4cout << "Generating focused vector: " << mom << G4endl;
336 }
337}
338
339void G4SPSAngDistribution::GenerateIsotropicFlux(G4ParticleMomentum& mom)
340{
341 // generates isotropic flux.
342 // No vectors are needed.
343
344 G4double rndm, rndm2;
345 G4double px, py, pz;
346
347 G4double sintheta, sinphi,costheta,cosphi;
348 rndm = angRndm->GenRandTheta();
349 costheta = std::cos(MinTheta) - rndm * (std::cos(MinTheta)
350 - std::cos(MaxTheta));
351 sintheta = std::sqrt(1. - costheta*costheta);
352
353 rndm2 = angRndm->GenRandPhi();
354 Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
355 sinphi = std::sin(Phi);
356 cosphi = std::cos(Phi);
357
358 px = -sintheta * cosphi;
359 py = -sintheta * sinphi;
360 pz = -costheta;
361
362 // For volume and point source use mother or user defined coordinates
363 // for plane and surface source user surface-normal or user-defined
364 // coordinates
365 //
366 G4double finx, finy, finz;
367 if (posDist->GetSourcePosType() == "Point"
368 || posDist->GetSourcePosType() == "Volume")
369 {
370 if (UserAngRef)
371 {
372 // Apply Rotation Matrix
373 // x * AngRef1, y * AngRef2 and z * AngRef3
374 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
375 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
376 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
377 }
378 else
379 {
380 finx = px;
381 finy = py;
382 finz = pz;
383 }
384 }
385 else
386 { // for plane and surface source
387 if (UserAngRef)
388 {
389 // Apply Rotation Matrix
390 // x * AngRef1, y * AngRef2 and z * AngRef3
391 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
392 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
393 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
394 }
395 else
396 {
397 finx = (px*posDist->GetSideRefVec1().x())
398 + (py*posDist->GetSideRefVec2().x())
399 + (pz*posDist->GetSideRefVec3().x());
400 finy = (px*posDist->GetSideRefVec1().y())
401 + (py*posDist->GetSideRefVec2().y())
402 + (pz*posDist->GetSideRefVec3().y());
403 finz = (px*posDist->GetSideRefVec1().z())
404 + (py*posDist->GetSideRefVec2().z())
405 + (pz*posDist->GetSideRefVec3().z());
406 }
407 }
408 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
409 finx = finx/ResMag;
410 finy = finy/ResMag;
411 finz = finz/ResMag;
412
413 mom.setX(finx);
414 mom.setY(finy);
415 mom.setZ(finz);
416
417 // particle_momentum_direction now holds unit momentum vector.
418
419 if(verbosityLevel >= 1)
420 {
421 G4cout << "Generating isotropic vector: " << mom << G4endl;
422 }
423}
424
425void G4SPSAngDistribution::GenerateCosineLawFlux(G4ParticleMomentum& mom)
426{
427 // Method to generate flux distributed with a cosine law
428
429 G4double px, py, pz;
430 G4double rndm, rndm2;
431
432 G4double sintheta, sinphi,costheta,cosphi;
433 rndm = angRndm->GenRandTheta();
434 sintheta = std::sqrt( rndm * (std::sin(MaxTheta)*std::sin(MaxTheta)
435 - std::sin(MinTheta)*std::sin(MinTheta) )
436 + std::sin(MinTheta)*std::sin(MinTheta) );
437 costheta = std::sqrt(1. -sintheta*sintheta);
438
439 rndm2 = angRndm->GenRandPhi();
440 Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
441 sinphi = std::sin(Phi);
442 cosphi = std::cos(Phi);
443
444 px = -sintheta * cosphi;
445 py = -sintheta * sinphi;
446 pz = -costheta;
447
448 // for volume and point source use mother or user defined coordinates
449 // for plane and surface source user surface-normal or userdefined
450 // coordinates
451 //
452 G4double finx, finy, finz;
453 if (posDist->GetSourcePosType() == "Point"
454 || posDist->GetSourcePosType() == "Volume")
455 {
456 if (UserAngRef)
457 {
458 // Apply Rotation Matrix
459 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
460 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
461 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
462 }
463 else
464 {
465 finx = px;
466 finy = py;
467 finz = pz;
468 }
469 }
470 else
471 { // for plane and surface source
472 if (UserAngRef)
473 {
474 // Apply Rotation Matrix
475 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
476 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
477 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
478 }
479 else
480 {
481 finx = (px*posDist->GetSideRefVec1().x())
482 + (py*posDist->GetSideRefVec2().x())
483 + (pz*posDist->GetSideRefVec3().x());
484 finy = (px*posDist->GetSideRefVec1().y())
485 + (py*posDist->GetSideRefVec2().y())
486 + (pz*posDist->GetSideRefVec3().y());
487 finz = (px*posDist->GetSideRefVec1().z())
488 + (py*posDist->GetSideRefVec2().z())
489 + (pz*posDist->GetSideRefVec3().z());
490 }
491 }
492 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
493 finx = finx/ResMag;
494 finy = finy/ResMag;
495 finz = finz/ResMag;
496
497 mom.setX(finx);
498 mom.setY(finy);
499 mom.setZ(finz);
500
501 // particle_momentum_direction now contains unit momentum vector.
502
503 if(verbosityLevel >= 1)
504 {
505 G4cout << "Resultant cosine-law unit momentum vector " << mom << G4endl;
506 }
507}
508
509void G4SPSAngDistribution::GeneratePlanarFlux(G4ParticleMomentum& mom)
510{
511 // particle_momentum_direction now contains unit momentum vector.
512 // nothing need be done here as the m-directions have been set directly
513 // under this option
514
515 if(verbosityLevel >= 1)
516 {
517 G4cout << "Resultant Planar wave momentum vector " << mom << G4endl;
518 }
519}
520
521void G4SPSAngDistribution::GenerateUserDefFlux(G4ParticleMomentum& mom)
522{
523 G4double rndm, px, py, pz, pmag;
524
525 if(UserDistType == "NULL")
526 {
527 G4cout << "Error: UserDistType undefined" << G4endl;
528 }
529 else if(UserDistType == "theta")
530 {
531 Theta = 10.;
532 while(Theta > MaxTheta || Theta < MinTheta)
533 {
534 Theta = GenerateUserDefTheta();
535 }
536 Phi = 10.;
537 while(Phi > MaxPhi || Phi < MinPhi)
538 {
539 rndm = angRndm->GenRandPhi();
540 Phi = twopi * rndm;
541 }
542 }
543 else if(UserDistType == "phi")
544 {
545 Theta = 10.;
546 while(Theta > MaxTheta || Theta < MinTheta)
547 {
548 rndm = angRndm->GenRandTheta();
549 Theta = std::acos(1. - (2. * rndm));
550 }
551 Phi = 10.;
552 while(Phi > MaxPhi || Phi < MinPhi)
553 {
554 Phi = GenerateUserDefPhi();
555 }
556 }
557 else if(UserDistType == "both")
558 {
559 Theta = 10.;
560 while(Theta > MaxTheta || Theta < MinTheta)
561 {
562 Theta = GenerateUserDefTheta();
563 }
564 Phi = 10.;
565 while(Phi > MaxPhi || Phi < MinPhi)
566 {
567 Phi = GenerateUserDefPhi();
568 }
569 }
570 px = -std::sin(Theta) * std::cos(Phi);
571 py = -std::sin(Theta) * std::sin(Phi);
572 pz = -std::cos(Theta);
573
574 pmag = std::sqrt((px*px) + (py*py) + (pz*pz));
575
576 if(!UserWRTSurface)
577 {
578 G4double finx, finy, finz;
579 if (UserAngRef)
580 {
581 // Apply Rotation Matrix
582 // x * AngRef1, y * AngRef2 and z * AngRef3
583 finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
584 finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
585 finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
586 }
587 else // use mother coordinates
588 {
589 finx = px;
590 finy = py;
591 finz = pz;
592 }
593 G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
594 finx = finx/ResMag;
595 finy = finy/ResMag;
596 finz = finz/ResMag;
597
598 mom.setX(finx);
599 mom.setY(finy);
600 mom.setZ(finz);
601 }
602 else // UserWRTSurface = true
603 {
604 G4double pxh = px/pmag;
605 G4double pyh = py/pmag;
606 G4double pzh = pz/pmag;
607 if(verbosityLevel > 1)
608 {
609 G4cout << "SideRefVecs " << posDist->GetSideRefVec1()
610 << posDist->GetSideRefVec2() << posDist->GetSideRefVec3()
611 << G4endl;
612 G4cout << "Raw Unit vector " << pxh
613 << "," << pyh << "," << pzh << G4endl;
614 }
615 G4double resultx = (pxh*posDist->GetSideRefVec1().x())
616 + (pyh*posDist->GetSideRefVec2().x())
617 + (pzh*posDist->GetSideRefVec3().x());
618
619 G4double resulty = (pxh*posDist->GetSideRefVec1().y())
620 + (pyh*posDist->GetSideRefVec2().y())
621 + (pzh*posDist->GetSideRefVec3().y());
622
623 G4double resultz = (pxh*posDist->GetSideRefVec1().z())
624 + (pyh*posDist->GetSideRefVec2().z())
625 + (pzh*posDist->GetSideRefVec3().z());
626
627 G4double ResMag = std::sqrt((resultx*resultx)
628 + (resulty*resulty)
629 + (resultz*resultz));
630 resultx = resultx/ResMag;
631 resulty = resulty/ResMag;
632 resultz = resultz/ResMag;
633
634 mom.setX(resultx);
635 mom.setY(resulty);
636 mom.setZ(resultz);
637 }
638
639 // particle_momentum_direction now contains unit momentum vector.
640
641 if(verbosityLevel > 0 )
642 {
643 G4cout << "Final User Defined momentum vector "
644 << particle_momentum_direction << G4endl;
645 }
646}
647
648G4double G4SPSAngDistribution::GenerateUserDefTheta()
649{
650 // Create cumulative histogram if not already done so.
651 // Then use RandFlat::shoot to generate the output Theta value.
652
653 if(UserDistType == "NULL" || UserDistType == "phi")
654 {
655 // No user defined theta distribution
656 G4cout << "Error ***********************" << G4endl;
657 G4cout << "UserDistType = " << UserDistType << G4endl;
658 return (0.);
659 }
660 else
661 {
662 // UserDistType = theta or both and so a theta distribution
663 // is defined. This should be integrated if not already done.
664 G4AutoLock l(&mutex);
665 if(IPDFThetaExist == false)
666 {
667 // IPDF has not been created, so create it
668 //
669 G4double bins[1024],vals[1024], sum;
670 G4int ii;
671 G4int maxbin = G4int(UDefThetaH.GetVectorLength());
672 bins[0] = UDefThetaH.GetLowEdgeEnergy(std::size_t(0));
673 vals[0] = UDefThetaH(std::size_t(0));
674 sum = vals[0];
675 for(ii=1; ii<maxbin; ++ii)
676 {
677 bins[ii] = UDefThetaH.GetLowEdgeEnergy(std::size_t(ii));
678 vals[ii] = UDefThetaH(std::size_t(ii)) + vals[ii-1];
679 sum = sum + UDefThetaH(std::size_t(ii));
680 }
681 for(ii=0; ii<maxbin; ++ii)
682 {
683 vals[ii] = vals[ii]/sum;
684 IPDFThetaH.InsertValues(bins[ii], vals[ii]);
685 }
686 IPDFThetaExist = true;
687 }
688 l.unlock();
689
690 // IPDF has been created so carry on
691 //
692 G4double rndm = G4UniformRand();
693 return(IPDFThetaH.GetEnergy(rndm));
694 }
695}
696
697G4double G4SPSAngDistribution::GenerateUserDefPhi()
698{
699 // Create cumulative histogram if not already done so.
700 // Then use RandFlat::shoot to generate the output Theta value.
701
702 if(UserDistType == "NULL" || UserDistType == "theta")
703 {
704 // No user defined phi distribution
705 G4cout << "Error ***********************" << G4endl;
706 G4cout << "UserDistType = " << UserDistType << G4endl;
707 return(0.);
708 }
709 else
710 {
711 // UserDistType = phi or both and so a phi distribution
712 // is defined. This should be integrated if not already done.
713 G4AutoLock l(&mutex);
714 if(IPDFPhiExist == false)
715 {
716 // IPDF has not been created, so create it
717 //
718 G4double bins[1024],vals[1024], sum;
719 G4int ii;
720 G4int maxbin = G4int(UDefPhiH.GetVectorLength());
721 bins[0] = UDefPhiH.GetLowEdgeEnergy(std::size_t(0));
722 vals[0] = UDefPhiH(std::size_t(0));
723 sum = vals[0];
724 for(ii=1; ii<maxbin; ++ii)
725 {
726 bins[ii] = UDefPhiH.GetLowEdgeEnergy(std::size_t(ii));
727 vals[ii] = UDefPhiH(std::size_t(ii)) + vals[ii-1];
728 sum = sum + UDefPhiH(std::size_t(ii));
729 }
730 for(ii=0; ii<maxbin; ++ii)
731 {
732 vals[ii] = vals[ii]/sum;
733 IPDFPhiH.InsertValues(bins[ii], vals[ii]);
734 }
735 IPDFPhiExist = true;
736 }
737 l.unlock();
738
739 // IPDF has been create so carry on
740 //
741 G4double rndm = G4UniformRand();
742
743 return(IPDFPhiH.GetEnergy(rndm));
744 }
745}
746
748{
749 G4AutoLock l(&mutex);
750 if (atype == "theta")
751 {
752 UDefThetaH = IPDFThetaH = ZeroPhysVector ;
753 IPDFThetaExist = false ;
754 }
755 else if (atype == "phi")
756 {
757 UDefPhiH = IPDFPhiH = ZeroPhysVector ;
758 IPDFPhiExist = false ;
759 }
760 else
761 {
762 G4cout << "Error, histtype not accepted " << G4endl;
763 }
764}
765
767{
768 // Local copy for thread safety
769 //
770 G4ParticleMomentum localM = particle_momentum_direction;
771
772 // Angular stuff
773 //
774 if(AngDistType == "iso")
775 GenerateIsotropicFlux(localM);
776 else if(AngDistType == "cos")
777 GenerateCosineLawFlux(localM);
778 else if(AngDistType == "planar")
779 GeneratePlanarFlux(localM);
780 else if(AngDistType == "beam1d" || AngDistType == "beam2d" )
781 GenerateBeamFlux(localM);
782 else if(AngDistType == "user")
783 GenerateUserDefFlux(localM);
784 else if(AngDistType == "focused")
785 GenerateFocusedFlux(localM);
786 else
787 G4cout << "Error: AngDistType has unusual value" << G4endl;
788 return localM;
789}
G4ThreeVector G4ParticleMomentum
#define G4MUTEXDESTROY(mutex)
Definition: G4Threading.hh:90
#define G4MUTEXINIT(mutex)
Definition: G4Threading.hh:87
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
double z() const
Hep3Vector unit() const
double x() const
void setY(double)
double y() const
Hep3Vector cross(const Hep3Vector &) const
void setZ(double)
void setX(double)
void InsertValues(G4double energy, G4double value)
G4double GetEnergy(G4double aValue)
G4double GetLowEdgeEnergy(std::size_t binNumber) const
std::size_t GetVectorLength() const
void SetBeamSigmaInAngX(G4double)
void SetBeamSigmaInAngR(G4double)
void SetPosDistribution(G4SPSPosDistribution *a)
void UserDefAngTheta(const G4ThreeVector &)
void SetFocusPoint(const G4ThreeVector &)
void SetAngDistType(const G4String &)
void UserDefAngPhi(const G4ThreeVector &)
G4ParticleMomentum GenerateOne()
void SetParticleMomentumDirection(const G4ParticleMomentum &aMomDirection)
void SetBeamSigmaInAngY(G4double)
void ReSetHist(const G4String &)
void SetBiasRndm(G4SPSRandomGenerator *a)
void DefineAngRefAxes(const G4String &, const G4ThreeVector &)
const G4ThreeVector & GetParticlePos() const
const G4String & GetSourcePosType() const
const G4ThreeVector & GetSideRefVec2() const
const G4ThreeVector & GetSideRefVec3() const
const G4ThreeVector & GetSideRefVec1() const
DLL_API const Hep3Vector HepZHat
Definition: ThreeVector.h:419
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat
Definition: ThreeVector.h:419