In my work, I need to batch convert a batch of similarly named root files into binary files. The solution I think is to first makeclass a root file and then modify the .h and .c files. Then put them in the include folder and src folder respectively, and then I can utilize loops in the main function to process them. So I modified the constructor in MakeClass:
ana(TTree *tree = 0, TString filename = "");
ana::ana(TTree *tree, TString filename) : fChain(0)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
if (tree == 0)
{
TFile *f = (TFile *)gROOT->GetListOfFiles()->FindObject(filename);
if (!f || !f->IsOpen())
{
f = new TFile(filename);
}
f->GetObject("tr", tree);
}
Init(tree);
}
But when I do Makefile, I keep getting an error:
main.cpp:(.text.startup+0x131): undefined reference to `ana::ana(TTree*, TString)’
I changed its constructor, and I’m sure I changed the definition of the constructor, but makefile still looks looking for the constructor generated by the makeclass earlier. This confused me a bit, so I came to ask for help, hoping that everyone could help me solve my problem, or provide me with a lot of file names similar to run0017.root, run0018.root… Such a regular root file idea or code that can be forked. Thank you all.