-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.cc
30 lines (24 loc) · 832 Bytes
/
run.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "run.hh"
MyRunAction::MyRunAction()
{}
MyRunAction::~MyRunAction()
{}
// Now we want to think about the informations we want to store into the ROOT files
void MyRunAction::BeginOfRunAction(const G4Run* )
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man -> OpenFile("output.root"); // Open file
// Ntuple creation
man -> CreateNtuple("Hits","Hits");
man -> CreateNtupleIColumn("fEvent");
man -> CreateNtupleDColumn("fX");
man -> CreateNtupleDColumn("fY");
man -> CreateNtupleDColumn("fZ");
man -> FinishNtuple(0); // Finish the 0 Ntuple
}
void MyRunAction::EndOfRunAction(const G4Run* )
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man -> Write(); // Write the file IMPORTANT
man -> CloseFile("output.root"); // Close the file in the end
}