Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointPrimaryGeneratorAction.hh
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//
27/////////////////////////////////////////////////////////////////////////////////
28// Class Name: G4AdjointPrimaryGeneratorAction
29// Author: L. Desorgher
30// Organisation: SpaceIT GmbH
31// Contract: ESA contract 21435/08/NL/AT
32// Customer: ESA/ESTEC
33/////////////////////////////////////////////////////////////////////////////////
34//
35// CHANGE HISTORY
36// --------------
37// ChangeHistory:
38// 10-01-2007 creation by L. Desorgher
39// 1-11-2009 Splitting of G4AdjointPrimaryGeneratorAction in two classes
40// G4AdjointPrimaryGeneratorAction and G4AdjointPrimaryGenerator
41// L.Desorgher
42//
43//
44//-------------------------------------------------------------
45// Documentation:
46// This class represents the PrimaryGeneratorAction that is used during the
47//entire
48// adjoint simulation. It uses the class G4AdjointPrimaryGenerator to
49// generate randomly adjoint primary particles on a user selected adjoint
50// source (External surface of a volume or Sphere). The spectrum of the
51// primary adjoint particles is set as 1/E with user defined max and min
52// energy. The weight of the primary is set according to ReverseMC theory as
53// w=log(Emax/Emin)*E*adjoint_source_area*pi/n, with E the energy of the
54// particle, n the number of adjoint primary particles of same type that will be
55// generated during the simulation. Different types of adjoint particles are
56// generated event after event in order to cover all the type of primaries
57// and secondaries needed for the simulation. For example if reverse e-
58// ionisation, brem, photo
59// electric effect, and compton are considered both adjoint gamma and adjoint
60// e- will be considered alternatively as adjoint primary. The user can
61// decide to consider/neglect some type of particle by using the macro commands
62// /adjoint/ConsiderAsPrimary and
63/// adjoint/NeglectAsPrimary. If an adjoint primary or its secondary has
64/// reached the
65// external surface, in the next event a fwd primary particle equivalent to
66// the last generated adjoint primary is generated with the same position,
67// energy but opposite direction and the forward tracking phase starts.
68//
69//
70//
71#ifndef G4AdjointPrimaryGeneratorAction_h
72#define G4AdjointPrimaryGeneratorAction_h 1
73#include "G4ThreeVector.hh"
75#include "globals.hh"
76#include <iterator>
77#include <map>
78#include <vector>
79
81class G4ParticleGun;
82class G4Event;
85
86/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
87//
89{
90 public: // constructor, destructor
93
94 public: // public methods
96 void SetRndmFlag(const G4String& val) { rndmFlag = val; }
97 void SetEmin(G4double val);
98 void SetEmax(G4double val);
99 void SetEminIon(G4double val);
100 void SetEmaxIon(G4double val);
103 const G4String& volume_name);
104 void ConsiderParticleAsPrimary(const G4String& particle_name);
105 void NeglectParticleAsPrimary(const G4String& particle_name);
106 void SetPrimaryIon(G4ParticleDefinition* adjointIon,
107 G4ParticleDefinition* fwdIon);
110 {
111 return ListOfPrimaryAdjParticles.size();
112 }
113 inline std::vector<G4ParticleDefinition*>* GetListOfPrimaryFwdParticles()
114 {
115 return &ListOfPrimaryFwdParticles;
116 }
117 inline const G4String& GetPrimaryIonName() { return ion_name; }
119 {
120 nb_fwd_gammas_per_event = nb;
121 }
123 {
124 nb_adj_primary_gammas_per_event = nb;
125 }
127 {
128 nb_adj_primary_electrons_per_event = nb;
129 }
131 {
132 return ListOfPrimaryFwdParticles[index_particle];
133 }
134
135 private: // private methods
136 G4double ComputeEnergyDistWeight(G4double energy, G4double E1, G4double E2);
137
138 private: // attributes
139 G4String rndmFlag; // flag for a rndm impact point
140
141 // The generator of primary vertex except for weight
142 G4AdjointPrimaryGenerator* theAdjointPrimaryGenerator;
143
144 // Emin and Emax energies of the adjoint source
145 //---------------------------------------------
146 G4double Emin;
147 G4double Emax;
148 G4double EminIon;
149 G4double EmaxIon;
150
151 // List of type of primary adjoint and forward particle used in the
152 // simulation
153 //---------------------------------------------------------------------------
154 std::vector<G4ParticleDefinition*> ListOfPrimaryFwdParticles;
155 std::vector<G4ParticleDefinition*> ListOfPrimaryAdjParticles;
156 std::map<G4String, G4bool>
157 PrimariesConsideredInAdjointSim; // if true considered if
158 // false not considered
159
160 size_t index_particle;
161
162 G4ThreeVector pos, direction, p;
163
164 G4String type_of_adjoint_source; // Spherical ExtSurfaceOfAVolume
165 G4double radius_spherical_source;
166 G4ThreeVector center_spherical_source;
167 G4int nb_fwd_gammas_per_event;
168 G4int nb_adj_primary_gammas_per_event;
169 G4int nb_adj_primary_electrons_per_event;
170
171 // For simulation with ions
172 //--------------------------
173 G4ParticleDefinition* fwd_ion;
174 G4ParticleDefinition* adj_ion;
175 G4String ion_name;
176 // disable copy constructor and assignement operator
180};
181#endif
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
void NeglectParticleAsPrimary(const G4String &particle_name)
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)