240{
241 if (isInitialised) { return; }
242
243 if (verboseLevel > 3)
244 G4cout <<
"Calling G4MicroElecInelasticModel_new::Initialise()" <<
G4endl;
245
246 char* path = std::getenv("G4LEDATA");
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
324 vector<TriDimensionMap>* eDiffCrossSectionData = new vector<TriDimensionMap>;
325 vector<TriDimensionMap>* eNrjTransfData = new vector<TriDimensionMap>;
326 vector<VecMap>* eProbaShellMap = new vector<VecMap>;
327 vector<G4double>* eTdummyVec = new vector<G4double>;
328 VecMap* eVecm = new VecMap;
329
330 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
331 {
332 eDiffCrossSectionData->push_back(TriDimensionMap());
333 eNrjTransfData->push_back(TriDimensionMap());
334 eProbaShellMap->push_back(VecMap());
335 }
336
337 eTdummyVec->push_back(0.);
338 while (!eDiffCrossSection.eof())
339 {
342 eDiffCrossSection >> tDummy >> eDummy;
343 if (tDummy != eTdummyVec->back()) eTdummyVec->push_back(tDummy);
344
346 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
347 {
348 eDiffCrossSection >> tmp;
349 (*eDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
350
351 if (fasterCode)
352 {
353 (*eNrjTransfData)[j][tDummy][(*eDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
354 (*eProbaShellMap)[j][tDummy].push_back((*eDiffCrossSectionData)[j][tDummy][eDummy]);
355 }
356 else {
357 if (!eDiffCrossSection.eof()) (*eDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
358 (*eVecm)[tDummy].push_back(eDummy);
359 }
360 }
361 }
362
364
365
366 if (fasterCode) {
367 eNrjTransStorage[mat] = eNrjTransfData;
368 eProbaShellStorage[mat] = eProbaShellMap;
369 }
370 else {
371 eDiffDatatable[mat] = eDiffCrossSectionData;
372 eVecmStorage[mat] = eVecm;
373 }
374 eIncidentEnergyStorage[mat] = eTdummyVec;
375 }
376
377
378 if (particle == protonDef)
379 {
380
381 G4String fileProton(
"Inelastic/" + modelName +
"_sigma_inelastic_p_" + mat);
G4cout << fileProton <<
G4endl;
384 tableData->insert(make_pair(proton, tableP));
385
386
387 std::ostringstream pFullFileName;
388 if (fasterCode) {
389 pFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
391 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat" <<
G4endl;
392 }
393 else {
394 pFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
396 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
397 }
398
399 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
400 if (!pDiffCrossSection)
401 {
402 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
403 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
404 else {
405 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
406 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
407 }
408 }
409
410
411
412
413
414
415
416 vector<TriDimensionMap>* pDiffCrossSectionData = new vector<TriDimensionMap>;
417 vector<TriDimensionMap>* pNrjTransfData = new vector<TriDimensionMap>;
418 vector<VecMap>* pProbaShellMap = new vector<VecMap>;
419 vector<G4double>* pTdummyVec = new vector<G4double>;
420 VecMap* eVecm = new VecMap;
422 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
423
424 {
425
426 pDiffCrossSectionData->push_back(TriDimensionMap());
427 pNrjTransfData->push_back(TriDimensionMap());
428 pProbaShellMap->push_back(VecMap());
429 }
430
431 pTdummyVec->push_back(0.);
432 while (!pDiffCrossSection.eof())
433 {
436 pDiffCrossSection >> tDummy >> eDummy;
437 if (tDummy != pTdummyVec->back()) pTdummyVec->push_back(tDummy);
438
440 for (
int j = 0; j < currentMaterialStructure->
NumberOfLevels(); j++)
441 {
442 pDiffCrossSection >> tmp;
443 (*pDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
444
445
446
447
448 if (fasterCode)
449 {
450 (*pNrjTransfData)[j][tDummy][(*pDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
451 (*pProbaShellMap)[j][tDummy].push_back((*pDiffCrossSectionData)[j][tDummy][eDummy]);
452 }
453 else {
454 if (!pDiffCrossSection.eof()) (*pDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
455 (*eVecm)[tDummy].push_back(eDummy);
456 }
457 }
458 }
459
460
462
463
464 if (fasterCode) {
465 pNrjTransStorage[mat] = pNrjTransfData;
466 pProbaShellStorage[mat] = pProbaShellMap;
467 }
468 else {
469 pDiffDatatable[mat] = pDiffCrossSectionData;
470 pVecmStorage[mat] = eVecm;
471 }
472 pIncidentEnergyStorage[mat] = pTdummyVec;
473 }
474
475
476 tableTCS[mat] = tableData;}
477 if (particle==electronDef)
478 {
481 }
482
483 if (particle==protonDef)
484 {
487 }
488
489 if( verboseLevel>1 )
490 {
491 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
492 << "Energy range: "
496 <<
" with mass (amu) " << particle->
GetPDGMass()/proton_mass_c2
499 }
500
502
504 isInitialised = true;
505}
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4bool LoadData(const G4String &argFileName) override
G4String GetMaterialName()
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)