# RDataFrame syntax more like TTree::Draw

**URL:** <https://root-forum.cern.ch/t/rdataframe-syntax-more-like-ttree-draw/31778>\
**Category:** Evolution Proposals, Apps & Ideas\
**Tags:** rdataframe\
**Created:** [November 26, 2018, 8:24pm UTC](https://root-forum.cern.ch/t/rdataframe-syntax-more-like-ttree-draw/31778 "2018-11-26T20:24:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [November 27, 2018, 9:04am UTC](https://root-forum.cern.ch/t/rdataframe-syntax-more-like-ttree-draw/31778/2 "2018-11-27T09:04:17Z")

</div>

Hi @mwilkins,  
thanks for the feedback!  
Indeed we wanted to implement this since even [before RDataFrame was part of ROOT](https://github.com/bluehood/tdataframe/issues/18)!

Then when you get to the details of designing the feature things get messier – no blockers, just annoyances:

- if you implement this for 1D histograms, it will be hard to justify why the functionality is not there also for 2D, 3D histograms and all other actions: `df.Max("x.size() - y.size()")`, `df.Snapshot(..., {"x*x","y*y", "x*y*z"})`
- the _proper_ way to implement this for histograms under the hood is with a function that calculates the quantity on the fly and fills the histogram with it directly, avoiding the cost of the copy and indirection that `Define` brings with it
- the feature is easy to abuse: you don’t want to encourage users to define `"myexpensivefunc(x)"` in-place everytime they use it – `Define`ing it once avoids extra computation
- the _performant_ way to do this is with lambda functions rather than just-in-time compiled strings: `df.Histo1D([](int x) { return x*y; }, {"x", "y"})`, but this is so verbose that just using a `Define` does not seem so bad now…

So…since the functionality _is there_ with just a few more keystrokes, we never got around to implement this. It’s on the bucket list though! And now we know users also feel this would be nice to have.

Cheers,  
Enrico

---

_[View the full topic](https://root-forum.cern.ch/t/rdataframe-syntax-more-like-ttree-draw/31778)._
