#include <rarMinuit.hh>
Public Member Functions | |
rarMinuit (RooAbsReal &function) | |
RooPlot * | contour (RooRealVar &var1, RooRealVar &var2, Double_t n1=1, Double_t n2=2, Double_t n3=0, Double_t n4=0, Double_t n5=0, Double_t n6=0) |
void | fixGraph (TGraph *graph, Int_t lineStyle=1) |
make it close graph (fix the graph, looks a bug in Root) | |
Private Attributes | |
RooArgList * | _floatParamList |
RooAbsReal * | _func |
Definition at line 27 of file rarMinuit.hh.
rarMinuit::rarMinuit | ( | RooAbsReal & | function | ) |
Definition at line 40 of file rarMinuit.cc.
References _floatParamList, and _func.
00040 : RooMinuit(function) 00041 { 00042 // The following are private in the base class so we have to set them up here 00043 _func = &function ; 00044 // Examine parameter list 00045 RooArgSet* paramSet = function.getParameters(RooArgSet()) ; 00046 RooArgList paramList(*paramSet) ; 00047 delete paramSet ; 00048 00049 _floatParamList = (RooArgList*) paramList.selectByAttrib("Constant",kFALSE) ; 00050 if (_floatParamList->getSize()>1) { 00051 _floatParamList->sort() ; 00052 } 00053 _floatParamList->setName("floatParamList") ; 00054 00055 }
RooPlot * rarMinuit::contour | ( | RooRealVar & | var1, | |
RooRealVar & | var2, | |||
Double_t | n1 = 1 , |
|||
Double_t | n2 = 2 , |
|||
Double_t | n3 = 0 , |
|||
Double_t | n4 = 0 , |
|||
Double_t | n5 = 0 , |
|||
Double_t | n6 = 0 | |||
) |
Definition at line 57 of file rarMinuit.cc.
References _floatParamList, _func, and fixGraph().
Referenced by rarMLFitter::doContourPlot().
00060 { 00061 // Verify that both variables are floating parameters of PDF 00062 Int_t index1= _floatParamList->index(&var1); 00063 if(index1 < 0) { 00064 cout << "rarMinuit::contour(" << GetName() 00065 << ") ERROR: " << var1.GetName() 00066 << " is not a floating parameter of " << _func->GetName() << endl ; 00067 return 0; 00068 } 00069 00070 Int_t index2= _floatParamList->index(&var2); 00071 if(index2 < 0) { 00072 cout << "rarMinuit::contour(" << GetName() 00073 << ") ERROR: " << var2.GetName() 00074 << " is not a floating parameter of PDF " 00075 << _func->GetName() << endl ; 00076 return 0; 00077 } 00078 00079 // create and draw a frame 00080 RooPlot *frame = new RooPlot(var1, var2) ; 00081 frame->SetStats(kFALSE); 00082 00083 // draw a point at the current parameter values 00084 TMarker *point= new TMarker(var1.getVal(), var2.getVal(), 8); 00085 00086 // remember our original value of ERRDEF 00087 Double_t errdef= gMinuit->fUp; 00088 00089 TGraph* graph1 = 0; 00090 if(n1 > 0) { 00091 // set the value corresponding to an n1-sigma contour 00092 gMinuit->SetErrorDef(n1*n1*errdef); 00093 // calculate and draw the contour 00094 graph1= (TGraph*)gMinuit->Contour(25, index1, index2); 00095 fixGraph(graph1); 00096 } 00097 00098 TGraph* graph2 = 0; 00099 if(n2 > 0) { 00100 // set the value corresponding to an n2-sigma contour 00101 gMinuit->SetErrorDef(n2*n2*errdef); 00102 // calculate and draw the contour 00103 graph2= (TGraph*)gMinuit->Contour(25, index1, index2); 00104 fixGraph(graph2,2); 00105 } 00106 00107 TGraph* graph3 = 0; 00108 if(n3 > 0) { 00109 // set the value corresponding to an n3-sigma contour 00110 gMinuit->SetErrorDef(n3*n3*errdef); 00111 // calculate and draw the contour 00112 graph3= (TGraph*)gMinuit->Contour(25, index1, index2); 00113 fixGraph(graph3,3); 00114 } 00115 00116 TGraph* graph4 = 0; 00117 if(n4 > 0) { 00118 // set the value corresponding to an n4-sigma contour 00119 gMinuit->SetErrorDef(n4*n4*errdef); 00120 // calculate and draw the contour 00121 graph4= (TGraph*)gMinuit->Contour(25, index1, index2); 00122 fixGraph(graph4,4); 00123 } 00124 00125 TGraph* graph5 = 0; 00126 if(n5 > 0) { 00127 // set the value corresponding to an n5-sigma contour 00128 gMinuit->SetErrorDef(n5*n5*errdef); 00129 // calculate and draw the contour 00130 graph5= (TGraph*)gMinuit->Contour(25, index1, index2); 00131 fixGraph(graph5,5); 00132 } 00133 00134 TGraph* graph6 = 0; 00135 if(n6 > 0) { 00136 // set the value corresponding to an n6-sigma contour 00137 gMinuit->SetErrorDef(n6*n6*errdef); 00138 // calculate and draw the contour 00139 graph6= (TGraph*)gMinuit->Contour(25, index1, index2); 00140 fixGraph(graph6,6); 00141 } 00142 // restore the original ERRDEF 00143 gMinuit->SetErrorDef(errdef); 00144 00145 00146 // Add all objects to the frame 00147 frame->addObject(point); 00148 if (graph1) frame->addObject(graph1, "C"); 00149 if (graph2) frame->addObject(graph2, "C"); 00150 if (graph3) frame->addObject(graph3, "C"); 00151 if (graph4) frame->addObject(graph4, "C"); 00152 if (graph5) frame->addObject(graph5, "C"); 00153 if (graph6) frame->addObject(graph6, "C"); 00154 00155 return frame; 00156 }
void rarMinuit::fixGraph | ( | TGraph * | graph, | |
Int_t | lineStyle = 1 | |||
) |
make it close graph (fix the graph, looks a bug in Root)
Definition at line 159 of file rarMinuit.cc.
Referenced by contour().
00159 { 00160 if (!graph) return; 00161 // set line style 00162 graph->SetLineStyle(lineStyle); 00163 // add a point to form closure 00164 Int_t nPoint=graph->GetN(); 00165 graph->Set(nPoint+1); 00166 Double_t x, y; 00167 graph->GetPoint(0, x, y); 00168 graph->SetPoint(nPoint, x, y); 00169 return; 00170 }
RooArgList* rarMinuit::_floatParamList [private] |
RooAbsReal* rarMinuit::_func [private] |