I am trying to get the TBranch variable type letter (as described in Case A of the TTree documentation [1]) of an existing branch. With branch.FindLeaf(branch.GetName()).GetTypeName() I manage to get the full type name (eg. Float_t), however, I require the letter only. Effectively, I need this to create another branch of the exactly same type which contains a subset of the original objects in a vector.
I could not find anything in the documentation that achieves this. Maybe I overlooked something simple…
The easiest solution for scalars would probably be to code up your own mapping function or array between the letter codes and the types, since the list is pretty short. If you also need to deal with arrays of values in the branches, looking into cloning the branch might be more productive.
Yes, I actually started making my own mapping function, however, I was hoping that there would be something less hard-coded like a simple method that one could call “GetTypeChar()”