How to read a Tree

Hi rooters,
I have a problem to read this Tree I made:
TFile *treefile = new TFile(nomerfile);
TTree *charge = new TTree(“charge”,“charge”);
charge->Branch(“adc”,adc,“L1C1G1/I:L1C2G1/I:L1C3G1/I:L1C4G1/I:L1C5G1/I”);

When I read it I’d like to fill a new array containing these variables L1C1G1 ecc…using charge->SetBranchAddress, but it doesn’t work becouse itś a sub branch!
What I do:
int name[nlink][nchannel];
for(int nl=0;nl<nlink;nl++){
for(int nc=0;ncSetBranchAddress(nhist,&(name[ng][nc]));
}
}
}
Could you help me?
Thanks

By usingcharge->Branch("adc",adc,"L1C1G1/I:L1C2G1/I:L1C3G1/I:L1C4G1/I:L1C5G1/I");you are (mostly) stuck with reading all the variable together.

Assumingly, you r ‘adc’ variable points to a struct with at least 5 ints. You simply need to reuse this same struct when reading.

Alternatively you could create the tree more like:[code]charge->Branch(“adc_L1C1G1”,&(adc->L1C1G1),“L1C1G1/I”);
charge->Branch(“adc_L1C2G1”,&(adc->L1C2G1),“L1C2G1/I”); [code]
Cheers,
Philippe

Thank you very much Philippe for your alternatives!
Maybe I’m stuck…but I’d like to read these variable putting them into another variable
name[ ][ ][ ][ ]. So I did:

for (int i=0;i<charge>GetEntries();i++){
   charge->GetEntry(i);   
   for(int nl=0;nl<nlink;nl++){
     for(int nc=0;nc<nchannel>GetLeaf(nhist);
       name[0][nl][0][nc]=l1->GetValue();
     }
   }   

It 's not really elegant, but OK.
Thanks again!
Fra