Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UltraActionInitializer.cc
Go to the documentation of this file.
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 // $Id: UltraActionInitializer.cc 66241 2012-12-13 18:34:42Z gunter $
27 // GEANT4 tag $Name: $
28 //
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 
33 
35 #include "UltraRunAction.hh"
36 #include "UltraEventAction.hh"
38 #include "G4ParticleTable.hh"
39 #include "G4ParticleDefinition.hh"
40 #include "G4SystemOfUnits.hh"
41 
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47 {
48  //Note: We instantiate a GPS here, because we want to set the defaults.
49  //Since GPS distributions are shared among threads, we need to be sure
50  //that defaults are done only once.
51  //See comments in file G4GeneralParticleSource.hh
52  masterGPS = new G4GeneralParticleSource();
53  // Define here the user default properties for the General Particle Source (GPS)
54  // Can be modified through the GPS Messenger (/gps/... commands)
55 
57  G4String particleName;
58 
59  G4ParticleDefinition* opticalphoton = particleTable->FindParticle(particleName="opticalphoton");
60 
61  //....PARTICLE DEFINITIONS
62  masterGPS->SetParticleDefinition(opticalphoton);
63 
64  G4ThreeVector Polarization = G4ThreeVector(1.,1.,0.) ;
65  masterGPS->SetParticlePolarization(Polarization);
66 
67  // DEFINE A MONO-ENERGETIC SOURCE
68  G4SPSEneDistribution *eneDist = masterGPS->GetCurrentSource()->GetEneDist() ;
69  eneDist->SetEnergyDisType("Mono");
70  eneDist->SetMonoEnergy(3.0*eV);
71 
72  // SET POSITION DISTRIBUTION
73  G4SPSPosDistribution *posDist = masterGPS->GetCurrentSource()->GetPosDist() ;
74  posDist->SetPosDisType("Plane");
75  posDist->SetPosDisShape("Circle");
76  posDist->SetRadius(20.0*cm);
77 
78  #ifdef ULTRA_MIRROR_USE
79  #define ULTRA_REFLECTION_USE
80  #endif
81 
82  #ifdef ULTRA_GROUND_USE
83  #define ULTRA_REFLECTION_USE
84  #endif
85 
86  G4SPSAngDistribution *angDist = masterGPS->GetCurrentSource()->GetAngDist() ;
87 
88  #ifdef ULTRA_REFLECTION_USE
89  angDist->SetParticleMomentumDirection(G4ThreeVector(0.0,-1.0,0.0)) ;
90  posDist->SetPosRot1(G4ThreeVector(1.,0.,0.));
91  posDist->SetPosRot2(G4ThreeVector(0.,0.,-1.));
92  posDist->SetCentreCoords(G4ThreeVector(0.0*cm,90.0*cm,150.0*cm));
93 
94  #else
95  angDist->SetParticleMomentumDirection(G4ThreeVector(0.0,0.0,-1.0)) ;
96  posDist->SetCentreCoords(G4ThreeVector(0.0*cm,0.0*cm,150.0*cm));
97 
98  #endif
99 
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 
105 {
106  delete masterGPS;
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
112 {
113 
114  // primary generator
116 
117  //Thread-local RunAction: same class, but code controlled by IsMaster()
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123 
125 {
126  //Thread-local RunAction: same class, but code controlled by IsMaster()
128 }
129 
G4SPSAngDistribution * GetAngDist() const
G4SPSEneDistribution * GetEneDist() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4SPSPosDistribution * GetPosDist() const
CLHEP::Hep3Vector G4ThreeVector
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
void SetCentreCoords(G4ThreeVector)
void SetParticlePolarization(G4ThreeVector aVal)
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double eV
Definition: G4SIunits.hh:215
void SetPosRot1(G4ThreeVector)
static G4ParticleTable * GetParticleTable()
void SetPosRot2(G4ThreeVector)
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void SetUserAction(G4VUserPrimaryGeneratorAction *) const
G4SingleParticleSource * GetCurrentSource() const