Hi, You do not give enough information when describing your problem. see below Rene Brun Vahe Mamyan wrote: > > Hello . > I have Tree h2 in root file whict > has some branchs, I can't read that > branchs. For example Trees one branch's name is > "Event_nr" when I am doing h2->Draw("Event_nr") > everything is ok, but when I am doing ` > > Int_t event; > TBranch *b_Event_nr ; > h2->SetBranchAddress("Event_nr",&Event_nr);(root file already opened) I suppose, you meant: h2->SetBranchAddress("Event_nr",&event);(root file already opened) or above the declaration should be Int_t Event_nr instead of Int_t event. In case your Tree was created with something like MyEvent *event=0; tree->Branch("event","MyEvent",&event); where MyEvent class has a member Event_nr, when reading your Tree, you should do: myEvent *event = 0; h2->SetBranchAddress("event",&event); You should set the address of the top level branch, not the address of a sub-branch > b_Event_nr = h2->GetBranch("Event_nr"); > if(!b_Event_nr){ cerr<<"## Error : Can't find branch > Event_nr"<<endl;exit(1);} > int nentrys = h2->GetEntries(); > for(int i=0;i<nentrys;i++) { > b_Event_nr->GetEntry(i); //or h2->GetEntry(i); > cout<<"Event = "<<Event_nr<<endl; > } > I get for for Event_nr wrong numbers like 12001212. > I am using root Version 3.02/07, my OS is RedHat 6.2 > > What did I wrong ? Thanks . > > Vahe.
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:46 MET