Changing graph titles through a loop

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/06
Platform: MacOSX, Catalina 10.15.5
Compiler: Not Provided

Hello all,

I have been working with ROOT since about late May. I’m sort of a newbie I think, but I can generally work my way through what I want to do in ROOT by reading up on the different class references, but this one issue I’m having I can’t find a solution for.

Basically, I have a loop with 120 iterations. In this loop, I use the class TGraph to construct a graph for 64 data points which are read in from a text file. The graph plots correctly and there is nothing wrong on that part, but I would like to have the title of the graph change with each iteration of the loop. I’ve been setting my Graph titles with SetTitle(“Title”), but as I understand it I can only pass character/string arguments to this, and can’t pass a string variable that changes with each iteration.

If anyone has any suggestions for something that might work, please let me know! I can try to provide more info if necessary.

Just pass the string with c_str(), e.g. SetTitle(mystring.c_str())