Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNAModelInterface.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//
27// Contact authors: S. Meylan, C. Villagrasa
28//
30// updated : Hoang Tran : 6/1/2023 clean code
31
32#ifndef G4DNAMODELINTERFACE_HH
33#define G4DNAMODELINTERFACE_HH
34
35#include "G4VEmModel.hh"
36
37#include <map>
39class G4VDNAModel;
41{
42using MaterialParticleModelTable =
43 std::map<std::size_t /*MatID*/, std::map<const G4ParticleDefinition*, G4VEmModel*>>;
44//should have only one model
45 public:
46 /*!
47 * \brief G4DNAModelManager
48 * Constructor
49 * \param nam
50 */
51 explicit G4DNAModelInterface(const G4String& nam);
52
53 /*!
54 * \brief ~G4DNAModelManager
55 * Destructor
56 */
57 ~G4DNAModelInterface() override = default;
58
59 G4DNAModelInterface(const G4DNAModelInterface&) = delete; // prevent copy-construction
60 G4DNAModelInterface& operator=(const G4DNAModelInterface& right) = delete; // prevent assignement
61
62 /*!
63 * \brief Initialise
64 * Initialise method to call all the initialise methods of the registered models
65 * \param particle
66 * \param cuts
67 */
68 void Initialise(const G4ParticleDefinition* particle, const G4DataVector& cuts) override;
69
70 /*!
71 * \brief CrossSectionPerVolume
72 * Method called by the process and used to call the CrossSectionPerVolume method of the
73 * registered models. The method also calculates through G4DNAMolecularMaterial the number of
74 * molecule per volume unit for the current material or (component of a composite material).
75 * \param material
76 * \param p
77 * \param ekin
78 * \param emin
79 * \param emax
80 * \return the final cross section value times with the number of molecule per volume unit
81 */
83 G4double ekin, G4double emin, G4double emax) override;
84
85 /*!
86 * \brief SampleSecondaries
87 * Used to call the SampleSecondaries method of the registered models. A sampling is done to
88 * select a component if the material is a composite one. \param fVect \param couple \param
89 * aDynamicElectron \param tmin \param tmax
90 */
91 void SampleSecondaries(std::vector<G4DynamicParticle*>* fVect, const G4MaterialCutsCouple* couple,
92 const G4DynamicParticle* aDynamicElectron, G4double tmin, G4double tmax) override;
93
94 /*!
95 * \brief RegisterModel
96 * Method used to associate a model with the interaction
97 * \param model
98 */
99 void RegisterModel(G4VEmModel* model);
100 /*!
101 * \brief GetSelectedMaterial
102 * To allow the user to retrieve the selected material in case of a composite material.
103 * \return the last selected material by SampleSecondaries.
104 */
105 inline std::size_t GetSelectedMaterial()
106 {
107 return fSampledMat;
108 }
109
110 void StreamInfo(std::ostream& os) const;
111
112 private:
113 /*!
114 * \brief BuildMaterialParticleModelTable
115 * Method used to build a map allowing the code to quickly retrieve the good model for a
116 * particle/material couple \param p
117 */
118 void BuildMaterialParticleModelTable(const G4ParticleDefinition* p);
119
120 void BuildMaterialMolPerVolTable();
121
122 /*!
123 * \brief InsertModelInTable
124 * Used to put a model in the table after performing some checks.
125 * \param matName
126 * \param pName
127 */
128 void InsertModelInTable(const std::size_t& matID, const G4ParticleDefinition* p);
129
130 /*!
131 * \brief GetDNAModel
132 * \param material
133 * \param particle
134 * \param ekin
135 * \return G4VDNAModel*
136 * Return the model corresponding to the material, particle and energy specified.
137 * This method will check the energy range of the models to find to good one for the current ekin.
138 */
139 G4VEmModel* SelectModel(
140 const std::size_t& material, const G4ParticleDefinition* particle, const G4double& ekin);
141
142 G4double GetNumMoleculePerVolumeUnitForMaterial(const G4Material* mat);
143 G4double GetNumMolPerVolUnitForComponentInComposite(
144 const G4Material* component, const G4Material* composite);
145
146 const G4String fName; ///< name of the interaction
147 G4ParticleChangeForGamma* fpParticleChangeForGamma = nullptr;
148 std::vector<G4VEmModel*> fRegisteredModels; ///< vector containing all the registered models
149
150 std::map<std::size_t, G4double> fMaterialCS; ///< map used to share information between
151 ///< CrossSectionPerVolume and SampleSecondaries
152 G4double fCSsumTot = 0; ///< value which contains the sum of all the component cross sections in
153 ///< case of a composite material
154 std::size_t fSampledMat = 0; ///< for the user to retrieve selected material/component
155 MaterialParticleModelTable fMaterialParticleModelTable;
156 std::map<std::size_t, const std::vector<G4double>*> fMaterialMolPerVol;
157 G4Material* fpG4_WATER = nullptr;
158};
159
160#endif // G4DNAMODELINTERFACE_HH
double G4double
Definition G4Types.hh:83
std::size_t GetSelectedMaterial()
GetSelectedMaterial To allow the user to retrieve the selected material in case of a composite materi...
void StreamInfo(std::ostream &os) const
void SampleSecondaries(std::vector< G4DynamicParticle * > *fVect, const G4MaterialCutsCouple *couple, const G4DynamicParticle *aDynamicElectron, G4double tmin, G4double tmax) override
SampleSecondaries Used to call the SampleSecondaries method of the registered models....
G4DNAModelInterface & operator=(const G4DNAModelInterface &right)=delete
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
CrossSectionPerVolume Method called by the process and used to call the CrossSectionPerVolume method ...
G4DNAModelInterface(const G4DNAModelInterface &)=delete
void RegisterModel(G4VEmModel *model)
RegisterModel Method used to associate a model with the interaction.
void Initialise(const G4ParticleDefinition *particle, const G4DataVector &cuts) override
Initialise Initialise method to call all the initialise methods of the registered models.
~G4DNAModelInterface() override=default
~G4DNAModelManager Destructor
G4DNAModelInterface(const G4String &nam)
G4DNAModelManager Constructor.
The G4VDNAModel class.