# Ask: how to access the sub-dataset in the joint dataset

**URL:** <https://root-forum.cern.ch/t/ask-how-to-access-the-sub-dataset-in-the-joint-dataset/16897>\
**Category:** Roofit and RooStats\
**Created:** [November 14, 2013, 8:02pm UTC](https://root-forum.cern.ch/t/ask-how-to-access-the-sub-dataset-in-the-joint-dataset/16897 "2013-11-14T20:02:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeiZhang](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@LeiZhang](https://root-forum.cern.ch/u/LeiZhang)\
**Post date:** [November 14, 2013, 8:02pm UTC](https://root-forum.cern.ch/t/ask-how-to-access-the-sub-dataset-in-the-joint-dataset/16897/1 "2013-11-14T20:02:04Z")

</div>

Dear RooFit expert,

May I ask a simple question? How to access the sub-dataset in a joint dataset?

I paste more code at the bottom. Here I just put the key part to discuss  
[size=85] RooDataSet\* obsData = new RooDataSet(“obsData”,"combined data ",\*Observables, Index(\*catelist), Import(“MET\_2m”, \*test11 ) );  
[/size]  
This is a test code. I could put more datasets into “obsData”. My question is how could I retrieve the “test11” from “obsData”?

Thank you in advance.

Cheers

Lei

P.S. most detailed code as following:

//==== read input root file of each category ====  
g\_inputfile[0] = new TFile( “…/…/Input/MET\_2m/Limit\_tot\_2012\_Normal\_Histo2.root” );

//=== read input histogram from each category root file ===  
//\*\*\*\*\*\* data signal background  
g\_dt\_hist[0] = (TH1F \*)g\_inputfile[0]-\>Get(“HMass\_Normaldata\_2tag\_MET1\_2j”) -\>Clone(“MET\_2m\_HMass\_Normaldata\_2tag\_MET1\_2j”);  
g\_bkg\_hist[0][0] = (TH1F \*)g\_inputfile[0]-\>Get(“HMass\_Normalconst\_2tag\_MET1\_2j”)-\>Clone(“MET\_2m\_HMass\_Normalconst\_2tag\_MET1\_2j”);

atlas\_invMass[0] = new RooRealVar(“atlas\_invMass\_MET\_2m”, “atlas\_invMass\_MET\_2m”, 125, 40, 290);  
RooDataHist \*new\_data = new RooDataHist(“newdata1”,“datanew1”, _atlas\_invMass[0], g\_dt\_hist[0]);  
RooDataSet_ test11 = (RooDataSet \*)new\_data-\>Clone(“MET\_2m\_test”);

RooArgSet\* Observables = new RooArgSet();  
Observables-\>add(\*atlas\_invMass[0]);

RooCategory\* catelist = new RooCategory(“catelist”,“catelist”);  
catelist -\> defineType( “MET\_2m” ) ;

RooDataSet\* obsData = new RooDataSet(“obsData”,"combined data ",\*Observables, Index(\*catelist), Import(“MET\_2m”, \*test11 ) );
