Header files for Trees

Dear All,

I need some general guidance, this may turn out to be more of a C++ question, but since i am using ROOT i thought this would be the best place to start. I have a large analysis that i am trying to make more modular. My issue now is that i have probalby about 100 branches in a TTree that i have to
declare at the top of my root macro. so basically i have

void analysis()
{
..
tree->Branch("name1", "title1")
tree->Branch("name2", "title2")
...
...
tree->Branch("name100", "title100")
}

i would love to have these hundred or so lines removed from my code and put into a header file.
i tried this by simply moving these definitions into a file “tree.h” with the proper header file syntax, and got a message:

I read somewhere that this error is because this syntax requires processing and the header file
does not do this. So, if not a header file then how would you best modularize a code so you dont
have 100’s of lines of branch declarations?

Any suggestions for how to achieve this?

Many Thanks,
Cathy

“Most recent” documentation about how to generate and use an “analysis skeleton”:

Notes:

2 Likes