Using G4Tools to get all bins info


I am using G4Tools to create a histogram using this line

tools::histo::h1d h(“1”,1024.,0.,3.516);

In the RunAction class.

I am trying to use h.fill to fill the histogram in the EndOfEventAction function using this line


I get the error:

error: ‘h’ was not declared in this scope

How do I put my histogram in the scope of the Event Action

Many thanks,

If you want to access a histogram (or any other object) from different class member functions, you need to define it as a class data member.
Or, if you use G4AnalysisManager (see the basic B4 or B5 example), it provides a global access to all histograms from any class function.
Best regards,