Dear Experts,
I’m trying to plot plot a sum of multiple category-labels of my simultaneous fit. Basically I have a fit that follows the structure of this tutorial: https://root.cern.ch/root/html/tutorials/roofit/rf501_simultaneouspdf.C.html
However with a bunch more category-labels for different years, signal and normalisation channel and additionally for a few D0-modes. Each with different or slightly different pdf-shapes.
Now the tutorial enables me to plot either one label at a time or the sum of all.
I haven’t found a solution to e.g. plot the sum of all years for my signal mode.
Lets say I have the labels: “a1, a2, b1, b2” and I want to plot “a1+a2”. I then could modify the tutorials plotting-section:
combData.plotOn(frame2,Cut(**"sample==sample::a1||sample==sample::a2"**)) ;
simPdf.plotOn(frame2,**Slice( no clue )**,ProjWData(sample,combData)) ;
simPdf.plotOn(frame2,**Slice( no clue )**,Components(**"model_a1,model_a2"**),ProjWData(sample,combData),LineStyle(kDashed)) ;
How can I plot the sum of two or more slices?
Thanks
Harald
Hi,
I didn’t solve my Problem, but maybe the follwing leads to some spark anywhere:
Digging a bit around, I found a few category possibilities, I missed out. One would be a RooSuperCategory, that takes a set of RooCategory objects and generates all possible superpositions, thus I could do s.th. like:
fitCat then now holds the categories "{a1;b1},{a1,b2},...". This would come close to my need as I then should be able to Slice(aCat), I guess. The RooSimultaneous object can take the RooSuperCategory as input.
I’m hover struggling with the setup of my RooDataSet. Lets say I have the trees for each superposition in the RooSuperCategory, how can I link these to each other?
As I know I can link category labels like:
This however would require, according to my understanding, the use the previously defined fitCat (RooSuperCategory) as input. RooDataSet's however seem to only take RooCategory objects.
Does anybody have an Idea?
I don’t see a way to plot two categories at the same time. I think this wasn’t foreseen, as categories were meant to be fit and plotted separately.
As you describe in your second post, you can indeed create a second category, and for plotting slice in one while doing nothing for the other, which enables you to plot the state a1 + a2. You would slice in b, though, and not select anything for a.
I don’t exactly know how to get two categories into one dataset. I could imagine these two options:
Create two datasets, and give each one a category. Let’s say you create a dataset with the a1 and a2 categories that is equivalent to the full b1. Do the same for a b2 dataset (also split this one into a1, a2 when constructing it).
Create a dataset, and add two category variables to the observables. RooArgSet(x, catA, catB).
Select category a1;b1 in the category variables, and fill all events from this category into the dataset.
Select category a2;b1, and fill all from this tree.
This method requires to set the values the values of x, catA, catB manually for each entry, and save this entry into the dataset.