ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HumanPhantomRunAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4HumanPhantomRunAction.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
27 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
28 //
29 
32 #include "G4SystemOfUnits.hh"
33 #include "G4UnitsTable.hh"
34 #include "G4ios.hh"
35 #include "G4Run.hh"
36 
37 #ifdef ANALYSIS_USE
39  :analysisMan(analysis)
40  {
41  }
42 #else
44  {}
45 #endif
46 
48 {
49 }
50 
52 {
53  G4int run_number = aRun->GetRunID();
54  G4cout << "### Run " << run_number << " start." << G4endl;
55  energyTotal["logicalHead"]=0.;
56  energyTotal["logicalTrunk"]=0.;
57  energyTotal["logicalLeftLeg"]=0.;
58  energyTotal["logicalRightLeg"]=0.;
59  energyTotal["logicalSkull"]=0.;
60  energyTotal["logicalLeftArmBone"]=0.;
61  energyTotal["logicalRightArmBone"]=0.;
62  energyTotal["logicalUpperSpine"]=0.;
63  energyTotal["logicalMiddleLowerSpine"]=0.;
64  energyTotal["logicalPelvis"]=0.;
65  energyTotal["logicalRibCage"]=0.;
66  energyTotal["logicalLeftClavicle"]=0.;
67  energyTotal["logicalRightClavicle"]=0.;
68  energyTotal["logicalLeftLegBone"]=0.;
69  energyTotal["logicalRightLegBone"]=0.;
70  energyTotal["logicalLeftScapula"]=0.;
71  energyTotal["logicalRightScapula"]=0.;
72  energyTotal["logicalHeart"]=0.;
73  energyTotal["logicalThyroid"]=0.;
74  energyTotal["logicalThymus"]=0.;
75  energyTotal["logicalMaleGenitalia"]=0.;
76  energyTotal["logicalBrain"]=0.;
77  energyTotal["logicalStomach"]=0.;
78  energyTotal["logicalUpperLargeIntestine"]=0.;
79  energyTotal["logicalLowerLargeIntestine"]=0.;
80  energyTotal["logicalSmallIntestine"]=0;
81  energyTotal["logicalSpleen"]=0.;
82  energyTotal["logicalPancreas"]=0.;
83  energyTotal["logicalLeftKidney"]=0.;
84  energyTotal["logicalRightKidney"]=0.;
85  energyTotal["logicalUrinaryBladder"]=0.;
86  energyTotal["logicalUterus"]=0.;
87  energyTotal["logicalLeftLung"]=0.;
88  energyTotal["logicalRightLung"]=0.;
89  energyTotal["logicalLeftOvary"]=0.;
90  energyTotal["logicalRightOvary"]=0.;
91  energyTotal["logicalLeftTeste"]=0;
92  energyTotal["logicalRightTeste"]=0;
93  energyTotal["logicalLeftBreast"]=0.;
94  energyTotal["logicalRightBreast"]=0.;
95  energyTotal["logicalLeftAdrenal"]=0.;
96  energyTotal["logicalRightAdrenal"]=0.;
97 
98 #ifdef ANALYSIS_USE
99  // Create ROOT file, histograms and ntuple
100  analysisMan -> book();
101 #endif
102 }
103 
105 {
106  G4cout << "Number of events = " << aRun->GetNumberOfEvent() << G4endl;
108 
109 #ifdef ANALYSIS_USE
110 // Close the output ROOT file with the results
111  analysisMan -> save();
112 #endif
113 }
114 
115 
117  G4double energyDeposit)
118 
119 {
120  energyTotal[bName] += energyDeposit;
121 }
122 
124 {
125  std::map<std::string,G4double>::iterator i = energyTotal.begin();
126  std::map<std::string,G4double>::iterator end = energyTotal.end();
127 
128  G4double totalEnergyDepositInPhantom =0.;
129  G4int k=0;
130  while(i!=end)
131  {
132  G4String bodypart = i->first;
133  G4double energyDep = i->second;
134  // if(energyDep != 0.)
135  // {
136 
137  G4cout << "Energy Total in Run:" << bodypart << ", ID: " << k
138  << ", Energy Deposition (MeV): "
139  << energyDep/MeV
140  << G4endl;
141 
142 #ifdef ANALYSIS_USE
143  // Fill Ntuple
144  analysisMan -> FillNtupleWithEnergyDeposition(k, energyDep/MeV);
145 #endif
146  i++;
147  k++;
148 
149  totalEnergyDepositInPhantom += energyDep;
150  }
151 
152 
153  G4cout << "Total Energy deposit in the body is: "
154  << totalEnergyDepositInPhantom/MeV << " MeV" <<G4endl;
155 }