math api to add all children at all levels under parent


is there any api available to add all children under a parent row even if it is grand or grandgrand child. [=sum] gives only immediate children sum. my requirement is to have sum of children of immediate children n so on recursively. like if hierarchy is like

—b______________________80 _______________ 0
—c______________________20 ______________ 120
------d____________________30 ________________90
---------f__________________50 ________________0


Built-in summ ability can’t be used in such use-case.
It possible to create a custom solution, which will use onCellChanged event as trigger, iterate through all sub-rows and calculate necessary value.