44 #include "DetectorConstruction.hh"
45 #include "PrimaryGeneratorAction.hh"
46 #include "Analysis.hh"
64 :
G4Run(), fDetector(det),
65 fParticle(0), fEkin(0.),
67 fTrackLen(0.), fTrackLen2(0.)
134 std::map<G4String,G4int>::iterator it =
fProcCounter.find(procName);
152 ParticleData&
data = it->second;
157 if (Ekin < emin) data.fEmin = Ekin;
159 if (Ekin > emax) data.fEmax = Ekin;
177 if (Ekin < emin) data.
fEmin = Ekin;
179 if (Ekin > emax) data.
fEmax = Ekin;
196 std::map<G4String,G4int>::iterator it =
fMoleculeNumber.find(moleculename);
217 const Run* localRun =
static_cast<const Run*
>(run);
230 std::map<G4String,G4int>::const_iterator itp;
235 G4int localCount = itp->second;
245 std::map<G4String,ParticleData>::const_iterator itc;
250 const ParticleData& localData = itc->second;
253 = ParticleData(localData.fCount,
260 data.fCount += localData.fCount;
261 data.fEmean += localData.fEmean;
263 if (emin < data.fEmin) data.fEmin = emin;
265 if (emax > data.fEmax) data.fEmax =
emax;
270 std::map<G4String,ParticleData>::const_iterator itn;
275 const ParticleData& localData = itn->second;
278 = ParticleData(localData.fCount,
285 data.fCount += localData.fCount;
286 data.fEmean += localData.fEmean;
288 if (emin < data.fEmin) data.fEmin = emin;
290 if (emax > data.fEmax) data.fEmax =
emax;
297 std::map<G4String,G4int>::const_iterator itm;
302 G4int localCount = itm->second;
362 if (rms>0.) rms = std::sqrt(rms);
else rms = 0.;
367 EdepTotal /= TotNbofEvents; EdepTotal2 /= TotNbofEvents;
368 G4double rmst = EdepTotal2 - EdepTotal*EdepTotal;
369 if (rmst>0.) rmst = std::sqrt(rmst);
389 FILE *
fp = fopen(
"OutputPerEvent.out",
"r");
391 ncols = fscanf(fp,
" %f %f %f %f %f %f %f %f",
392 &tmp, &tmp, &tmp, &tmp, &En, &tmp, &tmp, &tmp);
393 if (ncols < 0)
break;
400 G4double FluenceDoseperBeam = 0.160218*(dEdxFull)/(GunArea*std::pow(10,18)) ;
402 G4cout <<
"\n ======= The summary of simulation results 'neuron' ========\n";
404 <<
"\n Primary particle = " << Particle
405 <<
"\n Kinetic energy of beam = " <<
fEkin/
MeV<<
" A*MeV"
406 <<
"\n Particle traversals the neuron = " << Ntrav<<
" of "<<
numberOfEvent
407 <<
"\n Full LET of beam as formulas = " <<dEdxFull/(
keV/
um) <<
" keV/um"
408 <<
"\n Mean LET of beam as simulation = "
409 << meandEdx <<
" +- " << meandEdxerr <<
" keV/um"
410 <<
"\n Mean track length of beam = "
411 << fTrackLen/
um <<
" +- " << rms <<
" um"
412 <<
"\n Particle fluence = "
414 <<
"\n Fluence dose (full) = "
416 <<
"\n Fluence dose ber beam = "
423 G4cout <<
"\n List of generated physical process:" <<
G4endl;
426 std::map<G4String,G4int>::iterator it;
429 G4int count = it->second;
430 G4String space =
" ";
if (++index%1 == 0) space =
"\n";
431 G4cout <<
" " << std::setw(20) << procName <<
"="<< std::setw(7) << count
438 G4cout <<
"\n List of generated particles outside neuron structure:"
441 std::map<G4String,ParticleData>::iterator itc;
444 ParticleData data = itc->second;
445 G4int count = data.fCount;
450 G4double Eflow = data.fEmean/TotNbofEvents;
452 G4cout <<
" " << std::setw(13) << name <<
" : " << std::setw(7) << count
453 <<
" Emean = " << std::setw(wid) <<
G4BestUnit(eMean,
"Energy")
456 <<
") \tEflow/event = " <<
G4BestUnit(Eflow,
"Energy")
462 G4cout <<
"\n Number of secondary particles inside neuron structure:"
465 std::map<G4String,ParticleData>::iterator itn;
468 ParticleData data = itn->second;
469 G4int count = data.fCount;
476 G4cout <<
" " << std::setw(13) << name <<
" : " << std::setw(7) << count
486 G4cout <<
"\n Number of molecular products inside neuron structure:"
487 <<
"\n time: 1 ps - 10 ps "<<
G4endl;
490 std::map<G4String,G4int>::iterator itm;
493 G4int count = itm->second;
494 G4String space =
" ";
if (++ind%3 == 0) space =
"\n";
496 G4cout <<
" " << std::setw(13) << moleculeName <<
" : " << std::setw(7)
504 G4cout <<
"\n Total energy (MeV) deposition :" <<
G4endl;
507 << std::setw(13) <<
"All volume: " << std::setw(7) <<
fEdepAll/
MeV<<
"\n "
508 <<
" " << std::setw(13) <<
"Bounding slice: "
510 <<
" " << std::setw(13) <<
"Neuron: " << std::setw(7)
512 <<
" " << std::setw(13) <<
"Soma: " << std::setw(7)
514 <<
" " << std::setw(13) <<
"Dendrites: " << std::setw(7)
516 <<
" " << std::setw(13) <<
"Axon: " << std::setw(7)
523 G4int somaCompHit = 0;
529 remove (
"Soma3DEdep.out");
550 std::ofstream WriteDataInSoma(
"Soma3DEdep.out", std::ios::app);
558 << fSoma3DEdep[i]/
keV <<
'\t' <<
" "
573 somaCompEdep /= somaCompHit; somaCompEdep2 /= somaCompHit;
574 rmsEdepS = somaCompEdep2 - somaCompEdep*somaCompEdep;
575 if (rmsEdepS>0.) rmsEdepS = std::sqrt(rmsEdepS);
577 somaCompDose /= somaCompHit; somaCompDose2 /= somaCompHit;
578 rmsDoseS = somaCompDose2 - somaCompDose*somaCompDose;
579 if (rmsDoseS>0.) rmsDoseS = std::sqrt(rmsDoseS);
583 G4int DendCompHit = 0;
588 remove (
"Dend3DEdep.out");
608 std::ofstream WriteDataInDend(
"Dend3DEdep.out", std::ios::app);
616 << fDend3DEdep[i]/
keV <<
'\t' <<
" "
626 DendCompEdep /= DendCompHit; DendCompEdep2 /= DendCompHit;
627 rmsEdepD = DendCompEdep2 - DendCompEdep*DendCompEdep;
628 if (rmsEdepD>0.) rmsEdepD = std::sqrt(rmsEdepD);
630 DendCompDose /= DendCompHit; DendCompDose2 /= DendCompHit;
631 rmsDoseD = DendCompDose2 - DendCompDose*DendCompDose;
632 if (rmsDoseD>0.) rmsDoseD = std::sqrt(rmsDoseD);
636 G4int AxonCompHit = 0;
641 remove (
"Axon3DEdep.out");
661 std::ofstream WriteDataInAxon(
"Axon3DEdep.out", std::ios::app);
668 << fAxon3DEdep[i]/
keV <<
'\t' <<
" "
678 AxonCompEdep /= AxonCompHit; AxonCompEdep2 /= AxonCompHit;
679 rmsEdepA = AxonCompEdep2 - AxonCompEdep*AxonCompEdep;
680 if (rmsEdepA>0.) rmsEdepA = std::sqrt(rmsEdepA);
682 AxonCompDose /= AxonCompHit; AxonCompDose2 /= AxonCompHit;
683 rmsDoseA = AxonCompDose2 - AxonCompDose*AxonCompDose;
684 if (rmsDoseA>0.) rmsDoseA = std::sqrt(rmsDoseA);
688 G4cout <<
"\n Number of compartments traversed by particle tracks :"
690 G4cout <<
" " << std::setw(13) <<
"Soma: " << std::setw(7) << somaCompHit
692 <<
" " << std::setw(13) <<
"Dendrites: " << std::setw(7) << DendCompHit
694 <<
" " << std::setw(13) <<
"Axon: " << std::setw(7) << AxonCompHit
734 G4cout<<
"\n Dendritic (or Axon) compartmental energy deposits \n"
735 <<
" at the distance from Soma have been written into *.out files:"
736 <<
"\n Dend3DEdep.out, Axon3DEdep.out, Soma3DEdep.out"
737 <<
"\n Outputs of energy deposition per event written in data file:"
738 <<
"\n OutputPerEvent.out"
std::map< G4String, ParticleData > fParticleDataMap1
std::map< G4String, G4int > fMoleculeNumber
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
G4ThreeVector GetPosSomacomp(G4int i)
DetectorConstruction * fDetector
static constexpr double MeV
G4int GetnbDendritecomp()
static constexpr double keV
void AddPrimaryLET(G4double let)
const G4String & GetName() const
void MoleculeCountNeuron(G4Molecule *molecule)
G4double GetDistAxonsoma(G4int i)
const G4String & GetParticleName() const
G4double GetPDGCharge() const
void AddEflow(G4double eflow)
static const G4double emax
std::vector< G4double > fEnergyFlow
static constexpr double kg
void ParticleCount(G4String, G4double)
static constexpr double um
void MoleculeCount(G4String, G4double)
G4double GetDistADendSoma(G4int i)
const XML_Char const XML_Char * data
G4ThreeVector GetPosAxoncomp(G4int i)
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
const G4String & GetProcessName() const
virtual void Merge(const G4Run *)
std::map< G4String, G4int > fProcCounter
G4ParticleDefinition * fParticle
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
std::map< G4String, ParticleData > fParticleDataMap2
G4ThreeVector GetPosDendcomp(G4int i)
void ParticleCountNeuron(G4String, G4double)
const G4Material * GetTargetMaterial() const
void CountProcesses(G4String procName)
static constexpr double joule
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
void SetTrackLength(G4double tracklen)
virtual void Merge(const G4Run *)
G4double GetTotSurfMedium()
Simple detector construction with a box volume placed in a world.
G4double GetDistBDendSoma(G4int i)