Weighted RooDataSet

Hi, I have 3 root files with TTrees that contain some observables and the event weight
In my fit program I want to merge the three samples in a unique RooDataSet and fit it with RooSimultaneous.

for(int i=0; i<3; i++){
h[i] = (TTree*)f[i]->Get( “merged” );
data[i] = new RooDataSet(“data”, “data”, *obs, Import(h[i]));
reducedData[i] = (RooDataSet
) data[i]->reduce(cut.c_str());
reducedData[i]->SetName(“reducedData”);
// create weightfed data set
datawS[i] = new RooDataSet(reducedData[i]->GetName(), reducedData[i]->GetTitle(), reducedData[i], *reducedData[i]->get(), 0, “N_LsigR_sw”); //-----------> The weight is correctly assigned
datawS[i]->Print(“V”);
}

RooCategory selection(“selection”,“selection”);
selection.defineType(“prompt”);
selection.defineType(“fromB”);
selection.defineType(“MCB”);
RooDataSet *combData = new RooDataSet(“combData”, “combined data”, RooArgSet(D0IP), Index(selection), Import(“prompt”,*datawS[0]), Import(“fromB”,*datawS[1]),Import(“MCB”,*datawS[2]));

RooFormulaVar D0logIP(“D0logIP”, “log(D0 IP)”, “log(@0)”, RooArgList(D0IP)); // check units
RooRealVar D0logIPvar = (RooRealVar) combData->addColumn(D0logIP);

combData doesn’t seem to propagate the weight since I get this message:

DataStore reducedData (merged)
Observables:
1) D0_IP_OWNPV = 0.0277355 L(0 - 100000) // [mm] "D0 IP"
Dataset variable “N_LsigR_sw” is interpreted as the event weight

DataStore reducedData (merged)
Contains 116 entries
Observables:
1) D0_IP_OWNPV = 0.164524 L(0 - 100000) // [mm] "D0 IP"
Dataset variable “N_LsigR_sw” is interpreted as the event weight

DataStore reducedData (merged)
Contains 21162 entries
Observables:
1) D0_IP_OWNPV = 0.513287 L(0 - 100000) // [mm] "D0 IP"
Dataset variable “N_LsigR_sw” is interpreted as the event weight

29844
DataStore combData (merged)
Contains 29844 entries
Observables:
1) selection = prompt "selection"
2) D0_IP_OWNPV = 0.0277355 L(0 - 100000) // [mm] "D0 IP"
3) D0logIP = -3.58504 C L(-7 - 3) “log(D0 IP)”

How can I assign the weight also to combData?
Many thanks
Stefania

Hi Stefania,

You will need to repeat the WeightVar() argument in the constructor of the combined dataset.

Wouter

Hi Wouter,

I am having the same trouble, only, I am not allowed to add the WeightVar() argument to the constructor since maximum 11 arguments is allowed and for my simFit I need to pass 12 (WeightVar() included). Can you suggest some similar solution for my case ?

Thank you !
Best,
Jaroslav

I guess I have found a solution :

RooDataSet * combData=new RooDataSet("combData", "combined data", RooArgSet(B_VTX_mass,GLC_DDW_weight), Index(*sample), 
                                       Import("controlsignalRAD", *data_signalRAD_ctl),
                                       Import("controlsignalNONRAD", *data_signalNONRAD_ctl), 
                                       Import("controljpsipi", *data_jpsipi_ctl),WeightVar("GLC_DDW_weight"));
RooDataSet * combData1=new RooDataSet("combData1", "combined data1", RooArgSet(B_VTX_mass), Index(*sample), Import("physics", *data), 
                                       Import("controlbckgPRDStep", *PRDbigstep_data_ctl), 
                                       Import("controlbckgPRDBump", *PRDbump_data_ctl), 
                                       Import("controlbckgPRDEE", *PRDothers_data_ctl));
combData->append(*combData1);

Sorry for the noise, just let me know if it is obviously not correct, it works in the simfit without problems though.
Cheers,
Jaroslav

Thank you very much Jaroslav. Your solution was very useful to me.

Cheers,
Santiago