Files
geant4/source/event/include/G4SingleParticleSource.hh
T
2016-06-09 10:56:29 +02:00

185 lines
6.8 KiB
C++

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SingleParticleSource.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// The Single Particle Source is designed to extend the functionality of the
// G4ParticleGun class. It is designed to allow specification of input
// particles in terms of position, direction (or angular) and energy
// distributions. It is used by the General Particle source class
// and it is derived from G4VPrimaryGenerator.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SingleParticleSource ()
// Constructor: Initializes variables and instantiates the
// Messenger and Navigator classes
//
// ~G4SingleParticleSource ()
// Destructor: deletes Messenger and prints out run information.
//
// void GeneratePrimaryVertex(G4Event *evt)
// Generate the particles initial parameters.
//
// G4SPSPosDistribution* GetPosDist()
// Return a pointer to the position distribution generator
//
// G4SPSAngDistribution* GetAngDist()
// Return a pointer to the angular distribution generator
//
// G4SPSEneDistribution* GetEneDist()
// Return a pointer to the energy distribution generator
//
// G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Return a pointer to the biased random number generator
//
// void SetVerbosity(G4int);
// Set the verbosity level.
//
// void SetParticleDefinition ();
// G4ParticleDefinition * GetParticleDefinition ()
// Get/Set the particle definition of the primary track
//
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// Set/Get the polarization state of the primary track
//
// inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
// inline G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SingleParticleSource_h
#define G4SingleParticleSource_h 1
#include "G4VPrimaryGenerator.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
//
#include "G4SPSPosDistribution.hh"
#include "G4SPSAngDistribution.hh"
#include "G4SPSEneDistribution.hh"
#include "G4SPSRandomGenerator.hh"
class G4SingleParticleSource : public G4VPrimaryGenerator
{
public:
G4SingleParticleSource ();
~G4SingleParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
//
G4SPSPosDistribution* GetPosDist() {return posGenerator;};
G4SPSAngDistribution* GetAngDist() {return angGenerator;};
G4SPSEneDistribution* GetEneDist() {return eneGenerator;};
G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Set the verbosity level.
void SetVerbosity(G4int);
// Set the particle species
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition);
inline G4ParticleDefinition * GetParticleDefinition () { return particle_definition;} ;
inline void SetParticleCharge(G4double aCharge) { particle_charge = aCharge; } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal) {particle_polarization = aVal;};
inline G4ThreeVector GetParticlePolarization () {return particle_polarization;};
// Set Time.
inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
inline G4double GetParticleTime() { return particle_time; };
inline void SetNumberOfParticles(G4int i) { NumberOfParticlesToBeGenerated = i; };
//
inline G4int GetNumberOfParticles() { return NumberOfParticlesToBeGenerated; };
inline G4ThreeVector GetParticlePosition() { return particle_position;};
inline G4ThreeVector GetParticleMomentumDirection() { return particle_momentum_direction;};
inline G4double GetParticleEnergy() {return particle_energy;};
private:
G4SPSPosDistribution* posGenerator;
G4SPSAngDistribution* angGenerator;
G4SPSEneDistribution* eneGenerator;
G4SPSRandomGenerator* biasRndm;
//
// Other particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition * particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
G4double particle_weight;
// Verbosity
G4int verbosityLevel;
};
#endif