Ogilvy-Roofit issue

Dear all,

I am using ROOT 6.07/07 and the RooSimPdfBuilder class to generate a large number of very similar pdfs to fit subsets of my data. The code at the end of this post works great. Giving, as required:

Plot label is “simPdf”
— RooAbsPdf —
Cached value = 0

  1. 0x46e4aa0 RooRealVar:: a_a_param_a1 = 0.5 L(0 - 1) “a_a_param (a1)”
  2. 0x46e6f20 RooRealVar:: a_a_param_a2 = 0.5 L(0 - 1) “a_a_param (a2)”
  3. 0x46e3d80 RooRealVar:: a_d_param_a1 = 0.5 L(0 - 1) “a_d_param (a1)”
  4. 0x46fb020 RooRealVar:: a_d_param_a2 = 0.5 L(0 - 1) “a_d_param (a2)”
  5. 0x7fff9465a020 RooRealVar:: gamma = 0.5 L(0 - 1) “gamma”
  6. 0x46ef570 RooRealVar:: h_a_param_h1 = 0.5 L(0 - 1) “h_a_param (h1)”
  7. 0x4704bc0 RooRealVar:: h_a_param_h2 = 0.5 L(0 - 1) “h_a_param (h2)”
    8) 0x46fc120 RooRealVar:: h_d_param_h1 = 0.5 L(0 - 1) “h_d_param (h1)”
  8. 0x47176d0 RooRealVar:: h_d_param_h2 = 0.5 L(0 - 1) “h_d_param (h2)”

However, I am struggling to add a small extension…

I would like to have more than one prototype pdf i.e. 5 prototypes for 5 data subsets.

I know this is possible and the answer seems to be on page 11 of the tutorial here:

roofit.sourceforge.net/docs/tuto … ptools.pdf

However, I do not seem to be able to add the correct couple of lines to the code below to get things to work

If anyone could help RE those lines, I would be incredibly grateful! I have highlighted where the edits need to be made it the simple code below. However, when I include the commented out lines:

RooSimPdfBuilder mgr(simPdf) ;
//config->setStringValue(“physModels”,“data_cat : data_00=DC data_10=gauss_1 data_01=gauss_2 data_11=gauss_3 data_other=gauss_4”) ;

I see:

[#1] INFO:ObjectHandling – RooSimPdfBuilder::buildPdf: category indexing physics model: data_cat
[#0] ERROR:InputArguments – RooSimPdfBuilder::buildPdf: ERROR requested physics model DC is not defined

*** Break *** segmentation violation

Cheers!

Code:

// Data categories
RooCategory data_cat(“data_cat”, “data_cat”);
data_cat.defineType(“data_00”);
data_cat.defineType(“data_10”);
data_cat.defineType(“data_01”);
data_cat.defineType(“data_11”);
data_cat.defineType(“data_other”);

//--------- PDF builder method

// Code up the simplified DC model
RooRealVar h_a_param(“h_a_param”,“h_a_param”,0.5,0,1);
RooRealVar h_d_param(“h_d_param”,“h_d_param”,0.5,0,1);
RooRealVar a_a_param(“a_a_param”,“a_a_param”,0.5,0,1);
RooRealVar a_d_param(“a_d_param”,“a_d_param”,0.5,0,1);
RooRealVar gamma(“gamma”,“gamma”,0.5,0,1);
RooFormulaVar h_rate(“h_rate”, “h_a_parama_d_paramgamma”, RooArgList(h_a_param, a_d_param, gamma));
RooFormulaVar a_rate(“a_rate”, “a_a_param*h_d_param”, RooArgList(a_a_param, h_d_param));

RooPoisson h_g_poisson(“h_g_poisson”, “h_g_poisson”, ft_hs, h_rate);
RooPoisson a_g_poisson(“a_g_poisson”, “a_g_poisson”, ft_as, a_rate);

// Multiply the components
RooProdPdf DC(“DC”, “DC”, h_g_poisson, a_g_poisson);

RooRealVar mean_1(“mean_1”,“mean_1”,0,-10,10) ;
RooRealVar sigma_1(“sigma_1”,“sigma_1”,3,0.1,10) ;
RooGaussian gauss_1(“gauss_1”,“gauss_1”,ft_hs,mean_1,sigma_1) ;

// Repeated for 4 gaussians….omitted for brevity

// Define a category with labels only

RooCategory hid(“hid”,“hid”) ;
hid.defineType(“h1”) ;
hid.defineType(“h2”) ;

RooCategory aid(“aid”,“aid”) ;
aid.defineType(“a1”) ;
aid.defineType(“a2”) ;

RooSimultaneous simPdf(“simPdf”,“simultaneous pdf”,data_cat) ;
simPdf.addPdf(DC,“data_00”) ;
simPdf.addPdf(gauss_1,“data_10”) ;
// Make dummy data set for use by simpdf builder later on
RooDataSet data_dummy(“data_dummy”,“data_dummy”,RooArgList(h_rate, a_rate, ft_hs,ft_as,hid,aid,data_cat)) ;

//------- ***** Switch to simPdf causes problems ***** ----------------//
// Instantiate a builder
RooSimPdfBuilder mgr(DC) ;
//RooSimPdfBuilder mgr(simPdf) ;
//----------------------------------------------------------------------//

// Create an empty configuration object suitable for configuring ‘sum’
// A configuration object is a RooArgSet with RooStringVar objects
RooArgSet* config = mgr.createProtoBuildConfig() ;

// Enter configuration data

//------- ***** EDIT REQUIRED HERE TO USE MULTIPLE PROTOTYPE PDFS ***** ----------------//

//config->setStringValue(“physModels”,“data_cat : data_00=DC data_10=gauss_1 data_01=gauss_2 data_11=gauss_3 data_other=gauss_4”) ;
config->setStringValue(“physModels”,“DC”) ; // We wil only use prototype ‘sum’

config->setStringValue(“splitCats” ,“hid aid”) ; // We will use ‘tagCat’ and ‘runBlock’ to split parameters

config->setStringValue(“DC”, "hid : h_a_param " // Split parameters using hid and aid
"aid : a_d_param "
"hid : h_d_param "
"aid : a_a_param "

                            ) ;  

//---------------------------------------------------------------------------------------//

// Build the PDF
RooSimultaneous* simSum = mgr.buildPdf(*config,&data_dummy) ;
simSum->Print(“v”) ;
simSum->getParameters(&data_dummy)->Print(“v”) ;