ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VEmAdjointModel.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4VEmAdjointModel.hh
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 //
28 // Module: G4VEMAdjointModel
29 // Author: L. Desorgher
30 // Organisation: SpaceIT GmbH
31 // Contract: ESA contract 21435/08/NL/AT
32 // Customer: ESA/ESTEC
34 //
35 // CHANGE HISTORY
36 // --------------
37 // ChangeHistory:
38 // 10 September 2009 Move to a virtual class. L. Desorgher
39 // 1st April 2007 creation by L. Desorgher
40 //
41 //-------------------------------------------------------------
42 // Documentation:
43 // Base class for Adjoint EM model. It is based on the use of direct G4VEmModel.
44 //
45 
46 
47 #ifndef G4VEmAdjointModel_h
48 #define G4VEmAdjointModel_h 1
49 
50 #include "globals.hh"
51 #include "G4DynamicParticle.hh"
52 #include "G4ParticleDefinition.hh"
53 #include "G4MaterialCutsCouple.hh"
54 #include "G4Material.hh"
55 #include "G4Element.hh"
56 #include "G4ElementVector.hh"
57 #include "Randomize.hh"
58 #include "G4ParticleDefinition.hh"
59 #include "G4VEmModel.hh"
60 #include "G4Electron.hh"
61 #include "G4Gamma.hh"
62 #include "G4ProductionCutsTable.hh"
63 
64 class G4PhysicsTable;
65 class G4Region;
66 class G4VParticleChange;
67 class G4ParticleChange;
68 class G4Track;
69 class G4AdjointCSMatrix;
70 
72 {
73 
74 public: // public methods
75 
76  G4VEmAdjointModel(const G4String& nam);
77 
78  virtual ~G4VEmAdjointModel();
79 
80  //------------------------------------------------------------------------
81  // Virtual methods to be implemented for the sample secondaries concrete model
82  //------------------------------------------------------------------------
83 
84  //virtual void Initialise()=0;
85 
86  virtual void SampleSecondaries(const G4Track& aTrack,
87  G4bool IsScatProjToProjCase,
88  G4ParticleChange* fParticleChange)=0;
89 
90 
91  //------------------------------------------------------------------------
92  // Methods for adjoint processes; may be overwritten if needed;
93  //------------------------------------------------------------------------
94 
95 
96  virtual G4double AdjointCrossSection(const G4MaterialCutsCouple* aCouple,
97  G4double primEnergy,
98  G4bool IsScatProjToProjCase);
99 
101  G4double primEnergy,
102  G4bool IsScatProjToProjCase);
103 
105  G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
106  G4double kinEnergyProd, // kinetic energy of the secondary particle
107  G4double Z,
108  G4double A = 0.);
109 
111  G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
112  G4double kinEnergyScatProj, // kinetic energy of the primary particle after the interaction
113  G4double Z,
114  G4double A = 0.);
115 
116 
117 
119  const G4Material* aMaterial,
120  G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
121  G4double kinEnergyProd // kinetic energy of the secondary particle
122  );
123 
125  const G4Material* aMaterial,
126  G4double kinEnergyProj, // kinetic energy of the primary particle before the interaction
127  G4double kinEnergyScatProj // kinetic energy of the primary particle after the interaction
128  );
129 
130 
131  //Energy limits of adjoint secondary
132  //------------------
133 
138 
139 
140 
141  //Other Methods
142  //---------------
143 
144  void DefineCurrentMaterial(const G4MaterialCutsCouple* couple);
145 
146 
147  std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerAtomForSecond(
148  G4double kinEnergyProd,
149  G4double Z,
150  G4double A = 0.,
151  G4int nbin_pro_decade=10
152  );
153  std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerAtomForScatProj(
154  G4double kinEnergyProd,
155  G4double Z,
156  G4double A = 0.,
157  G4int nbin_pro_decade=10
158  );
159 
160  std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerVolumeForSecond(
161  G4Material* aMaterial,
162  G4double kinEnergyProd,
163  G4int nbin_pro_decade=10
164  );
165  std::vector< std::vector< double>* > ComputeAdjointCrossSectionVectorPerVolumeForScatProj(
166  G4Material* aMaterial,
167  G4double kinEnergyProd,
168  G4int nbin_pro_decade=10
169  );
170 
171 
172 
173  inline void SetCSMatrices(std::vector< G4AdjointCSMatrix* >* Vec1CSMatrix, std::vector< G4AdjointCSMatrix* >* Vec2CSMatrix){
176 
177 
178  };
179 
181 
183 
185 
187 
188  void SetHighEnergyLimit(G4double aVal);
189 
190  void SetLowEnergyLimit(G4double aVal);
191 
192  inline void DefineDirectEMModel(G4VEmModel* aModel){theDirectEMModel = aModel;}
193 
195 
198  }
199 
201 
203 
204  inline void SetUseMatrix(G4bool aBool) { UseMatrix = aBool;}
205 
206  inline void SetUseMatrixPerElement(G4bool aBool){ UseMatrixPerElement = aBool;}
208 
209  inline void SetApplyCutInRange(G4bool aBool){ ApplyCutInRange = aBool;}
210  inline G4bool GetUseMatrix() {return UseMatrix;}
214 
215  inline G4String GetName(){ return name;}
216  inline virtual void SetCSBiasingFactor(G4double aVal) {CS_biasing_factor = aVal;}
217 
220 
221 protected:
222 
223  //Some of them can be overriden by daughter classes
224 
225 
229 
230 
231 
232  //General methods to sample secondary energy
233  //--------------------------------------
234  G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex,G4double prim_energy,G4bool IsScatProjToProjCase);
235  G4double SampleAdjSecEnergyFromCSMatrix(G4double prim_energy,G4bool IsScatProjToProjCase);
236  void SelectCSMatrix(G4bool IsScatProjToProjCase);
237 
238  virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom(G4double prim_energy,G4bool IsScatProjToProjCase);
239 
240 
241 
242  //Post Step weight correction
243  //----------------------------
244  virtual void CorrectPostStepWeight(G4ParticleChange* fParticleChange,
245  G4double old_weight,
246  G4double adjointPrimKinEnergy,
247  G4double projectileKinEnergy,
248  G4bool IsScatProjToProjCase);
249 
250 
251 
252 
253 
254 
255 protected: //attributes
256 
259 
260 
261 
262 
263  //Name
264  //-----
265 
266  const G4String name;
267 
268  //Needed for CS integration at the initialisation phase
269  //-----------------------------------------------------
270 
277 
278  //for the adjoint simulation we need for each element or material:
279  //an adjoint CS Matrix
280  //-----------------------------
281 
282  std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForProdToProjBackwardScattering;
283  std::vector< G4AdjointCSMatrix* >* pOnCSMatrixForScatProjToProjBackwardScattering;
284  std::vector<G4double> CS_Vs_ElementForScatProjToProjCase;
285  std::vector<G4double> CS_Vs_ElementForProdToProjCase;
286 
290 
291  //particle definition
292  //------------------
293 
298 
299  //Prestep energy
300  //-------------
302 
303  //Current couple material
304  //----------------------
312 
313  //For ions
314  //---------
317 
318  //Energy limits
319  //-------------
320 
323 
324  //Cross Section biasing factor
325  //---------------------------
327 
328  //Type of Model with Matrix or not
329  //--------------------------------
331  G4bool UseMatrixPerElement; //other possibility is per Material
333 
334  //Index of Cross section matrices to be used
335  //------------
337 
338  size_t model_index;
339 
340  //This is needed for the forced interaction where part of the weight correction
341  // is given outside the model while the secondary are created in the model
342  //The weight should be fixed before adding the secondary
345 
346 };
347 
348 
349 #endif
350