Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geant4-projects
cosmic-rays
Commits
b0fca089
Commit
b0fca089
authored
Jul 15, 2019
by
MARCOS ANTONIO DE OLIVEIRA DEROS
Browse files
Open output file
parent
77e1c0ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/B1RunAction.cc
View file @
b0fca089
...
...
@@ -31,7 +31,8 @@
#include "B1PrimaryGeneratorAction.hh"
#include "B1DetectorConstruction.hh"
// #include "B1Run.hh"
// Adicionando header de análise de dados:
#include "B1Analysis.hh"
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4AccumulableManager.hh"
...
...
@@ -46,23 +47,23 @@ B1RunAction::B1RunAction()
:
G4UserRunAction
(),
fEdep
(
0.
),
fEdep2
(
0.
)
{
{
// add new units for dose
//
//
const
G4double
milligray
=
1.e-3
*
gray
;
const
G4double
microgray
=
1.e-6
*
gray
;
const
G4double
nanogray
=
1.e-9
*
gray
;
const
G4double
nanogray
=
1.e-9
*
gray
;
const
G4double
picogray
=
1.e-12
*
gray
;
new
G4UnitDefinition
(
"milligray"
,
"milliGy"
,
"Dose"
,
milligray
);
new
G4UnitDefinition
(
"microgray"
,
"microGy"
,
"Dose"
,
microgray
);
new
G4UnitDefinition
(
"nanogray"
,
"nanoGy"
,
"Dose"
,
nanogray
);
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
,
picogray
);
new
G4UnitDefinition
(
"picogray"
,
"picoGy"
,
"Dose"
,
picogray
);
// Register accumulable to the accumulable manager
G4AccumulableManager
*
accumulableManager
=
G4AccumulableManager
::
Instance
();
accumulableManager
->
RegisterAccumulable
(
fEdep
);
accumulableManager
->
RegisterAccumulable
(
fEdep2
);
accumulableManager
->
RegisterAccumulable
(
fEdep2
);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
@@ -73,7 +74,11 @@ B1RunAction::~B1RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
B1RunAction
::
BeginOfRunAction
(
const
G4Run
*
)
{
{
//chamar o "Analysis manager"
auto
analysisManager
=
G4AnalysisManager
::
Instance
();
//abre um arquivo de saída. OpenFIle(Nome do arquivo)
analysisManager
->
OpenFile
(
"B1"
);
// inform the runManager to save random number seed
G4RunManager
::
GetRunManager
()
->
SetRandomNumberStore
(
false
);
...
...
@@ -90,7 +95,7 @@ void B1RunAction::EndOfRunAction(const G4Run* run)
G4int
nofEvents
=
run
->
GetNumberOfEvent
();
if
(
nofEvents
==
0
)
return
;
// Merge accumulables
// Merge accumulables
G4AccumulableManager
*
accumulableManager
=
G4AccumulableManager
::
Instance
();
accumulableManager
->
Merge
();
...
...
@@ -98,9 +103,9 @@ void B1RunAction::EndOfRunAction(const G4Run* run)
//
G4double
edep
=
fEdep
.
GetValue
();
G4double
edep2
=
fEdep2
.
GetValue
();
G4double
rms
=
edep2
-
edep
*
edep
/
nofEvents
;
if
(
rms
>
0.
)
rms
=
std
::
sqrt
(
rms
);
else
rms
=
0.
;
if
(
rms
>
0.
)
rms
=
std
::
sqrt
(
rms
);
else
rms
=
0.
;
const
B1DetectorConstruction
*
detectorConstruction
=
static_cast
<
const
B1DetectorConstruction
*>
...
...
@@ -124,9 +129,9 @@ void B1RunAction::EndOfRunAction(const G4Run* run)
G4double
particleEnergy
=
particleGun
->
GetParticleEnergy
();
runCondition
+=
G4BestUnit
(
particleEnergy
,
"Energy"
);
}
// Print
//
//
if
(
IsMaster
())
{
G4cout
<<
G4endl
...
...
@@ -137,17 +142,22 @@ void B1RunAction::EndOfRunAction(const G4Run* run)
<<
G4endl
<<
"--------------------End of Local Run------------------------"
;
}
G4cout
<<
G4endl
<<
" The run consists of "
<<
nofEvents
<<
" "
<<
runCondition
<<
G4endl
<<
" Cumulated dose per run, in scoring volume : "
<<
" Cumulated dose per run, in scoring volume : "
<<
G4BestUnit
(
dose
,
"Dose"
)
<<
" rms = "
<<
G4BestUnit
(
rmsDose
,
"Dose"
)
<<
G4endl
<<
"------------------------------------------------------------"
<<
G4endl
<<
G4endl
;
//salva os histogramas
auto
analysisManager
=
G4AnalysisManager
::
Instance
();
analysisManager
->
Write
();
analysisManager
->
CloseFile
();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...
...
@@ -160,4 +170,3 @@ void B1RunAction::AddEdep(G4double edep)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment