Hi Mamen,
you are setting the branch addresses with wrong type, feppx and eppid are arrays[ncnd]. If you check, you see
root [5] epempi0Tuple.Print("feppx*")
******************************************************************************
*Br 0 :feppx : feppx[ncnd]/F *
*Entries : 477980 : Total Size= 3999009 bytes File Size = 2757478 *
root [6] epempi0Tuple.Print("eppid*")
******************************************************************************
*Br 0 :eppid : eppid[ncnd]/I *
*Entries : 477980 : Total Size= 3999002 bytes File Size = 1021207 *
The number 477980 is exactly the number of events you see in your second approach.
You should do the loop like this:
float feppx[100];
int eppid[100];
int ncnd;
epempi0TupleReco->SetBranchAddress("feppx", &feppx);
epempi0TupleReco->SetBranchAddress("eppid", &eppid);
epempi0TupleReco->SetBranchAddress("ncnd", &ncnd);
TH1F *Reco2;
Reco2 = new TH1F("Fill", "Fill", NBINS, BINMIN, BINMAX);
long NEntriesReco=(long)epempi0TupleReco->GetEntries();
for (int k=0; k<NEntriesReco; k++)
{
epempi0TupleReco->GetEntry(k);
if (k % 100000 == 0 && k != 0) cout<<"*** Reco Loop *** Getting Entry: "<< k << endl;
for (int kk=0;kk<ncnd;++kk)
Reco2->Fill(feppx[kk]);
}
With that I get the output:
File: epempi0-W2-10-Delta0-bw-LargeQ2-Merged.root
Number of events in the Histogram using Project:
Total_int (0-9) Integral (1-8) GetEntries
500104 500104 500104
*** Reco Loop *** Getting Entry: 100000
*** Reco Loop *** Getting Entry: 200000
*** Reco Loop *** Getting Entry: 300000
*** Reco Loop *** Getting Entry: 400000
Number of events in the Histogram looping over TTree:
Total_intF (0-9) IntegralF (1-8) GetEntriesF
500104 500104 500104
Best,
Klaus