Extract .root file problem

I am trying to convert a .root file to a readable format (csv, json, txt) file. I followed the tutorial from root.cern.ch/drupal/content/how … jects-file.
However, I got the error messages - please find in the attachment. Please, suggest me how can I extract the file.
Briefly, I want to convert .root to txt or csv file.
Sorry if it’s a dummy question, I am totally new to this framework.

Thank you


I guess that “Process()” method was a dummy method used in the example you linked. You have to replace it with the actual “processing” of the object, including the file writeout.

The best way to convert a ROOT generic object to a “readable format” depends on the object itself. Which kind of objects does CalibObjects.root contain? Could you give the command


and post the output here?

Here is the output of the command


Mmm… I hoped the output would be a list of objects I’m familiar with, like histograms or ntuples/trees :cry:

If you do not receive better answers, you can try to provide a copy of the file and I’ll have a look at it…

please… :cry:
drive.google.com/file/d/0B6fUiQ … sp=sharing

Some messages are missing Lost a forum day doesn’t matter here, we can resume the discussion.

pjenviri, you wrote that you want to port a ROOT application to something that do not use ROOT. This answers only part of the question “what are you trying to do”? :wink:

Now you have:

  1. a ROOT file
  2. an application within ROOT
  3. some results

And you want to have
-1) a ROOT file
0) a ROOT-to-TXT converter

  1. a TXT file
  2. an application outside ROOT (or without ROOT? That’s a different thing)
  3. the same results

My comments at this point:

  • do you want to get rid of ROOT command-line environment, or do you want to get rid of ROOT at all? The latter is not a viable options, since you need at least to read the file with ROOT libraries. The former is something real. You can write a compiled C++ program that takes the ROOT file as input and calculates the results; you won’t need to work inside the ROOT environment, you just need to link ROOT libraries. And since you must have them anyway in order to read the file, that is not a strong constraint
  • if you want to port an application you should know quite well what there is in the file and what you want to do with it. You say you are not familiar with the ROOT format, but are you familiar with the file contents and the related physics? Given the amount of stuff inside the file, I fear that the “general purpose converter” we are discussing (if it even exists) would only be a small part of the solution…


Thank you for your helpful comments. Actually, I want to get rid of ROOT command-line environment and this file is an input of the application that I want to port. Would you mind if I sent you a private message for further information and discussion?

With thanks,


I confirm you that you can get rid of ROOT command-line environment without getting rid of ROOT libraries and functions. Actually, if you have this “application” (I suppose it is a .C macro and you launch it with .x at ROOT command line… am I correct?) you can convert it in a standalone program changing only about, say, 10% of the code.
The most important thing is that you don’t have to re-invent the wheel converting thousands of ROOT objects into txt equivalents :wink:

I don’t mind about discussing in private, but I think you could have much more help (and quicker) if we stay public. My experience is limited to the basics of ROOT and most of my knowledge comes from bookmarks of this forum 8)