How to add files to a TChain with a generic pattern?

Let’s say i have a list of files .root and i’m doing this:

TChain chain("T"); chain.Add("file1.root"); chain.Add("file2.root"); chain.Add("file3.root");

Is there a way to make it smoother? Assuming all my root files are of the type filesomething.root, can i do something like chain.Add("file*.root"); where the * will replace any character coming after “file”?

Also, on a whole different topic, let’s say i have a TH1F. How do i find the value that appears most often (aka mode)?

Using histo->GetMaximum() will return the highest value on the y axis, what i’m looking for is the corresponding value to that maximum on the x axis!

Thanks in advance and let me know if anything i said results unclear.

Andrea

Any clue yet? :frowning:

EDIT:

Looks like i figured it out myself, but the second question is still open.

Hi,

if I understood your question correctly, you are looking for the following piece of code:

histo->GetBinCenter(histo->GetMaximumBin());

This should retrieve the bin-number of the bin with maximum content, and then use that information to get the center of that bin on the x-axis. Is this what you are looking for?

Cheers,
Oliver