Commit d56df314d90ab53bf85283ae8d1d27a5660bba9d
1 parent
d46c9caf
Add some debug options.
Showing
1 changed file
with
28 additions
and
2 deletions
src/model/GModelSky.cpp
| ... | ... | @@ -67,7 +67,8 @@ const GModelRegistry g_diffusesource_registry(&g_diffusesource_seed); |
| 67 | 67 | /* __ Coding definitions _________________________________________________ */ |
| 68 | 68 | |
| 69 | 69 | /* __ Debug definitions __________________________________________________ */ |
| 70 | -#define G_DUMP_MC 0 //!< Dump MC information | |
| 70 | +//#define G_DUMP_MC //!< Dump MC information | |
| 71 | +//#define G_DUMP_MC_DETAIL //!< Dump detailed MC information | |
| 71 | 72 | |
| 72 | 73 | |
| 73 | 74 | /*========================================================================== |
| ... | ... | @@ -865,7 +866,7 @@ GPhotons GModelSky::mc(const double& area, |
| 865 | 866 | double rate = flux * area; |
| 866 | 867 | |
| 867 | 868 | // Debug option: dump rate |
| 868 | - #if G_DUMP_MC | |
| 869 | + #if defined(G_DUMP_MC) | |
| 869 | 870 | std::cout << "GModelSky::mc(\"" << name() << "\": "; |
| 870 | 871 | std::cout << "flux=" << flux << " ph/cm2/s, "; |
| 871 | 872 | std::cout << "rate=" << rate << " ph/s)" << std::endl; |
| ... | ... | @@ -874,6 +875,11 @@ GPhotons GModelSky::mc(const double& area, |
| 874 | 875 | // Get photon arrival times from temporal model |
| 875 | 876 | GTimes times = m_temporal->mc(rate, tmin, tmax, ran); |
| 876 | 877 | |
| 878 | + // Debug option: dump number of times | |
| 879 | + #if defined(G_DUMP_MC_DETAIL) | |
| 880 | + std::cout << " Times=" << times.size() << std::endl; | |
| 881 | + #endif | |
| 882 | + | |
| 877 | 883 | // Reserve space for photons |
| 878 | 884 | if (times.size() > 0) { |
| 879 | 885 | photons.reserve(times.size()); |
| ... | ... | @@ -882,18 +888,38 @@ GPhotons GModelSky::mc(const double& area, |
| 882 | 888 | // Loop over photons |
| 883 | 889 | for (int i = 0; i < times.size(); ++i) { |
| 884 | 890 | |
| 891 | + // Debug option: dump photon index | |
| 892 | + #if defined(G_DUMP_MC_DETAIL) | |
| 893 | + std::cout << " Photon=" << i << std::endl; | |
| 894 | + #endif | |
| 895 | + | |
| 885 | 896 | // Allocate photon |
| 886 | 897 | GPhoton photon; |
| 887 | 898 | |
| 888 | 899 | // Set photon arrival time |
| 889 | 900 | photon.time(times[i]); |
| 890 | 901 | |
| 902 | + // Debug option: dump time | |
| 903 | + #if defined(G_DUMP_MC_DETAIL) | |
| 904 | + std::cout << " Time=" << times[i] << std::endl; | |
| 905 | + #endif | |
| 906 | + | |
| 891 | 907 | // Set photon energy |
| 892 | 908 | photon.energy(spectral->mc(emin, emax, photon.time(), ran)); |
| 893 | 909 | |
| 910 | + // Debug option: dump energy | |
| 911 | + #if defined(G_DUMP_MC_DETAIL) | |
| 912 | + std::cout << " Energy=" << photon.energy() << std::endl; | |
| 913 | + #endif | |
| 914 | + | |
| 894 | 915 | // Set incident photon direction |
| 895 | 916 | photon.dir(m_spatial->mc(photon.energy(), photon.time(), ran)); |
| 896 | 917 | |
| 918 | + // Debug option: dump direction | |
| 919 | + #if defined(G_DUMP_MC_DETAIL) | |
| 920 | + std::cout << " Direction=" << photon.dir() << std::endl; | |
| 921 | + #endif | |
| 922 | + | |
| 897 | 923 | // Append photon |
| 898 | 924 | if (dir.dist_deg(photon.dir()) <= radius) { |
| 899 | 925 | photons.append(photon); | ... | ... |