# Newbie with root and MakeSelector class

**URL:** <https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012>\
**Category:** Newbie\
**Created:** [January 31, 2024, 11:02am UTC](https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012 "2024-01-31T11:02:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eru\_Iluvatar](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eru_iluvatar/32/35588_2.png) [@Eru\_Iluvatar](https://root-forum.cern.ch/u/Eru_Iluvatar)\
**Post date:** [January 31, 2024, 11:02am UTC](https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012/1 "2024-01-31T11:02:07Z")

</div>

Hello,

I am trying get familiar with root and especially the MakeSelector class.

From the root command I have created the two files .h and .C but in my effort to analyze a branch, when I try to “Draw” a histogram with the command

(q1xHist-\>Fill(\* “name”))

I get the following error:  
error: indirection requires pointer operand (‘TTreeReaderArray’ invalid)  
Error in TSelector::GetSelector: The file " ".C does not define a class named " ".

I have tried some variations in the .h and .C files regarding the type of the value but nothing worked.

When I “Print()” the tree in root command, I noticed the variable I try to analyze is a “vector\< int \>”

Could you give me any recommendations?

Thank you for your concern.

V.P

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [January 31, 2024, 11:55am UTC](https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012/2 "2024-01-31T11:55:38Z")

</div>

Hello @Eru_Iluvatar,  
welcome to the ROOT forum!

It is not very clear to me what is raising this error. Could you please provide the content of your .h and .C files so I am able to reproduce your error?

Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![Eru\_Iluvatar](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eru_iluvatar/32/35588_2.png) [@Eru\_Iluvatar](https://root-forum.cern.ch/u/Eru_Iluvatar)\
**Post date:** [January 31, 2024, 2:53pm UTC](https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012/3 "2024-01-31T14:53:51Z")

</div>

Hello @mdessole, thank you for your quick response.

I will upload the “.C” and “.h” files that I have created with the MakeSelector() macro in root command line. Unfortunately I cannot upload the “.root” I am trying to analyze (I changed the argument inside the “Fill()” and now I get a segmentation violation)

[bat\_analysis.C](https://root-forum.cern.ch/uploads/short-url/1GAyeZhqymlim5SY4sIS9avONTx.C) (2.1 KB)  
[bat\_analysis.h](https://root-forum.cern.ch/uploads/short-url/bBvqKOAOTEv01WAS0xIldnnZsZn.h) (5.5 KB)

Many thanks,  
Vasilis

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [January 31, 2024, 9:36pm UTC](https://root-forum.cern.ch/t/newbie-with-root-and-makeselector-class/58012/4 "2024-01-31T21:36:01Z")

</div>

The files uploaded do not contains any syntax errors (load clean with `.L bat_analysis.C+`) and the odd looking line:[quote=“Eru\_Iluvatar, post:1, topic:58012”]  
(q1xHist-\>Fill(\* “name”))  
[/quote]  
seemed replaced with the correct:

```auto
bat_q1xHist->Fill(bat_q1x[entry]);

```

so it looks like you are all set.

That said, especially if you are just starting out, we strongly recommend looking into using `RDataFrame` from the get go (instead of `MakeSelector`) as it is better supported and allow for better performance (eg. using many threads). See [Dataframes - ROOT](https://root.cern/manual/data_frame) or [ROOT: Dataframe tutorials](https://root.cern.ch/doc/master/group __tutorial__ dataframe.html)
