The following are some code snippets of how I have implemented it.
In my RunAction.cc #include "G4TScoreHistFiller.hh"
In the Constructor of my G4UserRunAction: auto AnalysisManager = G4AnalysisManager::Instance(); AnalysisManager->SetVerboseLevel(1); AnalysisManager->SetFirstHistoId(1); histFiller = new G4TScoreHistFiller<G4AnalysisManager>;
In my RunAction.hh file: #include "Analysis.hh" G4TScoreHistFiller<G4AnalysisManager>* histFiller;
where my Analysis.hh includes #include "g4csv.hh"
The scoring portion of my macro file looks like this: /score/create/probe Probes 2. mm /score/probe/locate 0. 0. 0. cm /score/quantity/volumeFlux eMinusFlux /score/filter/particle eMinusFilter e- /score/close /score/list /analysis/h1/create eMinusFlux Probes_eMinusFlux 100 0.0001 1. MeV ! log /score/fill1D 1 Probes eMinusFlux
I’m able to dump the volumeFlux tally to a csv using /score/dumpAllQuantitiesToFile Probes Probes.csv but that gives me a single Flux value for the Probe region in the csv. GEANT states that a scoring mesh for the Probe volume has been created but I don’t see anything in the output about the histogram creation or scoring. What am I missing?
Thanks much. I am able to now output a .csv with the histogram bins showing but there is no data that is recorded. Is there something else I need to do, maybe to register the G4TScoreHistFiller histFiller to the histogram? I was under the impression that the /score/fillH1 command would take care of that. Could this have to do with multithreading?
I have added the following to my RunAction::BeginofRunAction auto analysisManager = G4AnalysisManager::Instance(); analysisManager->OpenFile("OutputCSV");
and the following to RunAction::EndofRunAction auto analysisManager = G4AnalysisManager::Instance(); analysisManager->Write(); analysisManager->CloseFile();
Sorry, I should have been more specific. The simulation I have set up is a point source of I-131 at (0,0,0) and I have the scoring probe as a 4mm cube at (0,0,0). I believe I have confirmed that the probe is scoring because I will use the UI command /score/dumpAllQuantitiesToFile Probes Probes.csv and it outputs the following:
# mesh name: Probes # primitive scorer name: eMinusFlux # i, i, i, total(value) [NoUnit], total(val^2), entry 0,0,0,112378,132364,103315
The histogram .csv file that is written is the following: I also have tried other energy binning to no avail.
Update: I was able to get the histogram for the ‘Probe’ volume to populate. I first was able to do so by compiling the program on a single-threaded GEANT4 build, thus pointing me to the idea it was a problem with multi-threading. The problem was ultimately in my RunAction. I was utilizing the ‘RE02’ example which at the beginning of the EndOfRunAction had the line if(!IsMaster()) return; The code used to write the histogram was after this line, implying only the master thread would write the histogram. Once I placed the code to write the histogram before that line, the histograms were written correctly.
Hi dpadam,
I also have same problem about the output file.
i only get a Probes.csv like you show,which only one line data like:
# mesh name: Probes
# primitive scorer name: volFlux
# i, i, i, total(value) [NoUnit], total(val^2), entry
0,0,0,0,0,0
i have added the following to my RunAction::BeginofRunAction auto analysisManager = G4AnalysisManager::Instance(); analysisManager->OpenFile("OutputCSV");
and the following to RunAction::EndofRunAction auto analysisManager = G4AnalysisManager::Instance(); analysisManager->Write(); analysisManager->CloseFile();
but l cann’t get any other .csx file output. Could you please help me to it?