Writing ROOT output to file

I would like to run a ROOT script in batch mode and write all the output that is generated to a text file for later reference. The command line I’ve been using is

root -b RunSignalPoint.cpp > output.txt

This seems to work, but it takes a really long time – much longer than it would just to run the script interactively (without writing to a file). Is there a better way to do this?

What is the size of output.txt? I do not see what it should take more time in batch! should be the contrary.


Well, output.txt is blank at first, and the script generates maybe a few hundred lines of text. It’s not much.

OK, but could you give an idea of the difference between batch and interactive, seconds vs hours?


Hmm, it only takes maybe 5-10 minutes when you run it interactively, and it seemed to take more like 30-60 minutes in batch.

On the same machine? or are you submitting your job to a batch system with multiple users ?


I’m running it on my local machine either way.

Could you post RunSignalPoint.cpp ? and possible other files used by the script?


Here is RunSignalPoint.cpp and the files that go with it. The output mostly consists of some lines as it reads the data files as well as several 5x5 TMatrixT objects.
Sample.h (5.75 KB)
Sample.cpp (40.4 KB)
SimPipeline.h (994 Bytes)
SimPipeline.cpp (7.35 KB)
RunSignalPoint.cpp (5.71 KB)


Since you did not use the option ‘-q’ (i.e. end root process after executing the command), how do you tell that the script is finished?

Anyway your should get the best performance by trying:root -b -q RunSignalPoint.cpp+(i.e. compile the code and exit after completion).


I just checked the output text file periodically as it was being written – but I will try the -q option and see how it works.