43 #include "DetectorConstruction.hh"
44 #include "PrimaryGeneratorAction.hh"
45 #include "Analysis.hh"
63 :
G4Run(), fDetector(det),
64 fParticle(0), fEkin(0.),
66 fTrackLen(0.), fTrackLen2(0.)
133 std::map<G4String,G4int>::iterator
it =
fProcCounter.find(procName);
151 ParticleData&
data = it->second;
156 if (Ekin < emin) data.fEmin = Ekin;
158 if (Ekin > emax) data.fEmax = Ekin;
176 if (Ekin < emin) data.
fEmin = Ekin;
178 if (Ekin > emax) data.
fEmax = Ekin;
195 std::map<G4String,G4int>::iterator it =
fMoleculeNumber.find(moleculename);
216 const Run* localRun =
static_cast<const Run*
>(run);
229 std::map<G4String,G4int>::const_iterator itp;
234 G4int localCount = itp->second;
244 std::map<G4String,ParticleData>::const_iterator itc;
249 const ParticleData& localData = itc->second;
252 = ParticleData(localData.fCount,
259 data.fCount += localData.fCount;
260 data.fEmean += localData.fEmean;
262 if (emin < data.fEmin) data.fEmin =
emin;
264 if (emax > data.fEmax) data.fEmax =
emax;
269 std::map<G4String,ParticleData>::const_iterator itn;
274 const ParticleData& localData = itn->second;
277 = ParticleData(localData.fCount,
284 data.fCount += localData.fCount;
285 data.fEmean += localData.fEmean;
287 if (emin < data.fEmin) data.fEmin =
emin;
289 if (emax > data.fEmax) data.fEmax =
emax;
296 std::map<G4String,G4int>::const_iterator itm;
301 G4int localCount = itm->second;
361 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
366 EdepTotal /= TotNbofEvents; EdepTotal2 /= TotNbofEvents;
367 G4double rmst = EdepTotal2 - EdepTotal*EdepTotal;
368 if (rmst>0.) rmst = std::sqrt(rmst);
388 FILE *
fp = fopen(
"OutputPerEvent.out",
"r");
390 ncols = fscanf(fp,
" %f %f %f %f %f %f %f %f",
391 &tmp, &tmp, &tmp, &tmp, &En, &tmp, &tmp, &tmp);
392 if (ncols < 0)
break;
399 G4double FluenceDoseperBeam = 0.160218*(dEdxFull)/(GunArea*std::pow(10,18)) ;
401 G4cout <<
"\n ======= The summary of simulation results 'neuron' ========\n";
403 <<
"\n Primary particle = " << Particle
404 <<
"\n Kinetic energy of beam = " <<
fEkin/
MeV<<
" A*MeV"
405 <<
"\n Particle traversals the neuron = " << Ntrav<<
" of "<<
numberOfEvent
406 <<
"\n Full LET of beam as formulas = " <<dEdxFull/(
keV/
um) <<
" keV/um"
407 <<
"\n Mean LET of beam as simulation = "
408 << meandEdx <<
" +- " << meandEdxerr <<
" keV/um"
409 <<
"\n Mean track length of beam = "
410 << fTrackLen/
um <<
" +- " << rms <<
" um"
411 <<
"\n Particle fluence = "
413 <<
"\n Fluence dose (full) = "
415 <<
"\n Fluence dose ber beam = "
422 G4cout <<
"\n List of generated physical process:" <<
G4endl;
425 std::map<G4String,G4int>::iterator
it;
428 G4int count = it->second;
429 G4String space =
" ";
if (++index%1 == 0) space =
"\n";
430 G4cout <<
" " << std::setw(20) << procName <<
"="<< std::setw(7) << count
437 G4cout <<
"\n List of generated particles outside neuron structure:"
440 std::map<G4String,ParticleData>::iterator itc;
443 ParticleData data = itc->second;
444 G4int count = data.fCount;
449 G4double Eflow = data.fEmean/TotNbofEvents;
451 G4cout <<
" " << std::setw(13) << name <<
" : " << std::setw(7) << count
452 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
455 <<
") \tEflow/event = " <<
G4BestUnit(Eflow,
"Energy")
461 G4cout <<
"\n Number of secondary particles inside neuron structure:"
464 std::map<G4String,ParticleData>::iterator itn;
467 ParticleData data = itn->second;
468 G4int count = data.fCount;
475 G4cout <<
" " << std::setw(13) << name <<
" : " << std::setw(7) << count
485 G4cout <<
"\n Number of molecular products inside neuron structure:"
486 <<
"\n time: 1 ps - 10 ps "<<
G4endl;
489 std::map<G4String,G4int>::iterator itm;
492 G4int count = itm->second;
493 G4String space =
" ";
if (++ind%3 == 0) space =
"\n";
495 G4cout <<
" " << std::setw(13) << moleculeName <<
" : " << std::setw(7)
503 G4cout <<
"\n Total energy (MeV) deposition :" <<
G4endl;
506 << std::setw(13) <<
"All volume: " << std::setw(7) <<
fEdepAll/
MeV<<
"\n "
507 <<
" " << std::setw(13) <<
"Bounding slice: "
509 <<
" " << std::setw(13) <<
"Neuron: " << std::setw(7)
511 <<
" " << std::setw(13) <<
"Soma: " << std::setw(7)
513 <<
" " << std::setw(13) <<
"Dendrites: " << std::setw(7)
515 <<
" " << std::setw(13) <<
"Axon: " << std::setw(7)
522 G4int somaCompHit = 0;
528 remove (
"Soma3DEdep.out");
549 std::ofstream WriteDataInSoma(
"Soma3DEdep.out",
std::ios::app);
557 << fSoma3DEdep[i]/
keV <<
'\t' <<
" "
572 somaCompEdep /= somaCompHit; somaCompEdep2 /= somaCompHit;
573 rmsEdepS = somaCompEdep2 - somaCompEdep*somaCompEdep;
574 if (rmsEdepS>0.) rmsEdepS = std::sqrt(rmsEdepS);
576 somaCompDose /= somaCompHit; somaCompDose2 /= somaCompHit;
577 rmsDoseS = somaCompDose2 - somaCompDose*somaCompDose;
578 if (rmsDoseS>0.) rmsDoseS = std::sqrt(rmsDoseS);
582 G4int DendCompHit = 0;
587 remove (
"Dend3DEdep.out");
607 std::ofstream WriteDataInDend(
"Dend3DEdep.out",
std::ios::app);
615 << fDend3DEdep[i]/
keV <<
'\t' <<
" "
625 DendCompEdep /= DendCompHit; DendCompEdep2 /= DendCompHit;
626 rmsEdepD = DendCompEdep2 - DendCompEdep*DendCompEdep;
627 if (rmsEdepD>0.) rmsEdepD = std::sqrt(rmsEdepD);
629 DendCompDose /= DendCompHit; DendCompDose2 /= DendCompHit;
630 rmsDoseD = DendCompDose2 - DendCompDose*DendCompDose;
631 if (rmsDoseD>0.) rmsDoseD = std::sqrt(rmsDoseD);
635 G4int AxonCompHit = 0;
640 remove (
"Axon3DEdep.out");
660 std::ofstream WriteDataInAxon(
"Axon3DEdep.out",
std::ios::app);
667 << fAxon3DEdep[i]/
keV <<
'\t' <<
" "
677 AxonCompEdep /= AxonCompHit; AxonCompEdep2 /= AxonCompHit;
678 rmsEdepA = AxonCompEdep2 - AxonCompEdep*AxonCompEdep;
679 if (rmsEdepA>0.) rmsEdepA = std::sqrt(rmsEdepA);
681 AxonCompDose /= AxonCompHit; AxonCompDose2 /= AxonCompHit;
682 rmsDoseA = AxonCompDose2 - AxonCompDose*AxonCompDose;
683 if (rmsDoseA>0.) rmsDoseA = std::sqrt(rmsDoseA);
687 G4cout <<
"\n Number of compartments traversed by particle tracks :"
689 G4cout <<
" " << std::setw(13) <<
"Soma: " << std::setw(7) << somaCompHit
691 <<
" " << std::setw(13) <<
"Dendrites: " << std::setw(7) << DendCompHit
693 <<
" " << std::setw(13) <<
"Axon: " << std::setw(7) << AxonCompHit
733 G4cout<<
"\n Dendritic (or Axon) compartmental energy deposits \n"
734 <<
" at the distance from Soma have been written into *.out files:"
735 <<
"\n Dend3DEdep.out, Axon3DEdep.out, Soma3DEdep.out"
736 <<
"\n Outputs of energy deposition per event written in data file:"
737 <<
"\n OutputPerEvent.out"