Hello.
I thank you in advance for any help.
I am trying to use Geant4’s advanced example “brachytherapy”. After running a simulation I can get the file “brachytherapy.root”.
Using Root I am able to use “macro.C” and “plot_primary.C” to generate the graphs.
(I load the file with ’ root brachytherapy.root’, then ‘.x macro.C’)
My problem is when I try to make the comparison between the generated data and the reference data.
In the ‘comparison’ folder is the ‘TG43_relative_dose.C’ which should be used to transform the file ‘brachytherapy.root’ to ‘geant4_dose.txt’ needed to do the comparison.
I am unable to use ‘TG43_relative_dose.C’.
I load the file with ’ root brachytherapy.root’, then ‘.L TG43_relative_dose.C’ and then ‘TG43_relative_dose(“iodine”, “gps”)’.
This is probably something trivial, but after many, many attempts I have not been able to figure out where I am going wrong.
root [0]
Attaching file brachytherapy.root as _file0...
(TFile *) 0x5d03a188e530
root [1] .L TG43_relative_dose.C
root [2] TG43_relative_dose("iodine","gamma")
input_line_30:2:3: error: use of undeclared identifier 'TG43_relative_dose'
(TG43_relative_dose("iodine", "gamma"))
^
Error in <HandleInterpreterException>: Error evaluating expression (TG43_relative_dose("iodine", "gamma"))
Execution of your code was aborted.
Thanks for the post and welcome to the ROOT Community!
This does not look like a ROOT error but more of a configuration issue on your side: have you tried posting the issue on the G4 Discourse Forum?
This error
input_line_30:2:3: error: use of undeclared identifier 'TG43_relative_dose'
(TG43_relative_dose("iodine", "gamma"))
is telling you that the TG43_relative_dose does not exist in your macro: have you checked it’s there?
Thank you for the response.
Since I will have to use Root often I would like to learn how it works.
With macros without input variables I had no problems, while with this one I did. There should be no problems related to packages or installation. However after checking the code and I don’t understand where I am going wrong.
I can neither attach files nor put links, but the file can be easily found as I can neither attach files nor put links, but the file can be easily found as
Now I tried to write in Geant4’s group as well, but since the question is learning how to use macros in Root it seemed to me that this forum is more suitable.
I have already read the materials, especially root_macros_and_shared_libraries.
I have also already searched the forum and could not find a solution. I decided to open this post after a week of trying, not knowing how else I could do it. I don’t want to waste other people’s time with maybe trivial questions, but I don’t know how else to solve it.
Have you done what Danilo first suggested? If you are trying to call TG43_relative_dose(“iodine”, “gps”) (or gamma), there should be a function inside your TG43_relative_dose.C macro called TG43_relative_dose that takes the 2 arguments you are trying to pass to it (of whatever types iodine and gamma or gps are). If you have, or think you have, such a function, then it’s probably not properly implemented in your macro and thus it cannot be used/found (and then it’s a C++ problem, not a ROOT issue).