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.

[quote]{
gROOT->Reset();

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

k196->setSensor(“PT1000”);

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

ScanConditions cond;
cond.name = “330872-02-21”;
cond.kind = “FE-I3 SCS”;
cond.comment = “xyz”;
cond.pIrrad = 0;
cond.nIrrad = 0;
cond.op = “xyz”;
cond.uuid = “”;
ssave->setConditions(&cond);

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

k487->reset();
k487->enable();
k487->setRange(2e-5);
k487->current.setNegLimit(-20e-6);
k487->voltage.setRampSteps(2.);

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

//scan->Run(0,-500,10,2);

ssave->write(“cis_72_02_21.root”);
}
[/quote]

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 …?