Ntuple for multiple data columns

U62.C (1.76 KB)Hello,I want to plot and make an ntuple from an ascii data file which has 17 columns, the macro which I used is attached. I get the error message like
Error: Can’t call TNtuple::Fill(n,Et,ECsI1,ECsI2,ECsI3,ECsI4,ECsI5,ECsI6,ECsI7,ECsI8,ECsI9,ECsI10,ECsI11,ECsI12,ECsIF,ECsIB,ECMO) in current scope U62.C:30:
Possible candidates are…
(in TNtuple)
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 protected: virtual Int_t TNtuple::Fill(void);
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 public: virtual Int_t TNtuple::Fill(const Float_t* x);
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 public: Int_t TNtuple::Fill(Int_t x0);
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 public: Int_t TNtuple::Fill(Double_t x0);
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 public: virtual Int_t TNtuple::Fill(Float_t x0,Float_t x1=0,Float_t x2=0,Float_t x3=0,Float_t x4=0,Float_t x5=0,Float_t x6=0,Float_t x7=0,Float_t x8=0,Float_t x9=0,Float_t x10=0,Float_t x11=0,Float_t x12=0,Float_t x13=0,Float_t x14=0);
(in TTree)
/usr/local/root/5.34.03/lib/root/libTree.so -1:-1 0 public: virtual Int_t TTree::Fill(void);
*** Interpreter error recovered ***

If you thing about that error message for a moment you’ll realize it is
actually pretty helpful: You try to call TNtuple::Fill with 17 variables, but
there is no function that takes that many arguments. There is one version that
takes up to 14 arguments, but you gave more.

Instead you have to use the version TNtuple::Fill which takes an array of
values to fill, i.e.

float data[17] =
{
  n, Et, ECsI1, ECsI2, ECsI3,
  ECsI4, ECsI5, ECsI6, ECsI7,
  ECsI8, ECsI9, ECsI10, ECsI11,
  ECsI12, ECsIF, ECsIB, ECMO
};

ntuple->Fill(data);