199{
200
201 if (verboseLevel > 3)
202 G4cout <<
"Calling G4MicroElecInelasticModel_new::Initialise()" <<
G4endl;
203
205 if (!path)
206 {
208 return;
209 }
210
211 G4String modelName = "mermin";
214
215
220
222
223
225 highEnergyLimit[
electron] = 10.0 * MeV;
226
227
230
231 for (
G4int i = 0; i < numOfCouples; ++i) {
233 G4cout <<
"Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
234 if (material->
GetName() ==
"Vacuum")
continue;
235 G4String mat = material->
GetName().substr(3, material->
GetName().size());
236 MapData* tableData = new MapData;
237 currentMaterialStructure = new G4MicroElecMaterialStructure(mat);
238
239 tableMaterialsStructures[mat] = currentMaterialStructure;
240 if (particle == electronDef) {
241
242 G4String fileElectron("Inelastic/" + modelName + "_sigma_inelastic_e-_" + mat);
244 G4MicroElecCrossSectionDataSet_new* tableE = new G4MicroElecCrossSectionDataSet_new(new G4LogLogInterpolation, MeV, scaleFactor);
246 tableData->insert(make_pair(electron, tableE));
247
248
249 std::ostringstream eFullFileName;
250 if (fasterCode) {
251 eFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
253 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
254 }
255 else {
256 eFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
258 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
259 }
260
261 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
262 if (!eDiffCrossSection)
263 {
264 std::stringstream ss;
265 ss << "Missing data " << eFullFileName.str().c_str();
266 std::string sortieString = ss.str();
267
268 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
270 else {
271 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
272 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
273 }
274 }
275
276
277
278
279
281 vector<TriDimensionMap>* eDiffCrossSectionData = new vector<TriDimensionMap>;
282 vector<TriDimensionMap>* eNrjTransfData = new vector<TriDimensionMap>;
283 vector<VecMap>* eProbaShellMap = new vector<VecMap>;
284 vector<G4double>* eTdummyVec = new vector<G4double>;
285 VecMap* eVecm = new VecMap;
286
287 for (
G4int j = 0; j < currentMaterialStructure->NumberOfLevels(); ++j)
288 {
289 eDiffCrossSectionData->push_back(TriDimensionMap());
290 eNrjTransfData->push_back(TriDimensionMap());
291 eProbaShellMap->push_back(VecMap());
292 }
293
294 eTdummyVec->push_back(0.);
295 while (!eDiffCrossSection.eof())
296 {
299 eDiffCrossSection >> tDummy >> eDummy;
300 if (tDummy != eTdummyVec->back()) eTdummyVec->push_back(tDummy);
301
303 for (
G4int j = 0; j < currentMaterialStructure->NumberOfLevels(); ++j)
304 {
305 eDiffCrossSection >> tmp;
306 (*eDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
307
308 if (fasterCode)
309 {
310 (*eNrjTransfData)[j][tDummy][(*eDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
311 (*eProbaShellMap)[j][tDummy].push_back((*eDiffCrossSectionData)[j][tDummy][eDummy]);
312 }
313 else {
314 (*eDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
315 (*eVecm)[tDummy].push_back(eDummy);
316 }
317 }
318 }
319
320
321 if (fasterCode) {
322 isUsed1 = true;
323 eNrjTransStorage[mat] = eNrjTransfData;
324 eProbaShellStorage[mat] = eProbaShellMap;
325 }
326 else {
327 eDiffDatatable[mat] = eDiffCrossSectionData;
328 eVecmStorage[mat] = eVecm;
329 }
330 eIncidentEnergyStorage[mat] = eTdummyVec;
331
332
333 if (!isUsed1) {
334 delete eProbaShellMap;
335 delete eNrjTransfData;
336 }
337 else {
338 delete eDiffCrossSectionData;
339 delete eVecm;
340 }
341 }
342
343
344 if (particle == protonDef)
345 {
346
347 G4String fileProton(
"Inelastic/" + modelName +
"_sigma_inelastic_p_" + mat);
G4cout << fileProton <<
G4endl;
348 G4MicroElecCrossSectionDataSet_new* tableP = new G4MicroElecCrossSectionDataSet_new(new G4LogLogInterpolation, MeV, scaleFactor);
350 tableData->insert(make_pair(proton, tableP));
351
352
353 std::ostringstream pFullFileName;
354 if (fasterCode) {
355 pFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
357 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat" <<
G4endl;
358 }
359 else {
360 pFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
362 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
363 }
364
365 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
366 if (!pDiffCrossSection)
367 {
368 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
369 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
370 else {
371 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
372 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
373 }
374 }
375
376
377
378
379
381 vector<TriDimensionMap>* pDiffCrossSectionData =
382 new vector<TriDimensionMap>;
383 vector<TriDimensionMap>* pNrjTransfData =
384 new vector<TriDimensionMap>;
385 vector<VecMap>* pProbaShellMap =
386 new vector<VecMap>;
387 vector<G4double>* pTdummyVec =
388 new vector<G4double>;
389 VecMap* pVecm = new VecMap;
390
391 for (
G4int j = 0; j < currentMaterialStructure->NumberOfLevels(); ++j)
392
393 {
394 pDiffCrossSectionData->push_back(TriDimensionMap());
395 pNrjTransfData->push_back(TriDimensionMap());
396 pProbaShellMap->push_back(VecMap());
397 }
398
399 pTdummyVec->push_back(0.);
400 while (!pDiffCrossSection.eof())
401 {
404 pDiffCrossSection >> tDummy >> eDummy;
405 if (tDummy != pTdummyVec->back()) pTdummyVec->push_back(tDummy);
406
408 for (
G4int j = 0; j < currentMaterialStructure->NumberOfLevels(); j++)
409 {
410 pDiffCrossSection >> tmp;
411 (*pDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
412
413
414
415 if (fasterCode)
416 {
417 (*pNrjTransfData)[j][tDummy][(*pDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
418 (*pProbaShellMap)[j][tDummy].push_back((*pDiffCrossSectionData)[j][tDummy][eDummy]);
419 }
420 else {
421 (*pDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
422 (*pVecm)[tDummy].push_back(eDummy);
423 }
424 }
425 }
426
427 if (fasterCode) {
428 isUsed1 = true;
429 pNrjTransStorage[mat] = pNrjTransfData;
430 pProbaShellStorage[mat] = pProbaShellMap;
431 }
432 else {
433 pDiffDatatable[mat] = pDiffCrossSectionData;
434 pVecmStorage[mat] = pVecm;
435 }
436 pIncidentEnergyStorage[mat] = pTdummyVec;
437
438
439 if (!isUsed1) {
440 delete pProbaShellMap;
441 delete pNrjTransfData;
442 } else {
443 delete pDiffCrossSectionData;
444 delete pVecm;
445 }
446 }
447 tableTCS[mat] = tableData;
448 }
449 if (particle==electronDef)
450 {
453 }
454
455 if (particle==protonDef)
456 {
459 }
460
461 if( verboseLevel>1 )
462 {
463 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
464 << "Energy range: "
468 <<
" with mass (amu) " << particle->
GetPDGMass()/proton_mass_c2
471 }
472
475 isInitialised = true;
476}
const char * G4FindDataDir(const char *)
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4bool LoadData(const G4String &argFileName) override
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)