35 ClassImp(RooStats::ProfileInspector);
37 using namespace RooStats;
42 ProfileInspector::ProfileInspector()
49 ProfileInspector::~ProfileInspector()
67 TList* ProfileInspector::GetListOfProfilePlots( RooAbsData& data, RooStats::ModelConfig * config)
70 const RooArgSet* poi_set = config->GetParametersOfInterest();
71 const RooArgSet* nuis_params=config->GetNuisanceParameters();
72 RooAbsPdf* pdf = config->GetPdf();
76 cout <<
"no parameters of interest" << endl;
80 if(poi_set->getSize()!=1){
81 cout <<
"only one parameter of interest is supported currently" << endl;
84 RooRealVar* poi = (RooRealVar*) poi_set->first();
88 cout <<
"no nuisance parameters" << endl;
93 cout <<
"pdf not set" << endl;
97 RooAbsReal* nll = pdf->createNLL(data);
98 RooAbsReal* profile = nll->createProfile(*poi);
100 TList * list =
new TList;
107 Double_t max =
dynamic_cast<RooAbsRealLValue*
>(poi)->getMax();
108 Double_t min =
dynamic_cast<RooAbsRealLValue*
>(poi)->getMin();
109 Double_t step = (max-min)/(curve_N-1);
110 curve_x=
new Double_t[curve_N];
111 for(
int i=0; i<curve_N; ++i){
112 curve_x[i]=min+step*i;
116 map<string, std::vector<Double_t> > name_val;
117 for(
int i=0; i<curve_N; i++){
118 poi->setVal(curve_x[i]);
121 TIterator* nuis_params_itr=nuis_params->createIterator();
122 TObject* nuis_params_obj;
123 while((nuis_params_obj=nuis_params_itr->Next())){
124 RooRealVar* nuis_param =
dynamic_cast<RooRealVar*
>(nuis_params_obj);
126 string name = nuis_param->GetName();
127 if(nuis_params->getSize()==0)
continue;
128 if(nuis_param && (! nuis_param->isConstant())){
129 if(name_val.find(name)==name_val.end()) name_val[name]=std::vector<Double_t>(curve_N);
130 name_val[name][i]=nuis_param->getVal();
133 TGraph* g =
new TGraph(curve_N, curve_x, &(name_val[name].front()));
134 g->SetName((name+
"_"+
string(poi->GetName())+
"_profile").c_str());
135 g->GetXaxis()->SetTitle(poi->GetName());
136 g->GetYaxis()->SetTitle(nuis_param->GetName());