Convert .root to .txt

Hi everyone, I have some data recorded to root files and would like to convert them to txt. My programming skills are somewhat limited to say the least, so my question is: does anyone of you have a script to do this? Below you can find the code of the script I used to record the data. Thanks in advance.


K487 k487 = new K487(“gpib03”, “gpib0,10”);
k196 = new K196(“gpib03”, “gpib0,9”);


Scan1D *scan = new Scan1D(&k487->voltage);
ScanSave *ssave = new ScanSave(scan);

ScanConditions cond; = “330872-02-21”;
cond.kind = “FE-I3 SCS”;
cond.comment = “xyz”;
cond.pIrrad = 0;
cond.nIrrad = 0;
cond.op = “xyz”;
cond.uuid = “”;

scan->addChannel(&k487->current, 10, 0.1);
scan->addChannel(&k196->value, 1,0);
scan->drawOnline(); //show Graph-Windows while measureing for all channels


std::vector steps;
for(double d = -0; d>=-200; d-=5){
//for(double d=-270; d>=-400; d-=20){
// steps.push_back(d);



What are K487, K196, Scan1D, ScanSave …?

K487 & K196 are just definitions for the input. It tells the program where to look for the incoming data and the gpib… are the names of the actual physical measuring devices.

Scan1D & ScanSave are - I belive - defined functions that say what kind of scan it should do (1D in this case = electrical current being assigned to a given voltage) and scansave tells the program how to save all that. Again, I’m not a proficient programmer, so I can’t be sure if that’s entirely accurate.

Ok, but we can not really do anything with this macro as we cannot run it as it is.
What kind of objects do you want to save in txt file ? TH1, TH2 …?