199{
200 if (isInitialised) { return; }
201
202 if (verboseLevel > 3)
203 G4cout <<
"Calling G4MicroElecInelasticModel_new::Initialise()" <<
G4endl;
204
206 if (!path)
207 {
209 return;
210 }
211
215
216
221
223
224
226 highEnergyLimit[
electron] = 10.0 * MeV;
227
228
231
232 for (
G4int i = 0; i < numOfCouples; ++i) {
234 G4cout <<
"Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
235 if (material->
GetName() ==
"Vacuum")
continue;
237 MapData* tableData = new MapData;
239
240 tableMaterialsStructures[mat] = currentMaterialStructure;
241 if (particle == electronDef) {
242
243 G4String fileElectron(
"Inelastic/" + modelName +
"_sigma_inelastic_e-_" + mat);
247 tableData->insert(make_pair(electron, tableE));
248
249
250 std::ostringstream eFullFileName;
251 if (fasterCode) {
252 eFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
254 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
255 }
256 else {
257 eFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_e-_" + mat + ".dat";
259 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
260 }
261
262 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
263 if (!eDiffCrossSection)
264 {
265 std::stringstream ss;
266 ss << "Missing data " << eFullFileName.str().c_str();
267 std::string sortieString = ss.str();
268
269 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
271 else {
272 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
273 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
274 }
275 }
276
277
278
279
280
282 vector<TriDimensionMap>* eDiffCrossSectionData =
283 new vector<TriDimensionMap>;
284 vector<TriDimensionMap>* eNrjTransfData =
285 new vector<TriDimensionMap>;
286 vector<VecMap>* eProbaShellMap = new vector<VecMap>;
287 vector<G4double>* eTdummyVec = new vector<G4double>;
288 VecMap* eVecm = new VecMap;
289
291 {
292 eDiffCrossSectionData->push_back(TriDimensionMap());
293 eNrjTransfData->push_back(TriDimensionMap());
294 eProbaShellMap->push_back(VecMap());
295 }
296
297 eTdummyVec->push_back(0.);
298 while (!eDiffCrossSection.eof())
299 {
302 eDiffCrossSection >> tDummy >> eDummy;
303 if (tDummy != eTdummyVec->back()) eTdummyVec->push_back(tDummy);
304
307 {
308 eDiffCrossSection >> tmp;
309 (*eDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
310
311 if (fasterCode)
312 {
313 (*eNrjTransfData)[j][tDummy][(*eDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
314 (*eProbaShellMap)[j][tDummy].push_back((*eDiffCrossSectionData)[j][tDummy][eDummy]);
315 }
316 else {
317 (*eDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
318 (*eVecm)[tDummy].push_back(eDummy);
319 }
320 }
321 }
322
323
324
325
326 if (fasterCode) {
327 isUsed1 = true;
328 eNrjTransStorage[mat] = eNrjTransfData;
329 eProbaShellStorage[mat] = eProbaShellMap;
330 }
331 else {
332 eDiffDatatable[mat] = eDiffCrossSectionData;
333 eVecmStorage[mat] = eVecm;
334 }
335 eIncidentEnergyStorage[mat] = eTdummyVec;
336
337
338 if (!isUsed1) {
339 delete eProbaShellMap;
340 delete eNrjTransfData;
341 } else {
342 delete eDiffCrossSectionData;
343 delete eVecm;
344 }
345 }
346
347
348 if (particle == protonDef)
349 {
350
351 G4String fileProton(
"Inelastic/" + modelName +
"_sigma_inelastic_p_" + mat);
G4cout << fileProton <<
G4endl;
354 tableData->insert(make_pair(proton, tableP));
355
356
357 std::ostringstream pFullFileName;
358 if (fasterCode) {
359 pFullFileName << path << "/microelec/Inelastic/cumulated_" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
361 G4cout <<
"Inelastic/cumulated_" + modelName +
"_sigmadiff_inelastic_p_" + mat +
".dat" <<
G4endl;
362 }
363 else {
364 pFullFileName << path << "/microelec/Inelastic/" + modelName + "_sigmadiff_inelastic_p_" + mat + ".dat";
366 G4cout <<
"Inelastic/" + modelName +
"_sigmadiff_inelastic_e-_" + mat +
".dat" <<
G4endl;
367 }
368
369 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
370 if (!pDiffCrossSection)
371 {
372 if (fasterCode)
G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
373 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
374 else {
375 G4Exception(
"G4MicroElecInelasticModel_new::Initialise",
"em0003",
376 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
377 }
378 }
379
380
381
382
383
384
385
387 vector<TriDimensionMap>* pDiffCrossSectionData =
388 new vector<TriDimensionMap>;
389 vector<TriDimensionMap>* pNrjTransfData =
390 new vector<TriDimensionMap>;
391 vector<VecMap>* pProbaShellMap =
392 new vector<VecMap>;
393 vector<G4double>* pTdummyVec =
394 new vector<G4double>;
395 VecMap* pVecm = new VecMap;
396
398
399 {
400 pDiffCrossSectionData->push_back(TriDimensionMap());
401 pNrjTransfData->push_back(TriDimensionMap());
402 pProbaShellMap->push_back(VecMap());
403 }
404
405 pTdummyVec->push_back(0.);
406 while (!pDiffCrossSection.eof())
407 {
410 pDiffCrossSection >> tDummy >> eDummy;
411 if (tDummy != pTdummyVec->back()) pTdummyVec->push_back(tDummy);
412
415 {
416 pDiffCrossSection >> tmp;
417 (*pDiffCrossSectionData)[j][tDummy][eDummy] = tmp;
418
419
420
421
422 if (fasterCode)
423 {
424 (*pNrjTransfData)[j][tDummy][(*pDiffCrossSectionData)[j][tDummy][eDummy]] = eDummy;
425 (*pProbaShellMap)[j][tDummy].push_back((*pDiffCrossSectionData)[j][tDummy][eDummy]);
426 }
427 else {
428 (*pDiffCrossSectionData)[j][tDummy][eDummy] *= scaleFactor;
429 (*pVecm)[tDummy].push_back(eDummy);
430 }
431 }
432 }
433
434
435 if (fasterCode) {
436 isUsed1 = true;
437 pNrjTransStorage[mat] = pNrjTransfData;
438 pProbaShellStorage[mat] = pProbaShellMap;
439 }
440 else {
441 pDiffDatatable[mat] = pDiffCrossSectionData;
442 pVecmStorage[mat] = pVecm;
443 }
444 pIncidentEnergyStorage[mat] = pTdummyVec;
445
446
447 if (!isUsed1) {
448 delete pProbaShellMap;
449 delete pNrjTransfData;
450 } else {
451 delete pDiffCrossSectionData;
452 delete pVecm;
453 }
454 }
455 tableTCS[mat] = tableData;
456 }
457 if (particle==electronDef)
458 {
461 }
462
463 if (particle==protonDef)
464 {
467 }
468
469 if( verboseLevel>1 )
470 {
471 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
472 << "Energy range: "
476 <<
" with mass (amu) " << particle->
GetPDGMass()/proton_mass_c2
479 }
480
482
484 isInitialised = true;
485}
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)