Incorrect "Error in <TArrayI::At>" in TTree:

Hi,

I am using ROOT version 5.19/03 (for reasons given here: root.cern.ch/phpBB2/viewtopic.ph … highlight= I don’t know how to say exactly which branch it is.) to read a TTree with 1D and 2D arrays (actually vector and vector<vector >) of basic types (double and int). Mostly things work OK, but I’ve just spotted some inconsistencies when I apply a selection.

In the following, reco_ee_match_e20_L1_EM18 is a 2D array of n x 3 members (n=0,1,2,…), and Passed_e20 is a 3 element 1D array. Just follow the error messages:

root [3] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]") // No error root [4] CollectionTree->Draw("Passed_e20[2]") // No error accessing the third component of Passed_e20 root [5] CollectionTree->Draw("!Passed_e20[2]") // No error root [6] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]") // No error root [7] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]","Passed_e20") // No error applying a simple (and useless) cut (Long64_t)58 root [8] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]","Passed_e20[0]") // Still no error accessing first component of Passed_e20 (Long64_t)62 root [9] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]","Passed_e20[1]") // Now we start getting errors Error in <TArrayI::At>: index 1 out of bounds (size: 1, this: 0x08bf46a8) Error in <TArrayI::At>: index 1 out of bounds (size: 1, this: 0x08bf46a8) (Long64_t)62 root [10] CollectionTree->Draw("reco_ee_match_e20_L1_EM18[][1]","Passed_e20[2]") // Oh dear! Error in <TArrayI::At>: index 2 out of bounds (size: 1, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 1, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 2, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 2, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 2, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 2, this: 0x08e92dc0) Error in <TArrayI::At>: index 2 out of bounds (size: 2, this: 0x08e92dc0) (Long64_t)62
Also, doing CollectionTree->Draw("Passed_e20@.size()") makes a histogram with all entries at 3, as it should. So, the first argument of TTree::Draw is reading this array correctly, the second argument is not.

Any ideas? I’m a bit worried about using a branch version of ROOT, is this likely to be part of the problem’s cause?

Cheers,
Mike

Hi again,

It’s actually a little worse than this. These constructs also give the same error:

CollectionTree->Draw("Passed_e20[1]:reco_ee_match_e20_L1_EM18[][1]","","TEXT") CollectionTree->Draw("Passed_e20[1]&&reco_ee_match_e20_L1_EM18[][1]")
The 2D plot is particularly interesting. Out of 100 entries, 81 should have Passed_e20[1]==1, but only 62 are plotted. None of the 19 entries where Passed_e20[1]==0 make it on to the plot.

Could it be the mix of 1D and 2D arrays perhaps?

Cheers,
Mike