Looping over leaves

Hi,
I have a Tree with 256 branches in that I’d like a simple way of looping over. The branches are imaginatively named Fadc0, Fadc1, …, Fadc255 and are just a float value.

I’ve generated the main event loop using TTree->MakeSelector(…) but now I need to access the leaves so I can store the values to a graph. As such I’m using a loop to generate the names of the variables (defined as Float_t in the generated header file) but I can’t figure out how to get the leaf value for a given value of entry.


Bool_t mu1::Process(Int_t entry)
{ 
  fChain->GetTree()->GetEntry(entry);

 Int_t nadc = 256;  // number of channels per adc

for (Int_t k = 0; k < nadc; k++)
     {
       TString hbase = "Fadc";
       hbase += k;
       const char *hname = (const char*)hbase;
   
       // now get the leaf value corresponding to the hname

       // Suggestions here please

       // add value to graph => graph->SetPoint(k,k,value)

     }
}

Any idea what would work? Things like

Float_t adc = (Float_t)gDirectory->Get(hname); 

don’t work and are a bit redundant anyway as the entire event has been obtained by the

fChain->GetTree()->GetEntry(entry);

Any ideas on how to access the values in this loop? Obviously I could just access them directly by name but I’d rather not duplicate code 256 times!

Thanks

Ewan

maybe try something like :

Float_t some_variable;
myTree->SetBranchAddress(hname,  &some_variable);

and after

myTree->GetEntry(10);

the value stored in some_variable should be the value of the “hbase” leaf for entry number 10.

asen.