File indexing completed on 2025-02-23 09:20:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "G4HumanPhantomRunAction.hh"
0031 #include "G4HumanPhantomAnalysisManager.hh"
0032 #include "G4SystemOfUnits.hh"
0033 #include "G4UnitsTable.hh"
0034 #include "G4ios.hh"
0035 #include "G4Run.hh"
0036
0037 G4HumanPhantomRunAction::G4HumanPhantomRunAction(G4HumanPhantomAnalysisManager* analysis) :fAnalysisMan(analysis)
0038 { }
0039
0040 G4HumanPhantomRunAction::~G4HumanPhantomRunAction()
0041 {}
0042
0043 void G4HumanPhantomRunAction::BeginOfRunAction(const G4Run* aRun)
0044 {
0045 G4int run_number = aRun->GetRunID();
0046 G4cout << "### Run " << run_number << " start." << G4endl;
0047 fEnergyTotal["logicalHead"]=0.;
0048 fEnergyTotal["logicalTrunk"]=0.;
0049 fEnergyTotal["logicalLeftLeg"]=0.;
0050 fEnergyTotal["logicalRightLeg"]=0.;
0051 fEnergyTotal["logicalSkull"]=0.;
0052 fEnergyTotal["logicalLeftArmBone"]=0.;
0053 fEnergyTotal["logicalRightArmBone"]=0.;
0054 fEnergyTotal["logicalUpperSpine"]=0.;
0055 fEnergyTotal["logicalMiddleLowerSpine"]=0.;
0056 fEnergyTotal["logicalPelvis"]=0.;
0057 fEnergyTotal["logicalRibCage"]=0.;
0058 fEnergyTotal["logicalLeftClavicle"]=0.;
0059 fEnergyTotal["logicalRightClavicle"]=0.;
0060 fEnergyTotal["logicalLeftLegBone"]=0.;
0061 fEnergyTotal["logicalRightLegBone"]=0.;
0062 fEnergyTotal["logicalLeftScapula"]=0.;
0063 fEnergyTotal["logicalRightScapula"]=0.;
0064 fEnergyTotal["logicalHeart"]=0.;
0065 fEnergyTotal["logicalThyroid"]=0.;
0066 fEnergyTotal["logicalThymus"]=0.;
0067 fEnergyTotal["logicalMaleGenitalia"]=0.;
0068 fEnergyTotal["logicalBrain"]=0.;
0069 fEnergyTotal["logicalStomach"]=0.;
0070 fEnergyTotal["logicalUpperLargeIntestine"]=0.;
0071 fEnergyTotal["logicalLowerLargeIntestine"]=0.;
0072 fEnergyTotal["logicalSmallIntestine"]=0;
0073 fEnergyTotal["logicalSpleen"]=0.;
0074 fEnergyTotal["logicalPancreas"]=0.;
0075 fEnergyTotal["logicalLeftKidney"]=0.;
0076 fEnergyTotal["logicalRightKidney"]=0.;
0077 fEnergyTotal["logicalUrinaryBladder"]=0.;
0078 fEnergyTotal["logicalUterus"]=0.;
0079 fEnergyTotal["logicalLeftLung"]=0.;
0080 fEnergyTotal["logicalRightLung"]=0.;
0081 fEnergyTotal["logicalLeftOvary"]=0.;
0082 fEnergyTotal["logicalRightOvary"]=0.;
0083 fEnergyTotal["logicalLeftTeste"]=0;
0084 fEnergyTotal["logicalRightTeste"]=0;
0085 fEnergyTotal["logicalLeftBreast"]=0.;
0086 fEnergyTotal["logicalRightBreast"]=0.;
0087 fEnergyTotal["logicalLeftAdrenal"]=0.;
0088 fEnergyTotal["logicalRightAdrenal"]=0.;
0089
0090
0091 fAnalysisMan -> book();
0092 }
0093
0094 void G4HumanPhantomRunAction::EndOfRunAction(const G4Run* aRun)
0095 {
0096 G4cout << "Number of events = " << aRun->GetNumberOfEvent() << G4endl;
0097 totalRunEnergyDeposit();
0098
0099
0100 fAnalysisMan -> save();
0101 }
0102
0103 void G4HumanPhantomRunAction::Fill(G4String bName,
0104 G4double energyDeposit)
0105 {
0106 fEnergyTotal[bName] += energyDeposit;
0107 }
0108
0109 void G4HumanPhantomRunAction::totalRunEnergyDeposit()
0110 {
0111 std::map<std::string,G4double>::iterator i = fEnergyTotal.begin();
0112 std::map<std::string,G4double>::iterator end = fEnergyTotal.end();
0113
0114 G4double totalEnergyDepositInPhantom =0.;
0115 G4int k=0;
0116 while(i!=end)
0117 {
0118 G4String bodypart = i->first;
0119 G4double energyDep = i->second;
0120
0121
0122
0123 G4cout << "Energy Total in Run:" << bodypart << ", ID: " << k
0124 << ", Energy Deposition (MeV): "
0125 << energyDep/MeV
0126 << G4endl;
0127
0128
0129 fAnalysisMan -> FillNtupleWithEnergyDeposition(k, energyDep/MeV);
0130
0131 i++;
0132 k++;
0133
0134 totalEnergyDepositInPhantom += energyDep;
0135 }
0136
0137 G4cout << "Total Energy deposit in the body is: "
0138 << totalEnergyDepositInPhantom/MeV << " MeV" <<G4endl;
0139 }