Hi Martin,
Could you send me the result of tree.Print and tell me
how to access your file ?
Rene Brun
On Thu, 9 Jan 2003, Martin Turner wrote:
> Hi root experts,
> I want to iterate over the entries of a tree but absalutely do not want to
> use MakeClass nor MakeSlector for this particular job.
> MakeCode looked as though it could have been the answer but is
> obsolete.
>
> the root file has the structure:
>
> file-> Tree :Jpsi_analysis_track_data -> Branch: track_jpsi_data which
> then contain leaves fC0 etc.
>
> Then what is wrong with:
>
> TFile("/cdf/scratch/martin78/Lambda_analysisdata_c_0.root","READ");
> TTree *other_tree =(TTree*)f->Get("Jpsi_analysis_track_data");
>
>
> //Declaration of variable types, these are the only variables on the
> branch
>
> Float_t fC0;
> Float_t fD0;
> Float_t fD0_corr;
> Float_t fD0_err;
>
> //Set branch addresses in order
> TBranch* b_track_combinations;
>
> other_tree->SetBranchAddress("fC0",&fC0);
> other_tree->SetBranchAddress("fD0",&fD0);
> other_tree->SetBranchAddress("fD0_corr",&fD0_corr);
> other_tree->SetBranchAddress("fD0_err",&fD0_err);
>
> b_track_combinations = other_tree->GetBranch("track_jpsi_data");
>
> for (int a=0;a<10;a++)
> {
> b_track_combinations->GetEntry(a);
> cout<<fC0<<endl;
> cout<<fD0<<endl;
> }
> _____________________________________________
> complains with
> Error in <TTree::SetBranchAddress>: unknown branch -> fC0
> Error in <TTree::SetBranchAddress>: unknown branch -> fD0
> Error in <TTree::SetBranchAddress>: unknown branch -> fD0_corr
> Error in <TTree::SetBranchAddress>: unknown branch -> fD0_err
>
> What's missing?
>
> Thanks in advance
> Martin
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET