Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
UltraPrimaryGeneratorAction.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // --------------------------------------------------------------
28 // GEANT 4 - ULTRA experiment example
29 // --------------------------------------------------------------
30 //
31 // Code developed by:
32 // B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
33 //
34 // ****************************************************
35 // * UltraPrimaryGeneratorAction.cc
36 // ****************************************************
37 //
38 // Class used in the definition of the optical photons source
39 // A plane, circular source is used. Depending on the source position, optical
40 // photons may reach the UVscope directly or after reflection. By default direct
41 // incidence is used. The source parameters can be set directly in this class
42 // or through the GeneralParticleSource messenger class.
43 //
46 
47 #include "G4PhysicalConstants.hh"
48 #include "G4SystemOfUnits.hh"
49 #include "G4RunManager.hh"
50 #include "G4Event.hh"
52 #include "G4SPSAngDistribution.hh"
53 #include "G4SPSEneDistribution.hh"
54 #include "G4SPSPosDistribution.hh"
55 #include "G4ParticleTable.hh"
56 #include "G4ParticleDefinition.hh"
57 #include "G4ThreeVector.hh"
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
60 
62 {
63 
65 
66 
67 
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
71 
73 {
74  delete particleGun;
75 }
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78 
80 {
81 
82  G4int iEvent = anEvent->GetEventID() ;
83  if ( iEvent == 0 ){
84 
88 
89 
90 // Check if optical photon wavelength is within limits set for material optical properties tables.
91 
92 
93 
94 
95 }
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 
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 }
124 
125 
G4GeneralParticleSource * particleGun
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4int GetEventID() const
Definition: G4Event.hh:151
static constexpr double nm
Definition: G4SIunits.hh:112
#define G4endl
Definition: G4ios.hh:61
const G4String & GetParticleName() const
G4SPSPosDistribution * GetPosDist() const
static constexpr double h_Planck
double G4double
Definition: G4Types.hh:76
G4String GetPosDisType() const
G4ParticleDefinition * GetParticleDefinition() const
double energy
Definition: plottest35.C:25
G4SPSEneDistribution * GetEneDist() const
static constexpr double eV
Definition: G4SIunits.hh:215
G4GLOB_DLL std::ostream G4cerr
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
int G4int
Definition: G4Types.hh:78
static constexpr double c_light
G4GLOB_DLL std::ostream G4cout
G4SingleParticleSource * GetCurrentSource() const