Tree's branch is a vector and add a friend with branch also a vector


ROOT Version: 6.14/06
Platform: mac os
Compiler: clang


I have a tree’s(tree1) branch(br1) is filled as vector. I add a brach(br2) from another tree(tree2) which is also filled as vector to it as friend. Suppose br1 and br2 have same entries but each entry for the vector have different size, something like:

TTree *tree1 = new TTree("tree1","tree1");
TTree *tree2 = new TTree("tree2","tree2");
vector<double> br1, br2;
tree1->Branch("br1",&br1);
tree2->Branch("br2",&br2);
for(int i=0;i<5;i++){
     br1.clear();br2.clear();
     for(int j=0;j<10;j++){
          br1.push_back(i+j);
     }
    for(int k=0;k<20;k++){
         br2.push_back(i*2+k);
    }
tree1->Fill();
tree2->Fill();
}

save the trees to a file.

Then I open the file and get the trees and do
tree1->AddFriend(tree2);
I’m wondering how it will deal if I do tree1->Draw(“br2”,“br1>3”); since each entry(which is a vector) has different size.

Best

for each entry it will look only at the first min(br1.size(), br2.size()) elements.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.