[ROOT] Function on array

From: Tingjun Yang (tjyang@slac.stanford.edu)
Date: Sat Apr 03 2004 - 04:16:52 MEST


Hi rooters,
   I have a tree file which has an array branch:
*...........................................................................*
*Br   13 :peUZa     : peUZa[50]/F                                           *
*Entries :       10 : Total  Size=       2574 bytes  One basket in memory   *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00    *
*...........................................................................*
   I wonder if I can define a function on that array and make a cut on
it. I tried the following way:
//file w.C
Float_t w(Float_t *x){
  Float_t tmp=0;
  for(Int_t i=0; i<50; i++)
    tmp+=x[i];
    return tmp;
}
Then I did:
.L w.C++;
TFile f("test.root");
tree->Draw("w(peUZa)");

   But it doesn't work. Did I make any mistakes? I'm using the cvs version
on rh9. Thank you.

Regards,
T.J.





This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET