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
0031
0032
0033 #include "G4HumanPhantomAnalysisManager.hh"
0034 #include "G4UnitsTable.hh"
0035 #include "G4SystemOfUnits.hh"
0036
0037 G4HumanPhantomAnalysisManager::G4HumanPhantomAnalysisManager()
0038 {
0039 fFactoryOn = false;
0040
0041
0042 for (G4int k=0; k<MaxNtCol; k++) {
0043 fNtColId[k] = 0;
0044 }
0045 }
0046
0047 void G4HumanPhantomAnalysisManager::book()
0048 {
0049 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0050
0051 analysisManager->SetVerboseLevel(2);
0052
0053
0054 G4String fileName = "human_phantom.root";
0055
0056
0057 analysisManager->SetNtupleDirectoryName("human_phantom_ntuple");
0058
0059 G4bool fileOpen = analysisManager->OpenFile(fileName);
0060 if (!fileOpen) {
0061 G4cout << "\n---> HistoManager::book(): cannot open "
0062 << fileName
0063 << G4endl;
0064 return;
0065 }
0066
0067
0068 analysisManager->SetFirstNtupleId(1);
0069 analysisManager->CreateNtuple("1", "3Dedep");
0070 fNtColId[0] = analysisManager->CreateNtupleDColumn("organID");
0071 fNtColId[1] = analysisManager->CreateNtupleDColumn("edep");
0072
0073 analysisManager->FinishNtuple();
0074
0075 fFactoryOn = true;
0076 }
0077
0078 void G4HumanPhantomAnalysisManager::FillNtupleWithEnergyDeposition(G4int organ,G4double energyDep)
0079 {
0080 if (energyDep !=0)
0081 {
0082 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0083 analysisManager->FillNtupleDColumn(1, fNtColId[0], organ);
0084 analysisManager->FillNtupleDColumn(1, fNtColId[1], energyDep);
0085 analysisManager->AddNtupleRow(1);
0086 G4cout << "Analysis: organ " << organ << " edep: "<< energyDep << G4endl;
0087 }
0088 }
0089
0090 void G4HumanPhantomAnalysisManager::save()
0091 {
0092 if (fFactoryOn)
0093 {
0094 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
0095 analysisManager->Write();
0096 analysisManager->CloseFile();
0097 analysisManager->Clear();
0098 fFactoryOn = false;
0099 }
0100 }
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112