Load more than 9 variables from a TTree

Hi all,

I was wondering if it is possible to load more than 9 variables from a TTree in a RooFit macro. In the moment I use RooDataSet together with RooArgList.

TFile* FitDaten = new TFile("/data91b/leddig/BtoLcLK/RefinedData/OnPeak_ntp1_reduced.root");
gROOT->cd();
TTree* ntp1 = FitDaten->Get(“ntp1”);
RooRealVar *B_m_ES = new RooRealVar(“B_m_ES”,“m_{ES}”,5.2,5.3);
RooRealVar *DeltaE = new RooRealVar(“DeltaE”,"#Delta E",-0.3,0.3);
RooRealVar *CMS_Energie = new RooRealVar(“CMS_Energie”,“Argus Endpunkt”,0.,20.);
RooArgList VarSet(*B_m_ES,*CMS_Energie);
RooDataSet *data = new RooDataSet(“data”,“data”,ntp1,VarSet);

Unfortunately RooArgList is limited to 9 elements, so what do I have to do if I want to use e.g. 15 variables stored in the tree?

Hi,

That’s no problem. Class RooArgSet has constructors taking up to 9 initial arguments,
but you can easily add more using the add() method, e.g.

RooArgSet s(a,b,c,d,e,f,h,i,j) ;
s.add(RooArgSet(k,l,m,n,o,p)) ;

Wouter

Dear All,

I replied my post on this topic cause it is similar. I have a roofit script

RooDataSet * dataSet= &(RooDataSet::read(FileName,RooArgSet(Bmass, kaonpt),“Q”));

RooArgSet is OK up to 9 but how can I add more variables to this dataSet? I have more than 9.

Thank you.