Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: G4AdjointPrimaryGeneratorAction.hh 98735 2016-08-09 10:54:06Z gcosmo $
27 //
29 // Class Name: G4AdjointPrimaryGeneratorAction
30 // Author: L. Desorgher
31 // Organisation: SpaceIT GmbH
32 // Contract: ESA contract 21435/08/NL/AT
33 // Customer: ESA/ESTEC
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 
71 class G4ParticleGun;
72 class G4Event;
75 
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);
97  void SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon);
99  inline size_t GetNbOfAdjointPrimaryTypes(){return ListOfPrimaryAdjParticles.size();}
100  inline std::vector<G4ParticleDefinition*>* GetListOfPrimaryFwdParticles(){
101  return &ListOfPrimaryFwdParticles;}
102  inline const G4String& GetPrimaryIonName(){return ion_name;}
103  inline void SetNbPrimaryFwdGammasPerEvent(G4int nb) {nb_fwd_gammas_per_event=nb;}
104  inline void SetNbAdjointPrimaryGammasPerEvent(G4int nb) {nb_adj_primary_gammas_per_event=nb;}
105  inline void SetNbAdjointPrimaryElectronsPerEvent(G4int nb) {nb_adj_primary_electrons_per_event=nb;}
106  inline G4ParticleDefinition* GetLastGeneratedFwdPrimaryParticle(){return ListOfPrimaryFwdParticles[index_particle];}
107 
108  private: //private methods
109 
110  G4double ComputeEnergyDistWeight(G4double energy, G4double E1, G4double E2);
111 
112  private: //attributes
113 
114  G4String rndmFlag; //flag for a rndm impact point
115 
116  //The generator of primary vertex except for weight
117  G4AdjointPrimaryGenerator* theAdjointPrimaryGenerator;
118 
119  //Emin and Emax energies of the adjoint source
120  //---------------------------------------------
121  G4double Emin;
122  G4double Emax;
123  G4double EminIon;
124  G4double EmaxIon;
125 
126  //List of type of primary adjoint and forward particle used in the simulation
127  //---------------------------------------------------------------------------
128  std::vector<G4ParticleDefinition*> ListOfPrimaryFwdParticles;
129  std::vector<G4ParticleDefinition*> ListOfPrimaryAdjParticles;
130  std::map<G4String, G4bool> PrimariesConsideredInAdjointSim; //if true considered if false not considered
131 
132 
133  size_t index_particle;
134 
135  G4ThreeVector pos, direction, p;
136 
137  G4String type_of_adjoint_source; //Spherical ExtSurfaceOfAVolume
138  G4double radius_spherical_source;
139  G4ThreeVector center_spherical_source;
140  G4int nb_fwd_gammas_per_event;
141  G4int nb_adj_primary_gammas_per_event;
142  G4int nb_adj_primary_electrons_per_event;
143 
144  //For simulation with ions
145  //--------------------------
146  G4ParticleDefinition* fwd_ion;
147  G4ParticleDefinition* adj_ion;
148  G4String ion_name;
149  //disable copy constructor and assignement operator
152 };
153 #endif
154 
155 
const char * p
Definition: xmltok.h:285
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
int G4int
Definition: G4Types.hh:78
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
void ConsiderParticleAsPrimary(const G4String &particle_name)
G4double energy(const ThreeVector &p, const G4double m)
void NeglectParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
double G4double
Definition: G4Types.hh:76
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)