16 using namespace genie;
53 double W = pow(Mn,2) + 2*Mn*Q0 - pow(Q3,2) + pow(Q0,2) ;
57 if ( W < 0 )
return 1. ;
61 MECScaleVsW::weight_type_map::iterator it_min = weight_map.begin() ;
62 MECScaleVsW::weight_type_map::iterator it_max = std::next( weight_map.begin(), weight_map.size() -1 ) ;
64 if ( W < it_min->first || W > it_max->first )
return fDefaultWeight ;
66 while ( std::distance( it_min, it_max ) > 1 ) {
67 unsigned int step = std::distance( weight_map.begin(), it_min ) + std::distance( it_min, it_max ) / 2 ;
68 MECScaleVsW::weight_type_map::iterator it_middle = std::next( weight_map.begin(), step ) ;
69 if ( W < it_middle->first ) it_max = it_middle ;
70 else it_min = it_middle ;
83 double W_max = sqrt( pow(Mn,2) + 2*Mn*Q0 ) ;
98 return ( max.second - min.second ) * ( W - min.first ) / ( max.first - min.first ) + min.second ;
105 bool good_config = true ;
109 if(
GetConfig().Exists(
"MECScaleVsW-Default-Weight") ) {
112 good_config = false ;
113 LOG(
"MECScaleVsW",
pERROR) <<
"Default weight is not specified." ;
116 std::vector<double> Weights, WValues ;
120 if( Weights.size() != WValues.size() ) {
121 good_config = false ;
122 LOG(
"MECScaleVsW",
pERROR) <<
"Entries don't match" ;
123 LOG(
"MECScaleVsW",
pERROR) <<
"Weights size: " << Weights.size() ;
124 LOG(
"MECScaleVsW",
pERROR) <<
"WValues size: " << WValues.size() ;
128 for(
unsigned int i = 0 ; i<Weights.size() ; ++i ) {
132 std::vector<double> limit_Q0, limit_Q3 ;
133 if(
GetParamVect(
"MECScaleVsW-LowerLimitQ0", limit_Q0 ) == 0 ) {
134 good_config = false ;
135 LOG(
"MECScaleVsW",
pERROR) <<
"MECScaleVsW-LowerLimitQ0 is empty" ;
138 if(
GetParamVect(
"MECScaleVsW-LowerLimitQ3", limit_Q3 ) == 0 ) {
139 good_config = false ;
140 LOG(
"MECScaleVsW",
pERROR) <<
"MECScaleVsW-LowerLimitQ3 is empty" ;
143 if( limit_Q0.size() != limit_Q3.size() ) {
144 good_config = false ;
145 LOG(
"MECScaleVsW",
pERROR) <<
"Entries don't match" ;
146 LOG(
"MECScaleVsW",
pERROR) <<
"Lower limit for Q0 size: " << limit_Q0.size() ;
147 LOG(
"MECScaleVsW",
pERROR) <<
"Lower limit for Q3 size: " << limit_Q3.size() ;
153 if( ! good_config ) {
154 LOG(
"MECScaleVsW",
pERROR) <<
"Configuration has failed.";
158 fW1_Q0Q3_limits = TSpline3(
"fW1_Q0Q3_limits",limit_Q3.data(),limit_Q0.data(),limit_Q3.size());
virtual void LoadConfig(void) override
This class is responsible to compute a scaling factor for the XSec.
int GetParamVect(const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
Handle to load vectors of parameters.
virtual double GetScaling(const Interaction &) const override
virtual const Registry & GetConfig(void) const
double W(const Interaction *const i)
Summary information for an interaction.
std::pair< double, double > weight_type_pair
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
weight_type_map GetMapWithLimits(const double Q0, const double Q3) const
const Kinematics & Kine(void) const
double GetKV(KineVar_t kv) const
std::map< double, double > weight_type_map
virtual double ScaleFunction(const double W, const weight_type_pair min, const weight_type_pair max) const
weight_type_map fWeightsMap
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...