Hi All,
I have a class called Neuron that I want to store and retrieve using TTree.
The class has three int members and one TCloneArray. When I make the tree using the following code;
TTree* tree = new TTree(“NT”,“Tree with Neurons”);
for (Int_t=0;t<50;t++){
Neuron* n = new Neuron();
// set the three int data members
n->SetValues(i+55,i+510;i+5*20);
tree->Branch(“NeuronObj”,“Neuron”,&n,3200,99);
tree->Fill();
tree->Write();
}
This results in having (50) NeuronObj branches at the top level under tree “NT”. There is no probelm in using the Scan, Draw methods for printing values contained in different Neuron objects.
When I use the Tree Viewer; on the top level I see data members of ALL 50 Neurons.
NT->StartViewer();
Similarly when I use MakeClass() ; the resultant NT.h file has Neuron data members (and branch decalrations) for ALL 50 Neurons. This results in a LONG header file. May be I am doing something wrong in the process.
Can some one suggest to me a better method to store these Neuron objects in tree. Or guide me to an example. I looked at ROOT tutorail tree4.C but it stores a SINGLE Event object in tree; where as I need to store multiple top level objects.
I tried using a “NeuronContainer” class with TClonesArray of Neurons. And stored “NeuronContainer” object in tree. But this did not result in sort of organisation that I want.
Thanks in advance
Asif