240{
241 if (isInitialised) { return; }
242
243 if (verboseLevel > 3)
244 G4cout <<
"Calling G4MicroElecInelasticModel_new::Initialise()" <<
G4endl;
245
247 if (!path)
248 {
250 return;
251 }
252
256
257
262
264
265
267 highEnergyLimit[
electron] = 10.0 * MeV;
268
269
272
273 for (
G4int i = 0; i < numOfCouples; ++i) {
275 G4cout <<
"Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
276 if (material->
GetName() ==
"Vacuum")
continue;
278 MapData* tableData = new MapData;
280
281 tableMaterialsStructures[mat] = currentMaterialStructure;
282 if (particle == electronDef) {
283
284 G4String fileElectron(
"Inelastic/" + modelName +
"_sigma_inelastic_e-_" + mat);
288 tableData->insert(make_pair(electron, tableE));
289
290
291 std::ostringstream eFullFileName;
292 if (fasterCode) {
293 eFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
295 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
296 }
297 else {
298 eFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
300 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
301 }
302
303 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
304 if (!eDiffCrossSection)
305 {
306 std::stringstream ss;
307 ss << "Missing data " << eFullFileName.str().c_str();
308 std::string sortieString = ss.str();
309
310 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
312
313 else {
314 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
315 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
316 }
317 }
318
319
320
321
322
323 vector<TriDimensionMap>* eDiffCrossSectionData =
324 new vector<TriDimensionMap>;
325 vector<TriDimensionMap>* eNrjTransfData =
326 new vector<TriDimensionMap>;
327 vector<VecMap>* eProbaShellMap = new vector<VecMap>;
328 vector<G4double>* eTdummyVec = new vector<G4double>;
329 VecMap* eVecm = new VecMap;
330
331 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
332 {
333 eDiffCrossSectionData->push_back(TriDimensionMap());
334 eNrjTransfData->push_back(TriDimensionMap());
335 eProbaShellMap->push_back(VecMap());
336 }
337
338 eTdummyVec->push_back(0.);
339 while (!eDiffCrossSection.eof())
340 {
343 eDiffCrossSection >> tDummy >> eDummy;
344 if (tDummy != eTdummyVec->back()) eTdummyVec->push_back(tDummy);
345
347 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
348 {
349 eDiffCrossSection >> tmp;
350 (*eDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
351
352 if (fasterCode)
353 {
354 (*eNrjTransfData)[j][tDummy][(*eDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
355 (*eProbaShellMap)[j][tDummy].push_back((*eDiffCrossSectionData)[j][tDummy][eDummy]);
356 }
357 else {
358 if (!eDiffCrossSection.eof()) (*eDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
359 (*eVecm)[tDummy].push_back(eDummy);
360 }
361 }
362 }
363
365
366
367 if (fasterCode) {
368 eNrjTransStorage[mat] = eNrjTransfData;
369 eProbaShellStorage[mat] = eProbaShellMap;
370 }
371 else {
372 eDiffDatatable[mat] = eDiffCrossSectionData;
373 eVecmStorage[mat] = eVecm;
374 }
375 eIncidentEnergyStorage[mat] = eTdummyVec;
376
377
378
379
380
381 }
382
383
384 if (particle == protonDef)
385 {
386
387 G4String fileProton(
"Inelastic/" + modelName +
"_sigma_inelastic_p_" + mat);
G4cout << fileProton <<
G4endl;
390 tableData->insert(make_pair(proton, tableP));
391
392
393 std::ostringstream pFullFileName;
394 if (fasterCode) {
395 pFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
397 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat" <<
G4endl;
398 }
399 else {
400 pFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
402 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
403 }
404
405 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
406 if (!pDiffCrossSection)
407 {
408 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
409 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
410 else {
411 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
412 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
413 }
414 }
415
416
417
418
419
420
421
422 vector<TriDimensionMap>* pDiffCrossSectionData =
423 new vector<TriDimensionMap>;
424 vector<TriDimensionMap>* pNrjTransfData =
425 new vector<TriDimensionMap>;
426 vector<VecMap>* pProbaShellMap =
427 new vector<VecMap>;
428 vector<G4double>* pTdummyVec =
429 new vector<G4double>;
430 VecMap* eVecm = new VecMap;
431
432 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); ++j)
433
434 {
435 pDiffCrossSectionData->push_back(TriDimensionMap());
436 pNrjTransfData->push_back(TriDimensionMap());
437 pProbaShellMap->push_back(VecMap());
438 }
439
440 pTdummyVec->push_back(0.);
441 while (!pDiffCrossSection.eof())
442 {
445 pDiffCrossSection >> tDummy >> eDummy;
446 if (tDummy != pTdummyVec->back()) pTdummyVec->push_back(tDummy);
447
449 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
450 {
451 pDiffCrossSection >> tmp;
452 (*pDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
453
454
455
456
457 if (fasterCode)
458 {
459 (*pNrjTransfData)[j][tDummy][(*pDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
460 (*pProbaShellMap)[j][tDummy].push_back((*pDiffCrossSectionData)[j][tDummy][eDummy]);
461 }
462 else {
463 if (!pDiffCrossSection.eof()) (*pDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
464 (*eVecm)[tDummy].push_back(eDummy);
465 }
466 }
467 }
468
469
470 if (fasterCode) {
471 pNrjTransStorage[mat] = pNrjTransfData;
472 pProbaShellStorage[mat] = pProbaShellMap;
473 }
474 else {
475 pDiffDatatable[mat] = pDiffCrossSectionData;
476 pVecmStorage[mat] = eVecm;
477 }
478 pIncidentEnergyStorage[mat] = pTdummyVec;
479
480
481
482
483
484
485 }
486 tableTCS[mat] = tableData;
487}
488 if (particle==electronDef)
489 {
492 }
493
494 if (particle==protonDef)
495 {
498 }
499
500 if( verboseLevel>1 )
501 {
502 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
503 << "Energy range: "
507 <<
" with mass (amu) " << particle->
GetPDGMass()/proton_mass_c2
510 }
511
513
515 isInitialised = true;
516}
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)