Geant4 11.1.1
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 ()=default
 
virtual ~G4RayShooter ()=default
 
void Shoot (G4Event *evt, G4ThreeVector vtx, G4ThreeVector direc)
 

Detailed Description

Definition at line 47 of file G4RayShooter.hh.

Constructor & Destructor Documentation

◆ G4RayShooter()

G4RayShooter::G4RayShooter ( )
default

◆ ~G4RayShooter()

virtual G4RayShooter::~G4RayShooter ( )
virtualdefault

Member Function Documentation

◆ Shoot()

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

Definition at line 39 of file G4RayShooter.cc.

40{
41 if(particle_definition == nullptr)
42 {
44 G4String particleName;
45 particle_definition = particleTable->FindParticle(particleName="geantino");
46 if(particle_definition == nullptr)
47 {
48 G4String msg;
49 msg = "G4RayTracer uses geantino to trace the ray, but your physics list does not\n";
50 msg += "define G4Geantino. Please add G4Geantino in your physics list.";
51 G4Exception("G4RayShooter::Shoot()", "RayTracer001", FatalException, msg);
52 }
53 }
54
55 // Create a new vertex
56 //
57 auto* vertex = new G4PrimaryVertex(vtx,particle_time);
58
59 // Create new primaries and set them to the vertex
60 //
61 G4double mass = particle_definition->GetPDGMass();
62 auto* particle = new G4PrimaryParticle(particle_definition);
63 particle->SetKineticEnergy( particle_energy );
64 particle->SetMass( mass );
65 particle->SetMomentumDirection( direc );
66 particle->SetPolarization(particle_polarization.x(),
67 particle_polarization.y(),
68 particle_polarization.z());
69 vertex->SetPrimary( particle );
70
71 evt->AddPrimaryVertex( vertex );
72}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
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()

Referenced by G4TheRayTracer::CreateBitMap().


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