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. ;
64 if ( W < it_min->first || W > it_max->first )
return fDefaultWeight ;
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());
THE MAIN GENIE PROJECT NAMESPACE
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 const Registry & GetConfig(void) const
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...
virtual double GetScaling(const Interaction &) const override
weight_type_map GetMapWithLimits(const double Q0, const double Q3) const
const Kinematics & Kine(void) const
double GetKV(KineVar_t kv) const
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::map< double, double > weight_type_map
static int max(int a, int b)
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)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
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...