Uint with TTreeReader

Dear root support,

I am trying to read a tree branch with TTreeReader defined as:
TTreeReaderValue<UInt_t> m_DACIndex(m_reader, “DACIndex”);

When I execute with .x ramps.C+

I get the following error:

Error in TTreeReaderValueBase::CreateProxy(): The branch DACIndex contains data of type unsigned int. It cannot be accessed by a TTreeReaderValue

(I have also tried to use unsigned int and got the same answer).
Is there something special I should do to handle UInt ?

Many thanks in advance for your help,
Isabelle.

Good morning,

Please find below more details and a test program and associated ntuple.
In the mean time, I have “cloned” my ntuple suppressing the UInt variables
and can read the “cloned” files.

The macro + input ntuple is available at /afs/cern.ch/user/i/isabelle/public/testUInt .

I have tried to run on my MacBook and got error number 1 (see below and my post of yesterday) and
on lxplus and got error number 2 (see below).

Thank you in advance for your help,
Isabelle.


ERROR 1 - MacBook OS-x 10.10.5
pb-d-128-141-149-17:calibration isabelle$ /Applications/root_v6.06.00/bin/root.exe testUInt.C

| Welcome to ROOT 6.06/00 root.cern.ch |
| © 1995-2014, The ROOT Team |
| Built for macosx64 |
| From tag v6-06-00, 9 December 2015 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

Applying ATLAS style settings…

root [0]
Processing testUInt.C…
==> entering
===> file HG opened LArRamp_00281325_EB-EMBA_StripsXtalkCorr_OFC.root
==> done
Error in TTreeReaderValueBase::CreateProxy(): The branch DACIndex contains data of type unsigned int. It cannot be accessed by a TTreeReaderValue


ERROR 2 - lxplus

[isabelle@lxplus0048]~/public/testUInt% root testUInt.C

| Welcome to ROOT 6.02/12 root.cern.ch |
| © 1995-2014, The ROOT Team |
| Built for linuxx8664gcc |
| From tag v6-02-12, 24 June 2015 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

root [0]
Processing testUInt.C…
==> entering
Error in TFile::ReadBuffer: error reading all requested bytes from file LArRamp_00281325_EB-EMBA_StripsXtalkCorr_OFC.root, got 0 of 300
Error in TFile::Init: LArRamp_00281325_EB-EMBA_StripsXtalkCorr_OFC.root failed to read the file type data.
===> file HG opened LArRamp_00281325_EB-EMBA_StripsXtalkCorr_OFC.root
==> done
root [1]

Hi Isabelle,

I think you have found a bug :frowning: I will have a look today.

Cheers, Axel.

Hi Isabelle,

LArRamp_00281325_EB-EMBA_StripsXtalkCorr_OFC.root has 0 bytes - do you happen to have a larger file that demonstrates that? :wink:

In the meantime I will try to reproduce this myself. But I’d still like to verify that I fix your problem.

Cheers, Axel.

Hi,

Alright, I can not reproduce that in my little test. I’ll need the ROOT file that you were referring to, with more bytes than zero.

Cheers, Axel.

Dear Alex,

thank you very much for your reply.
I have just put back the file (and also the one I created to overcome the problem with _copy in the filename).
Please excuse me for giving you an empty file… I must have made a wrong manipulation at some stage.

I have just tested the macro now; pb still there.

Cheers,
Isabelle.

Hi Isabelle,

Thanks - I can reproduce it. Debugging…

Cheers, Axel.

Hello,

any further feedback on this question?
Many thanks in advance,
isabelle.

Sorry Isabelle,

I do have a patch for this but never managed to check whether it breaks anything else. Let me try to get this done this week…

Cheers, Axel.

Hi,

I have created sft.its.cern.ch/jira/browse/ROOT-8363 so we can track my progress over there! This makes it a more visible reminder for me.

Apologies that I am so slow with this, I hope you managed to resort to a signed size in the meantime…

Cheers, Axel.

Hi Axel. I am experiencing the same problem as Isabelle. The progress tracker indicates that the case was transferred to Philippe Canal some time ago. Do you know if any progress has been made since? Thanks, Oliver

Hi Oliver,

Not much I can do here, but @pcanal might be able to comment.

What is your use case, can you fix the tree?

Axel

Updating ROOT to support unsigned int for array size is not trivial and we have not found the resource to do this work so far. Note that in most case, you can replace the C-style array (and its size variable) by an std::vector (Solving this problem and simplify your code in general)

1 Like

Thanks for the quick reply. I solved the problem by implementing my own tree reader. Fixing the tree is not really an option (the format of the tree is determined by some other software which I cannot easily change). I will make sure to use vectors instead of arrays in future projects! Cheers, Oliver

Hi Oliver,

If your own tree reader happens to be sort of a patch to the existing one then please share it :slight_smile:

Out of curiosity, which other software are we talking about? Delphes, by any chance?

Axel.