How to add a value to an existing leaf?

Hello,

Is it possible to add a value to a leaf?
for example, I have a leaf named “momentum” with these given values:

root[0] tree->Show(0);
======> EVENT:0
 EventMetaData   = (EventMetaData*)0x6294960
 MCParticles.m_momentum_x = 0.456297, 0.346359, 0.109938, -1.189059

And I would like to add some value to the end of this array.

Thanks

A TTree is a write-once, read-many time structure, so you can not modify the value ‘in place’.

The tutorials: tutorials/tree/copytree3.C gives some hints on how you could copy the original into a new tree while modifying the value during the copy.

Cheers,
Philippe.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.