SetBranchStatus does a wildcard match on the name of the branches. Doing SetBranchStatus on a top level branch only affects that top level branches and none of the subbranches. So try SetBranchStatus(“muon.*”,1)
In this case, it must mean that when creating the branches, the trailing dot was not added to the top level branch name. This means the top level branch name is not embedded in the sub-branches name and that using SetBranchStatus is going to be difficult (You would need to enumerate the sub-branches names).
Instead I recommend that you do not use SetBranchStatus but instead use the branch directly. So you would need to use something like:[code]
Tree *tree = 0;
// file() will return TFile *
//
file()->GetObject(“MyDir/TreeName”, tree);
When I try to read Tree via Branches (explicitly), ROOT crashes b/c of the ~Muon(). I guess ROOT is doing some memory management and deletes _p4. So, attempt to manually destroy non-existing object leads to crash.
[quote]produces error:[/quote]Humm strange. It might depends on the content of your muons branch. tree->SetBranchStatus("muons*", 1);should work better …
[quote]In the meantime, as I wrote before Muons is a std::vector<Muon *> where Muon is something like:[/quote]Humm do you really need a container of pointer (do you derive from Muon)? You should try vector it would be more efficient. private:
TLorentzVector *_p4;It seems that the pointer is unnecessary since you always allocate it. Wouldn’t [code]class Muon
{
public:
Muon() { }
~Muon() { }
//...
private:
TLorentzVector _p4;
}[/code] work as well for you?
[quote]When I try to read Tree via Branches (explicitly), ROOT crashes b/c of the ~Muon().[/quote]A priori, it shouldn’t, so there is more to the sorry (to track this down, the best is to use valgrind).