How to calculate and Plot Photon Interactions Cross sections?

Hi All,
Please guide me how to calculate and plot cross section plots of different photon interactions using Geant4. As I am new in this area and just want to compare results of cross sections of same geometry for both MCNP5 and Geant4. I also studied Geant4 extended example Hadr00 and electromagnetic TestEM but still get nothing.

My MCNP5 Plots as attached below and I want to also plot these cross section using Geant4.

Thank you

TestEm0 and Hadr00 print the input data of Geant4, eg. what Geant4 readin and use.
TestEm13, TestEm14, Hadr03 print cross sections computed from simulation results, eg. what Geant4 really does.
There is no plot facility inside these examples.

Thank you so much. TestEm0 is good and I modified it as per my requirement.

As I need a series of values of cross section per mass (cm2/g) for energy starting from 1keV to 141keV to plot a graph, I think, a for loop over functions of cross section calculation can do this

// define file to store cross section
std::ofstream file; (“cross-section.txt”);

// for loop for energy from 1 to 141 kev

for(int energy=1; energy<142; energy++)


G4cout << "\n  cross section per mass   : ";

for (size_t j=0; j<sigma2.size();j++) {
G4cout << "\t" << std::setw(13) 
       << G4BestUnit(sigma2[j], "Surface/Mass");

file<< "Sigma:"<<G4BestUnit(sigma2[j];           

file.close(); // close file

Please guide me, Is this loop will be okay or is there another way?
For storing values in local file of ostream is right option are geant4 provide facility to store loop values if loop is right choice.

Looking for your guidance.

Thank you.