#include #include "ExampleMiniSim.hh" #include #include #include using namespace RAT; class MyUserProc : public Processor { public: MyUserProc(); virtual ~MyUserProc() { }; virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); protected: std::map energy_nhit_map; }; namespace RAT { Processor *construct_user_proc(std::string /*userProcName*/) { return new MyUserProc; } } MyUserProc::MyUserProc() : Processor("user") { G4ThreeVector center(0, 0, 0); // build a table by running the simulation at several energies for (size_t i=0; i<4; i++) { double energy = 2.5 + 0.5 * i; std::cout << "Running simulation at " << energy << " MeV..." << std::endl; ExampleMiniSim sim(center, energy); sim.Run(5); energy_nhit_map[energy] = sim.GetMeanNhits(); } std::cout << "Energy-NHIT map:" << std::endl; std::map::iterator it; for (it=energy_nhit_map.begin(); it!=energy_nhit_map.end(); it++) { std::cout << (*it).first << ": " << (*it).second << std::endl; } } Processor::Result MyUserProc::DSEvent(DS::Run& /*run*/, DS::Entry& /*ds*/) { // use the energy_nhit_map in the processor somehow... return OK; }