Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UltraPrimaryGeneratorAction Class Reference

#include <UltraPrimaryGeneratorAction.hh>

Inheritance diagram for UltraPrimaryGeneratorAction:
Collaboration diagram for UltraPrimaryGeneratorAction:

Public Member Functions

 UltraPrimaryGeneratorAction ()
 
 ~UltraPrimaryGeneratorAction ()
 
void GeneratePrimaries (G4Event *anEvent)
 
G4GeneralParticleSourceGetParticleGun ()
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 53 of file UltraPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

UltraPrimaryGeneratorAction::UltraPrimaryGeneratorAction ( )

Definition at line 61 of file UltraPrimaryGeneratorAction.cc.

62 {
63 
64  particleGun = new G4GeneralParticleSource();
65 
66 
67 
68 }
UltraPrimaryGeneratorAction::~UltraPrimaryGeneratorAction ( )

Definition at line 72 of file UltraPrimaryGeneratorAction.cc.

73 {
74  delete particleGun;
75 }

Member Function Documentation

void UltraPrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 79 of file UltraPrimaryGeneratorAction.cc.

80 {
81 
82  G4int iEvent = anEvent->GetEventID() ;
83  if ( iEvent == 0 ){
84 
85  G4cout << particleGun->GetParticleDefinition()->GetParticleName() << " " ;
86  G4cout << particleGun->GetCurrentSource()->GetEneDist()->GetEnergyDisType() << " " ;
87  G4cout << particleGun->GetCurrentSource()->GetPosDist()->GetPosDisType() << G4endl ;
88 
89 
90 // Check if optical photon wavelength is within limits set for material optical properties tables.
91 
92 
93 
94 
95 }
96  particleGun->GeneratePrimaryVertex(anEvent);
97 
98  if (particleGun->GetParticleDefinition()->GetParticleName() == "opticalphoton"){
99 
100  const UltraDetectorConstruction * detector =
101  dynamic_cast<const UltraDetectorConstruction *>((G4RunManager::GetRunManager())->GetUserDetectorConstruction()) ;
102 
103  G4double lambda_min = detector->GetLambdaMin() ;
104  G4double lambda_max = detector->GetLambdaMax() ;
105 
106  G4double energy = particleGun->GetParticleEnergy() ;
107 
108  if (h_Planck*c_light/energy > lambda_max || h_Planck*c_light/energy < lambda_min){
109  G4cerr << "Error ! Optical photon energy (" << energy/eV << " eV) out of limits set by material optical properties tables. \n"
110  << "Please check that photon wavelength is within the following interval: ["
111  << lambda_min/nm << ","
112  << lambda_max/nm << "] nm"
113  << ", i.e., ["
114  << h_Planck*c_light/lambda_max/eV << ","
115  << h_Planck*c_light/lambda_min/eV << "] eV"
116  << G4endl ;
117 
118  G4Exception("UltraPrimaryGeneratorAction::GeneratePrimaries()","AirSh005",
119  FatalException,"Wavelength outside the valid range") ;
120  }
121  }
122 
123 }
G4SPSEneDistribution * GetEneDist() const
G4SPSPosDistribution * GetPosDist() const
float h_Planck
Definition: hepunit.py:263
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
G4int GetEventID() const
Definition: G4Event.hh:151
G4GLOB_DLL std::ostream G4cout
static constexpr double eV
Definition: G4SIunits.hh:215
G4ParticleDefinition * GetParticleDefinition() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static constexpr double nm
Definition: G4SIunits.hh:112
G4double energy(const ThreeVector &p, const G4double m)
G4String GetPosDisType() const
#define G4endl
Definition: G4ios.hh:61
G4SingleParticleSource * GetCurrentSource() const
double G4double
Definition: G4Types.hh:76
float c_light
Definition: hepunit.py:257
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

G4GeneralParticleSource* UltraPrimaryGeneratorAction::GetParticleGun ( )
inline

Definition at line 64 of file UltraPrimaryGeneratorAction.hh.

64 {return particleGun;}

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