there is no more histogram in the root file even though G4cout tells me the parameters I am passing to CreateH2 are the same in both cases.
I can also test the histogram contents in EndofRunAction, with
G4cout << " mean_x = " << G4BestUnit(analysisManager->GetH2(0)->mean_x(), “Length”)<<G4endl;
I get some statistics in the first case and a segfault in the second (histogram does not exist)
*** G4Exception : Analysis_W011
issued by : G4THnManager::GetH2
histogram 0 does not exist.
This is how i call(?) MuDetectorConstruction in RunAction. The function GetWorld_sizeX() simply returns the value of a function that was set in MuDetectorConstruction.
So, it turns out MyRunAction is called twice. The first call occurs before MuDetectorConstruction and G4cout returns 0 for all variables. The second time the variables are correct but it’s too late.
/run/verbose/2 shows that I crash because of
Illegal value of number of bins: nbins <= 0
Should I instantiate (?) AnalysisManager in MuRunAction::BeginOfRunAction ??
Should I instantiate (?) AnalysisManager in MuRunAction::BeginOfRunAction ??
That actually worked… is this a good way to go??
btw, I would like to whine a bit in that it would have been much easier to catch this if somehow I could suppress
" HADRONIC PROCESSES SUMMARY (verbose level 1)" that loads my screen with stuff that, while I have been advised “It’s important and you want to pay attention to”, it’s maybe not so important that I have to look at it everytime as I am building my model…
Any idea how I could suppress this lengthy summary of hadronic process ? thx
-t
It looks like you run in multi-threaded mode, that’s why you get your RunAction constructed more times. G4 analysis manager implicitly requires that the histograms (with the same id) created on master and workers are identical (as it performs their merging at the end of run), and as this was not the case when you extracted parameters from geometry, it failed with the message that you posted.
By moving creating histograms at BeginOfRun(), you get the geometry parameters correct also on master and this explains why this helped, and why this is a good way to go.