Which symbols are allowed for a TNamed name object?


Which symbols are allowed for a TNamed name object?

Thanks a lot!!! :slight_smile:


All ascii characters are in principle possible.
However, if you try to print names (or draw) with exotic characters
you may have problems.


Also, if you intend on being able to use the features of ROOT and CINT that allow the access to an object from its name, for the name part of TNamed you should restrict yourself to something that is a legal C++ variable name.
Example of this is when on the ROOT prompt you use:

TFile f(....); T->Draw(); // T is the 'name' of a TTree object.
In the name is more complex you have to do:

TFile f(....); TTree *tree; f.GetObject("my name with space",tree); tree->Draw(); // T is the 'name' of a TTree object.
Another example is histogram names if they are to be used from TTree::Draw or function names if they are to be composed or or used by name for fitting.


Dear Rene and Philippe,

Thank you!!! :smiley:

My case is the following. I need to TObject::Write many different events in to a file.
If I give to the objects the same name it turns out to be very slow and there is a limit of
max(Short_t) on the number of such objects. So I give them random number names currently :slight_smile:

Some more questions:

Is there any limit on the number of objects with different names saved to a one single file?

Is there a limit on the file size?


When a TFile is active, there is a TKey object in memory for each object written via object.Write(). Count around 70 bytes per key.
If you reach a memory limit, it means that you are wronly using the system. Like on a Unix file system, it does not make much sense to store zillions of files in the same directory. TTrees have been invented to
store many objects with a similar data structure. A TTree is designed to support a very large number of entries.

a TFile is automatically extended when you add objects.
In case you use a TTree, we have a default maximum Tree size
of 1.9 Gigabytes. You can change this default. See:
root.cern.ch/root/htmldoc/TTree. … axTreeSize
root.cern.ch/root/htmldoc/TTree. … ChangeFile


Dear Rene,

Thank you for your reply :slight_smile:

Yes, my first idea was also to try to put the events into a tree and to
save the tree. Unfortunately I spent several days to make sure that our
experiment events or tracks can not be saved in a TTree :cry:
I am using the system the only way it does not crash…


[quote]Unfortunately I spent several days to make sure that our
experiment events or tracks can not be saved in a TTree[/quote]
If you can save and retrieve your object in a TDirectory, you should
be able to do the same in a TTree. Please send some specifics on
what you tried and how it failed!


Dear Philipppe,

I tried many different ways to do the things. Finally my supervisor said
to me that I am waisting my time by trying to save something in to a tree
while it is possible to dump the events in to a file. And I am just not
sure if I can reveal the details of how things are done in our experiment
in this forum. If you are really interested we can discuss it private.

Sincerely yours,

I do understand what you mean by "dumping events to a file"
It does not matter if you put your Event class into a file or Tree.
If you do not succeed with a Tree, it is unlikely that you will succeed
with event.Write.
Trees have so far always proven to be superior in all aspects to
simple Write.

It is difficult to tell you more without knowing more details on
your problems.