# RReader does not support Spectators?

**URL:** <https://root-forum.cern.ch/t/rreader-does-not-support-spectators/45951>\
**Category:** TMVA\
**Created:** [July 21, 2021, 12:16pm UTC](https://root-forum.cern.ch/t/rreader-does-not-support-spectators/45951 "2021-07-21T12:16:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooter\_03](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rooter_03/32/19119_2.png) [@rooter\_03](https://root-forum.cern.ch/u/rooter_03)\
**Post date:** [July 21, 2021, 12:16pm UTC](https://root-forum.cern.ch/t/rreader-does-not-support-spectators/45951/1 "2021-07-21T12:16:39Z")

</div>

Hi,

I am trying to use:

[https://root.cern/doc/master/classTMVA\_1\_1Experimental\_1\_1RReader.html](https://root.cern/doc/master/classTMVA_1_1Experimental_1_1RReader.html)

to read an XML file produced with TMVA. The training used an spectator and when I call the constructor I see:

```auto
<FATAL> : Dataset[Default] : You declared 0 spectators in the Reader while there are 1 

```

This `RReader` class makes sense to me and it would be nice if it would be able to accept spectators or that this error be bypassed.

Just in case some else has this problem, I managed to remove the spectators from the XML file with:

```auto
for BDTXML in `find . -mindepth 2 -name "*.xml" -type f | sort`;do
    cat $BDTXML | grep -v "Spectator" > tmp.xml

    ORGNAME=$(echo $BDTXML | sed "s|.xml|_original.xml|g")

    #echo "mv $BDTXML $ORGNAME"
    mv $BDTXML $ORGNAME

    #echo "mv tmp.xml $BDTXML"
    mv tmp.xml $BDTXML

    diff -y -W 200 --suppress-common-lines $ORGNAME $BDTXML 
    echo ""
done

```

which should remove the lines with “Spectator” from the XML files in a given subdirectory (-mindepth 2) in the current directory.

I am using this version of ROOT:

```auto
/cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc8-opt/bin/root

```

Cheers.

---

<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:** [July 21, 2021, 3:39pm UTC](https://root-forum.cern.ch/t/rreader-does-not-support-spectators/45951/2 "2021-07-21T15:39:10Z")

</div>

Hi,  
At the moment it does not support Spectators. There is an open PR for this, [[TMVA] RReader: allow spectators in xml file by goi42 · Pull Request #7899 · root-project/root · GitHub](https://github.com/root-project/root/pull/7899), you can try to use it and if it works in your case, we have one additional check that it is ok to merge it

Cheers

Lorenzo
