# RReader and spectator variables

**URL:** <https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844>\
**Category:** Newbie\
**Created:** [December 23, 2020, 7:07pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844 "2020-12-23T19:07:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dertexaner](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dertexaner/32/21605_2.png) [@dertexaner](https://root-forum.cern.ch/u/dertexaner)\
**Post date:** [December 23, 2020, 7:07pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/1 "2020-12-23T19:07:16Z")

</div>

Dear experts,

I use the experimental RReader function to compactly evaluate a TMVA xml file in an RDataFrame based framework.  
Is there a recommended way of using “spectator variables” in the RReader?

The following declaration :  
ROOT.TMVA.Experimental.RReader(model.xml)  
crashes with the error below:  
 : Dataset[Default] : You declared 0 spectators in the Reader while there are 1 spectators declared in the file

I am aware of the TTree based methods where one explicitly declares a spectator variable, but would not want to roll back to explicitly looping over events for the purposes of TMVA evaluation.

Thanks in advance for your help and happy holidays!

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [December 23, 2020, 8:41pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/2 "2020-12-23T20:41:43Z")

</div>

@moneta will most probably able to help you once back from vacation

---

<div class="post-metadata">

**Author:** ![dertexaner](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dertexaner/32/21605_2.png) [@dertexaner](https://root-forum.cern.ch/u/dertexaner)\
**Post date:** [December 24, 2020, 9:21pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/3 "2020-12-24T21:21:28Z")

</div>

thanks, looking forward to it!

---

<div class="post-metadata">

**Author:** ![swunsch](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@swunsch](https://root-forum.cern.ch/u/swunsch)\
**Post date:** [January 11, 2021, 11:07am UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/4 "2021-01-11T11:07:23Z")

</div>

Hi there,

Sorry for the late reply!

Unfortunately, the `TMVA::RReader` does not support spectator variables and apparently also does not neglect if they are defined. Feel free to open an issue [here](https://github.com/root-project/root/issues)!

A short term solution is simply removing the spectators from the xml file, or training without any spectators.

Best  
Stefan

---

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [April 16, 2021, 1:18pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/5 "2021-04-16T13:18:37Z")

</div>

Created [issue #7900](https://github.com/root-project/root/issues/7900) and submitted [PR #7899](https://github.com/root-project/root/pull/7899).

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 16, 2021, 1:42pm UTC](https://root-forum.cern.ch/t/rreader-and-spectator-variables/42844/6 "2021-04-16T13:42:31Z")

</div>

Thank you !
