-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.cc
60 lines (49 loc) · 1.81 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "run.hh"
MyRunAction::MyRunAction(G4String output_Name="None")
{
foutput_Name=output_Name;
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->CreateNtuple("Photons", "Photons");
man->CreateNtupleIColumn("Event");
man->CreateNtupleDColumn("X");
man->CreateNtupleDColumn("Y");
man->CreateNtupleDColumn("Z");
man->CreateNtupleDColumn("T");
man->CreateNtupleDColumn("Wlen");
man->CreateNtupleDColumn("Phi");
man->CreateNtupleDColumn("Theta");
man->CreateNtupleDColumn("Sensor");
man->FinishNtuple(0);
man->CreateNtuple("Hits", "Hits");
man->CreateNtupleIColumn("Event");
man->CreateNtupleDColumn("X"); //column of doubles
man->CreateNtupleDColumn("Y");
man->CreateNtupleDColumn("Z");
man->CreateNtupleDColumn("Sensor");
man->CreateNtupleDColumn("AccumHits"); //0 arapuca, 1/2 SiPM
man->FinishNtuple(1);
// man->CreateNtuple("Scoring", "Scoring");
// man->CreateNtupleDColumn("fEdep");
// man->FinishNtuple(2);
}
MyRunAction::~MyRunAction()
{}
void MyRunAction::BeginOfRunAction(const G4Run* run)
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
std::cout<<"-------- WWWW ------- Message-START -------- WWWW -------"<<std::endl;
std::cout<<"Output file path: "+foutput_Name<<std::endl;
std::cout<<"-------- WWWW ------- Message-END -------- WWWW -------"<<std::endl;
man->OpenFile(foutput_Name);
// G4int runID = run->GetRunID();
// std::stringstream strRunID;
// strRunID << runID;
// man->OpenFile("output.root");
// man->OpenFile("data/output"+strRunID.str()+".root"); //trying not to overwrite all the output files
}
void MyRunAction::EndOfRunAction(const G4Run*)
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->Write();
man->CloseFile();
}