Dear rooters,
I have a very embarrassing problem with TTree::GetEntry() method. I have developed a very simple code:
[code]
void simple_dump(){
TFile *file = new TFile (âP1G.rootâ);
TTree tree = (TTree)file->Get(âUSR1â);
if(tree==0) return;
tree->SetMakeClass(1);
Int_t eRun;
Int_t eSpill;
Int_t eEvinspill;
tree->SetBranchStatus("*", 0);
tree->SetBranchAddress(âeRunâ,&eRun);
tree->SetBranchAddress(âeSpillâ,&eSpill);
tree->SetBranchAddress(âeEvinspillâ,&eEvinspill);
Long64_t events = tree->GetEntries();
cout<<"****"<<events<<endl;
cout<<âEvt\tâ<<âSpill\tâ<<âRun\tâ<<endl;
for(Long64_t i = 0; i<events; i++)
{
tree->GetEntry(i);
cout<<eEvinspill<<'\t'<<eSpill<<'\t'<<eRun<<endl;
}
}[/code]
Which aims to make a simple dump of three variables from a tree inside âP1G.rootâ file (attached). I expect to have dumped down all data but I got âzerosâ
Why after tree->GetEntry(i);
the variables are not filled?
I guess Iâm doing some very basic mistake.
Could someone please point me my mistake?
Many thanks in advance.
Cheers,
LuĂs.
P1G.root (70.3 KB)