Hi Rooters,
Is there something like a TParameter?
I’m already using TParameter to safe some values in a TFile.
In addition to that I would like to safe a string as well.
Does anyone have an idea on how to do that?
Cheers,
Christian
Hi Rooters,
Is there something like a TParameter?
I’m already using TParameter to safe some values in a TFile.
In addition to that I would like to safe a string as well.
Does anyone have an idea on how to do that?
Cheers,
Christian
Hi Christian,
You could use TObjString …
Philippe.
Hello Philippe,
thanks for your answer.
TObjString looks like a interesting option. The problem is that TObjString doesn’t have a name.
The string in the object is used as name and value.
In my case I wanted to safe the version of the software which created the root file in the file it self.
Therefore I wanted to create an object with the name “version” and a string value.
Unfortunately this is not possible for TObjString.
Are there any other options to save a sting value with a name in a TFile?
Thanks for the help
Christian
use TNamed
Rene
Hi Rene,
thanks for your answer.
This is exactly what I was looking for.
Regards,
Christian
Hi,
I know this is a 15-year-old thread, but I would be very interested to know how a string used as a TNamed can be saved into a TParameter.
Thanks!
Answering my own question: I realized that yesterday I misunderstood the suggestion in this topic. I mistakenly thought the idea was to put a string into a TNamed and then to create a TParameter with this TNamed inside. But what René was really suggesting was to use a TNamed instead of TParameter. Indeed, this works in python:
myString = "ROOT 6.32.08"
tn_myString = ROOT.TNamed("tn_myString", myString)
tn_myString.Write()