diff --git a/src/libraries/AMPTOOLS_AMPS/Vec_ps_refl.cc b/src/libraries/AMPTOOLS_AMPS/Vec_ps_refl.cc index 8b0ec40a3..0394d7074 100644 --- a/src/libraries/AMPTOOLS_AMPS/Vec_ps_refl.cc +++ b/src/libraries/AMPTOOLS_AMPS/Vec_ps_refl.cc @@ -15,6 +15,7 @@ #include "AMPTOOLS_AMPS/wignerD.h" #include "AMPTOOLS_AMPS/vecPsAngles.h" #include "AMPTOOLS_AMPS/barrierFactor.h" +#include "IUAmpTools/report.h" #include "UTILITIES/BeamProperties.h" @@ -83,18 +84,20 @@ UserAmplitude< Vec_ps_refl >( args ){ // Loop over any additional amplitude arguments to change defaults for(uint ioption=5; ioptionGet(args[7].c_str()); - if(polFrac_vs_E != nullptr ){ + if(polFrac_vs_E == nullptr ){ throw std::runtime_error( "Vec_ps_refl ERROR: Could not find histogram '" + args[7] + "' in file " + std::string(polOption.Data())); @@ -102,6 +105,7 @@ UserAmplitude< Vec_ps_refl >( args ){ } else{ polFraction = parseValidatedNumber("polarization fraction", args[6]); + } } // Check for omega->3pi option @@ -135,6 +139,17 @@ Vec_ps_refl::calcUserVars( GDouble** pKin, GDouble* userVars ) const{ int bin = polFrac_vs_E->GetXaxis()->FindBin(pKin[0][0]); if (bin == 0 || bin > polFrac_vs_E->GetXaxis()->GetNbins()){ beam_polFraction = 0.0; + // Warn if using events outside histogram range + static bool warned_hist = false; // only warn once + if(!warned_hist){ + report( NOTICE ) + << " Energy for polFraction: " << pKin[0][0] + << " appears to be outside histogram range." + << " the value will be set to zero." + << " This message will only be shown once." + << endl; + warned_hist = true; + } } else beam_polFraction = polFrac_vs_E->GetBinContent(bin); }