source: trunk/source/processes/electromagnetic/adjoint/include/G4AdjointCSManager.hh@ 1192

Last change on this file since 1192 was 966, checked in by garnier, 17 years ago

fichier ajoutes

File size: 7.9 KB
RevLine 
[966]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// Module: G4AdjointCSManager.hh
28// Author: L. Desorgher
29// Date: 1st April 2007
30// Organisation: SpaceIT GmbH
31// Customer: ESA/ESTEC
32/////////////////////////////////////////////////////////////////////////////////
33//
34// CHANGE HISTORY
35// --------------
36// ChangeHistory:
37// 1st April 2007 creation by L. Desorgher
38//
39//-------------------------------------------------------------
40// Documentation:
41// Is responsible for the management of all adjoint cross sections matrices, and for the computation of the total forward and adjoint cross sections.
42// Total adjoint and forward cross sections are needed to correct continuously the weight of a particle after a tracking step.
43// It is also used to sample an adjoint secondary from a given adjoint cross section matrix.
44//
45#ifndef G4AdjointCSManager_h
46#define G4AdjointCSManager_h 1
47
48#include"globals.hh"
49#include<vector>
50#include"G4AdjointCSMatrix.hh"
51
52
53class G4VEmAdjointModel;
54class G4MaterialCutsCouple;
55class G4Material;
56class G4ParticleDefinition;
57class G4Element;
58class G4VEmProcess;
59class G4VEnergyLossProcess;
60class G4PhysicsTable;
61
62////////////////////////////////////////////////////////////////////////////////
63//
64class G4AdjointCSManager
65{
66
67 public:
68 ~G4AdjointCSManager();
69 static G4AdjointCSManager* GetAdjointCSManager();
70
71 public:
72 G4int GetNbProcesses();
73
74 //Registration of the different models and processes
75
76 void RegisterEmAdjointModel(G4VEmAdjointModel*);
77
78 void RegisterEmProcess(G4VEmProcess* aProcess, G4ParticleDefinition* aPartDef);
79
80 void RegisterEnergyLossProcess(G4VEnergyLossProcess* aProcess, G4ParticleDefinition* aPartDef);
81
82 void RegisterAdjointParticle(G4ParticleDefinition* aPartDef);
83
84 //Building of thr CS Matrices and Total Forward and Adjoint LambdaTables
85 //----------------------------------------------------------------------
86
87 void BuildCrossSectionMatrices();
88 void BuildTotalSigmaTables();
89
90
91 //Get TotalCrossSections form Total Lambda Tables
92 //-------------------------------------------------
93 G4double GetTotalAdjointCS(G4ParticleDefinition* aPartDef, G4double Ekin,
94 const G4MaterialCutsCouple* aCouple);
95 G4double GetTotalForwardCS(G4ParticleDefinition* aPartDef, G4double Ekin,
96 const G4MaterialCutsCouple* aCouple);
97
98
99
100 //Weight correction
101 //------------------
102
103 G4double GetContinuousWeightCorrection(G4ParticleDefinition* aPartDef, G4double PreStepEkin,G4double AfterStepEkin,
104 const G4MaterialCutsCouple* aCouple, G4double step_length);
105 G4double GetPostStepWeightCorrection(G4ParticleDefinition* aPrimPartDef, G4ParticleDefinition* aSecondPartDef,
106 G4double EkinPrim,G4double EkinSecond,
107 const G4MaterialCutsCouple* aCouple);
108
109
110 double ComputeAdjointCS(G4Material* aMaterial,
111 G4VEmAdjointModel* aModel,
112 G4double PrimEnergy,
113 G4double Tcut,
114 G4bool IsScatProjToProjCase,
115 std::vector<double>&
116 AdjointCS_for_each_element);
117
118
119 G4Element* SampleElementFromCSMatrices(G4Material* aMaterial,
120 G4VEmAdjointModel* aModel,
121 G4double PrimEnergy,
122 G4double Tcut,
123 G4bool IsScatProjToProjCase);
124 G4double ComputeTotalAdjointCS(const G4MaterialCutsCouple* aMatCutCouple,G4ParticleDefinition* aPart,G4double PrimEnergy);
125 G4ParticleDefinition* GetAdjointParticleEquivalent(G4ParticleDefinition* theFwdPartDef);
126 G4ParticleDefinition* GetForwardParticleEquivalent(G4ParticleDefinition* theAdjPartDef);
127
128 //inline
129 inline void SetTmin(G4double aVal){Tmin=aVal;}
130 inline void SetTmax(G4double aVal){Tmax=aVal;}
131 inline void SetNbins(G4int aInt){nbins=aInt;}
132
133
134
135 //inline
136 inline void ConsiderContinuousWeightCorrection(G4bool aBool){consider_continuous_weight_correction=aBool;}
137 inline void ConsiderPoststepWeightCorrection(G4bool aBool){consider_poststep_weight_correction=aBool;}
138
139
140
141
142 private:
143 static G4AdjointCSManager* theInstance;
144 std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForScatProjToProj; //x dim is for G4VAdjointEM* while y dim is for elements
145 std::vector< std::vector<G4AdjointCSMatrix*> > theAdjointCSMatricesForProdToProj;
146 std::vector< G4VEmAdjointModel*> listOfAdjointEMModel;
147
148 std::vector<G4AdjointCSMatrix*>
149 BuildCrossSectionsMatricesForAGivenModelAndElement(G4VEmAdjointModel* aModel,
150 G4int Z,
151 G4int A,
152 G4int nbin_pro_decade);
153
154 std::vector<G4AdjointCSMatrix*>
155 BuildCrossSectionsMatricesForAGivenModelAndMaterial(G4VEmAdjointModel* aModel,
156 G4Material* aMaterial,
157 G4int nbin_pro_decade);
158
159
160 G4Material* lastMaterial;
161 G4double lastPrimaryEnergy;
162 G4double lastTcut;
163 std::vector< size_t> listOfIndexOfAdjointEMModelInAction;
164 std::vector< G4bool> listOfIsScatProjToProjCase;
165 std::vector< std::vector<double> > lastAdjointCSVsModelsAndElements;
166 G4bool CrossSectionMatrixesAreBuilt;
167
168 //total adjoint and total forward cross section table in function of material and in function of adjoint particle type
169 //--------------------------------------------------------------------------------------------------------------------
170 std::vector<G4PhysicsTable*> theTotalForwardSigmaTableVector;
171 std::vector<G4PhysicsTable*> theTotalAdjointSigmaTableVector;
172
173 //list of forward G4VEMLossProcess and of G4VEMProcess for the different adjoint particle
174 //--------------------------------------------------------------
175 std::vector< std::vector<G4VEmProcess*>* > listOfForwardEmProcess;
176 std::vector< std::vector<G4VEnergyLossProcess*>* > listOfForwardEnergyLossProcess;
177
178 //list of adjoint particles considered
179
180 std::vector< G4ParticleDefinition*> theListOfAdjointParticlesInAction;
181
182
183 G4double Tmin,Tmax;
184 G4int nbins;
185
186
187 //Current material
188 //----------------
189 G4MaterialCutsCouple* currentCouple;
190 G4Material* currentMaterial;
191 size_t currentMatIndex;
192
193 int verbose;
194
195
196 //Weight correction
197 //------------------
198 G4bool consider_continuous_weight_correction;
199 G4bool consider_poststep_weight_correction;
200
201 private:
202 G4AdjointCSManager();
203 void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
204 double ComputeAdjointCS(G4double aPrimEnergy, G4AdjointCSMatrix* anAdjointCSMatrix, G4double Tcut);
205
206};
207#endif
Note: See TracBrowser for help on using the repository browser.