I want to make loop over 3 root files which name are Kinematics_1.root, Kinematics_2.root and Kinematics_3.root. Each files contain 100 event folder and each folder contain TreeK and under this there is a Particles branch. I want to access the branch Particles. I started to loop over root files. I define a char “filename” for this purpose. And then I try to access branch. If I have only one root file, I can do my analysis properly. But when I add other root files I encounter an error;
“Error: class, struct, union or type Key not defined.”
and
"Error: Incorrect assiggnment to key, wrong type ‘TObject*’
But I defined Key in my code. This error only occures when I try to use more than one root file.
I don’t know where am I wrong. I attached the code for you. Could you please help me to solve this problem.
Your code contains far too many errors to give a meaningful answer (see some comments below). I strongly suggest to contact the person(s) who created your file/Tree to get more help.
How did you solve your problem? I find myself having a problem quite similar to yours…
I could copy my code but in essence: I loop over rootfiles, open them up, check for a value and close. However first loop runs like a charm, second gives me the same error as you have!
Hi,
this topic is 10 years old. Please open a new one describing in detail what you have attempted (e.g. by providing a minimal snippet of code that reproduces the issue). I am closing this topic.