ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4HumanPhantomAnalysisManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4HumanPhantomAnalysisManager.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
Author: Susanna Guatelli, University of Wollongong, Australia
27
*/
28
// The class G4HumanPhantomAnalysisManager creates and manages ntuples
29
30
// The analysis was included in this application following the extended Geant4
31
// example analysis/AnaEx01
32
33
#include <stdlib.h>
34
#include "
G4HumanPhantomAnalysisManager.hh
"
35
#include "
G4UnitsTable.hh
"
36
#include "
G4SystemOfUnits.hh
"
37
38
G4HumanPhantomAnalysisManager::G4HumanPhantomAnalysisManager
()
39
{
40
41
factoryOn
=
false
;
42
43
// Initialization ntuple
44
for
(
G4int
k
=0;
k
<
MaxNtCol
;
k
++) {
45
fNtColId
[
k
] = 0;
46
}
47
}
48
49
G4HumanPhantomAnalysisManager::~G4HumanPhantomAnalysisManager
()
50
{
51
}
52
53
void
G4HumanPhantomAnalysisManager::book
()
54
{
55
G4AnalysisManager
*
AnalysisManager
=
G4AnalysisManager::Instance
();
56
57
AnalysisManager->
SetVerboseLevel
(2);
58
59
// Create a root file
60
G4String
fileName =
"human_phantom.root"
;
61
62
// Create directories
63
AnalysisManager->
SetNtupleDirectoryName
(
"human_phantom_ntuple"
);
64
65
66
G4bool
fileOpen = AnalysisManager->
OpenFile
(fileName);
67
if
(!fileOpen) {
68
G4cout
<<
"\n---> HistoManager::book(): cannot open "
69
<< fileName
70
<<
G4endl
;
71
return
;
72
}
73
74
//creating a ntuple, containg 3D energy deposition in the phantom
75
AnalysisManager->
SetFirstNtupleId
(1);
76
AnalysisManager -> CreateNtuple(
"1"
,
"3Dedep"
);
77
fNtColId
[0] = AnalysisManager->
CreateNtupleDColumn
(
"organID"
);
78
fNtColId
[1] = AnalysisManager->
CreateNtupleDColumn
(
"edep"
);
79
80
AnalysisManager->
FinishNtuple
();
81
82
factoryOn
=
true
;
83
}
84
85
86
void
G4HumanPhantomAnalysisManager::FillNtupleWithEnergyDeposition
(
G4int
organ,
G4double
energyDep)
87
{
88
if
(energyDep !=0)
89
{
90
G4AnalysisManager
*
AnalysisManager
=
G4AnalysisManager::Instance
();
91
AnalysisManager->
FillNtupleDColumn
(1,
fNtColId
[0], organ);
92
AnalysisManager->
FillNtupleDColumn
(1,
fNtColId
[1], energyDep);
93
AnalysisManager->
AddNtupleRow
(1);
94
G4cout
<<
"Analysis: organ "
<< organ <<
" edep: "
<< energyDep <<
G4endl
;
95
}
96
}
97
98
void
G4HumanPhantomAnalysisManager::save
()
99
{
100
if
(
factoryOn
)
101
{
102
G4AnalysisManager
*
AnalysisManager
=
G4AnalysisManager::Instance
();
103
AnalysisManager->
Write
();
104
AnalysisManager->
CloseFile
();
105
106
delete
G4AnalysisManager::Instance
();
107
factoryOn
=
false
;
108
}
109
}
110
111
112
113
114
115
116
117
118
119
120
121
geant4
tree
geant4-10.6-release
examples
advanced
human_phantom
src
G4HumanPhantomAnalysisManager.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:59
using
1.8.2 with
ECCE GitHub integration