Dear experts
I am trying out to make a Splots using the TSPlot class.
I have looked into root.cern.ch/root/html534/tutor … lot.C.html
but I find it not helpful.
In a simple approach I have created a data set that consists of the control variable p and
the discriminating variable m. m is Gaussian(mean=5620,sigma=20) for signal and uniformly distributed
for background. p is a Landau (signal) + uniform (background).
The variables are uncorrelated and #Signal = 25000 and #Background=75000.
My code so far is:
void mySPlot()
{
TFile *file = TFile::Open(“Data.root”);
TTree tree = (TTree)file->Get(“tree”);
TF1 *mSg = new TF1(“mSg”,“TMath::Gaus(x,5620,20,1)”,5120,6120);
TF1 *mBg = new TF1(“mBg”,“1.0/1000”,5120,6120);
TSPlot *splot = new TSPlot(1,1,100000,2,tree);
splot->SetTreeSelection(“p:m:mSg:mBg”);
Int_t ne[2];
ne[0]=25000; ne[1]=75000;
splot->SetInitialNumbersOfSpecies(ne);
splot->MakeSPlot(“VV”);
splot->FillSWeightsHists(100);
TH1D *hp = splot->GetSWeightsHist(1,0,0);
hp->Draw(“E”);
}
I was expecting the sPlot weighted distribution of p, but it does not work correctly.
For example ROOT complaints:
Error in TTreeFormula::Compile: Bad numerical expression : "mSg"
Error in TTreeFormula::Compile: Bad numerical expression : “mBg”
How is it done correctly?
Cheers and thanks
Oliver