Hello,
I want to analyse TTree data of different length. E.g: “ABC.root” file having two TTrees “tree1” and “tree2”. For filling the data in “tree1” its referring to .data file named as “dataTree1” which contains 10000 entries. For filling the data in “tree2” its referring to .data file as “dataTree2” which contains 15000 entries.
Code is as below:
void drawGraph()
{
TFile *f1 = TFile::Open(“ABC.root”);
TTree T1 = (TTree)f1->Get(“tree1”);
T1->AddFriend(“tree2”, “ABC.root”);
TCanvas *c = new TCanvas(“c”, “c”, 0, 0, 800, 800);
T1->Draw(“element1:tree2.element1”);
TGraph *gr = new TGraph(T1->GetSelectedRows(),T1->GetV2(), T1->GetV1());
TF1 *f = new TF1(“f”, “exp([0]+[1]*x)”, -1, 6.10);
f->SetLineColor(kRed);
gr->Fit(f, “R”);
gr->Draw(“AC”);
gr->SetLineColor(16);
}
This works fine. But for the data above 10000 its showing a line on zero. My logic is to get a numberOfEntries in “tree2” and “tree1”. Take a difference of numberOfEntries. and assign that much zero entries to “tree1”.
Is it a right approach? OR How can I analyze a TTree data of different number of entries?