37 :
G4VEmModel(nam), fStringOfMaterials(applyToMaterial)
47 fModelMaterials.push_back(materialID);
48 fModelParticles.push_back(particleName);
49 fModelCSFiles.push_back(fileCS);
50 fModelDiffCSFiles.push_back(fileDiffCS);
51 fModelScaleFactors.push_back(scaleFactor);
58 fModelMaterials.push_back(materialID);
59 fModelParticles.push_back(particleName);
60 fModelCSFiles.push_back(fileCS);
61 fModelScaleFactors.push_back(scaleFactor);
66 G4String fileElectron, fileDiffElectron =
"";
67 G4String materialName, modelParticleName;
69 std::size_t materialID;
78 for (
const auto & i : applyToMatVect) {
80 if (i !=
"all" && pMat ==
nullptr) {
93 for (std::size_t j = 0; j < fModelMaterials.size(); ++j) {
94 if (i ==
"all" || pMat->GetIndex() == fModelMaterials[j]) {
96 materialID = fModelMaterials[j];
97 pParticle = fModelParticles[j];
98 fileElectron = fModelCSFiles[j];
99 if (!fModelDiffCSFiles.empty()) fileDiffElectron = fModelDiffCSFiles[j];
100 scaleFactor = fModelScaleFactors[j];
104 if (!fileDiffElectron.empty())
105 ReadDiffCSFile(materialID, pParticle, fileDiffElectron, scaleFactor);
111 std::ostringstream oss;
113 <<
" material was not found. It means the material specified in the UserPhysicsList is "
114 "not a model material for ";
126 "ReadDiffCSFile must be implemented in the model class using a differential cross section data "
135 fData[materialID][p] =
nullptr;
141 std::vector<G4String> materialVect;
144 if (materials.find(
'/') == std::string::npos) {
146 materialVect.push_back(materials);
150 G4String materialsNonIdentified = materials;
152 while (materialsNonIdentified.find_first_of(
'/') != std::string::npos) {
154 G4String mat = materialsNonIdentified.substr(0, materialsNonIdentified.find_first_of(
'/'));
155 materialVect.push_back(mat);
158 materialsNonIdentified = materialsNonIdentified.substr(
159 materialsNonIdentified.find_first_of(
'/') + 1,
160 materialsNonIdentified.size() - materialsNonIdentified.find_first_of(
'/'));
165 materialVect.push_back(materialsNonIdentified);
174 fData[materialID][p] =
176 fData[materialID][p]->LoadData(file);
180 const std::size_t& materialID)
184 auto pos = fData[materialID].find(particle);
186 if (pos != fData[materialID].end()) {
189 if (table !=
nullptr) {
198 value += valuesBuffer[i];
208 if (valuesBuffer[i] > value) {
209 delete[] valuesBuffer;
212 value -= valuesBuffer[i];
215 delete[] valuesBuffer;
223 "Model not applicable to particle type : ");
236 for (
int i = 0; i < matTableSize; i++) {
244 "Materials are not defined!!");
248G4bool G4VDNAModel::IsMaterialExistingInModel(
const std::size_t& materialID)
252 for (
const auto& it : fModelMaterials) {
253 if (it == materialID) {
261 const std::size_t& materialID)
267 if (IsMaterialExistingInModel(materialID)) {
268 for (
const auto& it : fModelParticles) {
269 if (it == particleName) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
size_t NumberOfComponents() const override
const G4VEMDataSet * GetComponent(G4int componentId) const override
static G4MaterialTable * GetMaterialTable()
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
const G4String & GetParticleName() const
~G4VDNAModel() override
~G4VDNAModel
G4String GetName()
GetName.
void LoadCrossSectionData(const G4ParticleDefinition *particleName)
LoadCrossSectionData Method to loop on all the registered materials in the model and load the corresp...
G4bool IsMaterialDefine(const size_t &materialID)
IsMaterialDefine Check if the given material is defined in the simulation.
void EnableForMaterialAndParticle(const size_t &materialID, const G4ParticleDefinition *p)
EnableMaterialAndParticle.
G4VDNAModel(const G4String &nam, const G4String &applyToMaterial="")
G4VDNAModel Constructeur of the G4VDNAModel class.
G4int RandomSelectShell(const G4double &k, const G4ParticleDefinition *particle, const size_t &materialName)
RandomSelectShell Method to randomely select a shell from the data table uploaded....
std::vector< G4String > BuildApplyToMatVect(const G4String &materials)
BuildApplyToMatVect Build the material name vector which is used to know the materials the user want ...
G4bool IsParticleExistingInModelForMaterial(const G4ParticleDefinition *particleName, const size_t &materialID)
IsParticleExistingInModelForMaterial To check two things: 1- is the material existing in model ?...
void AddCrossSectionData(const size_t &materialName, const G4ParticleDefinition *particleName, const G4String &fileCS, const G4String &fileDiffCS, const G4double &scaleFactor)
AddCrossSectionData Method used during the initialization of the model class to add a new material....
virtual void ReadDiffCSFile(const size_t &materialName, const G4ParticleDefinition *particleName, const G4String &path, const G4double &scaleFactor)
ReadDiffCSFile Virtual method that need to be implemented if one wish to use the differential cross s...
void ReadAndSaveCSFile(const size_t &materialID, const G4ParticleDefinition *p, const G4String &file, const G4double &scaleFactor)
ReadAndSaveCSFile Read and save a "simple" cross section file : use of G4DNACrossSectionDataSet->load...
virtual G4double FindValue(G4double x, G4int componentId=0) const =0