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
RunAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RunAction.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
// Authors: S. Meylan and C. Villagrasa (IRSN, France)
26
// Updated: H. Tran (IRSN), France: 20/12/2018
27
28
#include "RunAction.hh"
29
#include "
G4Run.hh
"
30
#include "
g4root.hh
"
31
#include "
globals.hh
"
32
#include <map>
33
34
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35
36
RunAction::RunAction
()
37
:
G4UserRunAction
()
38
{}
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41
42
RunAction::~RunAction
()
43
{}
44
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47
void
RunAction::BeginOfRunAction
(
const
G4Run
*)
48
{
49
CreateNtuple
(
"output.root"
);
50
}
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53
54
void
RunAction::EndOfRunAction
(
const
G4Run
*)
55
{
56
WriteNtuple
();
57
}
58
59
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
60
61
void
RunAction::CreateNtuple
(
const
G4String
&
name
)
62
{
63
G4AnalysisManager
* analysisManager =
G4AnalysisManager::Instance
();
64
analysisManager->
SetVerboseLevel
(0);
65
analysisManager->
SetNtupleDirectoryName
(
"ntuple"
);
66
67
// open output file
68
//
69
G4bool
fileOpen = analysisManager->
OpenFile
(name);
70
if
(!fileOpen)
71
{
72
G4cout
<<
"\n---> HistoManager::book(): cannot open "
<< name<<
G4endl
;
73
return
;
74
}
75
76
analysisManager->
SetFirstNtupleId
(1);
77
analysisManager->
CreateNtuple
(
"ntuple_1"
,
"physical_stage"
);
78
analysisManager->
CreateNtupleDColumn
(1,
"x"
);
79
analysisManager->
CreateNtupleDColumn
(1,
"y"
);
80
analysisManager->
CreateNtupleDColumn
(1,
"z"
);
81
analysisManager->
CreateNtupleDColumn
(1,
"edep"
);
82
analysisManager->
CreateNtupleDColumn
(1,
"diffKin"
);
83
analysisManager->
CreateNtupleIColumn
(1,
"volumeName"
);
84
analysisManager->
CreateNtupleDColumn
(1,
"CopyNumber"
);
85
analysisManager->
CreateNtupleIColumn
(1,
"EventID"
);
86
analysisManager->
FinishNtuple
(1);
87
88
// For chemistry
89
90
analysisManager->
CreateNtuple
(
"ntuple_2"
,
"chem_stage"
);
91
analysisManager->
CreateNtupleDColumn
(2,
"x"
);
92
analysisManager->
CreateNtupleDColumn
(2,
"y"
);
93
analysisManager->
CreateNtupleDColumn
(2,
"z"
);
94
analysisManager->
CreateNtupleSColumn
(2,
"RadName"
);
95
analysisManager->
CreateNtupleIColumn
(2,
"EventID"
);
96
analysisManager->
FinishNtuple
(2);
97
98
G4cout
<<
"\n----> Histogram file is opened in "
<< name <<
G4endl
;
99
}
100
101
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
102
void
RunAction::WriteNtuple
()
103
{
104
G4AnalysisManager
* analysisManager =
G4AnalysisManager::Instance
();
105
analysisManager->
Write
();
106
analysisManager->
CloseFile
();
107
G4cout
<<
"\n----> Histograms are saved"
<<
G4endl
;
108
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
dnadamage1
src
RunAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:52
using
1.8.2 with
ECCE GitHub integration