How to disable the prompt to continue in TTree::Scan(..)

Posted on April 2, 2010. Filed under: Uncategorized | Tags: , , , |

I was recently wondering how to disable the periodic prompt:

Type <CR> to continue or q to quit ==>

when using TTree::Scan(…) in root. Disabling this can be useful when dumping a list of values into a file. By default, it seems that ROOT asks for a confirmation to continue every 25 rows.

After search quite a bit, I found that one can use


where tree is an instance of the class TTree (or a descendant such as TNtuple) to disable this prompt. Setting it to a positive value n will stop every n rows.


Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

4 Responses to “How to disable the prompt to continue in TTree::Scan(..)”

RSS Feed for Andre Holzner's Blog Comments RSS Feed

How do you dump it into a file? Scan returns a Long64_t .

Actually I am interested in sorting the values of a leaf. I was thinking that if
I do Scan(“somevar”) I could get an array with the values. Do you know a way to dump the values of a leaf?

To redirect the output into a file from the ROOT interactive prompt, see the example at .

Obtaining the values of a few variables (or expressions calculated from several variables) is better done using the ‘goff’ option to TTree::Draw(..):

Long64_t num_events = mytree->GetSelectedRows();
Double_t *values = mytree->GetV1();
for (Long64_t i = 0; i < num_events; ++i)
// do something with values[i]

Extra care needs to be taken if the number of selected rows is larger than a given limit (currently one million), see .

Is there a way you can get the number of selected instances within a row using TTree::Draw?

In my ntuple I have an array with multiple values for a branch in one ntuple entry.

Have you tried the function Length$(..) ? (see the documentation of TTree::Draw(..) on

Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: