Commit 2fff33a9 authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

begin transition to Parameters class- reading in Parser

parent 0ec4697f
......@@ -30,23 +30,30 @@ class Parameters : public ROOT::Minuit2::MnUserParameters
public:
//constructors
Parameters();
Parameters(){};
// destructor
~Parameters();
~Parameters(){};
//use this one to both fill MnUserParameters and nuisance vector
void add(const std::string& name,bool nuisance,double val)
//watch the lowercase for add
void add(const std::string& name,const bool& nuisance,const double& val)
{
MnUserParameters::Add(name,val);
_nui.push_back(nuisance);
}
//with a step
void add(const std::string& name,const bool& nuisance,const double& val,const double& step)
{
MnUserParameters::Add(name,val,step);
_nui.push_back(nuisance);
}
//specific acessors (others in MnUserParameters)
//specific acessors (see others in MnUserParameters)
const std::vector<bool>& nui(){return _nui;}
bool isNui(const unsigned& i) const {return _nui[i];}
//helper
bool isFixed(const unsigned& i) const {
MnUserParameters::Parameters()[i].IsFixed();
}
......
......@@ -72,6 +72,9 @@ Parser::Parser(const char* filepar):params(filepar)
upar.Add(parName,val);
upar.Fix(parName);
FixParam.push_back(true);
// SP 1/9/15
user_par.add(parName,isNui,val);
user_par.Fix(parName); //fixed
cout << key << "\t" << parName << "\t" << parType << "\t" << val <<endl;
}
else{ //error required
......@@ -79,10 +82,13 @@ Parser::Parser(const char* filepar):params(filepar)
if (!(info >> step)) throw Message_error("cannot decode step in="+line);
upar.Add(parName,val,step);
FixParam.push_back(false);
// SP 1/9/15
user_par.add(parName,isNui,val,step); //not fixed
// and optionally limits
cout << key << "\t" << parName << "\t" << parType << "\t" << val << "\t" << step ;
if ((info >> xmin >> xmax)) {
upar.SetLimits(parName,xmin,xmax);
user_par.SetLimits(parName,xmin,xmax);
cout << "\t" << xmin << "\t" << xmax ;
}
cout << endl;
......@@ -145,17 +151,23 @@ Parser::Parser(const char* filepar):params(filepar)
if (c1.Parameters().size() !=0) cons2=make_pair<MnUserParameters,MnUserParameters>(c1,c2);
cout << __FILE__ << "*******************************************" << endl;
cout << "#cosmological parameters=" << count(nuisance.begin(),nuisance.end(),false) << endl;
for (size_t i=0;i< upar.Params().size();i++){
if (!(nuisance[i]))
cout << __FILE__ << "-> " << upar.Name(i) <<endl;
unsigned nn=0;
for (size_t i=0;i< user_par.Params().size();i++){
if (!(user_par.isNui(i))) {
nn++;
cout << __FILE__ << "-> " << user_par.Name(i) <<endl;
}
}
cout << " # cosmo parameters=" << nn << endl;
cout <<"------------------------------------" <<endl;
cout << "# nuisance parameters=" << count(nuisance.begin(),nuisance.end(),true) <<endl;
for (size_t i=0;i<nuisance.size();i++){
if (nuisance[i])
cout << __FILE__ << "-> " << upar.Name(i) <<endl;
nn=0;
for (size_t i=0;i< user_par.Params().size();i++){
if (user_par.isNui(i)) {
cout << __FILE__ << "-> " << user_par.Name(i) <<endl;
nn++;
}
}
cout << " # nuisance parameters=" << nn << endl;
cout << __FILE__ << "*******************************************" << endl;
......
......@@ -20,6 +20,7 @@
#include "Minuit2/MnUserParameters.h"
#include "Class/ClassEngine.hh"
#include "cxxsupport/paramfile.h"
#include "Parameters.hh"
#include<vector>
#include<string>
......@@ -54,11 +55,11 @@ public:
//parameters
std::vector<string> parNames;
MnUserParameters upar;
//infos on parameters
std::vector<bool> nuisance;
std::vector<bool> FixParam;
Parameters user_par;
//derived par
bool add_par;
std::vector<string> derived;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment