Hello all,
I am having some issues with saving my data, which seems new as it used to work. I’ve included the error message below, but for context, the simulation still works it’s just not saving anything.
I’ll also include some snippets of my code.
I believe it may be an issue with my energy deposition variable, I want to print the value to the terminal unless it is 0. But it should be saving it all.
Error Message:
G4WT0 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W001
issued by : G4TNtupleManager<NT,FT>::FillNtupleTColumn
Ntuple 0 does not exist.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
G4WT0 > Energy deposition: 7.72819
G4WT0 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W001
issued by : G4TNtupleManager<NT,FT>::FillNtupleTColumn
Ntuple 1 does not exist.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
G4WT0 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W001
issued by : G4ToolsAnalysisManager::CloseFileImpl
Deleting empty files failed
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Implementing tuples:
MyRunAction::MyRunAction()
{
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->CreateNtuple("Photons", "Photons");
man->CreateNtupleIColumn("fEvent");
man->CreateNtupleDColumn("fX");
man->CreateNtupleDColumn("fY");
man->CreateNtupleDColumn("fZ");
man->CreateNtupleDColumn("fmomX");
man->CreateNtupleDColumn("fmomY");
man->CreateNtupleDColumn("fmomZ");
man->CreateNtupleDColumn("fwlen");
man->CreateNtupleDColumn("fT");
man->FinishNtuple(0);
man->CreateNtuple("Scoring", "Scoring");
man->CreateNtupleDColumn("fEdep");
man->FinishNtuple(1);
}
Writing to tuples:
void MyEventAction::EndOfEventAction(const G4Event*)
{
if(fEdep != 0.)
{
G4cout << "Energy deposition: " << fEdep << G4endl;
}
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->FillNtupleDColumn(1, 0, fEdep);
man->AddNtupleRow(1);
}
and again…
G4AnalysisManager *man = G4AnalysisManager::Instance();
man->FillNtupleIColumn(0, 0, evt);
man->FillNtupleDColumn(0, 1, posPhoton[0]);
man->FillNtupleDColumn(0, 2, posPhoton[1]);
man->FillNtupleDColumn(0, 3, posPhoton[2]);
man->FillNtupleDColumn(0, 4, momPhoton[0]);
man->FillNtupleDColumn(0, 5, momPhoton[1]);
man->FillNtupleDColumn(0, 6, momPhoton[2]);
man->FillNtupleDColumn(0, 7, wlen);
man->FillNtupleDColumn(0, 8, Ptime);
man->AddNtupleRow(0);