Cannot load/execute interpreted macro with ROOT6/CLING, worked fine with ROOT5/CINT

Hi,

one of the most powerful features of ROOT6 is an interpreter which is based on a production grade compiler. As such it guarantees that C++, even the latest standards, are supported. It also guarantees that future standards are supported too.
Being a compiler makes it picky about the correctness of the code. The usage of variables which are not defined but are names of objects in a TFile is not part of the C++ language and is not supported in macros like yours. On the other hand it is at the ROOT prompt, where the user experience is enhanced with respect to the one which could be granted by the mere interpretation of the C++ code.

If you want to loop over objects within a root file, you can programmatically do so and this will avoid you to write two extra lines of code for each of the dozens of individual graphs you want to draw. See for example:

Cheers,
Danilo