2 functions added

parent d81f9487
......@@ -30,6 +30,7 @@
#include "B1RunAction.hh"
#include "B1PrimaryGeneratorAction.hh"
#include "B1DetectorConstruction.hh"
#include "B1SteppingAction.hh"
// #include "B1Run.hh"
// Adicionando header de análise de dados:
#include "B1Analysis.hh"
......@@ -41,6 +42,7 @@
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B1RunAction::B1RunAction()
......@@ -75,10 +77,7 @@ B1RunAction::~B1RunAction()
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");
createHistogram();
// inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
......@@ -155,9 +154,8 @@ void B1RunAction::EndOfRunAction(const G4Run* run)
<< G4endl;
//salva os histogramas
auto analysisManager = G4AnalysisManager::Instance();
analysisManager->Write();
analysisManager->CloseFile();
WriteHistogram();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -168,5 +166,35 @@ void B1RunAction::AddEdep(G4double edep)
fEdep2 += edep*edep;
}
void B1RunAction::createHistogram()
{
//Avisa que está criando
G4cout << "CRIANDO HISTOGRAMAS" << G4endl;
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
//mostrando o tipo
G4cout << "utilizando " << analysisManager->GetType() << "Analysis Manager" << G4endl;
//setando o verbose
analysisManager->SetVerboseLevel(1);
//Abrindo arquivo de saída
G4String filename = "air_shower";
analysisManager->OpenFile(filename);
//criando ntuples
}
void B1RunAction::WriteHistogram()
{
G4cout<<"ESCREVENDO"<<G4endl;
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
//salvando ghistogramas
analysisManager->Write();
analysisManager->CloseFile();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment