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