36 : fStringOfMaterials(applyToMaterial), fName(nam)
44 std::map<G4String, std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > >::iterator posOuter;
45 std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator posInner;
47 for (posOuter = fTableData.begin(); posOuter != fTableData.end(); ++posOuter)
50 for(posInner = posOuter->second.begin(); posInner != posOuter->second.end(); ++posInner)
53 if(table != 0)
delete table;
60 fModelMaterials.push_back(materialName);
61 fModelParticles.push_back(particleName);
62 fModelCSFiles.push_back(fileCS);
63 fModelDiffCSFiles.push_back(fileDiffCS);
64 fModelScaleFactors.push_back(scaleFactor);
69 fModelMaterials.push_back(materialName);
70 fModelParticles.push_back(particleName);
71 fModelCSFiles.push_back(fileCS);
72 fModelScaleFactors.push_back(scaleFactor);
77 G4String fileElectron, fileDiffElectron;
78 G4String materialName, modelParticleName;
85 for(
unsigned int i=0;i<applyToMatVect.size();++i)
95 for(
unsigned int j=0;j<fModelMaterials.size();++j)
97 if(applyToMatVect[i] == fModelMaterials[j] || applyToMatVect[i] ==
"all")
100 materialName = fModelMaterials[j];
101 modelParticleName = fModelParticles[j];
102 fileElectron = fModelCSFiles[j];
103 if(!fModelDiffCSFiles.empty()) fileDiffElectron = fModelDiffCSFiles[j];
104 scaleFactor = fModelScaleFactors[j];
108 if(!fModelDiffCSFiles.empty())
ReadDiffCSFile(materialName, modelParticleName, fileDiffElectron, scaleFactor);
116 std::ostringstream oss;
117 oss << applyToMatVect[i] <<
" material was not found. It means the material specified in the UserPhysicsList is not a model material for ";
119 G4Exception(
"G4VDNAModel::LoadCrossSectionData",
"em0003",
128 G4String text(
"ReadDiffCSFile must be implemented in the model class using a differential cross section data file");
130 G4Exception(
"G4VDNAModel::ReadDiffCSFile",
"em0003",
136 fTableData[materialName][particleName] = 0;
142 std::vector<G4String> materialVect;
145 if(materials.find(
"/")==std::string::npos)
148 materialVect.push_back(materials);
153 G4String materialsNonIdentified = materials;
155 while(materialsNonIdentified.find_first_of(
"/") != std::string::npos)
158 G4String mat = materialsNonIdentified.substr(0, materialsNonIdentified.find_first_of(
"/"));
159 materialVect.push_back(mat);
162 materialsNonIdentified = materialsNonIdentified.substr(materialsNonIdentified.find_first_of(
"/")+1,
163 materialsNonIdentified.size()-materialsNonIdentified.find_first_of(
"/"));
168 materialVect.push_back(materialsNonIdentified);
179 fTableData[materialName][particleName]->LoadData(file);
188 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
189 pos = (*tableData)[materialName].find(particle);
191 if (pos != (*tableData)[materialName].end())
206 value += valuesBuffer[i];
217 if (valuesBuffer[i] > value)
219 delete[] valuesBuffer;
222 value -= valuesBuffer[i];
225 if (valuesBuffer)
delete[] valuesBuffer;
231 G4Exception(
"G4VDNAModel::RandomSelectShell",
"em0002",
245 for(
int i=0;i<matTableSize;i++)
261 if (fTableData.find(materialName) == fTableData.end())
279 if (fTableData[materialName].find(particleName) == fTableData[materialName].end())
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual size_t NumberOfComponents(void) const
virtual const G4VEMDataSet * GetComponent(G4int componentId) const
static G4MaterialTable * GetMaterialTable()
virtual ~G4VDNAModel()
~G4VDNAModel
G4bool IsMaterialExistingInModel(const G4String &materialName)
IsMaterialExistingInModel Check if the given material is defined in the current model class.
G4int RandomSelectShell(G4double k, const G4String &particle, const G4String &materialName)
RandomSelectShell Method to randomely select a shell from the data table uploaded....
G4bool IsParticleExistingInModelForMaterial(const G4String &particleName, const G4String &materialName)
IsParticleExistingInModelForMaterial To check two things: 1- is the material existing in model ?...
TableMapData * GetTableData()
GetTableData.
G4String GetName()
GetName.
G4VDNAModel(const G4String &nam, const G4String &applyToMaterial)
G4VDNAModel Constructeur of the G4VDNAModel class.
void ReadAndSaveCSFile(const G4String &materialName, const G4String &particleName, const G4String &file, G4double scaleFactor)
ReadAndSaveCSFile Read and save a "simple" cross section file : use of G4DNACrossSectionDataSet->load...
std::map< G4String, std::map< G4String, G4DNACrossSectionDataSet *, std::less< G4String > > > TableMapData
void AddCrossSectionData(G4String materialName, G4String particleName, G4String fileCS, G4String fileDiffCS, G4double scaleFactor)
AddCrossSectionData Method used during the initialization of the model class to add a new material....
G4bool IsMaterialDefine(const G4String &materialName)
IsMaterialDefine Check if the given material is defined in the simulation.
virtual void ReadDiffCSFile(const G4String &materialName, const G4String &particleName, const G4String &path, const G4double scaleFactor)
ReadDiffCSFile Virtual method that need to be implemented if one wish to use the differential cross s...
std::vector< G4String > BuildApplyToMatVect(const G4String &materials)
BuildApplyToMatVect Build the material name vector which is used to know the materials the user want ...
void LoadCrossSectionData(const G4String &particleName)
LoadCrossSectionData Method to loop on all the registered materials in the model and load the corresp...
void EnableForMaterialAndParticle(const G4String &materialName, const G4String &particleName)
EnableMaterialAndParticle.
virtual G4double FindValue(G4double x, G4int componentId=0) const =0