I’d like to define TTreeFormula using enum names. With a naive implementation, an error is returned saying the enum name is not recognized. Is there a way we can make TTreeFormula aware of the existence of extra enums?
An example:
enum eventType{
SubGeV_elike_0dcy = 1,
SubGeV_elike_1dcy
};
f = new TTreeFormula("f", "type == SubGeV_elike_0dcy", myTree);
In fact I’d like to define formula strings in an external .txt file. So this solution would not allow me to do so
Isn’t a way to define the enum namespace in a LinkDef file for example?
If the enum is a namespace then the correct syntax is:
f = new TTreeFormula("f", "type == name_of_the_namesapce::SubGeV_elike_0dcy", myTree);
In order for TTreeFormula to ‘see’ the enum, the interpreter need to know about it.
There are several ways to automate the process, one is to add to a LinkDef file:
#pragma link C++ namespace name_of_the_namespace;
#pragma link C++ enum eventType;