ERROR 30: Bad numerical expression

Hi,

I’m using ROOT 4.00/04, and I’m generating a subsample of my current tuple (by applying some simple cuts) and write out the results into a different root tuple. The following code is used to store my objects (electrons, muons etc.) in the new root tuple - and it works quite well. However there’s one branch were I get the error message:

ERROR 30: Bad numerical expression : “l3em.et

when I try to do a simple plot of the variable.

Here’s a code snipplet:

TClonesArray *cl_l3em = new TClonesArray("l3em");
_ttreeGood->Branch("l3em",&cl_l3em);
cl_l3em->Clear();

for (int k=0;k<L3E_Nelectron;++k) {
  l3em* l3em_ptr = new ((*cl_l3em)[k]) l3em;
  l3em_ptr->et         = L3E_Et[k];
  l3em_ptr->deteta   = L3E_deteta[k];
  l3em_ptr->phi        = L3E_phi[k];
  ...
}
cl_l3em->Compress();

Can anybody tell me what ERROR 30 means in this context? What do I have to look for?

Cheers,
Carsten

This usually means that there is a typo in your expression (i.e. l3em.et does not exist in your tree). Compare this string with the information from mytree->Print().
If there is no typo, please send me your ROOT file so that I can reproduce your problem.
Cheers,
Philippe

Hi Philippe,

these are the lines that I get when I do treeGood->Print():

I’ve attached a small root tuple which shows the problem. I’m really puzzled…

Thanks for your help.
Carsten
test_B.root (1.96 MB)

Hi,

I do not access to ROOT 4.00/04 for the moment.
However I tried with ROOT 4.00/08 (and with the CVS head) and failed to reproduce your problem.
Maybe I am missing something important.
I just did (as it seems to be suggested from your post):

[code]TFile *_file0 = TFile::Open(“test_B.root”);
treeGood->Draw(“l3em.et”);
treeGood->Scan(“l3em.et”);



  •    0 *        0 *         4 *
    
  •    1 *        0 *         9 *
    
  •    2 *        0 *         5 *
    
  •    3 *        0 *         4 *[/code]
    

which seems to work properly.

Cheers,
Philippe.

Hi,

I tried again with version 4.00/04, but the problems persists:

I’ve checked again using version 4.04/02f, and surprisingly I get the same values as you did when doing treeGood->Scan(“l3em.et”). However drawing the histogram (and all the other histograms in the l3em branch) I found that they all show the same contents. So I guess that something must be wrong with the initial code, or?

Cheers,
Carsten

[quote]I’ve checked again using version 4.04/02f, and surprisingly I get the same values as you did when doing treeGood->Scan(“l3em.et”)[/quote]This indicates that your orginal problem has been fixed! (v4.04/00 is newer than v4.00/04).

[quote]However drawing the histogram (and all the other histograms in the l3em branch) I found that they all show the same contents. So I guess that something must be wrong with the initial code, or?[/quote]I can see that do. I am checking to see if the problem is on the file or in the drawing.

Cheers,
Philippe

Hi,

The data on the file is correct. (Do treeGood->Show(0) for example to check).
However there is an issue related to the fact that you have both:

*Br 129 :em.l3em : l3em[em_] * *Entries : 1106 : Total Size= 10296 bytes One basket in memory * *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * and

*Br 378 :l3em : l3em_ * *Entries : 1106 : Total Size= 686217 bytes One basket in memory * *Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 * ..... *Br 381 :l3em.et : et[l3em_] * *Entries : 1106 : Total Size= 33796 bytes All baskets in memory * *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.00 * When you write

treeGood->Scan("l3em.et"); // or DrawThe system picks up the first ‘leaf’ whose name is l3em.
One problem is that the system should also (but obviously doesn’t yet) warn you that the .et part is not usable.
But more importantly, there was a deficiency in the branch lookup. It was looking for branches depth first, instead of breath first (so it found em.l3em when l3em.et was a better match). This is now fixed in the CVS repository.

You could work around the problem by creating the l3em branch before the em branch (you might also be able recover an existing file by manipulating the internal of the TTree).
Alternatively you could also use MakeSelector or MakeProxy to access your data.

Cheers,
Philippe.