Reading a TTree with an array float (via MakeClass)

Hello

I am sure it is trivial but could not find it :wink:

So, I ve made the .C and .H via the “MakeClass” and this is how the .h looks like

[code]Int_t NII;

Float_t XELEC[1801]; //[NII]
…
fChain->SetBranchAddress(“XELEC”, XELEC, &b_XELEC);

[/code]

Now, I am not sure how to loop and draw the contents of the XELEC since it is an array. Doing

[code] Int_t kentries = lcpolmc->GetEntriesFast();
TH1F *h1 = new TH1F(“h1”,“XELDET”, 100, -0.0,0.1);

for (Int_t jentry=0; jentry<kentries;jentry++) {
fChain->GetEntry(jentry);
Int_t ientry = LoadTree(jentry);

    h1->Fill(XELDET[jentry]);
cout<<" kentry "<<jentry<<" ientry  "<<ientry<<"  value "<<XELDET[jentry]<<endl;
    }

[/code]

does not produce the proper histogram… What am I missing ?

Thanks

Alex

[code]void MyTTree::Loop() {
TH1F *h1 = new TH1F(“h1”, “XELEC”, 100, 0.0, 0.1);

if (!fChain) return; // just a precaution

fChain->SetBranchStatus("*", 0); // disable all branches
fChain->SetBranchStatus(“NII”, 1); // activate “NII” branch
fChain->SetBranchStatus(“XELEC”, 1); // activate “XELEC” branch

Long64_t nentries = fChain->GetEntriesFast();

for (Long64_t jentry = 0; jentry < nentries; jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;

fChain->GetEntry(jentry);

for (Int_t i = 0; i < NII; i++) {
  h1->Fill(XELEC[i]);
}

}
}[/code]