Hi there,
I have a 2D simultaneous extended PDF and I am trying to plot a 1D projection of each slice, along with the data slice that it was successfully fitted to. I’ve tried to adapt the rf501 tutorial (see some sections of my code below) however something strange is happening. The data is plotted correctly onto each frame, but the “LL” PDF is plotted onto both frames with the normalisation for the LL data. The INFO messages for the plotting definitely show that the LL is used for both plots
Interestingly, if I reverse the order that the types are defined in the RooCategory, then the DD PDF is plotted in both cases. So it seems that the last entered type in the category is being used.
Does anyone know what could be happening here?
Dave
......
// Setup a splitting typeKs for the LL and DD datasets
RooCategory typeKs("KS","KS type");
typeKs.defineType("DD");
typeKs.defineType("LL");
wspace_Fit.import(typeKs);
// Create a combined dataset of both KS types with the category as an index
RooDataSet* data_LL = dynamic_cast<RooDataSet*>(wspace_Fit.data( "LL_Data" ) );
data_LL->Print();
RooDataSet* data_DD = dynamic_cast<RooDataSet*>(wspace_Fit.data( "DD_Data" ) );
data_DD->Print();
RooDataSet combData( "combData","combined data", obs, Index(typeKs), Import("DD",*data_DD), Import("LL",*data_LL), CutRange("fit") );
combData.Print();
// Begin the process of building a simultanous fit from the default pdfs
RooSimWSTool wst(wspace_Fit);
RooSimultaneous* sim = wst.build("sim","model",SplitParam("sigma_B,Yield","KS"));
RooFitResult* result = sim->fitTo( combData, Optimize(0), Save(kTRUE), Optimize(0), Extended(kTRUE), Range("fit") );
// Do some plotting
Int_t nBins = 50;
// Make a frame for the LL sample
RooPlot* frameLL = Bmass->frame( Bins(nBins), Range("fit"), Title("LL sample") );
// Plot all data tagged as LL
combData.plotOn( frameLL, Cut("KS==KS::LL") ) ;
sim->plotOn( frameLL, Slice(typeKs,"LL"), ProjWData(typeKs,combData), Range("fit"), NormRange("fit"), ProjectionRange("fit") );
// Make a frame for the DD sample
RooPlot* frameDD = Bmass->frame( Bins(nBins), Range("fit"), Title("DD sample") );
// Plot all data tagged as DD
combData.plotOn( frameDD, Cut("KS==KS::DD") );
sim->plotOn( frameDD, Slice(typeKs,"DD"), ProjWData(typeKs,combData), Range("fit"), NormRange("fit"), ProjectionRange("fit") );
.....