A problem when MakeClass

I want to chain 4 root files, say
file1.root, file2.root, file3.root, and file4.root, then I want to
produce a code using the MakeClass Functionality.

One possibility is:

At the directory where all these root files are located do:
root[] TChain ch(“SMT”);
root[] ch.Add(“file1.root”);
root[] ch.Add(“file2.root”);

root[] SMT->MakeClass(“myClass”);

Assuming the root files are of same tree structure, the above lines should
result to the creatioin of myClass.C and myClass.h.
Then I can edit/modify the files according the nature of your

But in the myClass.h, some variable arrays is not long enough.
For example, a array named MCPhoton[6] in the myClass.h, but there are more MCPhoto than 6 in file2.root, file3.root … .
So when run myClass.C, it reports the MCPhoton[6] is not long enough .
What cause the problem?
How to overcome it?

[quote]So when run myClass.C, it reports the MCPhoton[6] is not long enough. What cause the problem? [/quote]This is a known fundamental problem in MakeClass (which is resolved my moving to using MakeProxy instead). MakeClass uses the first file to determine the length of the array. You need to either register the file with the longest arrays as the first file or you need to modify the resulting file by hand.



Did you introduce a bug in MakeClass. This, for sure was working.



As Rene pointed out, I have forgotten that we fixed this problem (or more exactly my guess of what your problem is) 4 year ago :slight_smile:.
So unless you are using a version of ROOT older than v3.10, this is not the issue and you should provide us with a running example demonstrating your case. My apologies for the confusion.