I have a flat tree with observables I want to use for my pdf (and some other variables). The tree also contains a leaf ‘wgt’ designating event weight - it is different for each event.
I want to construct RooHistPdf out of this dataset.
I proceed like this:
RooRealVar* wgt=new RooRealVar(“wgt”,“wgt”,0.0,1.0);
then read files trees etc… then make a dataset:
RooDataSet* sig_train_data_var1= new RooDataSet "name","title" t_sig_selected_var2, RooArgSet(var1,var2,*wgt) ,0,wname);
where wname is a const char* = “wgt”
then I make RooDataHist and RooHistPdf:
RooDataHist* hist_sig_var1=new RooDataHist ("anothername","anothertitle", RooArgList(var1),*sig_train_data_var1); RooHistPdf* sig_PDF_var1=new RooHistPdf ("yetanothername","yetanothertitle", RooArgSet(var1),*hist_sig_var1);
I do the same for var2 (applying different selections etc) and then make a product pdf.
I plot the pdf and the data it was derrived from and I dont get what I expect at all - namely the pdf looks like the unweighted pdf scaled by 0.5. If I do something like: (*wgt)=0.9; somewhere up front it looks like all the points are multiplied equally by 0.9.
If I don’t declare the variable wgt and don’t include it in the RooArgSet containing the set of variables making up the RooDataSet I get a warning:
WARNING: designated weight variable wgt not found in set of variables, no weighting will be assigned
How do I make this behave correctly? I.e. assing not a global weight but a per-event weight???