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 49 of file G4RayShooter.hh.


Constructor & Destructor Documentation

G4RayShooter::G4RayShooter (  ) 

Definition at line 39 of file G4RayShooter.cc.

00040 {
00041   SetInitialValues();
00042 }

G4RayShooter::~G4RayShooter (  )  [virtual]

Definition at line 55 of file G4RayShooter.cc.

00056 {
00057 }


Member Function Documentation

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

Definition at line 59 of file G4RayShooter.cc.

References G4Event::AddPrimaryVertex(), FatalException, G4ParticleTable::FindParticle(), G4Exception(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGMass(), G4PrimaryParticle::SetKineticEnergy(), G4PrimaryParticle::SetMass(), G4PrimaryParticle::SetMomentumDirection(), G4PrimaryParticle::SetPolarization(), and G4PrimaryVertex::SetPrimary().

Referenced by G4TheRayTracer::CreateBitMap().

00060 {
00061   if(!particle_definition)
00062   {
00063     G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00064     G4String particleName;
00065     particle_definition = particleTable->FindParticle(particleName="geantino");
00066     if(!particle_definition)
00067     {
00068       G4String msg;
00069       msg =  " G4RayTracer uses geantino to trace the ray, but your physics list does not\n";
00070       msg += "define G4Geantino. Please add G4Geantino in your physics list.";
00071       G4Exception("G4RayShooter::Shoot","RayTracer001",FatalException,msg);
00072     }
00073   }
00074 
00075   // create a new vertex
00076   G4PrimaryVertex* vertex = new G4PrimaryVertex(vtx,particle_time);
00077 
00078   // create new primaries and set them to the vertex
00079   G4double mass = particle_definition->GetPDGMass();
00080   G4PrimaryParticle* particle =
00081     new G4PrimaryParticle(particle_definition);
00082   particle->SetKineticEnergy( particle_energy );
00083   particle->SetMass( mass );
00084   particle->SetMomentumDirection( direc );
00085   particle->SetPolarization(particle_polarization.x(),
00086                             particle_polarization.y(),
00087                             particle_polarization.z());
00088   vertex->SetPrimary( particle );
00089 
00090   evt->AddPrimaryVertex( vertex );
00091 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:15 2013 for Geant4 by  doxygen 1.4.7