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

#include <G4RayShooter.hh>

Public Member Functions

 G4RayShooter ()
 
virtual ~G4RayShooter ()
 
void Shoot (G4Event *evt, G4ThreeVector vtx, G4ThreeVector direc)
 

Detailed Description

Definition at line 47 of file G4RayShooter.hh.

Constructor & Destructor Documentation

◆ G4RayShooter()

G4RayShooter::G4RayShooter ( )

Definition at line 39 of file G4RayShooter.cc.

40{
41 SetInitialValues();
42}

◆ ~G4RayShooter()

G4RayShooter::~G4RayShooter ( )
virtual

Definition at line 53 of file G4RayShooter.cc.

54{
55}

Member Function Documentation

◆ Shoot()

void G4RayShooter::Shoot ( G4Event evt,
G4ThreeVector  vtx,
G4ThreeVector  direc 
)

Definition at line 57 of file G4RayShooter.cc.

58{
59 if(particle_definition == nullptr)
60 {
62 G4String particleName;
63 particle_definition = particleTable->FindParticle(particleName="geantino");
64 if(particle_definition == nullptr)
65 {
66 G4String msg;
67 msg = "G4RayTracer uses geantino to trace the ray, but your physics list does not\n";
68 msg += "define G4Geantino. Please add G4Geantino in your physics list.";
69 G4Exception("G4RayShooter::Shoot()", "RayTracer001", FatalException, msg);
70 }
71 }
72
73 // Create a new vertex
74 //
75 G4PrimaryVertex* vertex = new G4PrimaryVertex(vtx,particle_time);
76
77 // Create new primaries and set them to the vertex
78 //
79 G4double mass = particle_definition->GetPDGMass();
80 G4PrimaryParticle* particle = new G4PrimaryParticle(particle_definition);
81 particle->SetKineticEnergy( particle_energy );
82 particle->SetMass( mass );
83 particle->SetMomentumDirection( direc );
84 particle->SetPolarization(particle_polarization.x(),
85 particle_polarization.y(),
86 particle_polarization.z());
87 vertex->SetPrimary( particle );
88
89 evt->AddPrimaryVertex( vertex );
90}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83
double z() const
double x() const
double y() const
void AddPrimaryVertex(G4PrimaryVertex *aPrimaryVertex)
Definition: G4Event.hh:121
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void SetPolarization(const G4ThreeVector &pol)
void SetKineticEnergy(G4double eKin)
void SetMomentumDirection(const G4ThreeVector &p)
void SetMass(G4double mas)
void SetPrimary(G4PrimaryParticle *pp)

Referenced by G4TheRayTracer::CreateBitMap().


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