I’m attempting to save a (set of) TStrings in a root file. Think of things like a timestamp or the revision that an ntuple was created with, or a username, or anything with a name and a string value. This is now currently totally impossible, it appears. I have found OK’ish half-solutions in these forums and in other documentation, but nothing that meets this (seemingly simple) need.
The usual format to store such a thing in is a string (whether it’s a TString or std::string is irrelevant). Assume I have a class which determines that
std::string m_revision = “v7.0-17-gcbd75df”;
This string needs to be saved in the file which has an ntuple in it, for bookkeeping and versioning purposes. There seem to be two possibilities for this, both not meeting the basic needs of something as simple as storing a string in a file! Then there’s one very dirty hack. Let me go through them:
[li]If one creates a TObjString, it doesn’t work. A TObjString has the same name as value (both the class member fString), so rather than something called “revision” in the ntuple, I end up with a string that has both the name and the value “v7.0-17-gcbd75df”. That is useless. It would work if a TObjString had a name and a value.[/li]
[li]The next option is a TNamed. That is also quite useless: it has a name and a title. No value. I don’t care about the title of my object, I care about its value. However, there is no such thing to set. [/li]
[li]The final option is to create a TTree with 1 row and 1 branch. That strikes me as a ridiculous workaround. [/li][/ul]
Is it really true that ROOT provides no use-case whatsoever for something as simple as this?