Unable to fill a Branch

Hi,

I’m trying to fill a single Branch (I don’t want to use tree->fill() ).
Therefor I wrote something like:

TFile *file;
TTree *tree;
TBranch *bra;

[…]

void open(void)
{
file = new TFile("./histotree.root",“RECREATE”);
tree= new TTree(“Asim”,“name2”);
bra = new evtree->Branch(“bra”,&blatt,“amp/I:channel/I:rot/I:dist/F:height/F”);
}

void fill(void)
{if(check==1)
{
blatt.amp=1;
blatt.channel=2;
blatt.rot=3;
blatt.dist=4.5;
blatt.height=5.6;
bra->Fill();
}
}

void close(void)
{
tree->Write();
file->Write();
}

If I do write “tree->fill” instead of “bra->fill” everything is fine.
But since I need to create several branches and I have to choose which branch has to be filled, I can’t use “tree->fill”.
As far as I’ve seen in the web, “Fill” should be declared for TBranch, too (?),
so what am I doing wrong ?

I’m using CINT calling
open()
fill()
close().

Cheers;
Asim.

[quote]But since I need to create several branches and I have to choose which branch has to be filled, I can’t use “tree->fill”.
As far as I’ve seen in the web, “Fill” should be declared for TBranch, too (?),
[/quote]
What is your problem?
In general it does not make much sense to fill only one branch.

Rene

I want to read out differnt events according to different parts of a system.
Now I want to have one branch per part of the system.

So I have to dicide to which part the event belongs, and then I want to fill the data in the according branch.

That’s why I want to fill single branches and not the whole tree.

You need to call SetEntries:
See the documentation: root.cern.ch/root/html/TTree.htm … SetEntries

Also instead of multiple branches, you should consider multiple trees.

Philippe