Reading a TTree with an array float (via MakeClass)


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);


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++) {
Int_t ientry = LoadTree(jentry);

cout<<" kentry "<<jentry<<" ientry  "<<ientry<<"  value "<<XELDET[jentry]<<endl;


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



[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;


for (Int_t i = 0; i < NII; i++) {