Unless entry number somehow get bigger than 650049 or your TTree file is corrupted, I do not see why you would get -2. To investigate further I would need access to your ROOT file.
[quote]You see that GetEntriesFast gives (apparently) meaningless number
(BTW, where does 1234567890 come from? ). [/quote]This is intentionally a large number. This is used to be able to loop over the entry of chains without having to open all the files before starting to loop [GetEntries will open and close every single file in the chain]; opening all those file can be quite a slow operation if the file are not local.
When using GetEntriesFast, you ought to add a break in your loop:[code] Long64_t nentries = fChain->GetEntriesFast();
_nEntries = int(fChain->GetEntries ());
When running your example I noticed:Warning in <TROOT::Append>: Replacing existing TH1: beamProfU_Det0 (Potential memory leak).
Warning in <TROOT::Append>: Replacing existing TH1: beamProfV_Det0 (Potential memory leak).
... etc ... which lead me to believe that you inadvertently create your histogram twice (and probably Fill one while Drawing the other)