source: trunk/source/run/include/G4AdjointPrimaryGeneratorAction.hh@ 1327

Last change on this file since 1327 was 1197, checked in by garnier, 16 years ago

nvx fichiers dans CVS

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