Ntupla iterator or something instead

I have following problem:

I have series of measurements for 4 similar objects. I have a loop that iterates through each measurement of an object. This loop is inside a loop that iterates through objects. I want to fill ntupla with results of fit which I perform for every measurement.

Something like that:

for(int obj_num=0; obj_num<4; obj_num++) { for(int meas_num=0; meas_num<100; meas_num++) { measurement->Fit("function"); ntuple->Fill(function->GetParameter(0), function->GetParameter(1)...); } }
Now, I would like to plot parameter(0) of object 1 vs parameter(0) of object 2. Is it possible, when this parameter(0) is inside one column? I imagine I should do something like
ntuple->Draw(“param0[i]:param0[100+i]”)

where i is some kind of iterator used when drawing ntupla. But I haven’t seen anything like that.

Maybe there is other, proper what of this kind of storing into ntuple and drawing?

[quote]Now, I would like to plot parameter(0) of object 1 vs parameter(0) of object 2. [/quote]This is possible however not with the structure your tried.

Instead you should use a small container for your parameter and store the information for all 4 object separately.

One of the possible solution looks like: vector<double> *params[4]; TTree *tree; for(int obj_num=0; obj_num<4; obj_num++) { params[obj_num] = new vector<double>[4]; tree->Branch(Form("obj_%d.",obj_num),&(params[obj_num]); } for(int meas_num=0; meas_num<100; meas_num++) { for(int obj_num=0; obj_num<4; obj_num++) { measurement->Fit("function"); param[obj_num]->clear(); param[obj_num]->push_back(function->GetParameter(0)); param[obj_num]->push_back(function->GetParameter(1)); .... } tree->Fill(); } ...
and then you will be able to dotree->Draw("obj_1[0]:obj_2[0]");

Cheers,
Philippe.

Thanks, that should work.

However, implementing an ntuple interator could give some new possibilities, like ploting part of data against other part, not thinking that this parts should be divided in time of filling the ntuple.