spradlin / WCSim

The WCSim GEANT4 application
0 stars 0 forks source link

Make RnModel_Fit_Params and its use into sensible C++ #19

Open spradlin opened 1 year ago

spradlin commented 1 year ago
          ### Constants that can be constexpr

C++11 introduced strongly typed compiler constants that are declared with constexpr. Since we are using the C++11 standard for WCSim, compiler constants that were formerly untyped #define macros should be converted to constexpr constants. The following #defines appear to define such constants.

include/RnModel_Fit_Params.hh

In L37-L40:

#define     RNMODEL_CONC_BOTTOM         2.63    // mBq/m^{3} -> From Nakano-san et al.
#define     RNMODEL_CONC_CENTER         0.1     // mBq/m^{3} -> From Nakano-san et al.
#define     RNMODEL_CONC_INTERMEDIATE   0.3     // mBq/m^{3} -> Arbitrary

These are used extensively within the header file that defines them but nowhere else. It looks like much of include/RnModel_Fit_Params.hh is are constants. Strangely, the header does not declare the variables vParam_Z and vParam_R2 that it modifies. What is going on with this header?

include/RnModel_Fit_Params.hh is only included in src/WCSimGenerator_Radioactivity.cc at L204 and at L234. It is included TWICE. Worse, both times are in the body of a function definition, WCSimGenerator_Radioactivity::SetScenario(). OK, this is an unsafe abuse the #include mechanism.

Spin this off into its own issue and set it aside for now.

Originally posted by @spradlin in https://github.com/spradlin/WCSim/issues/17#issuecomment-1381879702