36 #include "G4HCofThisEvent.hh"
41 :
G4Run(),fTotalEnergyDepositTarget(0.),fTotalEnergyDepositFoil(0.),fParticleTarget(0),fTargetThickness(0.),fTargetDiameter(0.),fFoilThickness(0.),fTargetVolume(0.),fFoilVolume(0.),fPrimariesPerEvent(0),fTimePerEvent(0),fBeamName(
""),fBeamCurrent(0.),fBeamEnergy(0.)
72 std::map<G4String,G4int>::iterator itSI;
73 std::map<G4String,G4double>::iterator itSD;
74 std::map<G4String,G4String>::iterator itSS;
75 std::map<G4int,G4String>::iterator itIS;
79 for (itSI = locPrimaryIsotopeCountTarget.begin(); itSI != locPrimaryIsotopeCountTarget.end(); itSI++)
82 G4int count = itSI->second;
87 for (itSD = locPrimaryIsotopeTimeTarget.begin(); itSD != locPrimaryIsotopeTimeTarget.end(); itSD++)
97 for (itSS = locDecayIsotopeCountTarget.begin(); itSS != locDecayIsotopeCountTarget.end(); itSS++)
104 for (itSD = locDecayIsotopeTimeTarget.begin(); itSD != locDecayIsotopeTimeTarget.end(); itSD++)
106 G4String nameDaughter = itSD->first;
110 std::map<G4String,G4String> locParticleParent = localRun->
fParticleParent;
111 for (itSS = locParticleParent.begin(); itSS != locParticleParent.end(); itSS++)
113 G4String nameDaughter = itSS->first;
118 for (itIS = locIsotopeIDTarget.begin(); itIS != locIsotopeIDTarget.end(); itIS++)
120 G4int ID = itIS->first;
128 for (itSI = locStableIsotopeCountTarget.begin(); itSI != locStableIsotopeCountTarget.end(); itSI++)
131 G4int count = itSI->second;
137 for (itSI = locParticleCountTarget.begin(); itSI != locParticleCountTarget.end(); itSI++)
140 G4int count = itSI->second;
154 if (nbEvents == 0)
return;
159 fOutPut.open(
"Output_General.txt",std::ofstream::out);
160 fOutPut1.open(
"Output_ParentIsotopes.txt",std::ofstream::out);
161 fOutPut2.open(
"Output_DaughterIsotopes.txt",std::ofstream::out);
162 fOutPut3.open(
"Output_OtherParticles.txt",std::ofstream::out);
163 fOutPut4.open(
"Output_StableIsotopes.txt",std::ofstream::out);
169 G4double timeForARun = nbEvents*timePerEvent;
181 else currentFactor = 0.;
184 fOutPut <<
"//-----------------------------------//" <<
G4endl;
186 fOutPut <<
"//-----------------------------------//" <<
G4endl;
191 fOutPut << irradiationTime <<
" - Irradiation time in hour(s)." <<
G4endl;
193 fOutPut <<
"//-----------------------------------//" <<
G4endl;
195 fOutPut << timePerEvent <<
" - Equivalent time per event (s)." <<
G4endl;
199 fOutPut <<
"//-----------------------------------//" <<
G4endl;
214 std::map<G4String,G4double> fPrimaryIsotopeEOBTarget;
215 std::map<G4String,G4double> fPrimaryActivityTarget;
216 std::map<G4String,G4double> fDecayIsotopeEOBTarget;
217 std::map<G4String,G4double> fDecayActivityTarget;
225 std::map<G4String,G4int>::iterator
it;
229 fOutPut1 <<
"//-----------------------------------//\n"
230 <<
"// Data for parent isotopes //\n"
231 <<
"//-----------------------------------//\n" <<
G4endl;
238 G4double count = (it->second)*currentFactor;
244 if(halfLifeTime > minDecay && halfLifeTime < maxDecay) store =
true;
262 fPrimaryIsotopeEOBTarget[
name] = particlesPerSecond/decayConstant * (1. - std::exp(-irradiationTime*3600*decayConstant));
270 fPrimaryActivityTarget[
name]= fPrimaryIsotopeEOBTarget[
name]*decayConstant*conv;
279 primaryActivityTotal = primaryActivityTotal + fPrimaryActivityTarget[
name];
290 fOutPut1 << count/currentFactor <<
" - number of isotopes created during the simulation." <<
G4endl;
291 fOutPut1 << decayConstant <<
" - decay constant in s-1." <<
G4endl;
292 fOutPut1 << halfLifeTime <<
" - half life time in hour(s)." <<
G4endl;
294 fOutPut1 << particlesPerSecond <<
" - isotope per sec." <<
G4endl;
296 fOutPut1 << fPrimaryActivityTarget[
name] <<
" - activity (mCi) at the EOB." <<
G4endl;
307 fOutPut2 <<
"//-----------------------------------//\n"
308 <<
"// Data for daughter isotopes //\n"
309 <<
"//-----------------------------------//\n" <<
G4endl;
311 std::map<G4String,G4String>::iterator it1;
324 if(halfLifeTimeMum > minDecay && halfLifeTimeMum < maxDecay &&
325 halfLifeTimeDaughter > minDecay && halfLifeTimeDaughter < maxDecay){store=
true;}
350 fDecayIsotopeEOBTarget[nameDaughter] = particlesPerSecond*((1 - std::exp(-irradiationTime*3600*decayConstantDaughter))/decayConstantDaughter + (std::exp(-irradiationTime*3600*decayConstantDaughter) - std::exp(-irradiationTime*3600*decayConstantMum))/(decayConstantDaughter-decayConstantMum));
359 fDecayActivityTarget[nameDaughter]= fDecayIsotopeEOBTarget[nameDaughter]*decayConstantDaughter*conv;
363 decayActivityTotal = decayActivityTotal + fDecayActivityTarget[nameDaughter];
368 fOutPut2 << nameDaughter <<
" - name of daughter isotope." <<
G4endl;
370 fOutPut2 << decayConstantDaughter <<
" - decay constant of daughter in s-1." <<
G4endl;
371 fOutPut2 << decayConstantMum <<
" - decay constant of mum in s-1." <<
G4endl;
372 fOutPut2 << halfLifeTimeDaughter <<
" - half life time of daughter in hour(s)." <<
G4endl;
373 fOutPut2 << halfLifeTimeMum <<
" - half life time of mum in hour(s)." <<
G4endl;
374 fOutPut2 << particlesPerSecond <<
" - isotope per sec." <<
G4endl;
375 fOutPut2 << fDecayIsotopeEOBTarget[nameDaughter] <<
" - yield at the EOB." <<
G4endl;
376 fOutPut2 << fDecayActivityTarget[nameDaughter] <<
" - activity (mCi) at the EOB." <<
G4endl;
386 fOutPut3 <<
"//-----------------------------------//\n"
387 <<
"// Data for other particles //\n"
388 <<
"//-----------------------------------//" <<
G4endl;
390 std::map<G4String, G4int>::iterator it3;
403 fOutPut4 <<
"//-----------------------------------//\n"
404 <<
"// Data for stable isotopes //\n"
405 <<
"//-----------------------------------//\n" <<
G4endl;
407 std::map<G4String, G4int>::iterator it6;
420 fPrimaryIsotopeEOBTarget.clear();
421 fPrimaryActivityTarget.clear();
422 fDecayIsotopeEOBTarget.clear();
423 fDecayActivityTarget.clear();
449 fOutPut <<
"//-------------------------------------------------//\n"
450 <<
"// Heating, total activity and process data //\n"
451 <<
"//-------------------------------------------------//" <<
G4endl;
453 fOutPut <<
"Total heating in the target : "
454 << heatTarget <<
" W/mm3" <<
G4endl;
455 fOutPut <<
"The total heating during the irradiation is " << totalEnergyDepositTargetEOB <<
"J/mm3" <<
G4endl;
456 fOutPut <<
"Total heating in the foil : " << heatFoil <<
" W/mm3" <<
G4endl;