ROOT Version: All version
Platform: Mac & Linux
Compiler: Not Provided
Attached is a simple test root file. I post the code which produces it at the end. My problem is that I want to access some entry in the vector<string>, e.g. tree->Draw("br2[3]"); always giving the result tree->Draw("br2[0]"); but I check tree->Scan("br2[3]") is correct. Is this a bug? Or there is any other way to accomplish this?
#include <vector>
using namespace std;
void test(){
vector<int> br1;
vector<string> br2;
vector<string> *br3;
vector<TString> br4;
TFile *f = new TFile("testTree.root","RECREATE");
TTree *tree = new TTree("tree","tree");
tree->Branch("br1",&br1);
tree->Branch("br2",&br2);
tree->Branch("br3",&br3);
tree->Branch("br4",&br4);
for(int i=0;i<100;i++){
br1.clear(); br2.clear();br3->clear();
br4.clear();
for(int j=0;j<10;j++){
br1.push_back(i*10+j);
br2.push_back(Form("test %d",j));
br3->push_back(Form("test %d",j));
br4.push_back(Form("test %d",j));
}
tree->Fill();
}
f->Write();
f->Close();
}
testTree.root (9.0 KB)