Newbie with root and MakeSelector class


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.


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?


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 (2.1 KB)
bat_analysis.h (5.5 KB)

Many thanks,

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”))
seemed replaced with the correct:


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 or ROOT: Dataframe tutorials