TChain Problem

Dear rooters,
I have problem with TChain, My tree contain events (UEvent class) with some variables (B, Phi etc.) and Table of TClonesArray that contain particles (UParticle). I try to get some loop over events variables (B,Phi) and if they have some values read entire event with particles. So I wrote constructor of my class that contain drzewo = new TChain("events"); for(Int_t i =0;i<files_nr;i++){ drzewo->Add(filename[i]);} uevent = new UEvent(); drzewo->SetBranchAddress("event",&uevent); //drzewo->GetBranch("event")->SetAddress(&uevent); drzewo->SetBranchStatus("*",0); drzewo->SetBranchStatus("fNpa",1); drzewo->SetBranchStatus("fNes",1); drzewo->SetBranchStatus("fPhi",1); drzewo->SetBranchStatus("fB",1);
Later I loop over events by drzewo->GetEntry(i) if its event that I looked for I try to read this by:

Int_t temp = drzewo->LoadTree(lastScanned);
drzewo->GetEntry(temp,1);

Unfortunatelly when I try to get some variables from particle (I use uparticle = uevent->GetParticle(j) and uparticle->GetSomething()) I get segfault. But if I don’t use drzewo->SetBranchStatus("*",0); It’s work fine. How you any idea how to force this to work and don’t read entire event?

Thanks for your help.

Daniel

Have a look at the skeleton analysis source code that you can generate for your “drzewo” by doing:
drzewo->MakeClass(“MyClass”);
and/or by:
drzewo->MakeSelector(“MySelector”);
For details, see:

Ok,
I tried many methods but it’s seems that avoidg SetBranchStatus("*",0) by SetBranchStatus for each branch is only sollution.