@@ -765,6 +765,11 @@ void utils::setModelParameters( const std::string & setPhysicsModelParameterExpr
765765 cout << " Set Default Value of Parameter " << target
766766 << " To : " << PhysicsParameterValue << " \n " ;
767767 tmpParameter->setVal (PhysicsParameterValue);
768+ if (tmpParameter->getVal () != PhysicsParameterValue) {
769+ throw std::runtime_error (Form (" Parameter %s value %g is outside its range [%g, %g]. "
770+ " Use --rMin/--rMax or --setParameterRanges to adjust the range." ,
771+ target.c_str (), PhysicsParameterValue, tmpParameter->getMin (), tmpParameter->getMax ()));
772+ }
768773 }
769774 } else {
770775 RooCategory *tmpCategory = dynamic_cast <RooCategory*>(tmp);
@@ -791,9 +796,14 @@ void utils::setModelParameters( const std::string & setPhysicsModelParameterExpr
791796 if (isrvar) {
792797 RooRealVar *tmpParameter = dynamic_cast <RooRealVar*>(tmp);
793798 double PhysicsParameterValue = atof (SetParameterExpression[1 ].c_str ());
794- cout << " Set Default Value of Parameter " << SetParameterExpression[0 ]
799+ cout << " Set Default Value of Parameter " << SetParameterExpression[0 ]
795800 << " To : " << PhysicsParameterValue << " \n " ;
796801 tmpParameter->setVal (PhysicsParameterValue);
802+ if (tmpParameter->getVal () != PhysicsParameterValue) {
803+ throw std::runtime_error (Form (" Parameter %s value %g is outside its range [%g, %g]. "
804+ " Use --rMin/--rMax or --setParameterRanges to adjust the range." ,
805+ SetParameterExpression[0 ].c_str (), PhysicsParameterValue, tmpParameter->getMin (), tmpParameter->getMax ()));
806+ }
797807 } else {
798808 RooCategory *tmpCategory = dynamic_cast <RooCategory*>(tmp);
799809 int PhysicsParameterValue = atoi (SetParameterExpression[1 ].c_str ());
0 commit comments