15 #include <CLHEP/Random/RandGaussQ.h> 16 #include <CLHEP/Units/SystemOfUnits.h> 17 #include "G4ParticleDefinition.hh" 18 #include "G4ParticleGun.hh" 22 G4int nPhotonsGun = 1;
23 G4int nPhotonsBeam = 1;
24 G4double
Energy = 1.15 * CLHEP::eV;
30 : thenParticleInGun(0), thenParticle(0), thePhotonEnergy(0) {
51 G4ParticleTable *theParticleTable = G4ParticleTable::GetParticleTable();
52 G4ParticleDefinition *theOpticalPhoton = theParticleTable->FindParticle(
"opticalphoton");
56 theParticleGun->SetParticlePosition(G4ThreeVector(-500.0 * CLHEP::cm, 0.0 * CLHEP::cm, 0.0 * CLHEP::cm));
57 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(5.0, 3.0, 0.0));
86 const G4int nLaserRings = 2;
87 const G4int nLaserBeams = 8;
92 G4double LaserPositionZ = 2057.5 * mm;
95 G4double LaserRingRadius[nLaserRings] = {564.0 * mm, 840.0 * mm};
98 G4double LaserPhi0 = 0.392699082;
101 G4double LaserRingSigmaX[nLaserRings] = {0.5 * mm, 0.5 * mm};
102 G4double LaserRingSigmaY[nLaserRings] = {0.5 * mm, 0.5 * mm};
105 G4ParticleTable *theParticleTable = G4ParticleTable::GetParticleTable();
106 G4ParticleDefinition *theOpticalPhoton = theParticleTable->FindParticle(
"opticalphoton");
109 for (
int theRing = 0; theRing < nLaserRings; theRing++) {
111 for (
int theBeam = 0; theBeam < nLaserBeams; theBeam++) {
114 G4double LaserPositionPhi = LaserPhi0 + G4double(theBeam * G4double(G4double(2 *
M_PI) / nLaserBeams));
117 G4double LaserPositionX =
cos(LaserPositionPhi) * LaserRingRadius[theRing];
118 G4double LaserPositionY =
sin(LaserPositionPhi) * LaserRingRadius[theRing];
121 for (
int theParticle = 0; theParticle <
thenParticle; theParticle++) {
123 CLHEP::RandGaussQ aGaussObjX(*
theDRand48Engine, LaserPositionX, LaserRingSigmaX[theRing]);
124 CLHEP::RandGaussQ aGaussObjY(*
theDRand48Engine, LaserPositionY, LaserRingSigmaY[theRing]);
126 G4double theXPosition = aGaussObjX.fire();
127 G4double theYPosition = aGaussObjY.fire();
128 G4double theZPosition = LaserPositionZ;
133 theParticleGun->SetParticlePosition(G4ThreeVector(theXPosition, theYPosition, theZPosition));
137 for (
int theDirection = 0; theDirection < 2; theDirection++) {
139 if (theDirection == 0)
141 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, 1.0));
148 if (theDirection == 1)
150 theParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.0, 0.0, -1.0));
169 if (
theParticleGun->GetParticleDefinition()->GetParticleName() !=
"opticalphoton") {
171 <<
"<LaserBeamsTEC1::SetOptPhotonPolar()>: WARNING! The ParticleGun is " 172 "not an optical photon";
178 G4ThreeVector
normal(1.0, 0.0, 0.0);
179 G4ThreeVector kphoton =
theParticleGun->GetParticleMomentumDirection();
180 G4ThreeVector product =
normal.cross(kphoton);
181 G4double modul2 = product * product;
183 G4ThreeVector e_perpendicular(0.0, 0.0, 1.0);
186 e_perpendicular = (1.0 /
sqrt(modul2)) * product;
189 G4ThreeVector e_parallel = e_perpendicular.cross(kphoton);
191 G4ThreeVector polar =
cos(Angle) * e_parallel +
sin(Angle) * e_perpendicular;
static const char * normal
Sin< T >::type sin(const T &t)
void GeneratePrimaries(G4Event *myEvent) override
shoot optical photons into the detector at the beginning of an event
virtual std::uint32_t mySeed() const =0
Cos< T >::type cos(const T &t)
LaserBeamsTEC1()
default constructor
CLHEP::DRand48Engine * theDRand48Engine
~LaserBeamsTEC1() override
destructor
Log< level::Warning, false > LogWarning
void setOptPhotonPolar(G4double Angle)
set the polarisation of the photons
G4ParticleGun * theParticleGun